├── .github └── workflows │ └── npm-publish.yml ├── .gitignore ├── LICENSE ├── docs ├── .gitignore ├── 404.md ├── LICENSE.md ├── NOTICE.md ├── README.md ├── _config.yml ├── _includes │ ├── my-head.html │ └── my-scripts.html ├── assets │ ├── icons │ │ └── icon.svg │ ├── img │ │ └── prefetching.png │ └── style.css ├── example │ ├── 1.html │ ├── 2.html │ ├── 3.html │ └── index.html └── licenses │ ├── Apache-2.0.md │ ├── GPL-3.0.md │ ├── MIT.md │ └── README.md ├── package-lock.json ├── package.json ├── rollup.config.js ├── src ├── common.ts ├── event-listeners.ts ├── event.ts ├── fetch.ts ├── history.ts ├── index.ts ├── rewrite-urls.ts ├── script.ts ├── scroll.ts └── update.ts ├── tsconfig.json └── typings └── Decorators.d.ts /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages 3 | 4 | name: Node.js Package 5 | 6 | on: 7 | push: 8 | tags: 9 | - v* 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: actions/setup-node@v1 17 | with: 18 | node-version: 12 19 | - run: npm ci 20 | - run: npm test 21 | 22 | publish-npm: 23 | needs: build 24 | runs-on: ubuntu-latest 25 | steps: 26 | - uses: actions/checkout@v2 27 | - uses: actions/setup-node@v1 28 | with: 29 | node-version: 12 30 | registry-url: https://registry.npmjs.org/ 31 | - run: npm ci 32 | - run: npm publish 33 | env: 34 | NODE_AUTH_TOKEN: ${{secrets.npm_token}} 35 | 36 | # publish-gpr: 37 | # needs: build 38 | # runs-on: ubuntu-latest 39 | # steps: 40 | # - uses: actions/checkout@v2 41 | # - uses: actions/setup-node@v1 42 | # with: 43 | # node-version: 12 44 | # registry-url: https://npm.pkg.github.com/ 45 | # - run: npm ci 46 | # - run: npm publish 47 | # env: 48 | # NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Dependency directory 6 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 7 | node_modules 8 | 9 | # Remove some common IDE working directories 10 | .idea 11 | .vscode 12 | 13 | # macOS 14 | .DS_Store 15 | 16 | # Packages 17 | *.tgz 18 | 19 | # Build artifacts 20 | lib 21 | module 22 | docs/assets/hy-* 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | /_site/ 2 | _drafts 3 | /.sass-cache/ 4 | /Gemfile* 5 | /.bundle/ 6 | /vendor/ -------------------------------------------------------------------------------- /docs/404.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: not-found 3 | permalink: 404.html 4 | --- 5 | -------------------------------------------------------------------------------- /docs/LICENSE.md: -------------------------------------------------------------------------------- 1 | # LICENSE 2 | ## GNU GENERAL PUBLIC LICENSE 3 | 4 | Version 3, 29 June 2007 5 | 6 | Copyright (C) 2007 Free Software Foundation, Inc. 7 | 8 | 9 | Everyone is permitted to copy and distribute verbatim copies of this 10 | license document, but changing it is not allowed. 11 | 12 | ### Preamble 13 | 14 | The GNU General Public License is a free, copyleft license for 15 | software and other kinds of works. 16 | 17 | The licenses for most software and other practical works are designed 18 | to take away your freedom to share and change the works. By contrast, 19 | the GNU General Public License is intended to guarantee your freedom 20 | to share and change all versions of a program--to make sure it remains 21 | free software for all its users. We, the Free Software Foundation, use 22 | the GNU General Public License for most of our software; it applies 23 | also to any other work released this way by its authors. You can apply 24 | it to your programs, too. 25 | 26 | When we speak of free software, we are referring to freedom, not 27 | price. Our General Public Licenses are designed to make sure that you 28 | have the freedom to distribute copies of free software (and charge for 29 | them if you wish), that you receive source code or can get it if you 30 | want it, that you can change the software or use pieces of it in new 31 | free programs, and that you know you can do these things. 32 | 33 | To protect your rights, we need to prevent others from denying you 34 | these rights or asking you to surrender the rights. Therefore, you 35 | have certain responsibilities if you distribute copies of the 36 | software, or if you modify it: responsibilities to respect the freedom 37 | of others. 38 | 39 | For example, if you distribute copies of such a program, whether 40 | gratis or for a fee, you must pass on to the recipients the same 41 | freedoms that you received. You must make sure that they, too, receive 42 | or can get the source code. And you must show them these terms so they 43 | know their rights. 44 | 45 | Developers that use the GNU GPL protect your rights with two steps: 46 | (1) assert copyright on the software, and (2) offer you this License 47 | giving you legal permission to copy, distribute and/or modify it. 48 | 49 | For the developers' and authors' protection, the GPL clearly explains 50 | that there is no warranty for this free software. For both users' and 51 | authors' sake, the GPL requires that modified versions be marked as 52 | changed, so that their problems will not be attributed erroneously to 53 | authors of previous versions. 54 | 55 | Some devices are designed to deny users access to install or run 56 | modified versions of the software inside them, although the 57 | manufacturer can do so. This is fundamentally incompatible with the 58 | aim of protecting users' freedom to change the software. The 59 | systematic pattern of such abuse occurs in the area of products for 60 | individuals to use, which is precisely where it is most unacceptable. 61 | Therefore, we have designed this version of the GPL to prohibit the 62 | practice for those products. If such problems arise substantially in 63 | other domains, we stand ready to extend this provision to those 64 | domains in future versions of the GPL, as needed to protect the 65 | freedom of users. 66 | 67 | Finally, every program is threatened constantly by software patents. 68 | States should not allow patents to restrict development and use of 69 | software on general-purpose computers, but in those that do, we wish 70 | to avoid the special danger that patents applied to a free program 71 | could make it effectively proprietary. To prevent this, the GPL 72 | assures that patents cannot be used to render the program non-free. 73 | 74 | The precise terms and conditions for copying, distribution and 75 | modification follow. 76 | 77 | ### TERMS AND CONDITIONS 78 | 79 | #### 0. Definitions 80 | 81 | "This License" refers to version 3 of the GNU General Public License. 82 | 83 | "Copyright" also means copyright-like laws that apply to other kinds 84 | of works, such as semiconductor masks. 85 | 86 | "The Program" refers to any copyrightable work licensed under this 87 | License. Each licensee is addressed as "you". "Licensees" and 88 | "recipients" may be individuals or organizations. 89 | 90 | To "modify" a work means to copy from or adapt all or part of the work 91 | in a fashion requiring copyright permission, other than the making of 92 | an exact copy. The resulting work is called a "modified version" of 93 | the earlier work or a work "based on" the earlier work. 94 | 95 | A "covered work" means either the unmodified Program or a work based 96 | on the Program. 97 | 98 | To "propagate" a work means to do anything with it that, without 99 | permission, would make you directly or secondarily liable for 100 | infringement under applicable copyright law, except executing it on a 101 | computer or modifying a private copy. Propagation includes copying, 102 | distribution (with or without modification), making available to the 103 | public, and in some countries other activities as well. 104 | 105 | To "convey" a work means any kind of propagation that enables other 106 | parties to make or receive copies. Mere interaction with a user 107 | through a computer network, with no transfer of a copy, is not 108 | conveying. 109 | 110 | An interactive user interface displays "Appropriate Legal Notices" to 111 | the extent that it includes a convenient and prominently visible 112 | feature that (1) displays an appropriate copyright notice, and (2) 113 | tells the user that there is no warranty for the work (except to the 114 | extent that warranties are provided), that licensees may convey the 115 | work under this License, and how to view a copy of this License. If 116 | the interface presents a list of user commands or options, such as a 117 | menu, a prominent item in the list meets this criterion. 118 | 119 | #### 1. Source Code 120 | 121 | The "source code" for a work means the preferred form of the work for 122 | making modifications to it. "Object code" means any non-source form of 123 | a work. 124 | 125 | A "Standard Interface" means an interface that either is an official 126 | standard defined by a recognized standards body, or, in the case of 127 | interfaces specified for a particular programming language, one that 128 | is widely used among developers working in that language. 129 | 130 | The "System Libraries" of an executable work include anything, other 131 | than the work as a whole, that (a) is included in the normal form of 132 | packaging a Major Component, but which is not part of that Major 133 | Component, and (b) serves only to enable use of the work with that 134 | Major Component, or to implement a Standard Interface for which an 135 | implementation is available to the public in source code form. A 136 | "Major Component", in this context, means a major essential component 137 | (kernel, window system, and so on) of the specific operating system 138 | (if any) on which the executable work runs, or a compiler used to 139 | produce the work, or an object code interpreter used to run it. 140 | 141 | The "Corresponding Source" for a work in object code form means all 142 | the source code needed to generate, install, and (for an executable 143 | work) run the object code and to modify the work, including scripts to 144 | control those activities. However, it does not include the work's 145 | System Libraries, or general-purpose tools or generally available free 146 | programs which are used unmodified in performing those activities but 147 | which are not part of the work. For example, Corresponding Source 148 | includes interface definition files associated with source files for 149 | the work, and the source code for shared libraries and dynamically 150 | linked subprograms that the work is specifically designed to require, 151 | such as by intimate data communication or control flow between those 152 | subprograms and other parts of the work. 153 | 154 | The Corresponding Source need not include anything that users can 155 | regenerate automatically from other parts of the Corresponding Source. 156 | 157 | The Corresponding Source for a work in source code form is that same 158 | work. 159 | 160 | #### 2. Basic Permissions 161 | 162 | All rights granted under this License are granted for the term of 163 | copyright on the Program, and are irrevocable provided the stated 164 | conditions are met. This License explicitly affirms your unlimited 165 | permission to run the unmodified Program. The output from running a 166 | covered work is covered by this License only if the output, given its 167 | content, constitutes a covered work. This License acknowledges your 168 | rights of fair use or other equivalent, as provided by copyright law. 169 | 170 | You may make, run and propagate covered works that you do not convey, 171 | without conditions so long as your license otherwise remains in force. 172 | You may convey covered works to others for the sole purpose of having 173 | them make modifications exclusively for you, or provide you with 174 | facilities for running those works, provided that you comply with the 175 | terms of this License in conveying all material for which you do not 176 | control copyright. Those thus making or running the covered works for 177 | you must do so exclusively on your behalf, under your direction and 178 | control, on terms that prohibit them from making any copies of your 179 | copyrighted material outside their relationship with you. 180 | 181 | Conveying under any other circumstances is permitted solely under the 182 | conditions stated below. Sublicensing is not allowed; section 10 makes 183 | it unnecessary. 184 | 185 | #### 3. Protecting Users' Legal Rights From Anti-Circumvention Law 186 | 187 | No covered work shall be deemed part of an effective technological 188 | measure under any applicable law fulfilling obligations under article 189 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 190 | similar laws prohibiting or restricting circumvention of such 191 | measures. 192 | 193 | When you convey a covered work, you waive any legal power to forbid 194 | circumvention of technological measures to the extent such 195 | circumvention is effected by exercising rights under this License with 196 | respect to the covered work, and you disclaim any intention to limit 197 | operation or modification of the work as a means of enforcing, against 198 | the work's users, your or third parties' legal rights to forbid 199 | circumvention of technological measures. 200 | 201 | #### 4. Conveying Verbatim Copies 202 | 203 | You may convey verbatim copies of the Program's source code as you 204 | receive it, in any medium, provided that you conspicuously and 205 | appropriately publish on each copy an appropriate copyright notice; 206 | keep intact all notices stating that this License and any 207 | non-permissive terms added in accord with section 7 apply to the code; 208 | keep intact all notices of the absence of any warranty; and give all 209 | recipients a copy of this License along with the Program. 210 | 211 | You may charge any price or no price for each copy that you convey, 212 | and you may offer support or warranty protection for a fee. 213 | 214 | #### 5. Conveying Modified Source Versions 215 | 216 | You may convey a work based on the Program, or the modifications to 217 | produce it from the Program, in the form of source code under the 218 | terms of section 4, provided that you also meet all of these 219 | conditions: 220 | 221 | {:style="list-style-type:lower-latin"} 222 | 1. The work must carry prominent notices stating that you modified 223 | it, and giving a relevant date. 224 | 2. The work must carry prominent notices stating that it is 225 | released under this License and any conditions added under 226 | section 7. This requirement modifies the requirement in section 4 227 | to "keep intact all notices". 228 | 3. You must license the entire work, as a whole, under this 229 | License to anyone who comes into possession of a copy. This 230 | License will therefore apply, along with any applicable section 7 231 | additional terms, to the whole of the work, and all its parts, 232 | regardless of how they are packaged. This License gives no 233 | permission to license the work in any other way, but it does not 234 | invalidate such permission if you have separately received it. 235 | 4. If the work has interactive user interfaces, each must display 236 | Appropriate Legal Notices; however, if the Program has interactive 237 | interfaces that do not display Appropriate Legal Notices, your 238 | work need not make them do so. 239 | 240 | A compilation of a covered work with other separate and independent 241 | works, which are not by their nature extensions of the covered work, 242 | and which are not combined with it such as to form a larger program, 243 | in or on a volume of a storage or distribution medium, is called an 244 | "aggregate" if the compilation and its resulting copyright are not 245 | used to limit the access or legal rights of the compilation's users 246 | beyond what the individual works permit. Inclusion of a covered work 247 | in an aggregate does not cause this License to apply to the other 248 | parts of the aggregate. 249 | 250 | #### 6. Conveying Non-Source Forms 251 | 252 | You may convey a covered work in object code form under the terms of 253 | sections 4 and 5, provided that you also convey the machine-readable 254 | Corresponding Source under the terms of this License, in one of these 255 | ways: 256 | 257 | {:style="list-style-type:lower-latin"} 258 | 1. Convey the object code in, or embodied in, a physical product 259 | (including a physical distribution medium), accompanied by the 260 | Corresponding Source fixed on a durable physical medium 261 | customarily used for software interchange. 262 | 2. Convey the object code in, or embodied in, a physical product 263 | (including a physical distribution medium), accompanied by a 264 | written offer, valid for at least three years and valid for as 265 | long as you offer spare parts or customer support for that product 266 | model, to give anyone who possesses the object code either (1) a 267 | copy of the Corresponding Source for all the software in the 268 | product that is covered by this License, on a durable physical 269 | medium customarily used for software interchange, for a price no 270 | more than your reasonable cost of physically performing this 271 | conveying of source, or (2) access to copy the Corresponding 272 | Source from a network server at no charge. 273 | 3. Convey individual copies of the object code with a copy of the 274 | written offer to provide the Corresponding Source. This 275 | alternative is allowed only occasionally and noncommercially, and 276 | only if you received the object code with such an offer, in accord 277 | with subsection 6b. 278 | 4. Convey the object code by offering access from a designated 279 | place (gratis or for a charge), and offer equivalent access to the 280 | Corresponding Source in the same way through the same place at no 281 | further charge. You need not require recipients to copy the 282 | Corresponding Source along with the object code. If the place to 283 | copy the object code is a network server, the Corresponding Source 284 | may be on a different server (operated by you or a third party) 285 | that supports equivalent copying facilities, provided you maintain 286 | clear directions next to the object code saying where to find the 287 | Corresponding Source. Regardless of what server hosts the 288 | Corresponding Source, you remain obligated to ensure that it is 289 | available for as long as needed to satisfy these requirements. 290 | 5. Convey the object code using peer-to-peer transmission, 291 | provided you inform other peers where the object code and 292 | Corresponding Source of the work are being offered to the general 293 | public at no charge under subsection 6d. 294 | 295 | A separable portion of the object code, whose source code is excluded 296 | from the Corresponding Source as a System Library, need not be 297 | included in conveying the object code work. 298 | 299 | A "User Product" is either (1) a "consumer product", which means any 300 | tangible personal property which is normally used for personal, 301 | family, or household purposes, or (2) anything designed or sold for 302 | incorporation into a dwelling. In determining whether a product is a 303 | consumer product, doubtful cases shall be resolved in favor of 304 | coverage. For a particular product received by a particular user, 305 | "normally used" refers to a typical or common use of that class of 306 | product, regardless of the status of the particular user or of the way 307 | in which the particular user actually uses, or expects or is expected 308 | to use, the product. A product is a consumer product regardless of 309 | whether the product has substantial commercial, industrial or 310 | non-consumer uses, unless such uses represent the only significant 311 | mode of use of the product. 312 | 313 | "Installation Information" for a User Product means any methods, 314 | procedures, authorization keys, or other information required to 315 | install and execute modified versions of a covered work in that User 316 | Product from a modified version of its Corresponding Source. The 317 | information must suffice to ensure that the continued functioning of 318 | the modified object code is in no case prevented or interfered with 319 | solely because modification has been made. 320 | 321 | If you convey an object code work under this section in, or with, or 322 | specifically for use in, a User Product, and the conveying occurs as 323 | part of a transaction in which the right of possession and use of the 324 | User Product is transferred to the recipient in perpetuity or for a 325 | fixed term (regardless of how the transaction is characterized), the 326 | Corresponding Source conveyed under this section must be accompanied 327 | by the Installation Information. But this requirement does not apply 328 | if neither you nor any third party retains the ability to install 329 | modified object code on the User Product (for example, the work has 330 | been installed in ROM). 331 | 332 | The requirement to provide Installation Information does not include a 333 | requirement to continue to provide support service, warranty, or 334 | updates for a work that has been modified or installed by the 335 | recipient, or for the User Product in which it has been modified or 336 | installed. Access to a network may be denied when the modification 337 | itself materially and adversely affects the operation of the network 338 | or violates the rules and protocols for communication across the 339 | network. 340 | 341 | Corresponding Source conveyed, and Installation Information provided, 342 | in accord with this section must be in a format that is publicly 343 | documented (and with an implementation available to the public in 344 | source code form), and must require no special password or key for 345 | unpacking, reading or copying. 346 | 347 | #### 7. Additional Terms 348 | 349 | "Additional permissions" are terms that supplement the terms of this 350 | License by making exceptions from one or more of its conditions. 351 | Additional permissions that are applicable to the entire Program shall 352 | be treated as though they were included in this License, to the extent 353 | that they are valid under applicable law. If additional permissions 354 | apply only to part of the Program, that part may be used separately 355 | under those permissions, but the entire Program remains governed by 356 | this License without regard to the additional permissions. 357 | 358 | When you convey a copy of a covered work, you may at your option 359 | remove any additional permissions from that copy, or from any part of 360 | it. (Additional permissions may be written to require their own 361 | removal in certain cases when you modify the work.) You may place 362 | additional permissions on material, added by you to a covered work, 363 | for which you have or can give appropriate copyright permission. 364 | 365 | Notwithstanding any other provision of this License, for material you 366 | add to a covered work, you may (if authorized by the copyright holders 367 | of that material) supplement the terms of this License with terms: 368 | 369 | {:style="list-style-type:lower-latin"} 370 | 1. Disclaiming warranty or limiting liability differently from the 371 | terms of sections 15 and 16 of this License; or 372 | 2. Requiring preservation of specified reasonable legal notices or 373 | author attributions in that material or in the Appropriate Legal 374 | Notices displayed by works containing it; or 375 | 3. Prohibiting misrepresentation of the origin of that material, 376 | or requiring that modified versions of such material be marked in 377 | reasonable ways as different from the original version; or 378 | 4. Limiting the use for publicity purposes of names of licensors 379 | or authors of the material; or 380 | 5. Declining to grant rights under trademark law for use of some 381 | trade names, trademarks, or service marks; or 382 | 6. Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions 384 | of it) with contractual assumptions of liability to the recipient, 385 | for any liability that these contractual assumptions directly 386 | impose on those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; the 405 | above requirements apply either way. 406 | 407 | #### 8. Termination 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your license 416 | from a particular copyright holder is reinstated (a) provisionally, 417 | unless and until the copyright holder explicitly and finally 418 | terminates your license, and (b) permanently, if the copyright holder 419 | fails to notify you of the violation by some reasonable means prior to 420 | 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | #### 9. Acceptance Not Required for Having Copies 436 | 437 | You are not required to accept this License in order to receive or run 438 | a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | #### 10. Automatic Licensing of Downstream Recipients 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | #### 11. Patents 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims owned 478 | or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within the 522 | scope of its coverage, prohibits the exercise of, or is conditioned on 523 | the non-exercise of one or more of the rights that are specifically 524 | granted under this License. You may not convey a covered work if you 525 | are a party to an arrangement with a third party that is in the 526 | business of distributing software, under which you make payment to the 527 | third party based on the extent of your activity of conveying the 528 | work, and under which the third party grants, to any of the parties 529 | who would receive the covered work from you, a discriminatory patent 530 | license (a) in connection with copies of the covered work conveyed by 531 | you (or copies made from those copies), or (b) primarily for and in 532 | connection with specific products or compilations that contain the 533 | covered work, unless you entered into that arrangement, or that patent 534 | license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | #### 12. No Surrender of Others' Freedom 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under 546 | this License and any other pertinent obligations, then as a 547 | consequence you may not convey it at all. For example, if you agree to 548 | terms that obligate you to collect a royalty for further conveying 549 | from those to whom you convey the Program, the only way you could 550 | satisfy both those terms and this License would be to refrain entirely 551 | from conveying the Program. 552 | 553 | #### 13. Use with the GNU Affero General Public License 554 | 555 | Notwithstanding any other provision of this License, you have 556 | permission to link or combine any covered work with a work licensed 557 | under version 3 of the GNU Affero General Public License into a single 558 | combined work, and to convey the resulting work. The terms of this 559 | License will continue to apply to the part which is the covered work, 560 | but the special requirements of the GNU Affero General Public License, 561 | section 13, concerning interaction through a network will apply to the 562 | combination as such. 563 | 564 | #### 14. Revised Versions of this License 565 | 566 | The Free Software Foundation may publish revised and/or new versions 567 | of the GNU General Public License from time to time. Such new versions 568 | will be similar in spirit to the present version, but may differ in 569 | detail to address new problems or concerns. 570 | 571 | Each version is given a distinguishing version number. If the Program 572 | specifies that a certain numbered version of the GNU General Public 573 | License "or any later version" applies to it, you have the option of 574 | following the terms and conditions either of that numbered version or 575 | of any later version published by the Free Software Foundation. If the 576 | Program does not specify a version number of the GNU General Public 577 | License, you may choose any version ever published by the Free 578 | Software Foundation. 579 | 580 | If the Program specifies that a proxy can decide which future versions 581 | of the GNU General Public License can be used, that proxy's public 582 | statement of acceptance of a version permanently authorizes you to 583 | choose that version for the Program. 584 | 585 | Later license versions may give you additional or different 586 | permissions. However, no additional obligations are imposed on any 587 | author or copyright holder as a result of your choosing to follow a 588 | later version. 589 | 590 | #### 15. Disclaimer of Warranty 591 | 592 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 593 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 594 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT 595 | WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT 596 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 597 | A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND 598 | PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE 599 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR 600 | CORRECTION. 601 | 602 | #### 16. Limitation of Liability 603 | 604 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 605 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR 606 | CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 607 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES 608 | ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT 609 | NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR 610 | LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM 611 | TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER 612 | PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 613 | 614 | #### 17. Interpretation of Sections 15 and 16 615 | 616 | If the disclaimer of warranty and limitation of liability provided 617 | above cannot be given local legal effect according to their terms, 618 | reviewing courts shall apply local law that most closely approximates 619 | an absolute waiver of all civil liability in connection with the 620 | Program, unless a warranty or assumption of liability accompanies a 621 | copy of the Program in return for a fee. 622 | -------------------------------------------------------------------------------- /docs/NOTICE.md: -------------------------------------------------------------------------------- 1 | # NOTICE 2 | 3 | Copyright (c) 2020 Florian Klampfer 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | ## Licenses 19 | Parts of this program are provided under separate licenses. 20 | 21 | ### smoothState 22 | This software also uses portions of the smoothState project, 23 | which is [MIT] licensed with the following copyright 24 | 25 | > Copyright (c) 2014 Miguel Angel Perez 26 | 27 | ### rxjs 28 | This software also uses portions of the rxjs project, 29 | which is [Apache-2.0] licensed with the following copyright 30 | 31 | > Copyright (c) 2015-2017 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors 32 | 33 | [MIT]: licenses/MIT.md 34 | [Apache-2.0]: licenses/Apache-2.0.md 35 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # hy-push-state 2 | 3 | **hy-push-state** is a web component that lets you turn web pages into web apps. The component dynamically loads new content (formerly known as "ajax") and inserts it into the current page, without causing Flash of White, Flash of Unstyled Content, etc. 4 | 5 | > Turn static web sites into dynamic web apps. 6 | {:.lead} 7 | 8 | **hy-push-state** is similar to [pjax] and [smoothState], but offers a [more advanced pre-fetching logic][pref] and gives you more control over its internals to enable [advanced page transition animations][anim]. 9 | 10 | **hy-push-state** is already used by hundreds of sites as part of the [Hydejack]{:.external} Jekyll theme. 11 | 12 | **NOTE**: The current version is still a pre-release. The public API may still change in important ways. 13 | {:.message} 14 | 15 | [pref]: #page-prefetching 16 | [anim]: #advanced-animations 17 | 18 | [pjax]: https://github.com/defunkt/jquery-pjax 19 | [smoothstate]: https://github.com/miguel-perez/smoothState.js 20 | [rxjs]: https://github.com/ReactiveX/rxjs 21 | [hydejack]: https://hydejack.com/ 22 | 23 | 24 | 25 | ## Examples 26 | When viewing this page on [webcomponents.org][wcorg], the example below will render as an interactive demo. Otherwise, find the standalone examples below. 27 | 28 | [wcorg]: https://www.webcomponents.org/element/qwtel/hy-push-state 29 | 30 | 31 | 42 | ```html 43 | 44 |

45 | Page 1 46 | Page 2 47 | Page 3 48 |

49 |

Super simple example.

50 |
51 | ``` 52 | 53 | When viewing this document on GitHub, npm, or elsewhere, you can check out the standalone examples: 54 | 55 | * [WebComponent Example](https://qwtel.com/hy-push-state/example/webcomponent/){:.external} 56 | * [jQuery Example](https://qwtel.com/hy-push-state/example/jquery/){:.external} 57 | * [Vanilla JS Example](https://qwtel.com/hy-push-state/example/vanilla/){:.external} 58 | * [Mixin Example](https://qwtel.com/hy-push-state/example/mixin/){:.external} 59 | 60 | 61 | ## License 62 | **hy-push-state** is Open Source but not free. 63 | 64 | You may use the component in accordance with the [GPL-3.0 license](licenses/GPL-3.0.md), 65 | but this means you must be willing to release your code under a GPLv3-compatible license in turn. 66 | 67 | For cases were this is not acceptable the following commercial licenses available: 68 | 69 | | | Personal | Startup | Enterprise | 70 | |:-------------|:------------------:|:------------------:|:------------------:| 71 | | # Developers | 2 | 15 | ∞ | 72 | | License | [Personal][pl] | [Startup][sl] | [Enterprise][el] | 73 | | Price | $29 | $249 | $499 | 74 | | | [**Buy**][bp]{:.gumroad-button} | [**Buy**][bs]{:.gumroad-button} | [**Buy**][be]{:.gumroad-button} | 75 | {:.stretch-table} 76 | 77 | 78 | [pl]: licenses/personal.md 79 | [sl]: licenses/startup.md 80 | [el]: licenses/enterprise.md 81 | [bp]: https://gumroad.com/l/hy-push-state-personal 82 | [bs]: https://gumroad.com/l/hy-push-state-startup 83 | [be]: https://gumroad.com/l/hy-push-state-enterprise 84 | 85 | 86 | ## Usage 87 | 88 | **hy-push-state** can be used in a variety of ways: 89 | * As [Web Component](usage/#web-component), both as *ES6 Module* and *HTML Import* 90 | * As [jQuery](usage/#jquery) plugin 91 | * As [Vanilla](usage/#vanilla) JavaScript class 92 | * As part of [bundled frontend code](usage/#bundlers). 93 | * (Advanced) Possibly as part of your own component hierarchy as [ES6 Mixin][esmixins]. 94 | 95 | [esmixins]: http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/ 96 | 97 | ### Web Component 98 | The Web Component is the preferred way of using **hy-push-state**, but requires [support] in the browser or a [polyfill]. There are multiple ways of including it on your page: 99 | 100 | #### Bundled ES6 Module 101 | This is the version that is going to have native support across all major browsers the soonest. 102 | 103 | ~~~html 104 | 105 | 106 | 107 |
108 | 109 |
110 | ~~~ 111 | 112 | #### HTML Import 113 | Some browsers have decided against implementing HTML Imports, but they are easily polyfilled. 114 | 115 | ~~~html 116 | 117 | 118 | 119 |
120 | 121 |
122 | ~~~ 123 | 124 | #### Unbundled ES6 Module (experimental) 125 | When loading the component form the [unpkg] CDN, you can import the source directly by appending the `?module` query parameter. 126 | 127 | ~~~html 128 | 129 | 130 | 131 |
132 | 133 |
134 | ~~~ 135 | 136 | Note that this approach will result in hundreds of separate HTTP requests (one for each module) and is intended for testing and prototypes only. Importing unbundled ES6 modules is much slower than bundled distributions and will remain so for the foreseeable future. 137 | 138 | One advantage of this approach is that shared dependencies will not be included twice when using more than one component from the Hydejack component family. However, setting up webpack is a better solution in these cases: 139 | 140 | #### Bundlers 141 | You can use **hy-push-state** with a frontend bundler like webpack or rollup. 142 | Just install the component with npm or yarn and import the source in your code: 143 | 144 | ```js 145 | import 'hy-push-state/src/webcomponent/module'; 146 | ``` 147 | 148 | If you want to have control over when the custom element gets `define`d, you can also import the `HTMLElement` like so: 149 | 150 | ```js 151 | import { HyPushStateElement } from 'hy-push-state/src/webcomponent'; 152 | // ... 153 | customElements.define('hy-push-state', HyPushStateElement); 154 | ``` 155 | 156 | Note that all of **hy-push-state**'s dependencies are valid ES6 modules, so that they can be inlined with webpack's [`ModuleConcatenationPlugin`][mcp]. 157 | 158 | [support]: https://caniuse.com/#feat=template,custom-elementsv1,shadowdomv1,es6-module,imports 159 | [polyfill]: https://github.com/webcomponents/webcomponentsjs 160 | [unpkg]: https://unpkg.com/ 161 | [mcp]: https://webpack.js.org/plugins/module-concatenation-plugin/ 162 | 163 | 164 | ## Documentation 165 | 166 | * [Options](doc/options.md) 167 | * [Methods](doc/methods.md) 168 | * [Events](doc/events.md) 169 | 170 | ### Page Prefetching 171 | **hy-push-state** starts a HTTP request as soon as the user "hints" that he/she is about to open a new page by hovering, focusing, or touching (`touchstart`-ing) a link. If the guess is correct, the request has a 100ms or more head-start, further increasing the perceived speed of your site in addition to the already fast webapp-style page replacing. 172 | 173 | Unlike other implementations of this feature, the current prefetch request will be canceled if the user hints at a different link, ensuring that there will be no more than one prefetch request in flight at a time. This avoids clogging up the network with requests that are going to be discarded upon arrival, which is essential when on slow 3G connections. 174 | 175 | For example, hovering links in the sidebar on [qwtel.com](https://qwtel.com/hy-push-state/) will produce a timeline like the one below: 176 | 177 | ![dev console screenshot](assets/img/prefetching.png){:.lead} 178 | Chrome developer console screenshot of prefetching requests. 179 | {:.figure} 180 | 181 | ### Advanced Animations 182 | **hy-push-state** allows building advanced page transition animations, like the ones used in [Hydejack](https://qwtel.com/hydejack/variations/) and state-of-the-art web apps. These can be promise-based instead of time-based to account for smaller delays caused by other code, GC interruptions, or slower devices in general 183 | 184 | The code for a simple fade-out animation using the [Web Animations API][waapi] may look like: 185 | 186 | ```js 187 | pushStateEl.addEventListener('hy-push-state-start', ({ detail }) => 188 | detail.transitionUntil(new Promise(res => 189 | document 190 | .getElementById('my-content') 191 | .animate([{ opacity: 1 }, { opacity: 0 }], { duration: 250 }) 192 | .addEventListener('finish', res) 193 | )) 194 | ); 195 | ``` 196 | 197 | Time-based animations are possible as well and are configured with the [`duration` option](doc/options.md#duration). 198 | 199 | [waapi]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API/Using_the_Web_Animations_API 200 | 201 | ### Gold Standard 202 | This component follows the Web Components [Gold Standard](doc/gold-standard.md). 203 | 204 | ### Source 205 | The source code is written in a *literal programming* style, and should be reasonably approachable. 206 | However, some knowledge of [RxJS] is required. 207 | 208 | The core functionality is implemented in [`mixin / index.js`](doc/source/mixin/README.md), 209 | which is used to create the framework-specific versions of the component. 210 | 211 | * `jquery` 212 | * [`index.js`](doc/source/jquery/README.md) 213 | * `mixin` 214 | * [`constants.js`](doc/source/mixin/constants.md) 215 | * [`event-listeners.js`](doc/source/mixin/event-listeners.md) 216 | * [`events.js`](doc/source/mixin/events.md) 217 | * [`fetching.js`](doc/source/mixin/fetching.md) 218 | * [`history.js`](doc/source/mixin/history.md) 219 | * [`index.js`](doc/source/mixin/README.md) 220 | * [`methods.js`](doc/source/mixin/methods.md) 221 | * [`operators.js`](doc/source/mixin/operators.md) 222 | * [`script-hack.js`](doc/source/mixin/script-hack.md) 223 | * [`scrolling.js`](doc/source/mixin/scrolling.md) 224 | * [`setup.js`](doc/source/mixin/setup.md) 225 | * [`update.js`](doc/source/mixin/update.md) 226 | * `vanilla` 227 | * [`index.js`](doc/source/vanilla/README.md) 228 | * `webcomponent` 229 | * [`html-import.s`](doc/source/webcomponent/html-import.md) 230 | * [`index.js`](doc/source/webcomponent/README.md) 231 | * [`module.js`](doc/source/webcomponent/module.md) 232 | * [`common.js`](doc/source/common.md) 233 | * [`index.js`](doc/source/README.md) 234 | * [`url.js`](doc/source/url.md) 235 | 236 | ### Size 237 | The size of the minified bundle is around 90kb, or ~20kb gzipped. 238 | The majority of it comes from RxJS. When already using RxJS in your project, or using more than one component of the Hydejack component family, consider using a [frontend bundler](usage/README.md#bundlers). 239 | 240 | | Size | File | 241 | |-----:|:-----| 242 | | 84K | `dist/jquery/index.js` | 243 | | 19K | `dist/jquery/index.js.gz` | 244 | | 80K | `dist/mixin/index.js` | 245 | | 18K | `dist/mixin/index.js.gz` | 246 | | 81K | `dist/vanilla/index.js` | 247 | | 18K | `dist/vanilla/index.js.gz` | 248 | | 86K | `dist/webcomponent/html-import.js` | 249 | | 19K | `dist/webcomponent/html-import.js.gz` | 250 | | 86K | `dist/webcomponent/index.js` | 251 | | 19K | `dist/webcomponent/index.js.gz` | 252 | | 86K | `dist/webcomponent/module.js` | 253 | | 19K | `dist/webcomponent/module.js.gz` | 254 | 255 | 256 | [rxjs]: https://github.com/ReactiveX/rxjs 257 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | title: hy-push-state 2 | email: mail@qwtel.com 3 | 4 | description: > 5 | Turn static web sites into dynamic web apps. 6 | url: https://hydecorp.github.io 7 | baseurl: /push-state 8 | 9 | author: 10 | email: mail@qwtel.com 11 | social: 12 | github: https://github.com/hydecorp/push-state 13 | npm: https://www.npmjs.com/package/@hydecorp/push-state 14 | download: https://github.com/hydecorp/push-state/releases 15 | 16 | logo: /assets/icons/icon.svg 17 | 18 | copyright: © 2018 Florian Klampfer 19 | 20 | permalink: pretty 21 | 22 | google_analytics: UA-84025722-4 23 | 24 | accent_color: "#4fb1ba" 25 | accent_image: 26 | background: "linear-gradient(to bottom,#193747 0%,#233e4c 30%,#3c929e 50%,#d5d5d4 70%,#cdccc8 100%)" 27 | overlay: true 28 | 29 | # Build settings 30 | markdown: kramdown 31 | 32 | plugins: 33 | - jekyll-default-layout 34 | - jekyll-optional-front-matter 35 | - jekyll-readme-index 36 | - jekyll-relative-links 37 | - jekyll-remote-theme 38 | - jekyll-seo-tag 39 | - jekyll-titles-from-headings 40 | exclude: 41 | - Gemfile 42 | - Gemfile.lock 43 | - node_modules 44 | - vendor 45 | - package.json 46 | - package-lock.json 47 | - webpack.config.js 48 | - src 49 | - scripts 50 | include: 51 | - LICENSE.md 52 | 53 | remote_theme: hydecorp/hydejack@v9.0.4 54 | 55 | hydejack: 56 | no_mark_external: true 57 | 58 | titles_from_headings: 59 | strip_title: true 60 | collections: true 61 | 62 | relative_links: 63 | collections: true 64 | 65 | optional_front_matter: 66 | remove_originals: true 67 | 68 | readme_index: 69 | remove_originals: true 70 | with_frontmatter: true 71 | 72 | data_social: 73 | github: 74 | name: GitHub 75 | icon: icon-github 76 | npm: 77 | name: npm 78 | icon: icon-npm 79 | download: 80 | name: Download 81 | icon: icon-box-add 82 | email: 83 | name: Email 84 | icon: icon-mail 85 | 86 | keywords: 87 | - page-transitions 88 | - ajax 89 | - pjax 90 | - smoothstate 91 | - hydejack 92 | - vanilla 93 | - jquery 94 | - animations 95 | - rxjs 96 | - vanilla-js 97 | - custom-element 98 | - jquery-plugin 99 | - history-api 100 | - web-components 101 | - webcomponent 102 | - history-management 103 | - prefetch 104 | - page-loader 105 | - prefetcher 106 | - reactive 107 | -------------------------------------------------------------------------------- /docs/_includes/my-head.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/_includes/my-scripts.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /docs/assets/icons/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/assets/img/prefetching.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hydecorp/push-state/dd58c75d0651f5720d19cad92354fecdd48db415/docs/assets/img/prefetching.png -------------------------------------------------------------------------------- /docs/assets/style.css: -------------------------------------------------------------------------------- 1 | * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } 2 | html { font-family:'Noto Sans', Helvetica, Arial, serif; font-size:16px; line-height:1.75; } 3 | body { margin:0; padding:0; color:#000; background:#fff; } 4 | h1, h2, h3, h4, h5, h6 { font-family:'Roboto Slab'; font-weight:bold; text-rendering:optimizeLegibility; margin:3rem 0 1rem; line-height:1.6; } 5 | h1 { font-size:2rem; line-height:1.25; } 6 | h2 { font-size:1.5rem; } 7 | h3 { font-size:1.17em; } 8 | .wrapper { background:rgba(0,0,0,0.025); max-width:38rem; margin:1rem; padding:1rem; margin:auto; } 9 | aside ul { list-style:none; margin:0; padding:0; } 10 | aside ul li a { display:block; padding:1.5rem; border-bottom:1px solid rgba(0, 0, 0, 0.05);} 11 | #menuEl { display:inline-block; padding:1.5rem 1rem; margin-left:-1rem; margin-top:-1rem; text-decoration:none; } 12 | #menuEl::after { content: "\2630"; } 13 | @media screen and (min-width:40em) { html { font-size:17px; } } 14 | @media screen and (min-width:54em) { .wrapper { max-width:42rem; } } 15 | @media screen and (min-width:92em) { .wrapper { max-width:48rem; } } 16 | @media screen and (min-width:125em) { html { font-size:18px; } } 17 | .sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; } 18 | -------------------------------------------------------------------------------- /docs/example/1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Page 1 | hy-push-state 6 | 7 | 8 | 9 | 10 | 11 |

12 | Page 1 13 | Page 2 14 | Page 3 15 |

16 |

Lorem ipsum

17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/example/2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Page 2 | hy-push-state 6 | 7 | 8 | 9 | 10 | 11 |

12 | Page 1 13 | Page 2 14 | Page 3 15 |

16 |

Augue ut lectus

17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/example/3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Page 3 | hy-push-state 6 | 7 | 8 | 9 | 10 | 11 |

12 | Page 1 13 | Page 2 14 | Page 3 15 |

16 |

Sit amet nisl

17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Index | hy-push-state 6 | 7 | 8 | 9 | 10 | 11 |

12 | Page 1 13 | Page 2 14 | Page 3 15 |

16 |

Lorem ipsum

17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/licenses/Apache-2.0.md: -------------------------------------------------------------------------------- 1 | # Apache License 2 | 3 | Version 2.0, January 2004 4 | 5 | 6 | 7 | ## TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 8 | ### 1. Definitions 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | ### 2. Grant of Copyright License 68 | Subject to the terms and conditions of 69 | this License, each Contributor hereby grants to You a perpetual, 70 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 71 | copyright license to reproduce, prepare Derivative Works of, 72 | publicly display, publicly perform, sublicense, and distribute the 73 | Work and such Derivative Works in Source or Object form. 74 | 75 | ### 3. Grant of Patent License 76 | Subject to the terms and conditions of 77 | this License, each Contributor hereby grants to You a perpetual, 78 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 79 | (except as stated in this section) patent license to make, have made, 80 | use, offer to sell, sell, import, and otherwise transfer the Work, 81 | where such license applies only to those patent claims licensable 82 | by such Contributor that are necessarily infringed by their 83 | Contribution(s) alone or by combination of their Contribution(s) 84 | with the Work to which such Contribution(s) was submitted. If You 85 | institute patent litigation against any entity (including a 86 | cross-claim or counterclaim in a lawsuit) alleging that the Work 87 | or a Contribution incorporated within the Work constitutes direct 88 | or contributory patent infringement, then any patent licenses 89 | granted to You under this License for that Work shall terminate 90 | as of the date such litigation is filed. 91 | 92 | ### 4. Redistribution 93 | You may reproduce and distribute copies of the 94 | Work or Derivative Works thereof in any medium, with or without 95 | modifications, and in Source or Object form, provided that You 96 | meet the following conditions: 97 | 98 | {:style="list-style: lower-latin"} 99 | 1. You must give any other recipients of the Work or 100 | Derivative Works a copy of this License; and 101 | 102 | 2. You must cause any modified files to carry prominent notices 103 | stating that You changed the files; and 104 | 105 | 3. You must retain, in the Source form of any Derivative Works 106 | that You distribute, all copyright, patent, trademark, and 107 | attribution notices from the Source form of the Work, 108 | excluding those notices that do not pertain to any part of 109 | the Derivative Works; and 110 | 111 | 4. If the Work includes a "NOTICE" text file as part of its 112 | distribution, then any Derivative Works that You distribute must 113 | include a readable copy of the attribution notices contained 114 | within such NOTICE file, excluding those notices that do not 115 | pertain to any part of the Derivative Works, in at least one 116 | of the following places: within a NOTICE text file distributed 117 | as part of the Derivative Works; within the Source form or 118 | documentation, if provided along with the Derivative Works; or, 119 | within a display generated by the Derivative Works, if and 120 | wherever such third-party notices normally appear. The contents 121 | of the NOTICE file are for informational purposes only and 122 | do not modify the License. You may add Your own attribution 123 | notices within Derivative Works that You distribute, alongside 124 | or as an addendum to the NOTICE text from the Work, provided 125 | that such additional attribution notices cannot be construed 126 | as modifying the License. 127 | 128 | You may add Your own copyright statement to Your modifications and 129 | may provide additional or different license terms and conditions 130 | for use, reproduction, or distribution of Your modifications, or 131 | for any such Derivative Works as a whole, provided Your use, 132 | reproduction, and distribution of the Work otherwise complies with 133 | the conditions stated in this License. 134 | 135 | ### 5. Submission of Contributions 136 | Unless You explicitly state otherwise, 137 | any Contribution intentionally submitted for inclusion in the Work 138 | by You to the Licensor shall be under the terms and conditions of 139 | this License, without any additional terms or conditions. 140 | Notwithstanding the above, nothing herein shall supersede or modify 141 | the terms of any separate license agreement you may have executed 142 | with Licensor regarding such Contributions. 143 | 144 | ### 6. Trademarks 145 | This License does not grant permission to use the trade 146 | names, trademarks, service marks, or product names of the Licensor, 147 | except as required for reasonable and customary use in describing the 148 | origin of the Work and reproducing the content of the NOTICE file. 149 | 150 | ### 7. Disclaimer of Warranty 151 | Unless required by applicable law or 152 | agreed to in writing, Licensor provides the Work (and each 153 | Contributor provides its Contributions) on an "AS IS" BASIS, 154 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 155 | implied, including, without limitation, any warranties or conditions 156 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 157 | PARTICULAR PURPOSE. You are solely responsible for determining the 158 | appropriateness of using or redistributing the Work and assume any 159 | risks associated with Your exercise of permissions under this License. 160 | 161 | ### 8. Limitation of Liability 162 | In no event and under no legal theory, 163 | whether in tort (including negligence), contract, or otherwise, 164 | unless required by applicable law (such as deliberate and grossly 165 | negligent acts) or agreed to in writing, shall any Contributor be 166 | liable to You for damages, including any direct, indirect, special, 167 | incidental, or consequential damages of any character arising as a 168 | result of this License or out of the use or inability to use the 169 | Work (including but not limited to damages for loss of goodwill, 170 | work stoppage, computer failure or malfunction, or any and all 171 | other commercial damages or losses), even if such Contributor 172 | has been advised of the possibility of such damages. 173 | 174 | ### 9. Accepting Warranty or Additional Liability 175 | While redistributing 176 | the Work or Derivative Works thereof, You may choose to offer, 177 | and charge a fee for, acceptance of support, warranty, indemnity, 178 | or other liability obligations and/or rights consistent with this 179 | License. However, in accepting such obligations, You may act only 180 | on Your own behalf and on Your sole responsibility, not on behalf 181 | of any other Contributor, and only if You agree to indemnify, 182 | defend, and hold each Contributor harmless for any liability 183 | 184 | END OF TERMS AND CONDITIONS 185 | 186 | ## APPENDIX: How to apply the Apache License to your work 187 | 188 | To apply the Apache License to your work, attach the following boilerplate 189 | notice, with the fields enclosed by brackets `[]` replaced with your own 190 | identifying information. (Don't include the brackets!) The text should be 191 | enclosed in the appropriate comment syntax for the file format. We also 192 | recommend that a file or class name and description of purpose be included on 193 | the same “printed page” as the copyright notice for easier identification within 194 | third-party archives. 195 | 196 | Copyright [yyyy] [name of copyright owner] 197 | 198 | Licensed under the Apache License, Version 2.0 (the "License"); 199 | you may not use this file except in compliance with the License. 200 | You may obtain a copy of the License at 201 | 202 | http://www.apache.org/licenses/LICENSE-2.0 203 | 204 | Unless required by applicable law or agreed to in writing, software 205 | distributed under the License is distributed on an "AS IS" BASIS, 206 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 207 | See the License for the specific language governing permissions and 208 | limitations under the License. 209 | -------------------------------------------------------------------------------- /docs/licenses/GPL-3.0.md: -------------------------------------------------------------------------------- 1 | # GNU GENERAL PUBLIC LICENSE 2 | 3 | Version 3, 29 June 2007 4 | 5 | Copyright (C) 2007 Free Software Foundation, Inc. 6 | 7 | 8 | Everyone is permitted to copy and distribute verbatim copies of this 9 | license document, but changing it is not allowed. 10 | 11 | ## Preamble 12 | 13 | The GNU General Public License is a free, copyleft license for 14 | software and other kinds of works. 15 | 16 | The licenses for most software and other practical works are designed 17 | to take away your freedom to share and change the works. By contrast, 18 | the GNU General Public License is intended to guarantee your freedom 19 | to share and change all versions of a program--to make sure it remains 20 | free software for all its users. We, the Free Software Foundation, use 21 | the GNU General Public License for most of our software; it applies 22 | also to any other work released this way by its authors. You can apply 23 | it to your programs, too. 24 | 25 | When we speak of free software, we are referring to freedom, not 26 | price. Our General Public Licenses are designed to make sure that you 27 | have the freedom to distribute copies of free software (and charge for 28 | them if you wish), that you receive source code or can get it if you 29 | want it, that you can change the software or use pieces of it in new 30 | free programs, and that you know you can do these things. 31 | 32 | To protect your rights, we need to prevent others from denying you 33 | these rights or asking you to surrender the rights. Therefore, you 34 | have certain responsibilities if you distribute copies of the 35 | software, or if you modify it: responsibilities to respect the freedom 36 | of others. 37 | 38 | For example, if you distribute copies of such a program, whether 39 | gratis or for a fee, you must pass on to the recipients the same 40 | freedoms that you received. You must make sure that they, too, receive 41 | or can get the source code. And you must show them these terms so they 42 | know their rights. 43 | 44 | Developers that use the GNU GPL protect your rights with two steps: 45 | (1) assert copyright on the software, and (2) offer you this License 46 | giving you legal permission to copy, distribute and/or modify it. 47 | 48 | For the developers' and authors' protection, the GPL clearly explains 49 | that there is no warranty for this free software. For both users' and 50 | authors' sake, the GPL requires that modified versions be marked as 51 | changed, so that their problems will not be attributed erroneously to 52 | authors of previous versions. 53 | 54 | Some devices are designed to deny users access to install or run 55 | modified versions of the software inside them, although the 56 | manufacturer can do so. This is fundamentally incompatible with the 57 | aim of protecting users' freedom to change the software. The 58 | systematic pattern of such abuse occurs in the area of products for 59 | individuals to use, which is precisely where it is most unacceptable. 60 | Therefore, we have designed this version of the GPL to prohibit the 61 | practice for those products. If such problems arise substantially in 62 | other domains, we stand ready to extend this provision to those 63 | domains in future versions of the GPL, as needed to protect the 64 | freedom of users. 65 | 66 | Finally, every program is threatened constantly by software patents. 67 | States should not allow patents to restrict development and use of 68 | software on general-purpose computers, but in those that do, we wish 69 | to avoid the special danger that patents applied to a free program 70 | could make it effectively proprietary. To prevent this, the GPL 71 | assures that patents cannot be used to render the program non-free. 72 | 73 | The precise terms and conditions for copying, distribution and 74 | modification follow. 75 | 76 | ## TERMS AND CONDITIONS 77 | 78 | ### 0. Definitions 79 | 80 | "This License" refers to version 3 of the GNU General Public License. 81 | 82 | "Copyright" also means copyright-like laws that apply to other kinds 83 | of works, such as semiconductor masks. 84 | 85 | "The Program" refers to any copyrightable work licensed under this 86 | License. Each licensee is addressed as "you". "Licensees" and 87 | "recipients" may be individuals or organizations. 88 | 89 | To "modify" a work means to copy from or adapt all or part of the work 90 | in a fashion requiring copyright permission, other than the making of 91 | an exact copy. The resulting work is called a "modified version" of 92 | the earlier work or a work "based on" the earlier work. 93 | 94 | A "covered work" means either the unmodified Program or a work based 95 | on the Program. 96 | 97 | To "propagate" a work means to do anything with it that, without 98 | permission, would make you directly or secondarily liable for 99 | infringement under applicable copyright law, except executing it on a 100 | computer or modifying a private copy. Propagation includes copying, 101 | distribution (with or without modification), making available to the 102 | public, and in some countries other activities as well. 103 | 104 | To "convey" a work means any kind of propagation that enables other 105 | parties to make or receive copies. Mere interaction with a user 106 | through a computer network, with no transfer of a copy, is not 107 | conveying. 108 | 109 | An interactive user interface displays "Appropriate Legal Notices" to 110 | the extent that it includes a convenient and prominently visible 111 | feature that (1) displays an appropriate copyright notice, and (2) 112 | tells the user that there is no warranty for the work (except to the 113 | extent that warranties are provided), that licensees may convey the 114 | work under this License, and how to view a copy of this License. If 115 | the interface presents a list of user commands or options, such as a 116 | menu, a prominent item in the list meets this criterion. 117 | 118 | ### 1. Source Code 119 | 120 | The "source code" for a work means the preferred form of the work for 121 | making modifications to it. "Object code" means any non-source form of 122 | a work. 123 | 124 | A "Standard Interface" means an interface that either is an official 125 | standard defined by a recognized standards body, or, in the case of 126 | interfaces specified for a particular programming language, one that 127 | is widely used among developers working in that language. 128 | 129 | The "System Libraries" of an executable work include anything, other 130 | than the work as a whole, that (a) is included in the normal form of 131 | packaging a Major Component, but which is not part of that Major 132 | Component, and (b) serves only to enable use of the work with that 133 | Major Component, or to implement a Standard Interface for which an 134 | implementation is available to the public in source code form. A 135 | "Major Component", in this context, means a major essential component 136 | (kernel, window system, and so on) of the specific operating system 137 | (if any) on which the executable work runs, or a compiler used to 138 | produce the work, or an object code interpreter used to run it. 139 | 140 | The "Corresponding Source" for a work in object code form means all 141 | the source code needed to generate, install, and (for an executable 142 | work) run the object code and to modify the work, including scripts to 143 | control those activities. However, it does not include the work's 144 | System Libraries, or general-purpose tools or generally available free 145 | programs which are used unmodified in performing those activities but 146 | which are not part of the work. For example, Corresponding Source 147 | includes interface definition files associated with source files for 148 | the work, and the source code for shared libraries and dynamically 149 | linked subprograms that the work is specifically designed to require, 150 | such as by intimate data communication or control flow between those 151 | subprograms and other parts of the work. 152 | 153 | The Corresponding Source need not include anything that users can 154 | regenerate automatically from other parts of the Corresponding Source. 155 | 156 | The Corresponding Source for a work in source code form is that same 157 | work. 158 | 159 | ### 2. Basic Permissions 160 | 161 | All rights granted under this License are granted for the term of 162 | copyright on the Program, and are irrevocable provided the stated 163 | conditions are met. This License explicitly affirms your unlimited 164 | permission to run the unmodified Program. The output from running a 165 | covered work is covered by this License only if the output, given its 166 | content, constitutes a covered work. This License acknowledges your 167 | rights of fair use or other equivalent, as provided by copyright law. 168 | 169 | You may make, run and propagate covered works that you do not convey, 170 | without conditions so long as your license otherwise remains in force. 171 | You may convey covered works to others for the sole purpose of having 172 | them make modifications exclusively for you, or provide you with 173 | facilities for running those works, provided that you comply with the 174 | terms of this License in conveying all material for which you do not 175 | control copyright. Those thus making or running the covered works for 176 | you must do so exclusively on your behalf, under your direction and 177 | control, on terms that prohibit them from making any copies of your 178 | copyrighted material outside their relationship with you. 179 | 180 | Conveying under any other circumstances is permitted solely under the 181 | conditions stated below. Sublicensing is not allowed; section 10 makes 182 | it unnecessary. 183 | 184 | ### 3. Protecting Users' Legal Rights From Anti-Circumvention Law 185 | 186 | No covered work shall be deemed part of an effective technological 187 | measure under any applicable law fulfilling obligations under article 188 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 189 | similar laws prohibiting or restricting circumvention of such 190 | measures. 191 | 192 | When you convey a covered work, you waive any legal power to forbid 193 | circumvention of technological measures to the extent such 194 | circumvention is effected by exercising rights under this License with 195 | respect to the covered work, and you disclaim any intention to limit 196 | operation or modification of the work as a means of enforcing, against 197 | the work's users, your or third parties' legal rights to forbid 198 | circumvention of technological measures. 199 | 200 | ### 4. Conveying Verbatim Copies 201 | 202 | You may convey verbatim copies of the Program's source code as you 203 | receive it, in any medium, provided that you conspicuously and 204 | appropriately publish on each copy an appropriate copyright notice; 205 | keep intact all notices stating that this License and any 206 | non-permissive terms added in accord with section 7 apply to the code; 207 | keep intact all notices of the absence of any warranty; and give all 208 | recipients a copy of this License along with the Program. 209 | 210 | You may charge any price or no price for each copy that you convey, 211 | and you may offer support or warranty protection for a fee. 212 | 213 | ### 5. Conveying Modified Source Versions 214 | 215 | You may convey a work based on the Program, or the modifications to 216 | produce it from the Program, in the form of source code under the 217 | terms of section 4, provided that you also meet all of these 218 | conditions: 219 | 220 | {:style="list-style-type:lower-latin"} 221 | 1. The work must carry prominent notices stating that you modified 222 | it, and giving a relevant date. 223 | 2. The work must carry prominent notices stating that it is 224 | released under this License and any conditions added under 225 | section 7. This requirement modifies the requirement in section 4 226 | to "keep intact all notices". 227 | 3. You must license the entire work, as a whole, under this 228 | License to anyone who comes into possession of a copy. This 229 | License will therefore apply, along with any applicable section 7 230 | additional terms, to the whole of the work, and all its parts, 231 | regardless of how they are packaged. This License gives no 232 | permission to license the work in any other way, but it does not 233 | invalidate such permission if you have separately received it. 234 | 4. If the work has interactive user interfaces, each must display 235 | Appropriate Legal Notices; however, if the Program has interactive 236 | interfaces that do not display Appropriate Legal Notices, your 237 | work need not make them do so. 238 | 239 | A compilation of a covered work with other separate and independent 240 | works, which are not by their nature extensions of the covered work, 241 | and which are not combined with it such as to form a larger program, 242 | in or on a volume of a storage or distribution medium, is called an 243 | "aggregate" if the compilation and its resulting copyright are not 244 | used to limit the access or legal rights of the compilation's users 245 | beyond what the individual works permit. Inclusion of a covered work 246 | in an aggregate does not cause this License to apply to the other 247 | parts of the aggregate. 248 | 249 | ### 6. Conveying Non-Source Forms 250 | 251 | You may convey a covered work in object code form under the terms of 252 | sections 4 and 5, provided that you also convey the machine-readable 253 | Corresponding Source under the terms of this License, in one of these 254 | ways: 255 | 256 | {:style="list-style-type:lower-latin"} 257 | 1. Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by the 259 | Corresponding Source fixed on a durable physical medium 260 | customarily used for software interchange. 261 | 2. Convey the object code in, or embodied in, a physical product 262 | (including a physical distribution medium), accompanied by a 263 | written offer, valid for at least three years and valid for as 264 | long as you offer spare parts or customer support for that product 265 | model, to give anyone who possesses the object code either (1) a 266 | copy of the Corresponding Source for all the software in the 267 | product that is covered by this License, on a durable physical 268 | medium customarily used for software interchange, for a price no 269 | more than your reasonable cost of physically performing this 270 | conveying of source, or (2) access to copy the Corresponding 271 | Source from a network server at no charge. 272 | 3. Convey individual copies of the object code with a copy of the 273 | written offer to provide the Corresponding Source. This 274 | alternative is allowed only occasionally and noncommercially, and 275 | only if you received the object code with such an offer, in accord 276 | with subsection 6b. 277 | 4. Convey the object code by offering access from a designated 278 | place (gratis or for a charge), and offer equivalent access to the 279 | Corresponding Source in the same way through the same place at no 280 | further charge. You need not require recipients to copy the 281 | Corresponding Source along with the object code. If the place to 282 | copy the object code is a network server, the Corresponding Source 283 | may be on a different server (operated by you or a third party) 284 | that supports equivalent copying facilities, provided you maintain 285 | clear directions next to the object code saying where to find the 286 | Corresponding Source. Regardless of what server hosts the 287 | Corresponding Source, you remain obligated to ensure that it is 288 | available for as long as needed to satisfy these requirements. 289 | 5. Convey the object code using peer-to-peer transmission, 290 | provided you inform other peers where the object code and 291 | Corresponding Source of the work are being offered to the general 292 | public at no charge under subsection 6d. 293 | 294 | A separable portion of the object code, whose source code is excluded 295 | from the Corresponding Source as a System Library, need not be 296 | included in conveying the object code work. 297 | 298 | A "User Product" is either (1) a "consumer product", which means any 299 | tangible personal property which is normally used for personal, 300 | family, or household purposes, or (2) anything designed or sold for 301 | incorporation into a dwelling. In determining whether a product is a 302 | consumer product, doubtful cases shall be resolved in favor of 303 | coverage. For a particular product received by a particular user, 304 | "normally used" refers to a typical or common use of that class of 305 | product, regardless of the status of the particular user or of the way 306 | in which the particular user actually uses, or expects or is expected 307 | to use, the product. A product is a consumer product regardless of 308 | whether the product has substantial commercial, industrial or 309 | non-consumer uses, unless such uses represent the only significant 310 | mode of use of the product. 311 | 312 | "Installation Information" for a User Product means any methods, 313 | procedures, authorization keys, or other information required to 314 | install and execute modified versions of a covered work in that User 315 | Product from a modified version of its Corresponding Source. The 316 | information must suffice to ensure that the continued functioning of 317 | the modified object code is in no case prevented or interfered with 318 | solely because modification has been made. 319 | 320 | If you convey an object code work under this section in, or with, or 321 | specifically for use in, a User Product, and the conveying occurs as 322 | part of a transaction in which the right of possession and use of the 323 | User Product is transferred to the recipient in perpetuity or for a 324 | fixed term (regardless of how the transaction is characterized), the 325 | Corresponding Source conveyed under this section must be accompanied 326 | by the Installation Information. But this requirement does not apply 327 | if neither you nor any third party retains the ability to install 328 | modified object code on the User Product (for example, the work has 329 | been installed in ROM). 330 | 331 | The requirement to provide Installation Information does not include a 332 | requirement to continue to provide support service, warranty, or 333 | updates for a work that has been modified or installed by the 334 | recipient, or for the User Product in which it has been modified or 335 | installed. Access to a network may be denied when the modification 336 | itself materially and adversely affects the operation of the network 337 | or violates the rules and protocols for communication across the 338 | network. 339 | 340 | Corresponding Source conveyed, and Installation Information provided, 341 | in accord with this section must be in a format that is publicly 342 | documented (and with an implementation available to the public in 343 | source code form), and must require no special password or key for 344 | unpacking, reading or copying. 345 | 346 | ### 7. Additional Terms 347 | 348 | "Additional permissions" are terms that supplement the terms of this 349 | License by making exceptions from one or more of its conditions. 350 | Additional permissions that are applicable to the entire Program shall 351 | be treated as though they were included in this License, to the extent 352 | that they are valid under applicable law. If additional permissions 353 | apply only to part of the Program, that part may be used separately 354 | under those permissions, but the entire Program remains governed by 355 | this License without regard to the additional permissions. 356 | 357 | When you convey a copy of a covered work, you may at your option 358 | remove any additional permissions from that copy, or from any part of 359 | it. (Additional permissions may be written to require their own 360 | removal in certain cases when you modify the work.) You may place 361 | additional permissions on material, added by you to a covered work, 362 | for which you have or can give appropriate copyright permission. 363 | 364 | Notwithstanding any other provision of this License, for material you 365 | add to a covered work, you may (if authorized by the copyright holders 366 | of that material) supplement the terms of this License with terms: 367 | 368 | {:style="list-style-type:lower-latin"} 369 | 1. Disclaiming warranty or limiting liability differently from the 370 | terms of sections 15 and 16 of this License; or 371 | 2. Requiring preservation of specified reasonable legal notices or 372 | author attributions in that material or in the Appropriate Legal 373 | Notices displayed by works containing it; or 374 | 3. Prohibiting misrepresentation of the origin of that material, 375 | or requiring that modified versions of such material be marked in 376 | reasonable ways as different from the original version; or 377 | 4. Limiting the use for publicity purposes of names of licensors 378 | or authors of the material; or 379 | 5. Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 6. Requiring indemnification of licensors and authors of that 382 | material by anyone who conveys the material (or modified versions 383 | of it) with contractual assumptions of liability to the recipient, 384 | for any liability that these contractual assumptions directly 385 | impose on those licensors and authors. 386 | 387 | All other non-permissive additional terms are considered "further 388 | restrictions" within the meaning of section 10. If the Program as you 389 | received it, or any part of it, contains a notice stating that it is 390 | governed by this License along with a term that is a further 391 | restriction, you may remove that term. If a license document contains 392 | a further restriction but permits relicensing or conveying under this 393 | License, you may add to a covered work material governed by the terms 394 | of that license document, provided that the further restriction does 395 | not survive such relicensing or conveying. 396 | 397 | If you add terms to a covered work in accord with this section, you 398 | must place, in the relevant source files, a statement of the 399 | additional terms that apply to those files, or a notice indicating 400 | where to find the applicable terms. 401 | 402 | Additional terms, permissive or non-permissive, may be stated in the 403 | form of a separately written license, or stated as exceptions; the 404 | above requirements apply either way. 405 | 406 | ### 8. Termination 407 | 408 | You may not propagate or modify a covered work except as expressly 409 | provided under this License. Any attempt otherwise to propagate or 410 | modify it is void, and will automatically terminate your rights under 411 | this License (including any patent licenses granted under the third 412 | paragraph of section 11). 413 | 414 | However, if you cease all violation of this License, then your license 415 | from a particular copyright holder is reinstated (a) provisionally, 416 | unless and until the copyright holder explicitly and finally 417 | terminates your license, and (b) permanently, if the copyright holder 418 | fails to notify you of the violation by some reasonable means prior to 419 | 60 days after the cessation. 420 | 421 | Moreover, your license from a particular copyright holder is 422 | reinstated permanently if the copyright holder notifies you of the 423 | violation by some reasonable means, this is the first time you have 424 | received notice of violation of this License (for any work) from that 425 | copyright holder, and you cure the violation prior to 30 days after 426 | your receipt of the notice. 427 | 428 | Termination of your rights under this section does not terminate the 429 | licenses of parties who have received copies or rights from you under 430 | this License. If your rights have been terminated and not permanently 431 | reinstated, you do not qualify to receive new licenses for the same 432 | material under section 10. 433 | 434 | ### 9. Acceptance Not Required for Having Copies 435 | 436 | You are not required to accept this License in order to receive or run 437 | a copy of the Program. Ancillary propagation of a covered work 438 | occurring solely as a consequence of using peer-to-peer transmission 439 | to receive a copy likewise does not require acceptance. However, 440 | nothing other than this License grants you permission to propagate or 441 | modify any covered work. These actions infringe copyright if you do 442 | not accept this License. Therefore, by modifying or propagating a 443 | covered work, you indicate your acceptance of this License to do so. 444 | 445 | ### 10. Automatic Licensing of Downstream Recipients 446 | 447 | Each time you convey a covered work, the recipient automatically 448 | receives a license from the original licensors, to run, modify and 449 | propagate that work, subject to this License. You are not responsible 450 | for enforcing compliance by third parties with this License. 451 | 452 | An "entity transaction" is a transaction transferring control of an 453 | organization, or substantially all assets of one, or subdividing an 454 | organization, or merging organizations. If propagation of a covered 455 | work results from an entity transaction, each party to that 456 | transaction who receives a copy of the work also receives whatever 457 | licenses to the work the party's predecessor in interest had or could 458 | give under the previous paragraph, plus a right to possession of the 459 | Corresponding Source of the work from the predecessor in interest, if 460 | the predecessor has it or can get it with reasonable efforts. 461 | 462 | You may not impose any further restrictions on the exercise of the 463 | rights granted or affirmed under this License. For example, you may 464 | not impose a license fee, royalty, or other charge for exercise of 465 | rights granted under this License, and you may not initiate litigation 466 | (including a cross-claim or counterclaim in a lawsuit) alleging that 467 | any patent claim is infringed by making, using, selling, offering for 468 | sale, or importing the Program or any portion of it. 469 | 470 | ### 11. Patents 471 | 472 | A "contributor" is a copyright holder who authorizes use under this 473 | License of the Program or a work on which the Program is based. The 474 | work thus licensed is called the contributor's "contributor version". 475 | 476 | A contributor's "essential patent claims" are all patent claims owned 477 | or controlled by the contributor, whether already acquired or 478 | hereafter acquired, that would be infringed by some manner, permitted 479 | by this License, of making, using, or selling its contributor version, 480 | but do not include claims that would be infringed only as a 481 | consequence of further modification of the contributor version. For 482 | purposes of this definition, "control" includes the right to grant 483 | patent sublicenses in a manner consistent with the requirements of 484 | this License. 485 | 486 | Each contributor grants you a non-exclusive, worldwide, royalty-free 487 | patent license under the contributor's essential patent claims, to 488 | make, use, sell, offer for sale, import and otherwise run, modify and 489 | propagate the contents of its contributor version. 490 | 491 | In the following three paragraphs, a "patent license" is any express 492 | agreement or commitment, however denominated, not to enforce a patent 493 | (such as an express permission to practice a patent or covenant not to 494 | sue for patent infringement). To "grant" such a patent license to a 495 | party means to make such an agreement or commitment not to enforce a 496 | patent against the party. 497 | 498 | If you convey a covered work, knowingly relying on a patent license, 499 | and the Corresponding Source of the work is not available for anyone 500 | to copy, free of charge and under the terms of this License, through a 501 | publicly available network server or other readily accessible means, 502 | then you must either (1) cause the Corresponding Source to be so 503 | available, or (2) arrange to deprive yourself of the benefit of the 504 | patent license for this particular work, or (3) arrange, in a manner 505 | consistent with the requirements of this License, to extend the patent 506 | license to downstream recipients. "Knowingly relying" means you have 507 | actual knowledge that, but for the patent license, your conveying the 508 | covered work in a country, or your recipient's use of the covered work 509 | in a country, would infringe one or more identifiable patents in that 510 | country that you have reason to believe are valid. 511 | 512 | If, pursuant to or in connection with a single transaction or 513 | arrangement, you convey, or propagate by procuring conveyance of, a 514 | covered work, and grant a patent license to some of the parties 515 | receiving the covered work authorizing them to use, propagate, modify 516 | or convey a specific copy of the covered work, then the patent license 517 | you grant is automatically extended to all recipients of the covered 518 | work and works based on it. 519 | 520 | A patent license is "discriminatory" if it does not include within the 521 | scope of its coverage, prohibits the exercise of, or is conditioned on 522 | the non-exercise of one or more of the rights that are specifically 523 | granted under this License. You may not convey a covered work if you 524 | are a party to an arrangement with a third party that is in the 525 | business of distributing software, under which you make payment to the 526 | third party based on the extent of your activity of conveying the 527 | work, and under which the third party grants, to any of the parties 528 | who would receive the covered work from you, a discriminatory patent 529 | license (a) in connection with copies of the covered work conveyed by 530 | you (or copies made from those copies), or (b) primarily for and in 531 | connection with specific products or compilations that contain the 532 | covered work, unless you entered into that arrangement, or that patent 533 | license was granted, prior to 28 March 2007. 534 | 535 | Nothing in this License shall be construed as excluding or limiting 536 | any implied license or other defenses to infringement that may 537 | otherwise be available to you under applicable patent law. 538 | 539 | ### 12. No Surrender of Others' Freedom 540 | 541 | If conditions are imposed on you (whether by court order, agreement or 542 | otherwise) that contradict the conditions of this License, they do not 543 | excuse you from the conditions of this License. If you cannot convey a 544 | covered work so as to satisfy simultaneously your obligations under 545 | this License and any other pertinent obligations, then as a 546 | consequence you may not convey it at all. For example, if you agree to 547 | terms that obligate you to collect a royalty for further conveying 548 | from those to whom you convey the Program, the only way you could 549 | satisfy both those terms and this License would be to refrain entirely 550 | from conveying the Program. 551 | 552 | ### 13. Use with the GNU Affero General Public License 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | ### 14. Revised Versions of this License 564 | 565 | The Free Software Foundation may publish revised and/or new versions 566 | of the GNU General Public License from time to time. Such new versions 567 | will be similar in spirit to the present version, but may differ in 568 | detail to address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the Program 571 | specifies that a certain numbered version of the GNU General Public 572 | License "or any later version" applies to it, you have the option of 573 | following the terms and conditions either of that numbered version or 574 | of any later version published by the Free Software Foundation. If the 575 | Program does not specify a version number of the GNU General Public 576 | License, you may choose any version ever published by the Free 577 | Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future versions 580 | of the GNU General Public License can be used, that proxy's public 581 | statement of acceptance of a version permanently authorizes you to 582 | choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | ### 15. Disclaimer of Warranty 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT 594 | WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT 595 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 596 | A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND 597 | PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE 598 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR 599 | CORRECTION. 600 | 601 | ### 16. Limitation of Liability 602 | 603 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 604 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR 605 | CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 606 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES 607 | ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT 608 | NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR 609 | LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM 610 | TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER 611 | PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 612 | 613 | ### 17. Interpretation of Sections 15 and 16 614 | 615 | If the disclaimer of warranty and limitation of liability provided 616 | above cannot be given local legal effect according to their terms, 617 | reviewing courts shall apply local law that most closely approximates 618 | an absolute waiver of all civil liability in connection with the 619 | Program, unless a warranty or assumption of liability accompanies a 620 | copy of the Program in return for a fee. 621 | -------------------------------------------------------------------------------- /docs/licenses/MIT.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright \ \ 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/licenses/README.md: -------------------------------------------------------------------------------- 1 | # License 2 | **hy-push-state** is Open Source but not free. 3 | 4 | You may use the component in accordance with the [GPL-3.0 license](../licenses/GPL-3.0.md), 5 | but this means you must be willing to release your code under a GPLv3-compatible license in turn. 6 | 7 | For cases were this is not acceptable the following commercial licenses available: 8 | 9 | | | Personal | Startup | Enterprise | 10 | |:-------------|:------------------:|:------------------:|:------------------:| 11 | | # Developers | 2 | 15 | ∞ | 12 | | License | [Personal][pl] | [Startup][sl] | [Enterprise][el] | 13 | | Price | $29 | $249 | $499 | 14 | | | [**Buy**][bp]{:.gumroad-button} | [**Buy**][bs]{:.gumroad-button} | [**Buy**][be]{:.gumroad-button} | 15 | {:.stretch-table} 16 | 17 | 18 | [pl]: personal.md 19 | [sl]: startup.md 20 | [el]: enterprise.md 21 | [bp]: https://gumroad.com/l/hy-push-state-personal 22 | [bs]: https://gumroad.com/l/hy-push-state-startup 23 | [be]: https://gumroad.com/l/hy-push-state-enterprise 24 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@hydecorp/push-state", 3 | "version": "1.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "@hydecorp/push-state", 9 | "version": "1.0.0", 10 | "license": "GPL-3.0", 11 | "dependencies": { 12 | "@hydecorp/component": "^1.0.0", 13 | "@types/resize-observer-browser": "^0.1.7", 14 | "lit-element": "^2.5.1", 15 | "rxjs": "^7.5.2", 16 | "tslib": "^2.3.1" 17 | }, 18 | "devDependencies": { 19 | "rollup": "^2.67.0", 20 | "rollup-plugin-commonjs": "^10.1.0", 21 | "rollup-plugin-node-resolve": "^5.2.0", 22 | "rollup-plugin-terser": "^7.0.2", 23 | "rollup-plugin-typescript": "^1.0.1", 24 | "typescript": "^4.5.5" 25 | } 26 | }, 27 | "node_modules/@babel/code-frame": { 28 | "version": "7.10.4", 29 | "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", 30 | "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", 31 | "dev": true, 32 | "dependencies": { 33 | "@babel/highlight": "^7.10.4" 34 | } 35 | }, 36 | "node_modules/@babel/helper-validator-identifier": { 37 | "version": "7.10.4", 38 | "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", 39 | "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", 40 | "dev": true 41 | }, 42 | "node_modules/@babel/highlight": { 43 | "version": "7.10.4", 44 | "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", 45 | "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", 46 | "dev": true, 47 | "dependencies": { 48 | "@babel/helper-validator-identifier": "^7.10.4", 49 | "chalk": "^2.0.0", 50 | "js-tokens": "^4.0.0" 51 | } 52 | }, 53 | "node_modules/@hydecorp/component": { 54 | "version": "1.0.0", 55 | "resolved": "https://registry.npmjs.org/@hydecorp/component/-/component-1.0.0.tgz", 56 | "integrity": "sha512-rEe6FjRRnHkNeXy90VRMgM74NFze80NvA8zTdfS3dXTZeBjC3JpvYNKn1V+E7y007tAa6zNZuVnNczlNQXeLiw==", 57 | "dependencies": { 58 | "@types/resize-observer-browser": "^0.1.7", 59 | "lit-element": "^2.5.1", 60 | "rxjs": "^7.5.2", 61 | "tslib": "^2.3.1" 62 | } 63 | }, 64 | "node_modules/@types/estree": { 65 | "version": "0.0.45", 66 | "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.45.tgz", 67 | "integrity": "sha512-jnqIUKDUqJbDIUxm0Uj7bnlMnRm1T/eZ9N+AVMqhPgzrba2GhGG5o/jCTwmdPK709nEZsGoMzXEDUjcXHa3W0g==", 68 | "dev": true 69 | }, 70 | "node_modules/@types/node": { 71 | "version": "14.14.6", 72 | "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.6.tgz", 73 | "integrity": "sha512-6QlRuqsQ/Ox/aJEQWBEJG7A9+u7oSYl3mem/K8IzxXG/kAGbV1YPD9Bg9Zw3vyxC/YP+zONKwy8hGkSt1jxFMw==", 74 | "dev": true 75 | }, 76 | "node_modules/@types/resize-observer-browser": { 77 | "version": "0.1.7", 78 | "resolved": "https://registry.npmjs.org/@types/resize-observer-browser/-/resize-observer-browser-0.1.7.tgz", 79 | "integrity": "sha512-G9eN0Sn0ii9PWQ3Vl72jDPgeJwRWhv2Qk/nQkJuWmRmOB4HX3/BhD5SE1dZs/hzPZL/WKnvF0RHdTSG54QJFyg==" 80 | }, 81 | "node_modules/@types/resolve": { 82 | "version": "0.0.8", 83 | "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", 84 | "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", 85 | "dev": true, 86 | "dependencies": { 87 | "@types/node": "*" 88 | } 89 | }, 90 | "node_modules/ansi-styles": { 91 | "version": "3.2.1", 92 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", 93 | "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", 94 | "dev": true, 95 | "dependencies": { 96 | "color-convert": "^1.9.0" 97 | }, 98 | "engines": { 99 | "node": ">=4" 100 | } 101 | }, 102 | "node_modules/buffer-from": { 103 | "version": "1.1.1", 104 | "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", 105 | "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", 106 | "dev": true 107 | }, 108 | "node_modules/builtin-modules": { 109 | "version": "3.1.0", 110 | "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", 111 | "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", 112 | "dev": true, 113 | "engines": { 114 | "node": ">=6" 115 | } 116 | }, 117 | "node_modules/chalk": { 118 | "version": "2.4.2", 119 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", 120 | "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", 121 | "dev": true, 122 | "dependencies": { 123 | "ansi-styles": "^3.2.1", 124 | "escape-string-regexp": "^1.0.5", 125 | "supports-color": "^5.3.0" 126 | }, 127 | "engines": { 128 | "node": ">=4" 129 | } 130 | }, 131 | "node_modules/color-convert": { 132 | "version": "1.9.3", 133 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", 134 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", 135 | "dev": true, 136 | "dependencies": { 137 | "color-name": "1.1.3" 138 | } 139 | }, 140 | "node_modules/color-name": { 141 | "version": "1.1.3", 142 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 143 | "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", 144 | "dev": true 145 | }, 146 | "node_modules/commander": { 147 | "version": "2.20.3", 148 | "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", 149 | "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", 150 | "dev": true 151 | }, 152 | "node_modules/escape-string-regexp": { 153 | "version": "1.0.5", 154 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 155 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", 156 | "dev": true, 157 | "engines": { 158 | "node": ">=0.8.0" 159 | } 160 | }, 161 | "node_modules/estree-walker": { 162 | "version": "0.6.1", 163 | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", 164 | "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", 165 | "dev": true 166 | }, 167 | "node_modules/fsevents": { 168 | "version": "2.3.2", 169 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", 170 | "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", 171 | "dev": true, 172 | "hasInstallScript": true, 173 | "optional": true, 174 | "os": [ 175 | "darwin" 176 | ], 177 | "engines": { 178 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0" 179 | } 180 | }, 181 | "node_modules/function-bind": { 182 | "version": "1.1.1", 183 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 184 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", 185 | "dev": true 186 | }, 187 | "node_modules/has": { 188 | "version": "1.0.3", 189 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 190 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 191 | "dev": true, 192 | "dependencies": { 193 | "function-bind": "^1.1.1" 194 | }, 195 | "engines": { 196 | "node": ">= 0.4.0" 197 | } 198 | }, 199 | "node_modules/has-flag": { 200 | "version": "3.0.0", 201 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", 202 | "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", 203 | "dev": true, 204 | "engines": { 205 | "node": ">=4" 206 | } 207 | }, 208 | "node_modules/is-core-module": { 209 | "version": "2.0.0", 210 | "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.0.0.tgz", 211 | "integrity": "sha512-jq1AH6C8MuteOoBPwkxHafmByhL9j5q4OaPGdbuD+ZtQJVzH+i6E3BJDQcBA09k57i2Hh2yQbEG8yObZ0jdlWw==", 212 | "dev": true, 213 | "dependencies": { 214 | "has": "^1.0.3" 215 | }, 216 | "funding": { 217 | "url": "https://github.com/sponsors/ljharb" 218 | } 219 | }, 220 | "node_modules/is-module": { 221 | "version": "1.0.0", 222 | "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", 223 | "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", 224 | "dev": true 225 | }, 226 | "node_modules/is-reference": { 227 | "version": "1.2.1", 228 | "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", 229 | "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", 230 | "dev": true, 231 | "dependencies": { 232 | "@types/estree": "*" 233 | } 234 | }, 235 | "node_modules/jest-worker": { 236 | "version": "26.6.1", 237 | "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.1.tgz", 238 | "integrity": "sha512-R5IE3qSGz+QynJx8y+ICEkdI2OJ3RJjRQVEyCcFAd3yVhQSEtquziPO29Mlzgn07LOVE8u8jhJ1FqcwegiXWOw==", 239 | "dev": true, 240 | "dependencies": { 241 | "@types/node": "*", 242 | "merge-stream": "^2.0.0", 243 | "supports-color": "^7.0.0" 244 | }, 245 | "engines": { 246 | "node": ">= 10.13.0" 247 | } 248 | }, 249 | "node_modules/jest-worker/node_modules/has-flag": { 250 | "version": "4.0.0", 251 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 252 | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 253 | "dev": true, 254 | "engines": { 255 | "node": ">=8" 256 | } 257 | }, 258 | "node_modules/jest-worker/node_modules/supports-color": { 259 | "version": "7.2.0", 260 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", 261 | "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", 262 | "dev": true, 263 | "dependencies": { 264 | "has-flag": "^4.0.0" 265 | }, 266 | "engines": { 267 | "node": ">=8" 268 | } 269 | }, 270 | "node_modules/js-tokens": { 271 | "version": "4.0.0", 272 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", 273 | "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", 274 | "dev": true 275 | }, 276 | "node_modules/lit-element": { 277 | "version": "2.5.1", 278 | "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.5.1.tgz", 279 | "integrity": "sha512-ogu7PiJTA33bEK0xGu1dmaX5vhcRjBXCFexPja0e7P7jqLhTpNKYRPmE+GmiCaRVAbiQKGkUgkh/i6+bh++dPQ==", 280 | "dependencies": { 281 | "lit-html": "^1.1.1" 282 | } 283 | }, 284 | "node_modules/lit-html": { 285 | "version": "1.3.0", 286 | "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-1.3.0.tgz", 287 | "integrity": "sha512-0Q1bwmaFH9O14vycPHw8C/IeHMk/uSDldVLIefu/kfbTBGIc44KGH6A8p1bDfxUfHdc8q6Ct7kQklWoHgr4t1Q==" 288 | }, 289 | "node_modules/magic-string": { 290 | "version": "0.25.7", 291 | "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", 292 | "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", 293 | "dev": true, 294 | "dependencies": { 295 | "sourcemap-codec": "^1.4.4" 296 | } 297 | }, 298 | "node_modules/merge-stream": { 299 | "version": "2.0.0", 300 | "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", 301 | "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", 302 | "dev": true 303 | }, 304 | "node_modules/path-parse": { 305 | "version": "1.0.7", 306 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", 307 | "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", 308 | "dev": true 309 | }, 310 | "node_modules/randombytes": { 311 | "version": "2.1.0", 312 | "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", 313 | "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", 314 | "dev": true, 315 | "dependencies": { 316 | "safe-buffer": "^5.1.0" 317 | } 318 | }, 319 | "node_modules/resolve": { 320 | "version": "1.18.1", 321 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz", 322 | "integrity": "sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==", 323 | "dev": true, 324 | "dependencies": { 325 | "is-core-module": "^2.0.0", 326 | "path-parse": "^1.0.6" 327 | }, 328 | "funding": { 329 | "url": "https://github.com/sponsors/ljharb" 330 | } 331 | }, 332 | "node_modules/rollup": { 333 | "version": "2.67.0", 334 | "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.67.0.tgz", 335 | "integrity": "sha512-W83AaERwvDiHwHEF/dfAfS3z1Be5wf7n+pO3ZAO5IQadCT2lBTr7WQ2MwZZe+nodbD+n3HtC4OCOAdsOPPcKZQ==", 336 | "dev": true, 337 | "bin": { 338 | "rollup": "dist/bin/rollup" 339 | }, 340 | "engines": { 341 | "node": ">=10.0.0" 342 | }, 343 | "optionalDependencies": { 344 | "fsevents": "~2.3.2" 345 | } 346 | }, 347 | "node_modules/rollup-plugin-commonjs": { 348 | "version": "10.1.0", 349 | "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz", 350 | "integrity": "sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==", 351 | "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-commonjs.", 352 | "dev": true, 353 | "dependencies": { 354 | "estree-walker": "^0.6.1", 355 | "is-reference": "^1.1.2", 356 | "magic-string": "^0.25.2", 357 | "resolve": "^1.11.0", 358 | "rollup-pluginutils": "^2.8.1" 359 | }, 360 | "peerDependencies": { 361 | "rollup": ">=1.12.0" 362 | } 363 | }, 364 | "node_modules/rollup-plugin-node-resolve": { 365 | "version": "5.2.0", 366 | "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz", 367 | "integrity": "sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw==", 368 | "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-node-resolve.", 369 | "dev": true, 370 | "dependencies": { 371 | "@types/resolve": "0.0.8", 372 | "builtin-modules": "^3.1.0", 373 | "is-module": "^1.0.0", 374 | "resolve": "^1.11.1", 375 | "rollup-pluginutils": "^2.8.1" 376 | }, 377 | "peerDependencies": { 378 | "rollup": ">=1.11.0" 379 | } 380 | }, 381 | "node_modules/rollup-plugin-terser": { 382 | "version": "7.0.2", 383 | "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz", 384 | "integrity": "sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==", 385 | "dev": true, 386 | "dependencies": { 387 | "@babel/code-frame": "^7.10.4", 388 | "jest-worker": "^26.2.1", 389 | "serialize-javascript": "^4.0.0", 390 | "terser": "^5.0.0" 391 | }, 392 | "peerDependencies": { 393 | "rollup": "^2.0.0" 394 | } 395 | }, 396 | "node_modules/rollup-plugin-typescript": { 397 | "version": "1.0.1", 398 | "resolved": "https://registry.npmjs.org/rollup-plugin-typescript/-/rollup-plugin-typescript-1.0.1.tgz", 399 | "integrity": "sha512-rwJDNn9jv/NsKZuyBb/h0jsclP4CJ58qbvZt2Q9zDIGILF2LtdtvCqMOL+Gq9IVq5MTrTlHZNrn8h7VjQgd8tw==", 400 | "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-typescript.", 401 | "dev": true, 402 | "dependencies": { 403 | "resolve": "^1.10.0", 404 | "rollup-pluginutils": "^2.5.0" 405 | }, 406 | "peerDependencies": { 407 | "tslib": "*", 408 | "typescript": ">=2.1.0" 409 | } 410 | }, 411 | "node_modules/rollup-pluginutils": { 412 | "version": "2.8.2", 413 | "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", 414 | "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", 415 | "dev": true, 416 | "dependencies": { 417 | "estree-walker": "^0.6.1" 418 | } 419 | }, 420 | "node_modules/rxjs": { 421 | "version": "7.5.2", 422 | "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.2.tgz", 423 | "integrity": "sha512-PwDt186XaL3QN5qXj/H9DGyHhP3/RYYgZZwqBv9Tv8rsAaiwFH1IsJJlcgD37J7UW5a6O67qX0KWKS3/pu0m4w==", 424 | "dependencies": { 425 | "tslib": "^2.1.0" 426 | } 427 | }, 428 | "node_modules/safe-buffer": { 429 | "version": "5.2.1", 430 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 431 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", 432 | "dev": true, 433 | "funding": [ 434 | { 435 | "type": "github", 436 | "url": "https://github.com/sponsors/feross" 437 | }, 438 | { 439 | "type": "patreon", 440 | "url": "https://www.patreon.com/feross" 441 | }, 442 | { 443 | "type": "consulting", 444 | "url": "https://feross.org/support" 445 | } 446 | ] 447 | }, 448 | "node_modules/serialize-javascript": { 449 | "version": "4.0.0", 450 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", 451 | "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", 452 | "dev": true, 453 | "dependencies": { 454 | "randombytes": "^2.1.0" 455 | } 456 | }, 457 | "node_modules/source-map": { 458 | "version": "0.7.3", 459 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", 460 | "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", 461 | "dev": true, 462 | "engines": { 463 | "node": ">= 8" 464 | } 465 | }, 466 | "node_modules/source-map-support": { 467 | "version": "0.5.19", 468 | "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", 469 | "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", 470 | "dev": true, 471 | "dependencies": { 472 | "buffer-from": "^1.0.0", 473 | "source-map": "^0.6.0" 474 | } 475 | }, 476 | "node_modules/source-map-support/node_modules/source-map": { 477 | "version": "0.6.1", 478 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", 479 | "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", 480 | "dev": true, 481 | "engines": { 482 | "node": ">=0.10.0" 483 | } 484 | }, 485 | "node_modules/sourcemap-codec": { 486 | "version": "1.4.8", 487 | "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", 488 | "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", 489 | "dev": true 490 | }, 491 | "node_modules/supports-color": { 492 | "version": "5.5.0", 493 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", 494 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", 495 | "dev": true, 496 | "dependencies": { 497 | "has-flag": "^3.0.0" 498 | }, 499 | "engines": { 500 | "node": ">=4" 501 | } 502 | }, 503 | "node_modules/terser": { 504 | "version": "5.3.8", 505 | "resolved": "https://registry.npmjs.org/terser/-/terser-5.3.8.tgz", 506 | "integrity": "sha512-zVotuHoIfnYjtlurOouTazciEfL7V38QMAOhGqpXDEg6yT13cF4+fEP9b0rrCEQTn+tT46uxgFsTZzhygk+CzQ==", 507 | "dev": true, 508 | "dependencies": { 509 | "commander": "^2.20.0", 510 | "source-map": "~0.7.2", 511 | "source-map-support": "~0.5.19" 512 | }, 513 | "bin": { 514 | "terser": "bin/terser" 515 | }, 516 | "engines": { 517 | "node": ">=10" 518 | } 519 | }, 520 | "node_modules/tslib": { 521 | "version": "2.3.1", 522 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", 523 | "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" 524 | }, 525 | "node_modules/typescript": { 526 | "version": "4.5.5", 527 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", 528 | "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", 529 | "dev": true, 530 | "bin": { 531 | "tsc": "bin/tsc", 532 | "tsserver": "bin/tsserver" 533 | }, 534 | "engines": { 535 | "node": ">=4.2.0" 536 | } 537 | } 538 | }, 539 | "dependencies": { 540 | "@babel/code-frame": { 541 | "version": "7.10.4", 542 | "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", 543 | "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", 544 | "dev": true, 545 | "requires": { 546 | "@babel/highlight": "^7.10.4" 547 | } 548 | }, 549 | "@babel/helper-validator-identifier": { 550 | "version": "7.10.4", 551 | "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", 552 | "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", 553 | "dev": true 554 | }, 555 | "@babel/highlight": { 556 | "version": "7.10.4", 557 | "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", 558 | "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", 559 | "dev": true, 560 | "requires": { 561 | "@babel/helper-validator-identifier": "^7.10.4", 562 | "chalk": "^2.0.0", 563 | "js-tokens": "^4.0.0" 564 | } 565 | }, 566 | "@hydecorp/component": { 567 | "version": "1.0.0", 568 | "resolved": "https://registry.npmjs.org/@hydecorp/component/-/component-1.0.0.tgz", 569 | "integrity": "sha512-rEe6FjRRnHkNeXy90VRMgM74NFze80NvA8zTdfS3dXTZeBjC3JpvYNKn1V+E7y007tAa6zNZuVnNczlNQXeLiw==", 570 | "requires": { 571 | "@types/resize-observer-browser": "^0.1.7", 572 | "lit-element": "^2.5.1", 573 | "rxjs": "^7.5.2", 574 | "tslib": "^2.3.1" 575 | } 576 | }, 577 | "@types/estree": { 578 | "version": "0.0.45", 579 | "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.45.tgz", 580 | "integrity": "sha512-jnqIUKDUqJbDIUxm0Uj7bnlMnRm1T/eZ9N+AVMqhPgzrba2GhGG5o/jCTwmdPK709nEZsGoMzXEDUjcXHa3W0g==", 581 | "dev": true 582 | }, 583 | "@types/node": { 584 | "version": "14.14.6", 585 | "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.6.tgz", 586 | "integrity": "sha512-6QlRuqsQ/Ox/aJEQWBEJG7A9+u7oSYl3mem/K8IzxXG/kAGbV1YPD9Bg9Zw3vyxC/YP+zONKwy8hGkSt1jxFMw==", 587 | "dev": true 588 | }, 589 | "@types/resize-observer-browser": { 590 | "version": "0.1.7", 591 | "resolved": "https://registry.npmjs.org/@types/resize-observer-browser/-/resize-observer-browser-0.1.7.tgz", 592 | "integrity": "sha512-G9eN0Sn0ii9PWQ3Vl72jDPgeJwRWhv2Qk/nQkJuWmRmOB4HX3/BhD5SE1dZs/hzPZL/WKnvF0RHdTSG54QJFyg==" 593 | }, 594 | "@types/resolve": { 595 | "version": "0.0.8", 596 | "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", 597 | "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", 598 | "dev": true, 599 | "requires": { 600 | "@types/node": "*" 601 | } 602 | }, 603 | "ansi-styles": { 604 | "version": "3.2.1", 605 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", 606 | "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", 607 | "dev": true, 608 | "requires": { 609 | "color-convert": "^1.9.0" 610 | } 611 | }, 612 | "buffer-from": { 613 | "version": "1.1.1", 614 | "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", 615 | "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", 616 | "dev": true 617 | }, 618 | "builtin-modules": { 619 | "version": "3.1.0", 620 | "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", 621 | "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", 622 | "dev": true 623 | }, 624 | "chalk": { 625 | "version": "2.4.2", 626 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", 627 | "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", 628 | "dev": true, 629 | "requires": { 630 | "ansi-styles": "^3.2.1", 631 | "escape-string-regexp": "^1.0.5", 632 | "supports-color": "^5.3.0" 633 | } 634 | }, 635 | "color-convert": { 636 | "version": "1.9.3", 637 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", 638 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", 639 | "dev": true, 640 | "requires": { 641 | "color-name": "1.1.3" 642 | } 643 | }, 644 | "color-name": { 645 | "version": "1.1.3", 646 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 647 | "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", 648 | "dev": true 649 | }, 650 | "commander": { 651 | "version": "2.20.3", 652 | "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", 653 | "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", 654 | "dev": true 655 | }, 656 | "escape-string-regexp": { 657 | "version": "1.0.5", 658 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 659 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", 660 | "dev": true 661 | }, 662 | "estree-walker": { 663 | "version": "0.6.1", 664 | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", 665 | "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", 666 | "dev": true 667 | }, 668 | "fsevents": { 669 | "version": "2.3.2", 670 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", 671 | "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", 672 | "dev": true, 673 | "optional": true 674 | }, 675 | "function-bind": { 676 | "version": "1.1.1", 677 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 678 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", 679 | "dev": true 680 | }, 681 | "has": { 682 | "version": "1.0.3", 683 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 684 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 685 | "dev": true, 686 | "requires": { 687 | "function-bind": "^1.1.1" 688 | } 689 | }, 690 | "has-flag": { 691 | "version": "3.0.0", 692 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", 693 | "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", 694 | "dev": true 695 | }, 696 | "is-core-module": { 697 | "version": "2.0.0", 698 | "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.0.0.tgz", 699 | "integrity": "sha512-jq1AH6C8MuteOoBPwkxHafmByhL9j5q4OaPGdbuD+ZtQJVzH+i6E3BJDQcBA09k57i2Hh2yQbEG8yObZ0jdlWw==", 700 | "dev": true, 701 | "requires": { 702 | "has": "^1.0.3" 703 | } 704 | }, 705 | "is-module": { 706 | "version": "1.0.0", 707 | "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", 708 | "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", 709 | "dev": true 710 | }, 711 | "is-reference": { 712 | "version": "1.2.1", 713 | "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", 714 | "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", 715 | "dev": true, 716 | "requires": { 717 | "@types/estree": "*" 718 | } 719 | }, 720 | "jest-worker": { 721 | "version": "26.6.1", 722 | "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.1.tgz", 723 | "integrity": "sha512-R5IE3qSGz+QynJx8y+ICEkdI2OJ3RJjRQVEyCcFAd3yVhQSEtquziPO29Mlzgn07LOVE8u8jhJ1FqcwegiXWOw==", 724 | "dev": true, 725 | "requires": { 726 | "@types/node": "*", 727 | "merge-stream": "^2.0.0", 728 | "supports-color": "^7.0.0" 729 | }, 730 | "dependencies": { 731 | "has-flag": { 732 | "version": "4.0.0", 733 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 734 | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 735 | "dev": true 736 | }, 737 | "supports-color": { 738 | "version": "7.2.0", 739 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", 740 | "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", 741 | "dev": true, 742 | "requires": { 743 | "has-flag": "^4.0.0" 744 | } 745 | } 746 | } 747 | }, 748 | "js-tokens": { 749 | "version": "4.0.0", 750 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", 751 | "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", 752 | "dev": true 753 | }, 754 | "lit-element": { 755 | "version": "2.5.1", 756 | "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.5.1.tgz", 757 | "integrity": "sha512-ogu7PiJTA33bEK0xGu1dmaX5vhcRjBXCFexPja0e7P7jqLhTpNKYRPmE+GmiCaRVAbiQKGkUgkh/i6+bh++dPQ==", 758 | "requires": { 759 | "lit-html": "^1.1.1" 760 | } 761 | }, 762 | "lit-html": { 763 | "version": "1.3.0", 764 | "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-1.3.0.tgz", 765 | "integrity": "sha512-0Q1bwmaFH9O14vycPHw8C/IeHMk/uSDldVLIefu/kfbTBGIc44KGH6A8p1bDfxUfHdc8q6Ct7kQklWoHgr4t1Q==" 766 | }, 767 | "magic-string": { 768 | "version": "0.25.7", 769 | "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", 770 | "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", 771 | "dev": true, 772 | "requires": { 773 | "sourcemap-codec": "^1.4.4" 774 | } 775 | }, 776 | "merge-stream": { 777 | "version": "2.0.0", 778 | "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", 779 | "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", 780 | "dev": true 781 | }, 782 | "path-parse": { 783 | "version": "1.0.7", 784 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", 785 | "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", 786 | "dev": true 787 | }, 788 | "randombytes": { 789 | "version": "2.1.0", 790 | "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", 791 | "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", 792 | "dev": true, 793 | "requires": { 794 | "safe-buffer": "^5.1.0" 795 | } 796 | }, 797 | "resolve": { 798 | "version": "1.18.1", 799 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz", 800 | "integrity": "sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==", 801 | "dev": true, 802 | "requires": { 803 | "is-core-module": "^2.0.0", 804 | "path-parse": "^1.0.6" 805 | } 806 | }, 807 | "rollup": { 808 | "version": "2.67.0", 809 | "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.67.0.tgz", 810 | "integrity": "sha512-W83AaERwvDiHwHEF/dfAfS3z1Be5wf7n+pO3ZAO5IQadCT2lBTr7WQ2MwZZe+nodbD+n3HtC4OCOAdsOPPcKZQ==", 811 | "dev": true, 812 | "requires": { 813 | "fsevents": "~2.3.2" 814 | } 815 | }, 816 | "rollup-plugin-commonjs": { 817 | "version": "10.1.0", 818 | "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz", 819 | "integrity": "sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==", 820 | "dev": true, 821 | "requires": { 822 | "estree-walker": "^0.6.1", 823 | "is-reference": "^1.1.2", 824 | "magic-string": "^0.25.2", 825 | "resolve": "^1.11.0", 826 | "rollup-pluginutils": "^2.8.1" 827 | } 828 | }, 829 | "rollup-plugin-node-resolve": { 830 | "version": "5.2.0", 831 | "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz", 832 | "integrity": "sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw==", 833 | "dev": true, 834 | "requires": { 835 | "@types/resolve": "0.0.8", 836 | "builtin-modules": "^3.1.0", 837 | "is-module": "^1.0.0", 838 | "resolve": "^1.11.1", 839 | "rollup-pluginutils": "^2.8.1" 840 | } 841 | }, 842 | "rollup-plugin-terser": { 843 | "version": "7.0.2", 844 | "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz", 845 | "integrity": "sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==", 846 | "dev": true, 847 | "requires": { 848 | "@babel/code-frame": "^7.10.4", 849 | "jest-worker": "^26.2.1", 850 | "serialize-javascript": "^4.0.0", 851 | "terser": "^5.0.0" 852 | } 853 | }, 854 | "rollup-plugin-typescript": { 855 | "version": "1.0.1", 856 | "resolved": "https://registry.npmjs.org/rollup-plugin-typescript/-/rollup-plugin-typescript-1.0.1.tgz", 857 | "integrity": "sha512-rwJDNn9jv/NsKZuyBb/h0jsclP4CJ58qbvZt2Q9zDIGILF2LtdtvCqMOL+Gq9IVq5MTrTlHZNrn8h7VjQgd8tw==", 858 | "dev": true, 859 | "requires": { 860 | "resolve": "^1.10.0", 861 | "rollup-pluginutils": "^2.5.0" 862 | } 863 | }, 864 | "rollup-pluginutils": { 865 | "version": "2.8.2", 866 | "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", 867 | "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", 868 | "dev": true, 869 | "requires": { 870 | "estree-walker": "^0.6.1" 871 | } 872 | }, 873 | "rxjs": { 874 | "version": "7.5.2", 875 | "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.2.tgz", 876 | "integrity": "sha512-PwDt186XaL3QN5qXj/H9DGyHhP3/RYYgZZwqBv9Tv8rsAaiwFH1IsJJlcgD37J7UW5a6O67qX0KWKS3/pu0m4w==", 877 | "requires": { 878 | "tslib": "^2.1.0" 879 | } 880 | }, 881 | "safe-buffer": { 882 | "version": "5.2.1", 883 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 884 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", 885 | "dev": true 886 | }, 887 | "serialize-javascript": { 888 | "version": "4.0.0", 889 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", 890 | "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", 891 | "dev": true, 892 | "requires": { 893 | "randombytes": "^2.1.0" 894 | } 895 | }, 896 | "source-map": { 897 | "version": "0.7.3", 898 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", 899 | "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", 900 | "dev": true 901 | }, 902 | "source-map-support": { 903 | "version": "0.5.19", 904 | "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", 905 | "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", 906 | "dev": true, 907 | "requires": { 908 | "buffer-from": "^1.0.0", 909 | "source-map": "^0.6.0" 910 | }, 911 | "dependencies": { 912 | "source-map": { 913 | "version": "0.6.1", 914 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", 915 | "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", 916 | "dev": true 917 | } 918 | } 919 | }, 920 | "sourcemap-codec": { 921 | "version": "1.4.8", 922 | "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", 923 | "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", 924 | "dev": true 925 | }, 926 | "supports-color": { 927 | "version": "5.5.0", 928 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", 929 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", 930 | "dev": true, 931 | "requires": { 932 | "has-flag": "^3.0.0" 933 | } 934 | }, 935 | "terser": { 936 | "version": "5.3.8", 937 | "resolved": "https://registry.npmjs.org/terser/-/terser-5.3.8.tgz", 938 | "integrity": "sha512-zVotuHoIfnYjtlurOouTazciEfL7V38QMAOhGqpXDEg6yT13cF4+fEP9b0rrCEQTn+tT46uxgFsTZzhygk+CzQ==", 939 | "dev": true, 940 | "requires": { 941 | "commander": "^2.20.0", 942 | "source-map": "~0.7.2", 943 | "source-map-support": "~0.5.19" 944 | } 945 | }, 946 | "tslib": { 947 | "version": "2.3.1", 948 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", 949 | "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" 950 | }, 951 | "typescript": { 952 | "version": "4.5.5", 953 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", 954 | "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", 955 | "dev": true 956 | } 957 | } 958 | } 959 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@hydecorp/push-state", 3 | "version": "1.0.0", 4 | "description": "Turn static web sites into dynamic web apps", 5 | "type": "module", 6 | "main": "lib/index.js", 7 | "module": "lib/index.js", 8 | "files": [ 9 | "src", 10 | "lib", 11 | "module", 12 | "tsconfig.json" 13 | ], 14 | "publishConfig": { 15 | "access": "public" 16 | }, 17 | "scripts": { 18 | "clean": "rm -rf lib module", 19 | "test": "exit 0", 20 | "build:tsc": "tsc -d", 21 | "watch:tsc": "tsc -d -w", 22 | "build:rollup": "rollup -c", 23 | "watch:rollup": "rollup -c -w", 24 | "build": "npm run build:tsc & npm run build:rollup & wait", 25 | "watch": "npm run watch:tsc & npm run watch:rollup", 26 | "serve": "serve -l 3337", 27 | "dev": "npm run watch & npm run serve", 28 | "preversion": "sed -i '' -E 's:^(lib|docs/assets/hy-\\*)$:#\\1:' .gitignore", 29 | "version": "npm run build && git add .", 30 | "postversion": "sed -i '' -E 's:^#(lib|docs/assets/hy-\\*)$:\\1:' .gitignore && git rm --cached -r lib docs/assets/hy-* && git add . && git commit -m 'Restore preversion .gitignore'", 31 | "prepack": "npm run clean && npm run build" 32 | }, 33 | "author": "Florian Klampfer (https://qwtel.com/)", 34 | "license": "GPL-3.0", 35 | "devDependencies": { 36 | "rollup": "^2.67.0", 37 | "rollup-plugin-commonjs": "^10.1.0", 38 | "rollup-plugin-node-resolve": "^5.2.0", 39 | "rollup-plugin-terser": "^7.0.2", 40 | "rollup-plugin-typescript": "^1.0.1", 41 | "typescript": "^4.5.5" 42 | }, 43 | "dependencies": { 44 | "@hydecorp/component": "^1.0.0", 45 | "@types/resize-observer-browser": "^0.1.7", 46 | "lit-element": "^2.5.1", 47 | "rxjs": "^7.5.2", 48 | "tslib": "^2.3.1" 49 | }, 50 | "repository": { 51 | "type": "git", 52 | "url": "git+https://github.com/hydecorp/push-state.git" 53 | }, 54 | "bugs": { 55 | "url": "https://github.com/hydecorp/push-state/issues" 56 | }, 57 | "homepage": "https://hydecorp.github.io/push-state/", 58 | "keywords": [ 59 | "page-transitions", 60 | "ajax", 61 | "pjax", 62 | "smoothstate", 63 | "hydejack", 64 | "vanilla", 65 | "jquery", 66 | "animations", 67 | "rxjs", 68 | "vanilla-js", 69 | "custom-element", 70 | "jquery-plugin", 71 | "history-api", 72 | "web-components", 73 | "webcomponent", 74 | "history-management", 75 | "prefetch", 76 | "page-loader", 77 | "prefetcher", 78 | "reactive" 79 | ] 80 | } 81 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import resolve from 'rollup-plugin-node-resolve'; 2 | import commonjs from 'rollup-plugin-commonjs'; 3 | import typescript from 'rollup-plugin-typescript'; 4 | import { terser } from 'rollup-plugin-terser'; 5 | 6 | export default [{ 7 | input: 'src/index.ts', 8 | output: [{ 9 | file: `docs/assets/hy-push-state.js`, 10 | format: 'es', 11 | sourcemap: true 12 | }, { 13 | file: `module/index.js`, 14 | format: 'es', 15 | sourcemap: true 16 | }], 17 | plugins: [ 18 | typescript(), 19 | resolve(), 20 | commonjs(), 21 | terser(), 22 | ], 23 | }]; -------------------------------------------------------------------------------- /src/common.ts: -------------------------------------------------------------------------------- 1 | export { 2 | applyMixins, 3 | subscribeWhen, 4 | unsubscribeWhen, 5 | filterWhen, 6 | bufferDebounceTime, 7 | fetchRx, 8 | fragmentFromString, 9 | createMutationObservable, 10 | getScrollHeight, 11 | getScrollLeft, 12 | getScrollTop, 13 | matches, 14 | matchesAncestors 15 | } from '@hydecorp/component'; 16 | 17 | export enum Cause { 18 | Init = "init", 19 | Hint = "hint", 20 | Push = "push", 21 | Pop = "pop", 22 | }; 23 | 24 | export interface Context { 25 | cause: Cause, 26 | url: URL, 27 | oldURL?: URL, 28 | cacheNr?: number, 29 | replace?: boolean, 30 | error?: any, 31 | anchor?: HTMLAnchorElement, 32 | } 33 | 34 | export interface ClickContext extends Context { 35 | event: MouseEvent, 36 | } 37 | 38 | export function isExternal( 39 | url?: { protocol: string, host: string } | null, 40 | location: { protocol: string, host: string } = window.location, 41 | ) { 42 | return url != null && (url.protocol !== location.protocol || url.host !== location.host); 43 | } 44 | 45 | export function isHash( 46 | { hash, origin, pathname }: { hash: string, origin: string, pathname: string }, 47 | location: { hash: string, origin: string, pathname: string } = window.location, 48 | ) { 49 | return hash !== "" && origin === location.origin && pathname === location.pathname; 50 | } 51 | 52 | export function shouldLoadAnchor(anchor?: HTMLAnchorElement | null) { 53 | return anchor && anchor.target === ""; 54 | } 55 | 56 | export function isPushEvent({ url, anchor, event: { metaKey, ctrlKey } }: ClickContext, location: Location) { 57 | return !!( 58 | !metaKey && 59 | !ctrlKey && 60 | shouldLoadAnchor(anchor) && 61 | !isExternal(url, location) 62 | ); 63 | } 64 | 65 | export function isHintEvent({ url, anchor }: Context, location: Location) { 66 | return !!( 67 | shouldLoadAnchor(anchor) && 68 | !isExternal(url, location) && 69 | !isHash(url, location) 70 | ); 71 | } 72 | 73 | export function isHashChange({ 74 | cause, 75 | url: { pathname, hash }, 76 | oldURL, 77 | }: Context) { 78 | return pathname === oldURL?.pathname && (cause === Cause.Pop || (cause === Cause.Push && hash !== '')); 79 | } 80 | -------------------------------------------------------------------------------- /src/event-listeners.ts: -------------------------------------------------------------------------------- 1 | import { Subject, Observable, from, fromEvent, of, merge, NEVER } from "rxjs"; 2 | 3 | import { matchesAncestors, createMutationObservable, subscribeWhen, bufferDebounceTime } from "./common"; 4 | import { map, filter, startWith, tap, mergeMap, mergeAll, switchMap } from "rxjs/operators"; 5 | 6 | const flat = (x: Array>): Array => Array.prototype.concat.apply([], x); 7 | 8 | type MiniRecord = { addedNodes: Iterable, removedNodes: Iterable }; 9 | 10 | const combineRecords = (records: MiniRecord[]) => ({ 11 | addedNodes: new Set(flat(records.map(r => Array.from(r.addedNodes)))), 12 | removedNodes: new Set(flat(records.map(r => Array.from(r.removedNodes)))), 13 | }); 14 | 15 | export class EventListenersMixin { 16 | el!: HTMLElement; 17 | 18 | linkSelector!: string; 19 | 20 | $!: { 21 | linkSelector: Subject; 22 | prefetch: Subject; 23 | } 24 | 25 | // LINKS 2 26 | setupEventListeners() { 27 | const pushEvent$ = fromEvent(this.el, "click").pipe( 28 | map(event => { 29 | const anchor = matchesAncestors(event.target, this.linkSelector); 30 | if (anchor instanceof HTMLAnchorElement) { 31 | return [event, anchor] as [MouseEvent, HTMLAnchorElement]; 32 | } 33 | }), 34 | filter(x => !!x), 35 | ); 36 | 37 | const matchOrQuery = (el: Element, selector: string): Observable => { 38 | if (el.matches(selector) && el instanceof HTMLAnchorElement) { 39 | return of(el); 40 | } else { 41 | return from(el.querySelectorAll(selector)).pipe( 42 | filter((el): el is HTMLAnchorElement => el instanceof HTMLAnchorElement), 43 | ); 44 | } 45 | } 46 | 47 | const addEventListeners = (link: HTMLAnchorElement) => { 48 | return merge( 49 | fromEvent(link, "mouseenter", { passive: true }), 50 | fromEvent(link, "touchstart", { passive: true }), 51 | fromEvent(link, "focus", { passive: true }), 52 | ).pipe(map(event => [event, link] as [Event, HTMLAnchorElement])) 53 | }; 54 | 55 | const hintEvent$ = this.$.linkSelector.pipe(switchMap((linkSelector) => { 56 | const links = new Map>(); 57 | 58 | const addLink = (link: HTMLAnchorElement) => { 59 | if (!links.has(link)) { 60 | links.set(link, addEventListeners(link)); 61 | } 62 | } 63 | const removeLink = (link: HTMLAnchorElement) => { 64 | links.delete(link); 65 | } 66 | 67 | 68 | return createMutationObservable(this.el, { childList: true, subtree: true }).pipe( 69 | startWith({ addedNodes: [this.el], removedNodes: [] }), 70 | bufferDebounceTime(500), 71 | map(combineRecords), 72 | switchMap(({ addedNodes, removedNodes }) => { 73 | from(removedNodes).pipe( 74 | filter((el): el is Element => el instanceof Element), 75 | mergeMap(el => matchOrQuery(el, linkSelector)), 76 | tap(removeLink) 77 | ).subscribe() 78 | 79 | from(addedNodes).pipe( 80 | filter((el): el is Element => el instanceof Element), 81 | mergeMap(el => matchOrQuery(el, linkSelector)), 82 | tap(addLink) 83 | ).subscribe() 84 | 85 | return from(links.values()).pipe(mergeAll()); 86 | }), 87 | subscribeWhen(this.$.prefetch), 88 | ); 89 | })); 90 | 91 | return { hintEvent$, pushEvent$ } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/event.ts: -------------------------------------------------------------------------------- 1 | import { Context } from './common'; 2 | import { ResponseContextErr } from './fetch'; 3 | import { HyPushState } from "./index"; 4 | 5 | const timeout = (t: number) => new Promise(r => setTimeout(r, t)); 6 | 7 | export class EventManager { 8 | private parent: HyPushState; 9 | 10 | constructor(parent: HyPushState) { 11 | this.parent = parent; 12 | } 13 | 14 | onStart(context: Context) { 15 | this.parent.animPromise = timeout(this.parent.duration); 16 | 17 | const transitionUntil = (promise: Promise<{}>) => { 18 | this.parent.animPromise = Promise.all([this.parent.animPromise, promise]); 19 | }; 20 | 21 | this.parent.fireEvent('start', { detail: { ...context, transitionUntil } }); 22 | } 23 | 24 | emitDOMError(error: any) { 25 | if (process.env.DEBUG) console.error(error); 26 | 27 | // To open the link directly, we first pop one entry off the browser history. 28 | // We have to do this because some browsers (Safari) won't handle the back button correctly otherwise. 29 | // We then wait for a short time and change the document's location. 30 | // TODO: If we didn't call `pushState` optimistically we wouldn't have to do this. 31 | // TODO: Use browser sniffing instead? 32 | const url = location.href; 33 | window.history.back(); 34 | setTimeout(() => document.location.assign(url), 100); 35 | } 36 | 37 | emitNetworkError(context: ResponseContextErr) { 38 | if (process.env.DEBUG) console.error(context); 39 | this.parent.fireEvent('networkerror', { detail: context }); 40 | } 41 | 42 | emitError(context: Context) { 43 | if (process.env.DEBUG) console.error(context); 44 | this.parent.fireEvent('error', { detail: context }); 45 | } 46 | 47 | emitReady(context: Context) { 48 | this.parent.fireEvent('ready', { detail: context }); 49 | } 50 | 51 | emitAfter(context: Context) { 52 | this.parent.fadePromise = timeout(this.parent.duration); 53 | 54 | const transitionUntil = (promise: Promise<{}>) => { 55 | this.parent.fadePromise = Promise.all([this.parent.fadePromise, promise]); 56 | }; 57 | 58 | this.parent.fireEvent('after', { detail: { ...context, transitionUntil } }); 59 | } 60 | 61 | emitProgress(context: Context) { 62 | this.parent.fireEvent('progress', { detail: context }); 63 | } 64 | 65 | emitLoad(context: Context) { 66 | this.parent.fireEvent('load', { detail: context }); 67 | } 68 | }; -------------------------------------------------------------------------------- /src/fetch.ts: -------------------------------------------------------------------------------- 1 | import { of, zip, Observable } from "rxjs"; 2 | import { catchError, map, take, switchMap } from "rxjs/operators"; 3 | 4 | import { fetchRx, Context } from "./common"; 5 | import { HyPushState } from './index'; 6 | 7 | export interface ResponseContext extends Context { 8 | responseText: string | null; 9 | error?: any; 10 | }; 11 | 12 | export interface ResponseContextOk extends ResponseContext { 13 | responseText: string; 14 | }; 15 | 16 | export interface ResponseContextErr extends ResponseContext { 17 | responseText: null; 18 | error: any; 19 | }; 20 | 21 | export class FetchManager { 22 | private parent: HyPushState; 23 | 24 | constructor(parent: HyPushState) { 25 | this.parent = parent; 26 | } 27 | 28 | fetchPage(context: Context): Observable { 29 | return fetchRx(context.url.href, { 30 | method: "GET", 31 | mode: 'cors', ///isExternal(this.parent) ? 'cors' : undefined, 32 | headers: { Accept: "text/html" }, 33 | }) 34 | .pipe( 35 | switchMap(response => response.text()), 36 | map(responseText => ({ ...context, responseText })), 37 | catchError(error => of({ ...context, error, responseText: null })), 38 | ); 39 | } 40 | 41 | private selectPrefetch({ href }: URL, latestPrefetch: ResponseContext, prefetch$: Observable) { 42 | return href === latestPrefetch.url.href // && latestPrefetch.error == null 43 | ? of(latestPrefetch) 44 | : prefetch$.pipe(take(1)); 45 | } 46 | 47 | // Returns an observable that emits exactly one notice, which contains the response. 48 | // It will not emit until an (optional) page transition animation completes. 49 | getResponse(prefetch$: Observable, context: Context, latestPrefetch: ResponseContext) { 50 | return zip( 51 | this.selectPrefetch(context.url, latestPrefetch, prefetch$), 52 | this.parent.animPromise, 53 | ).pipe( 54 | map(([prefetch]) => ({ ...prefetch, ...context }) as ResponseContext), 55 | ); 56 | } 57 | }; 58 | -------------------------------------------------------------------------------- /src/history.ts: -------------------------------------------------------------------------------- 1 | import { isExternal, getScrollTop, getScrollHeight, Cause, Context } from "./common"; 2 | 3 | import { ReplaceContext } from "./update"; 4 | 5 | // @ts-ignore 6 | window.HashChangeEvent = window.HashChangeEvent || function HashChangeEvent(type, { oldURL = '', newURL = '' } = {}) { 7 | const e = new CustomEvent(type) 8 | // @ts-ignore 9 | e.oldURL = oldURL; 10 | // @ts-ignore 11 | e.newURL = newURL; 12 | return e; 13 | } 14 | 15 | function simHashChange(newURL: URL, oldURL: URL) { 16 | if (newURL.hash !== oldURL.hash) { 17 | window.dispatchEvent(new HashChangeEvent('hashchange', { newURL: newURL.href, oldURL: oldURL.href })); 18 | } 19 | } 20 | 21 | export class HistoryManager { 22 | private parent: Location & { histId: string, simulateHashChange: boolean }; 23 | 24 | constructor(parent: Location & { histId: string, simulateHashChange: boolean }) { 25 | this.parent = parent; 26 | } 27 | 28 | updateHistoryState({ cause, replace, url, oldURL }: Context) { 29 | if (isExternal(this.parent)) return; 30 | 31 | switch (cause) { 32 | case Cause.Init: 33 | case Cause.Push: { 34 | const { histId } = this.parent; 35 | 36 | if (replace || url.href === location.href) { 37 | const state = { ...history.state, [histId]: {} }; 38 | history.replaceState(state, document.title, url.href); 39 | } else { 40 | history.pushState({ [histId]: {} }, document.title, url.href); 41 | } 42 | // no break 43 | } 44 | case Cause.Pop: { 45 | if (this.parent.simulateHashChange && oldURL) simHashChange(url, oldURL); 46 | break; 47 | } 48 | default: { 49 | // if (process.env.DEBUG) console.warn(`Type '${cause}' not reconginzed`); 50 | break; 51 | } 52 | } 53 | } 54 | 55 | updateTitle({ cause, title }: ReplaceContext) { 56 | document.title = title; 57 | if (!isExternal(this.parent) && cause === Cause.Push) { 58 | history.replaceState(history.state, title); 59 | } 60 | } 61 | 62 | updateHistoryScrollPosition = () => { 63 | if (isExternal(this.parent)) return; 64 | 65 | const state = this.assignScrollPosition(history.state || {}); 66 | history.replaceState(state, document.title); 67 | } 68 | 69 | private assignScrollPosition(state: any) { 70 | const { histId } = this.parent; 71 | return { 72 | ...state, 73 | [histId]: { 74 | ...state[histId], 75 | scrollTop: getScrollTop(), 76 | scrollHeight: getScrollHeight(), 77 | }, 78 | }; 79 | } 80 | }; 81 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Florian Klampfer 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | * 17 | * @license 18 | * @nocompile 19 | */ 20 | import { property, customElement } from 'lit-element'; 21 | 22 | import { Observable, Subject, BehaviorSubject, merge, defer, fromEvent, animationFrameScheduler } from "rxjs"; 23 | import { map, filter, tap, takeUntil, startWith, pairwise, share, mapTo, switchMap, distinctUntilChanged, withLatestFrom, catchError, observeOn } from 'rxjs/operators'; 24 | 25 | import { RxLitElement, createResolvablePromise, matchesAncestors } from '@hydecorp/component'; 26 | 27 | import { applyMixins, Context, Cause, ClickContext, isPushEvent, isHashChange, isHintEvent, filterWhen, isExternal } from './common'; 28 | 29 | import { FetchManager, ResponseContext, ResponseContextErr, ResponseContextOk } from './fetch'; 30 | import { UpdateManager } from './update'; 31 | import { EventListenersMixin } from './event-listeners'; 32 | import { EventManager } from './event'; 33 | import { HistoryManager } from './history'; 34 | import { ScrollManager } from './scroll'; 35 | 36 | function compareContext(p: Context, q: Context) { 37 | return p.url.href === q.url.href && p.error === q.error && p.cacheNr === q.cacheNr; 38 | } 39 | 40 | @customElement('hy-push-state') 41 | export class HyPushState 42 | extends applyMixins(RxLitElement, [EventListenersMixin]) 43 | implements Location, EventListenersMixin { 44 | 45 | el: HTMLElement = this 46 | 47 | createRenderRoot() { return this } 48 | 49 | @property({ type: String, reflect: true, attribute: 'replace-selector' }) replaceSelector?: string; 50 | @property({ type: String, reflect: true, attribute: 'link-selector' }) linkSelector: string = "a[href]:not([data-no-push])"; 51 | @property({ type: String, reflect: true, attribute: 'script-selector' }) scriptSelector?: string; 52 | @property({ type: Boolean, reflect: true }) prefetch: boolean = false; 53 | @property({ type: Number, reflect: true }) duration: number = 0; 54 | // @property({ type: Boolean, reflect: true, attribute: 'simulate-load' }) simulateLoad: boolean = false; 55 | @property({ type: Boolean, reflect: true, attribute: 'hashchange' }) simulateHashChange: boolean = false; 56 | 57 | @property({ type: String }) baseURL: string = window.location.href; 58 | 59 | #initialized = createResolvablePromise(); 60 | get initialized() { 61 | return this.#initialized; 62 | } 63 | 64 | $!: { 65 | linkSelector: Subject; 66 | prefetch: Subject; 67 | }; 68 | 69 | animPromise: Promise = Promise.resolve(null); 70 | fadePromise: Promise = Promise.resolve(null); 71 | 72 | #scrollManager = new ScrollManager(this); 73 | #historyManager = new HistoryManager(this); 74 | #fetchManager = new FetchManager(this); 75 | #updateManager = new UpdateManager(this); 76 | #eventManager = new EventManager(this); 77 | 78 | #url = new URL(this.baseURL) 79 | 80 | #setLocation = (key: 'hash' | 'host' | 'hostname' | 'href' | 'pathname' | 'port' | 'protocol' | 'search', value: string) => { 81 | const u = new URL(this.#url.href); 82 | u[key] = value; 83 | this.assign(u.href); 84 | } 85 | 86 | // Implement Location 87 | get hash() { return this.#url.hash } 88 | get host() { return this.#url.host } 89 | get hostname() { return this.#url.hostname } 90 | get href() { return this.#url.href } 91 | get pathname() { return this.#url.pathname } 92 | get port() { return this.#url.port } 93 | get protocol() { return this.#url.protocol } 94 | get search() { return this.#url.search } 95 | get origin() { return this.#url.origin } 96 | get ancestorOrigins() { return window.location.ancestorOrigins } 97 | 98 | set hash(value) { this.#setLocation('hash', value) } 99 | set host(value) { this.#setLocation('host', value) } 100 | set hostname(value) { this.#setLocation('hostname', value) } 101 | set href(value) { this.#setLocation('href', value) } 102 | set pathname(value) { this.#setLocation('pathname', value) } 103 | set port(value) { this.#setLocation('port', value) } 104 | set protocol(value) { this.#setLocation('protocol', value) } 105 | set search(value) { this.#setLocation('search', value) } 106 | 107 | // EventListenersMixin 108 | setupEventListeners!: () => { 109 | pushEvent$: Observable<[MouseEvent, HTMLAnchorElement]>; 110 | hintEvent$: Observable<[Event, HTMLAnchorElement]>; 111 | }; 112 | 113 | #cacheNr = 0; 114 | 115 | get histId() { return this.id || this.tagName } 116 | 117 | #reload$ = new Subject(); 118 | 119 | @property() 120 | assign(url: string) { 121 | this.#reload$.next({ 122 | cause: Cause.Push, 123 | url: new URL(url, this.href), 124 | cacheNr: ++this.#cacheNr, 125 | }); 126 | } 127 | 128 | @property() 129 | reload() { 130 | this.#reload$.next({ 131 | cause: Cause.Push, 132 | url: new URL(this.href), 133 | cacheNr: ++this.#cacheNr, 134 | replace: true, 135 | }); 136 | } 137 | 138 | @property() 139 | replace(url: string) { 140 | this.#reload$.next({ 141 | cause: Cause.Push, 142 | url: new URL(url, this.href), 143 | cacheNr: ++this.#cacheNr, 144 | replace: true, 145 | }); 146 | } 147 | 148 | connectedCallback() { 149 | super.connectedCallback() 150 | 151 | this.$ = { 152 | linkSelector: new BehaviorSubject(this.linkSelector), 153 | prefetch: new BehaviorSubject(this.prefetch), 154 | }; 155 | 156 | // Remember the current scroll position (for F5/reloads). 157 | window.addEventListener("beforeunload", this.#historyManager.updateHistoryScrollPosition); 158 | 159 | // Remember scroll position for backward/forward navigation cache. 160 | // Technically, this is only necessary for Safari, because other browsers will not use the BFN cache 161 | // when a beforeunload event is registered... 162 | document.documentElement.addEventListener('click', this.#updateHistoryScrollPosition) 163 | 164 | this.updateComplete.then(this.#upgrade) 165 | } 166 | 167 | #updateHistoryScrollPosition = (event: MouseEvent) => { 168 | const anchor = matchesAncestors(event.target as Element, 'a[href]') as HTMLAnchorElement | null; 169 | if (isExternal(anchor)) { 170 | this.#historyManager.updateHistoryScrollPosition(); 171 | } 172 | } 173 | 174 | #response$!: Observable 175 | 176 | #upgrade = () => { 177 | const { pushEvent$, hintEvent$ } = this.setupEventListeners(); 178 | 179 | const push$: Observable = pushEvent$.pipe( 180 | // takeUntil(this.subjects.disconnect), 181 | map(([event, anchor]) => ({ 182 | cause: Cause.Push, 183 | url: new URL(anchor.href, this.href), 184 | anchor, 185 | event, 186 | cacheNr: this.#cacheNr, 187 | })), 188 | filter(x => isPushEvent(x, this)), 189 | tap(({ event }) => { 190 | event.preventDefault(); 191 | this.#historyManager.updateHistoryScrollPosition(); 192 | }) 193 | ); 194 | 195 | const pop$: Observable = fromEvent(window, "popstate").pipe( 196 | // takeUntil(this.subjects.disconnect), 197 | filter(() => window.history.state && window.history.state[this.histId]), 198 | map(event => ({ 199 | cause: Cause.Pop, 200 | url: new URL(window.location.href), 201 | cacheNr: this.#cacheNr, 202 | event, 203 | })) 204 | ); 205 | 206 | const reload$ = this.#reload$; // .pipe(takeUntil(this.subjects.disconnect)); 207 | 208 | const merged$: Observable = merge(push$, pop$, reload$).pipe( 209 | startWith({ url: new URL(window.location.href) } as Context), 210 | pairwise(), 211 | map(([old, current]) => Object.assign(current, { oldURL: old.url })), 212 | share(), 213 | ); 214 | 215 | const page$ = merged$.pipe( 216 | filter(p => !isHashChange(p)), 217 | share(), 218 | ); 219 | 220 | const hash$ = merged$.pipe( 221 | filter(p => isHashChange(p)), 222 | filter(() => history.state && history.state[this.histId]), 223 | observeOn(animationFrameScheduler), 224 | tap(context => { 225 | this.#historyManager.updateHistoryState(context); 226 | this.#scrollManager.manageScrollPosition(context); 227 | }), 228 | ); 229 | 230 | const pauser$ = defer(() => merge( 231 | page$.pipe(mapTo(true)), 232 | this.#response$.pipe(mapTo(false)), 233 | )).pipe( 234 | startWith(false), 235 | ); 236 | 237 | const hint$: Observable = hintEvent$.pipe( 238 | // takeUntil(this.subjects.disconnect), 239 | filterWhen(pauser$.pipe(map(x => !x))), 240 | map(([event, anchor]) => ({ 241 | cause: Cause.Hint, 242 | url: new URL(anchor.href, this.href), 243 | anchor, 244 | event, 245 | cacheNr: this.#cacheNr, 246 | })), 247 | filter(x => isHintEvent(x, this)), 248 | ); 249 | 250 | const prefetchResponse$ = merge(hint$, page$).pipe( 251 | distinctUntilChanged((x, y) => compareContext(x, y)), 252 | switchMap(x => this.#fetchManager.fetchPage(x)), 253 | startWith({ url: {} } as ResponseContext), 254 | share(), 255 | ); 256 | 257 | const response$ = this.#response$ = page$.pipe( 258 | tap(context => { 259 | this.#eventManager.onStart(context) 260 | this.#historyManager.updateHistoryState(context); 261 | this.#url = context.url; 262 | }), 263 | withLatestFrom(prefetchResponse$), 264 | switchMap((args) => this.#fetchManager.getResponse(prefetchResponse$, ...args)), 265 | share(), 266 | ); 267 | 268 | const responseOk$ = response$.pipe(filter((ctx): ctx is ResponseContextOk => !ctx.error)); 269 | const responseErr$ = response$.pipe(filter((ctx): ctx is ResponseContextErr => !!ctx.error)); 270 | 271 | const main$ = responseOk$.pipe( 272 | map(context => this.#updateManager.responseToContent(context)), 273 | tap(context => this.#eventManager.emitReady(context)), 274 | observeOn(animationFrameScheduler), 275 | tap(context => { 276 | this.#updateManager.updateDOM(context); 277 | this.#historyManager.updateTitle(context) 278 | this.#eventManager.emitAfter(context); 279 | }), 280 | startWith({ 281 | cause: Cause.Init, 282 | url: this.#url, 283 | scripts: [], 284 | }), 285 | observeOn(animationFrameScheduler), 286 | tap(context => this.#scrollManager.manageScrollPosition(context)), 287 | tap({ error: (e) => this.#eventManager.emitDOMError(e) }), 288 | catchError((_, c) => c), 289 | switchMap((x) => this.fadePromise.then(() => x)), 290 | switchMap(x => this.#updateManager.reinsertScriptTags(x)), 291 | tap({ error: e => this.#eventManager.emitError(e) }), 292 | catchError((_, c) => c), 293 | tap(context => this.#eventManager.emitLoad(context)), 294 | ); 295 | 296 | const error$ = responseErr$.pipe( 297 | tap(e => this.#eventManager.emitNetworkError(e)), 298 | ); 299 | 300 | const progress$ = page$.pipe( 301 | switchMap(context => 302 | defer(() => this.animPromise).pipe( 303 | takeUntil(response$), 304 | mapTo(context), 305 | ), 306 | ), 307 | tap(context => this.#eventManager.emitProgress(context)), 308 | ); 309 | 310 | // Subscriptions 311 | main$.subscribe(); 312 | hash$.subscribe(); 313 | error$.subscribe(); 314 | progress$.subscribe(); 315 | 316 | this.#initialized.resolve(this); 317 | this.fireEvent('init'); 318 | } 319 | 320 | disconnectedCallback() { 321 | window.removeEventListener("beforeunload", this.#historyManager.updateHistoryScrollPosition); 322 | document.documentElement.removeEventListener('click', this.#updateHistoryScrollPosition); 323 | } 324 | } 325 | -------------------------------------------------------------------------------- /src/rewrite-urls.ts: -------------------------------------------------------------------------------- 1 | // When fetching documents from an external source, 2 | // relative URLs will be resolved relative to the current `window.location`. 3 | // We can rewrite URL to absolute urls 4 | export function rewriteURLs(replaceEls: (Element | null)[], base: string) { 5 | replaceEls.forEach((el) => { 6 | if (!el) return; 7 | el.querySelectorAll("[href]").forEach(rewriteURL("href", base)); 8 | el.querySelectorAll("[src]").forEach(rewriteURL("src", base)); 9 | el.querySelectorAll("img[srcset]").forEach(rewriteURLSrcSet("srcset", base)); 10 | el.querySelectorAll("blockquote[cite]").forEach(rewriteURL("cite", base)); 11 | el.querySelectorAll("del[cite]").forEach(rewriteURL("cite", base)); 12 | el.querySelectorAll("ins[cite]").forEach(rewriteURL("cite", base)); 13 | el.querySelectorAll("q[cite]").forEach(rewriteURL("cite", base)); 14 | el.querySelectorAll("img[longdesc]").forEach(rewriteURL("longdesc", base)); 15 | el.querySelectorAll("frame[longdesc]").forEach(rewriteURL("longdesc", base)); 16 | el.querySelectorAll("iframe[longdesc]").forEach(rewriteURL("longdesc", base)); 17 | el.querySelectorAll("img[usemap]").forEach(rewriteURL("usemap", base)); 18 | el.querySelectorAll("input[usemap]").forEach(rewriteURL("usemap", base)); 19 | el.querySelectorAll("object[usemap]").forEach(rewriteURL("usemap", base)); 20 | el.querySelectorAll("form[action]").forEach(rewriteURL("action", base)); 21 | el.querySelectorAll("button[formaction]").forEach(rewriteURL("formaction", base)); 22 | el.querySelectorAll("input[formaction]").forEach(rewriteURL("formaction", base)); 23 | el.querySelectorAll("video[poster]").forEach(rewriteURL("poster", base)); 24 | el.querySelectorAll("object[data]").forEach(rewriteURL("data", base)); 25 | el.querySelectorAll("object[codebase]").forEach(rewriteURL("codebase", base)); 26 | el.querySelectorAll("object[archive]").forEach(rewriteURLList("archive", base)); 27 | /* el.querySelectorAll("command[icon]").forEach(this.rewriteURL("icon")); */ // obsolte 28 | }); 29 | } 30 | 31 | function rewriteURL(attr: string, base: string) { 32 | return (el: Element) => { 33 | try { 34 | const attrVal = el.getAttribute(attr); 35 | if (attrVal == null) return; 36 | el.setAttribute(attr, new URL(attrVal, base).href); 37 | } catch (e) { 38 | // if (process.env.DEBUG) console.warn(`Couldn't rewrite URL in attribute ${attr} on element`, el); 39 | } 40 | }; 41 | } 42 | 43 | function rewriteURLSrcSet(attr: string, base: string) { 44 | return (el: Element) => { 45 | try { 46 | const attrVal = el.getAttribute(attr); 47 | if (attrVal == null) return; 48 | el.setAttribute( 49 | attr, 50 | attrVal 51 | .split(/\s*,\s*/) 52 | .map(str => { 53 | const pair = str.split(/\s+/); 54 | pair[0] = new URL(pair[0], base).href; 55 | return pair.join(" "); 56 | }) 57 | .join(", ") 58 | ); 59 | } catch (e) { 60 | // if (process.env.DEBUG) console.warn(`Couldn't rewrite URLs in attribute ${attr} on element`, el); 61 | } 62 | }; 63 | } 64 | 65 | function rewriteURLList(attr: string, base: string) { 66 | return (el: Element) => { 67 | try { 68 | const attrVal = el.getAttribute(attr); 69 | if (attrVal == null) return; 70 | el.setAttribute( 71 | attr, 72 | attrVal 73 | .split(/[\s,]+/) 74 | .map(str => new URL(str, base).href) 75 | .join(", ") 76 | ); 77 | } catch (e) { 78 | // if (process.env.DEBUG) console.warn(`Couldn't rewrite URLs in attribute ${attr} on element`, el); 79 | } 80 | }; 81 | } -------------------------------------------------------------------------------- /src/script.ts: -------------------------------------------------------------------------------- 1 | import { of, from } from "rxjs"; 2 | import { concatMap, catchError, finalize, mapTo } from "rxjs/operators"; 3 | 4 | import { HyPushState } from "."; 5 | 6 | function cloneScript(script: HTMLScriptElement) { 7 | const newScript = document.createElement('script'); 8 | Array.from(script.attributes).forEach(attr => newScript.setAttributeNode(attr.cloneNode() as Attr)); 9 | newScript.innerHTML = script.innerHTML; 10 | return newScript; 11 | } 12 | 13 | export class ScriptManager { 14 | private parent: HyPushState; 15 | 16 | constructor(parent: HyPushState) { 17 | this.parent = parent; 18 | } 19 | 20 | get scriptSelector() { return this.parent.scriptSelector } 21 | 22 | removeScriptTags(replaceEls: (Element|null)[]) { 23 | const scripts: Array<[HTMLScriptElement, HTMLScriptElement]> = []; 24 | 25 | replaceEls.forEach(el => { 26 | if (el && this.scriptSelector) { 27 | el.querySelectorAll(this.scriptSelector).forEach((script) => { 28 | if (script instanceof HTMLScriptElement) { 29 | const newScript = cloneScript(script); 30 | const pair: [HTMLScriptElement, HTMLScriptElement] = [newScript, script]; 31 | scripts.push(pair); 32 | } 33 | }); 34 | } 35 | }); 36 | 37 | return scripts; 38 | } 39 | 40 | reinsertScriptTags(context: { scripts: Array<[HTMLScriptElement, HTMLScriptElement]> }) { 41 | if (!this.scriptSelector) return Promise.resolve(context); 42 | 43 | const { scripts } = context; 44 | 45 | const originalWrite = document.write; 46 | 47 | return from(scripts).pipe( 48 | concatMap(script => this.insertScript(script)), 49 | catchError(error => of({ ...context, error })), 50 | finalize(() => (document.write = originalWrite)), 51 | mapTo(context), 52 | ) 53 | .toPromise(); 54 | } 55 | 56 | private insertScript([script, ref]: [HTMLScriptElement, HTMLScriptElement]): Promise<{}> { 57 | document.write = (...args) => { 58 | const temp = document.createElement("div"); 59 | temp.innerHTML = args.join(); 60 | Array.from(temp.childNodes).forEach(node => ref.parentNode?.insertBefore(node, ref)); 61 | }; 62 | 63 | return new Promise((resolve, reject) => { 64 | if (script.src !== "") { 65 | script.addEventListener("load", resolve); 66 | script.addEventListener("error", reject); 67 | ref.parentNode?.replaceChild(script, ref); 68 | } else { 69 | ref.parentNode?.replaceChild(script, ref); 70 | resolve({}); 71 | } 72 | }); 73 | } 74 | } -------------------------------------------------------------------------------- /src/scroll.ts: -------------------------------------------------------------------------------- 1 | import { getScrollTop, Cause } from "./common"; 2 | 3 | interface ScrollState { 4 | [k: string]: any; 5 | scrollTop?: number; 6 | scrollHeight?: number; 7 | } 8 | 9 | export class ScrollManager { 10 | private parent: { histId: string } & HTMLElement; 11 | 12 | constructor(parent: { histId: string } & HTMLElement) { 13 | this.parent = parent; 14 | if ('scrollRestoration' in history) { 15 | history.scrollRestoration = 'manual'; 16 | } 17 | } 18 | 19 | manageScrollPosition({ cause, url: { hash } }: { cause: Cause, url: URL }) { 20 | switch (cause) { 21 | case Cause.Push: { 22 | // FIXME: make configurable 23 | this.scrollHashIntoView(hash, { behavior: "smooth", block: "start", inline: "nearest" }); 24 | break; 25 | } 26 | case Cause.Pop: { 27 | this.restoreScrollPosition(); 28 | break; 29 | } 30 | case Cause.Init: { 31 | this.restoreScrollPositionOnReload(); 32 | break; 33 | } 34 | } 35 | } 36 | 37 | private elementFromHash(hash: string) { 38 | return document.getElementById(decodeURIComponent(hash.substr(1))) 39 | } 40 | 41 | private scrollHashIntoView(hash: string, options: boolean | ScrollIntoViewOptions) { 42 | if (hash) { 43 | const el = this.elementFromHash(hash); 44 | if (el) el.scrollIntoView(options); 45 | } else { 46 | window.scroll(window.pageXOffset, 0); 47 | } 48 | } 49 | 50 | private restoreScrollPosition() { 51 | const { histId } = this.parent; 52 | const { scrollTop } = (history.state && history.state[histId]) || {} as ScrollState; 53 | 54 | if (scrollTop != null) { 55 | window.scroll(window.pageXOffset, scrollTop); 56 | } 57 | } 58 | 59 | private restoreScrollPositionOnReload() { 60 | const { histId } = this.parent; 61 | const scrollState = history.state && history.state[histId]; 62 | // FIXME: As far as I can tell there is no better way of figuring out if the user has scrolled 63 | // and it doesn't work on hash links b/c the scroll position is going to be non-null by definition 64 | if (scrollState && getScrollTop() === 0) { 65 | this.restoreScrollPosition(); 66 | } else if (location.hash) { 67 | requestAnimationFrame(() => this.scrollHashIntoView(location.hash, true)); 68 | } 69 | } 70 | }; 71 | -------------------------------------------------------------------------------- /src/update.ts: -------------------------------------------------------------------------------- 1 | import { isExternal, fragmentFromString } from "./common"; 2 | 3 | import { ScriptManager } from "./script"; 4 | import { rewriteURLs } from "./rewrite-urls"; 5 | 6 | import { ResponseContext, ResponseContextOk } from './fetch'; 7 | import { HyPushState } from "."; 8 | 9 | const CANONICAL_SEL = 'link[rel=canonical]'; 10 | const META_DESC_SEL = 'meta[name=description]'; 11 | 12 | export interface ReplaceContext extends ResponseContext { 13 | title: string; 14 | document: Document, 15 | replaceEls: (Element | null)[]; 16 | scripts: Array<[HTMLScriptElement, HTMLScriptElement]>; 17 | }; 18 | 19 | export class UpdateManager { 20 | private parent!: HyPushState; 21 | private scriptManager!: ScriptManager; 22 | 23 | constructor(parent: HyPushState) { 24 | this.parent = parent; 25 | this.scriptManager = new ScriptManager(parent); 26 | } 27 | 28 | get el() { return this.parent; } 29 | get replaceSelector() { return this.parent.replaceSelector; } 30 | get scriptSelector() { return this.parent.scriptSelector; } 31 | 32 | // Extracts the elements to be replaced 33 | private getReplaceElements(doc: Document): (Element | null)[] { 34 | if (this.replaceSelector) { 35 | return this.replaceSelector.split(',').map(sel => doc.querySelector(sel)); 36 | } else if (this.el.id) { 37 | return [doc.getElementById(this.el.id)]; 38 | } else { 39 | const index = Array.from(document.getElementsByTagName(this.el.tagName)).indexOf(this.el); 40 | return [doc.getElementsByTagName(this.el.tagName)[index]]; 41 | } 42 | } 43 | 44 | // Takes the response string and turns it into document fragments 45 | // that can be inserted into the DOM. 46 | responseToContent(context: ResponseContextOk): ReplaceContext { 47 | const { responseText } = context; 48 | 49 | const doc = new DOMParser().parseFromString(responseText, 'text/html'); 50 | const { title = '' } = doc; 51 | const replaceEls = this.getReplaceElements(doc); 52 | 53 | if (replaceEls.every(el => el == null)) { 54 | throw new Error(`Couldn't find any element in the document at '${location}'.`); 55 | } 56 | 57 | const scripts = this.scriptSelector 58 | ? this.scriptManager.removeScriptTags(replaceEls) 59 | : []; 60 | 61 | return { ...context, document: doc, title, replaceEls, scripts }; 62 | } 63 | 64 | // Replaces the old elements with the new one, one-by-one. 65 | private replaceContentWithSelector(replaceSelector: string, elements: (Element | null)[]) { 66 | replaceSelector 67 | .split(',') 68 | .map(sel => document.querySelector(sel)) 69 | .forEach((oldElement, i) => { 70 | const el = elements[i]; 71 | if (el) oldElement?.parentNode?.replaceChild(el, oldElement); 72 | }); 73 | } 74 | 75 | // When no `replaceIds` are set, replace the entire content of the component (slow). 76 | private replaceContentWholesale([el]: (Element | null)[]) { 77 | if (el) this.el.innerHTML = el.innerHTML; 78 | } 79 | 80 | private replaceContent(replaceEls: (Element | null)[]) { 81 | if (this.replaceSelector) { 82 | this.replaceContentWithSelector(this.replaceSelector, replaceEls); 83 | } else { 84 | this.replaceContentWholesale(replaceEls); 85 | } 86 | } 87 | 88 | private replaceHead(doc: Document) { 89 | const { head } = this.el.ownerDocument; 90 | 91 | const canonicalEl = head.querySelector(CANONICAL_SEL) as HTMLLinkElement|null; 92 | const cEl = doc.head.querySelector(CANONICAL_SEL) as HTMLLinkElement|null; 93 | if (canonicalEl && cEl) canonicalEl.href = cEl.href; 94 | 95 | const metaDescEl = head.querySelector(META_DESC_SEL) as HTMLMetaElement|null; 96 | const mEl = doc.head.querySelector(META_DESC_SEL) as HTMLMetaElement|null; 97 | if (metaDescEl && mEl) metaDescEl.content = mEl.content; 98 | } 99 | 100 | updateDOM(context: ReplaceContext) { 101 | try { 102 | const { replaceEls, document } = context; 103 | if (isExternal(this.parent)) rewriteURLs(replaceEls, this.parent.href); 104 | this.replaceHead(document) 105 | this.replaceContent(replaceEls); 106 | } catch (error) { 107 | throw { ...context, error }; 108 | } 109 | } 110 | 111 | reinsertScriptTags(context: { scripts: Array<[HTMLScriptElement, HTMLScriptElement]> }) { 112 | return this.scriptManager.reinsertScriptTags(context); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "experimentalDecorators": true, 4 | "lib": ["DOM", "DOM.Iterable", "ES2020"], 5 | "moduleResolution": "Node", 6 | "module": "ES2020", 7 | "target": "ES2018", 8 | "outDir": "lib", 9 | "declaration": true, 10 | "declarationMap": true, 11 | "sourceMap": true, 12 | "inlineSources": true, 13 | "strict": true, 14 | "importHelpers": true, 15 | }, 16 | "include": [ 17 | "typings/**/*.ts", 18 | "src/**/*.ts", 19 | ], 20 | } -------------------------------------------------------------------------------- /typings/Decorators.d.ts: -------------------------------------------------------------------------------- 1 | type Constructor = { 2 | new (...args: unknown[]): T 3 | }; 4 | 5 | // From the TC39 Decorators proposal 6 | interface ClassDescriptor { 7 | kind: 'class'; 8 | elements: ClassElement[]; 9 | finisher?: (clazz: Constructor) => undefined | Constructor; 10 | } 11 | 12 | // From the TC39 Decorators proposal 13 | interface ClassElement { 14 | kind: 'field'|'method'; 15 | key: PropertyKey; 16 | placement: 'static'|'prototype'|'own'; 17 | initializer?: Function; 18 | extras?: ClassElement[]; 19 | finisher?: (clazz: Constructor) => undefined | Constructor; 20 | descriptor?: PropertyDescriptor; 21 | } --------------------------------------------------------------------------------