├── .bazelrc ├── .bazelversion ├── .github └── workflows │ └── ci.yaml ├── .gitignore ├── BUILD ├── CONTRIBUTING.md ├── LICENSE ├── MODULE.bazel ├── README.md ├── build_defs ├── BUILD └── internal_do_not_use │ ├── BUILD │ └── elemental_utils.bzl ├── build_test.sh ├── java └── elemental2 │ ├── core │ ├── BUILD │ ├── BuiltInClosureTypeCleaner.java │ ├── es3.js.diff │ ├── integer_entities.txt │ ├── name_mappings.txt │ └── wildcard_types.txt │ ├── dom │ ├── BUILD │ ├── EventListenerCleaner.java │ ├── integer_entities.txt │ ├── name_mappings.txt │ ├── w3c_css.js.diff │ ├── w3c_dom2.js.diff │ ├── w3c_rtc.js.diff │ └── window.js.diff │ ├── indexeddb │ ├── BUILD │ └── integer_entities.txt │ ├── media │ ├── BUILD │ └── integer_entities.txt │ ├── promise │ ├── BUILD │ ├── IThenable.java │ ├── Promise.gwt.xml │ ├── Promise.java │ └── promise.types │ ├── svg │ ├── BUILD │ └── integer_entities.txt │ ├── webassembly │ ├── BUILD │ ├── integer_entities.txt │ └── name_mappings.txt │ ├── webcrypto │ └── BUILD │ ├── webgl │ ├── BUILD │ └── integer_entities.txt │ └── webstorage │ ├── BUILD │ └── integer_entities.txt ├── maven ├── license.txt ├── pom-core.xml ├── pom-dom.xml ├── pom-indexeddb.xml ├── pom-media.xml ├── pom-promise.xml ├── pom-svg.xml ├── pom-webassembly.xml ├── pom-webgl.xml ├── pom-webstorage.xml └── release_elemental.sh ├── samples ├── helloworld │ └── java │ │ └── com │ │ └── google │ │ └── elemental2 │ │ └── samples │ │ └── helloworld │ │ ├── BUILD │ │ ├── HelloWorld.java │ │ └── app.js ├── promise │ └── java │ │ └── com │ │ └── google │ │ └── elemental2 │ │ └── samples │ │ └── promise │ │ ├── BUILD │ │ ├── PromiseSample.java │ │ └── app.js └── regexp │ └── java │ └── com │ └── google │ └── elemental2 │ └── samples │ └── regexp │ ├── BUILD │ ├── RegExpSample.java │ └── app.js └── third_party ├── BUILD └── extern.bzl /.bazelrc: -------------------------------------------------------------------------------- 1 | # Recommended bazel settings for working with J2CL. 2 | # You can copy this into root of your workspace. 3 | 4 | build --watchfs 5 | 6 | build --spawn_strategy=local 7 | 8 | build --strategy=J2cl=worker 9 | build --strategy=J2clStrip=worker 10 | build --strategy=J2clRta=worker 11 | 12 | build --strategy=J2wasm=worker 13 | build --strategy=J2wasmStrip=worker 14 | build --strategy=J2wasmApp=local 15 | 16 | build --strategy=Closure=worker 17 | build --strategy=Javac=worker 18 | build --strategy=JavaIjar=local 19 | build --strategy=JavaDeployJar=local 20 | build --strategy=JavaSourceJar=local 21 | build --strategy=Turbine=local 22 | 23 | # --experimental_inprocess_symlink_creation is used to workaround the missing 24 | # support for paths with spaces https://github.com/bazelbuild/bazel/issues/4327. 25 | # Remove the two flags after this issue is fixed in bazel new release. 26 | build --enable_platform_specific_config 27 | build:macos --experimental_inprocess_symlink_creation 28 | 29 | test --test_output=errors 30 | 31 | # Enable Java 21. Note this doesn't control whether J2CL accepts Java 21 inputs, 32 | # that is controlled in build_defs/internal_do_not_use/j2cl_common.bzl. 33 | build --java_language_version=21 34 | build --java_runtime_version=21 35 | 36 | # Enable Java 21 for J2CL compiler itself 37 | build --tool_java_language_version=21 38 | build --tool_java_runtime_version=21 -------------------------------------------------------------------------------- /.bazelversion: -------------------------------------------------------------------------------- 1 | 8.0.1 -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Format reference: https://docs.github.com/en/actions/reference 16 | 17 | name: CI 18 | 19 | # Declare default permissions as read only. 20 | permissions: read-all 21 | 22 | # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on 23 | on: 24 | push: 25 | branches: [ master ] 26 | pull_request: 27 | branches: [ master ] 28 | schedule: 29 | # Daily at 12pm UTC 30 | - cron: '0 12 * * *' 31 | 32 | # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs 33 | jobs: 34 | build: 35 | 36 | strategy: 37 | fail-fast: false 38 | matrix: 39 | test-target: ['default', 'samples'] 40 | os: [macos-latest, ubuntu-latest] 41 | 42 | runs-on: ${{ matrix.os }} 43 | 44 | steps: 45 | - name: Setup Java 46 | uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 47 | with: 48 | java-version: '21' 49 | distribution: 'zulu' 50 | java-package: jdk 51 | 52 | - name: Checkout current commit 53 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 54 | 55 | - name: Cache Bazel repositories 56 | uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 57 | with: 58 | path: ~/bazel-repository-cache 59 | key: bazel-repositories-${{hashFiles('**/MODULE.bazel')}} 60 | restore-keys: | 61 | bazel-repositories- 62 | 63 | - name: Cache Bazel results 64 | uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 65 | with: 66 | path: ~/bazel-action-cache 67 | key: bazel-actions-${{runner.os}}-${{github.sha}} 68 | restore-keys: | 69 | bazel-actions-${{runner.os}}- 70 | 71 | - name: Configure bazel 72 | run: | 73 | echo "build --repository_cache=~/bazel-repository-cache" >> ~/.bazelrc 74 | echo "build --disk_cache=~/bazel-action-cache" >> ~/.bazelrc 75 | echo "build -c opt" >> ~/.bazelrc 76 | echo "build --verbose_failures" >> ~/.bazelrc 77 | bazel info 78 | - name: Run tests 79 | if: matrix.test-target == 'default' 80 | run: ./build_test.sh CI 81 | - name: Run samples tests 82 | if: matrix.test-target == 'samples' 83 | run: | 84 | if [[ -f "./build_test_samples.sh" ]]; then 85 | ./build_test_samples.sh CI 86 | fi -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # NOTE: we don't include OS- or IDE/editor-specific files (e.g. Windows' Thumbs.db, 2 | # OSX's .DS_Store, Vim's *.swp, Emacs' *~, Visual Studio Code's .vscode, etc.) on-purpose. 3 | # Those patterns should go in a global gitignore or repository-specific excludes. 4 | # See https://help.github.com/articles/ignoring-files/ for how to configure your environment. 5 | # See https://github.com/github/gitignore/tree/master/Global for a list of global ignore rules. 6 | /bazel-* 7 | -------------------------------------------------------------------------------- /BUILD: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Build rules for Elemental. Elemental contains java classes annotated with JsInterop annotations 3 | # that expose native browsers API. 4 | # 5 | 6 | load("@bazel_skylib//rules:build_test.bzl", "build_test") 7 | load("@rules_license//rules:license.bzl", "license") 8 | load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator") 9 | 10 | package( 11 | default_applicable_licenses = ["//:license"], 12 | default_visibility = ["//visibility:public"], 13 | licenses = ["notice"], 14 | ) 15 | 16 | license( 17 | name = "license", 18 | package_name = "elemental2", 19 | ) 20 | 21 | exports_files(["LICENSE"]) 22 | 23 | build_test( 24 | name = "rule_test", 25 | targets = [ 26 | ":elemental2-core", 27 | ":elemental2-promise", 28 | ":elemental2-dom", 29 | ":elemental2-svg", 30 | ":elemental2-webgl", 31 | ":elemental2-media", 32 | ":elemental2-webstorage", 33 | ":elemental2-indexeddb", 34 | ], 35 | ) 36 | 37 | # Core of Elemental containing basic javascript types definitions 38 | jsinterop_generator( 39 | name = "elemental2-core", 40 | exports = ["//java/elemental2/core"], 41 | ) 42 | 43 | # Promise API 44 | jsinterop_generator( 45 | name = "elemental2-promise", 46 | exports = ["//java/elemental2/promise"], 47 | ) 48 | 49 | # Dom part of elemental 50 | jsinterop_generator( 51 | name = "elemental2-dom", 52 | exports = ["//java/elemental2/dom"], 53 | ) 54 | 55 | # SVG api 56 | jsinterop_generator( 57 | name = "elemental2-svg", 58 | exports = ["//java/elemental2/svg"], 59 | ) 60 | 61 | # Webgl api 62 | jsinterop_generator( 63 | name = "elemental2-webgl", 64 | exports = ["//java/elemental2/webgl"], 65 | ) 66 | 67 | # Webassembly api 68 | jsinterop_generator( 69 | name = "elemental2-webassembly", 70 | exports = ["//java/elemental2/webassembly"], 71 | ) 72 | 73 | # Media api 74 | jsinterop_generator( 75 | name = "elemental2-media", 76 | exports = ["//java/elemental2/media"], 77 | ) 78 | 79 | # Web storage api 80 | jsinterop_generator( 81 | name = "elemental2-webstorage", 82 | exports = ["//java/elemental2/webstorage"], 83 | ) 84 | 85 | # Indexed DB api 86 | jsinterop_generator( 87 | name = "elemental2-indexeddb", 88 | exports = ["//java/elemental2/indexeddb"], 89 | ) 90 | 91 | jsinterop_generator( 92 | name = "elemental2-webcrypto", 93 | exports = ["//java/elemental2/webcrypto"], 94 | ) 95 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributions 2 | -------------- 3 | ## Contributor License Agreements 4 | 5 | Before to propose a patch please fill out either the individual or corporate Contributor License Agreement (CLA). 6 | 7 | * If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html). 8 | * If you work for a company that wants to allow you to contribute your work, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html). 9 | 10 | Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we'll be able to accept your pull requests. 11 | 12 | ## Contributing A Patch 13 | 14 | Elemental2 Java sources are generated using [jsinterop generator] from the extern files provided by [closure-compiler]. 15 | 16 | ### Fixing bugs in code generation 17 | 18 | If you want to fix the way the code is generated, changes need to be done in the [jsinterop generator] project. 19 | 20 | ### Fixing bugs in existing Elemental2 API 21 | If you want to fix/improve an existing API, modifications need to be done in the externs files of the [closure-compiler] 22 | 23 | ### Adding a missing JavaScript API 24 | If you want to add an API that is not part of Elemental2, you need to search in [closure-compiler] project if an existing extern file already defines this API. 25 | 26 | * If there is an existing extern file defining this API: 27 | - Add @deprecated to all old APIs in the extern file and send a pull request to [closure-compiler] project. To know if an API is deprecated, search the API on [MDN website](https://developer.mozilla.org) and check if it is flagged as `deprecated` or `obsolete`. 28 | - Change corresponding Elemental BUILD file to include that extern file. 29 | - Fix number types by following [these instructions](#providing-a-specific-numeric-type-for-a-javascript-api) for all API defined in this file. 30 | - Fix parameter names by following [these instructions](#providing-parameter-names) for all API defined in this file. 31 | 32 | * If there is no file defining this API: 33 | - Add the API in one of the existing files and send a pull request to [closure-compiler]. 34 | - Fix number types by following [these instructions](#providing-a-specific-numeric-type-for-a-javascript-api). 35 | - Fix parameter names by following [these instructions](#providing-parameter-names). 36 | 37 | Note: When you create your PR in Elemental2 repository, please add links to any PR opened on [closure-compiler] project. 38 | 39 | ### Providing a specific numeric type for a JavaScript API 40 | By default, the [jsinterop generator] will convert all `number` javascript type to `double` when generating the java classes. 41 | In order to know if an API is accepting integer number, you need to refer to the API official specification. 42 | If the type is any of `byte`, `octet`, `short`, `long`, it needs to be converted to `int`. 43 | 44 | In order to do that: 45 | - Create an `integer_entities.txt` file and add it to `jsinterop_generator` rule of the related `BUILD` file (if it doesn't already exist). 46 | - Open the file and list the API whose type need to be converted to `int`: 47 | - for fields and method return types, use the java fully qualified name of the method or field (e.g. elemental2.dom.Baz.foo). 48 | - for a method's parameter, use the java fully qualified name of the parameter (e.g elemental2.dom.Baz.foo.param1)` 49 | 50 | For an example, see [integer_entities.txt file](https://github.com/google/elemental2/blob/master/java/elemental2/dom/integer_entities.txt) for elemental2-dom. 51 | 52 | Note: The official specification for an API can be found in the [MDN Web doc website](https://developer.mozilla.org/en-US/). Search for your API definition and then look at the Specifications section. 53 | For an example, see [element.scrollTop specification section](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop#Specifications). 54 | 55 | ### Providing parameter names 56 | In closure type system, function types like `{function(number):boolean}` cannot specify a name for their parameter. As a result, the jsinterop generator will generate a generic name for them. 57 | 58 | It's possible to tell the generator to use a more specific name for such parameters: 59 | - Create an `name_mappings.txt` file and add it to `jsinterop_generator` rule of the related `BUILD` file (if it doesn't already exist). 60 | - Open the file and add an entry for each parameter using syntax `=` 61 | 62 | Let's take an example. If you have the following generated code: 63 | 64 | ```java 65 | package foo; 66 | 67 | class Bar { 68 | interface BazCallback { 69 | void onInvoke(boolean p0); 70 | } 71 | } 72 | 73 | ``` 74 | 75 | You can rename the `onInvoke` `p0` parameter to `newName` by adding the following entry: 76 | `foo.Bar.BazCallback.onInvoke.p0=newName` 77 | 78 | For an example, see [name_mappings.txt file](https://github.com/google/elemental2/blob/master/java/elemental2/dom/name_mappings.txt) of elemental2-dom. 79 | 80 | ## Making your development experience smoother 81 | 82 | This repository is strongly linked to two other repositories: 83 | - [jsinterop generator] 84 | - [closure-compiler] 85 | 86 | For a smooth developer experience with [Bazel](https://bazel.build/), we recommend you to check-in locally both projects and modify the elemental2 `WORSPACE` in order to refer directly to your local repositories. 87 | For that purpose, add the following lines at the beginning of the WORKSPACE file (after the workspace definition): 88 | 89 | workspace(name = "com_google_elemental2") 90 | 91 | # add the code below just after the workspace definition 92 | 93 | new_local_repository( 94 | name = "com_google_closure_compiler", 95 | path = "/path/to/closure-compiler/repo", 96 | build_file = "jscomp.BUILD", 97 | ) 98 | 99 | local_repository( 100 | name = "com_google_jsinterop_generator", 101 | path = "/path/to/jsinterop-generator/repo", 102 | ) 103 | 104 | Be sure to replace `/path/to/closure-compiler/repo` and `/path/to/jsinterop-generator/repo` accordingly. 105 | 106 | 107 | You can now implement local modifications in both project and ask Bazel to build elemental2 with those modifications. 108 | 109 | 110 | [closure-compiler]:https://github.com/google/closure-compiler/tree/master/externs 111 | [jsinterop generator]:https://www.github.com/google/jsinterop-generator 112 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 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. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2017 Google Inc. 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /MODULE.bazel: -------------------------------------------------------------------------------- 1 | module( 2 | name = "com_google_elemental2", 3 | bazel_compatibility = [">=8.0.1"], 4 | ) 5 | 6 | bazel_dep(name = "com_google_j2cl") 7 | 8 | # j2cl is not available in BCR. 9 | archive_override( 10 | module_name = "com_google_j2cl", 11 | strip_prefix = "j2cl-master", 12 | urls = ["https://github.com/google/j2cl/archive/master.zip"], 13 | ) 14 | 15 | bazel_dep(name = "com_google_jsinterop_generator") 16 | 17 | # jsinterop-generator is not available in BCR. 18 | archive_override( 19 | module_name = "com_google_jsinterop_generator", 20 | strip_prefix = "jsinterop-generator-master", 21 | urls = ["https://github.com/google/jsinterop-generator/archive/master.zip"], 22 | ) 23 | 24 | bazel_dep(name = "com_google_jsinterop_base") 25 | 26 | # jsinterop-base is not available in BCR. 27 | archive_override( 28 | module_name = "com_google_jsinterop_base", 29 | strip_prefix = "jsinterop-base-master", 30 | urls = ["https://github.com/google/jsinterop-base/archive/master.zip"], 31 | ) 32 | 33 | bazel_dep( 34 | name = "google_bazel_common", 35 | version = "0.0.1", 36 | ) 37 | 38 | # rules_closure is not available in BCR. 39 | git_override( 40 | module_name = "io_bazel_rules_closure", 41 | commit = "790a1bd79cde595a5d296963a78d344681ff245c", 42 | remote = "https://github.com/bazelbuild/rules_closure", 43 | ) 44 | 45 | # rules_webtesting is not available in BCR. 46 | git_override( 47 | module_name = "rules_webtesting", 48 | commit = "7a1c88f61e35ee5ce0892ae24e2aa2a3106cbfed", 49 | remote = "https://github.com/bazelbuild/rules_webtesting", 50 | ) 51 | 52 | # rules_scala is not available in BCR. 53 | # The root module has to declare the same override as rules_webtesting. 54 | git_override( 55 | module_name = "rules_scala", 56 | commit = "219e63983e8e483e66ebf70372969ba227382001", 57 | remote = "https://github.com/mbland/rules_scala", 58 | ) 59 | 60 | bazel_dep( 61 | name = "rules_license", 62 | version = "1.0.0", 63 | ) 64 | 65 | bazel_dep( 66 | name = "bazel_skylib", 67 | version = "1.7.1", 68 | ) 69 | 70 | bazel_dep( 71 | name = "rules_java", 72 | version = "8.6.1", 73 | ) 74 | 75 | bazel_dep( 76 | name = "rules_jvm_external", 77 | version = "6.6", 78 | ) 79 | 80 | 81 | # Works around https://github.com/bazelbuild/rules_python/issues/1169 82 | bazel_dep( 83 | name = "rules_python", 84 | version = "0.23.1", 85 | ) 86 | 87 | python = use_extension("@rules_python//python/extensions:python.bzl", "python") 88 | python.toolchain( 89 | configure_coverage_tool = False, 90 | ignore_root_user_error = True, 91 | python_version = "3.11", 92 | ) 93 | 94 | maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") 95 | 96 | maven.artifact( 97 | artifact = "closure-compiler", 98 | group = "com.google.javascript", 99 | version = "v20240317", 100 | ) 101 | 102 | use_repo(maven, "maven") 103 | 104 | http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 105 | 106 | http_archive( 107 | name = "org_gwtproject_gwt", 108 | sha256 = "731879b8e56024a34f36b83655975a474e1ac1dffdfe72724e337976ac0e1749", 109 | strip_prefix = "gwt-073679594c6ead7abe501009f8ba31eb390047fc", 110 | url = "https://github.com/gwtproject/gwt/archive/073679594c6ead7abe501009f8ba31eb390047fc.zip", 111 | ) 112 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Elemental2 · [![Build Status](https://github.com/google/elemental2/actions/workflows/ci.yaml/badge.svg)](https://github.com/google/elemental2/actions/workflows/ci.yaml) 2 | 3 | Elemental2 provides type checked access to all browser APIs for Java code. This 4 | is done by using [closure extern files](https://github.com/google/closure-compiler/tree/master/externs) 5 | and generating JsTypes, which are part of the [new JsInterop specification](https://goo.gl/agme3T) 6 | that is both implemented in GWT and J2CL. 7 | 8 | Bazel dependencies 9 | ------------------ 10 | If your project uses [Bazel](https://bazel.build), add this repository as an 11 | external dependency in your `WORKSPACE` file: 12 | 13 | ``` 14 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 15 | 16 | http_archive( 17 | name = "com_google_elemental2", 18 | strip_prefix = "elemental2-1.2.1", 19 | url = "https://github.com/google/elemental2/archive/1.2.1.zip", 20 | ) 21 | 22 | load("@com_google_elemental2//build_defs:repository.bzl", "load_elemental2_repo_deps") 23 | load_elemental2_repo_deps() 24 | 25 | load("@com_google_elemental2//build_defs:workspace.bzl", "setup_elemental2_workspace") 26 | setup_elemental2_workspace() 27 | ``` 28 | 29 | Now from you can add elemental2 targets as needed to your `j2cl_library` deps. 30 | 31 | Following are the different elemental2 modules and their target names: 32 | 33 | module | Bazel targets for J2CL 34 | -----------| ----------------------- 35 | core | `@com_google_elemental2//:elemental2-core-j2cl` 36 | dom | `@com_google_elemental2//:elemental2-dom-j2cl` 37 | promise | `@com_google_elemental2//:elemental2-promise-j2cl` 38 | indexeddb | `@com_google_elemental2//:elemental2-indexeddb-j2cl` 39 | svg | `@com_google_elemental2//:elemental2-svg-j2cl` 40 | webgl | `@com_google_elemental2//:elemental2-webgl-j2cl` 41 | media | `@com_google_elemental2//:elemental2-media-j2cl` 42 | webstorage | `@com_google_elemental2//:elemental2-webstorage-j2cl` 43 | 44 | Maven dependencies 45 | ------------------ 46 | If your project uses [Maven](https://maven.apache.org), add the following maven 47 | dependencies in your `pom.xml`: 48 | 49 | 50 | com.google.elemental2 51 | ${artifact-id} 52 | 1.2.1 53 | 54 | 55 | 56 | module | artifact-id 57 | ------ | ----------- 58 | core | `elemental2-core` 59 | dom | `elemental2-dom` 60 | promise | `elemental2-promise` 61 | indexeddb | `elemental2-indexeddb` 62 | svg | `elemental2-svg` 63 | webgl | `elemental2-webgl` 64 | media | `elemental2-media` 65 | webstorage | `elemental2-webstorage` 66 | 67 | Download the jar files 68 | ---------------------- 69 | You can also download manually the jars files. 70 | 71 | module | jar file 72 | ------ | -------- 73 | core | [elemental2-core.jar](https://oss.sonatype.org/content/repositories/releases/com/google/elemental2/elemental2-core/1.2.1/elemental2-core-1.2.1.jar) 74 | dom | [elemental2-dom.jar](https://oss.sonatype.org/content/repositories/releases/com/google/elemental2/elemental2-dom/1.2.1/elemental2-dom-1.2.1.jar) 75 | promise | [elemental2-promise.jar](https://oss.sonatype.org/content/repositories/releases/com/google/elemental2/elemental2-promise/1.2.1/elemental2-promise-1.2.1.jar) 76 | indexeddb | [elemental2-indexeddb.jar](https://oss.sonatype.org/content/repositories/releases/com/google/elemental2/elemental2-indexeddb/1.2.1/elemental2-indexeddb-1.2.1.jar) 77 | svg | [elemental2-svg.jar](https://oss.sonatype.org/content/repositories/releases/com/google/elemental2/elemental2-svg/1.2.1/elemental2-svg-1.2.1.jar) 78 | webgl | [elemental2-webgl.jar](https://oss.sonatype.org/content/repositories/releases/com/google/elemental2/elemental2-webgl/1.2.1/elemental2-webgl-1.2.1.jar) 79 | media | [elemental2-media.jar](https://oss.sonatype.org/content/repositories/releases/com/google/elemental2/elemental2-media/1.2.1/elemental2-media-1.2.1.jar) 80 | webstorage | [elemental2-webstorage.jar](https://oss.sonatype.org/content/repositories/releases/com/google/elemental2/elemental2-webstorage/1.2.1/elemental2-webstorage-1.2.1.jar) 81 | 82 | GWT 83 | --- 84 | 85 | > Elemental2 v1.0.0+ requires GWT 2.9 or above. 86 | 87 | If you use Elemental2 with [GWT](http://www.gwtproject.org/), you need to inherit the right gwt module in your `gwt.xml` file: 88 | 89 | module | GWT module name 90 | ------ | --------------- 91 | core | `elemental2.core.Core` 92 | dom | `elemental2.dom.Dom` 93 | promise | `elemental2.promise.Promise` 94 | indexeddb | `elemental2.indexeddb.IndexedDb` 95 | svg | `elemental2.svg.Svg` 96 | webgl | `elemental2.webgl.WebGl` 97 | media | `elemental2.media.Media` 98 | webstorage | `elemental2.webstorage.WebStorage` 99 | 100 | 101 | Build GWT compatible maven jar files 102 | ------------------------------------ 103 | If you want to modify and/or build the last version on your own, follow the instructions below: 104 | 105 | - Install [Bazelisk](https://github.com/bazelbuild/bazelisk): 106 | 107 | ```shell 108 | $ npm install -g @bazel/bazelisk 109 | $ alias bazel=bazelisk 110 | ``` 111 | - Clone this git repository: 112 | ```shell 113 | $ git clone https://github.com/google/elemental2.git 114 | ``` 115 | - Run the release script: 116 | ```shell 117 | $ cd elemental2 118 | $ ./maven/release_elemental.sh --version local --no-deploy 119 | ``` 120 | 121 | The script will output the directory containing the generated jar files that 122 | can be used with maven. 123 | 124 | Contributing 125 | ------------ 126 | Please refer to [the contributing document](CONTRIBUTING.md). 127 | 128 | Licensing 129 | --------- 130 | Please refer to [the license file](LICENSE). 131 | 132 | Disclaimer 133 | ---------- 134 | This is not an official Google product. 135 | -------------------------------------------------------------------------------- /build_defs/BUILD: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Exists to provide a package for bzl files. 3 | 4 | package( 5 | default_applicable_licenses = ["//:license"], 6 | licenses = ["notice"], # Apache 2.0 7 | ) 8 | -------------------------------------------------------------------------------- /build_defs/internal_do_not_use/BUILD: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Build rules used internally by Elemental2 3 | 4 | ########################################################## 5 | # # 6 | # __ __ _____ _ _ _____ _ _ _____ # 7 | # \ \ / /\ | __ \| \ | |_ _| \ | |/ ____| # 8 | # \ \ /\ / / \ | |__) | \| | | | | \| | | __ # 9 | # \ \/ \/ / /\ \ | _ /| . ` | | | | . ` | | |_ | # 10 | # \ /\ / ____ \| | \ \| |\ |_| |_| |\ | |__| | # 11 | # \/ \/_/ \_\_| \_\_| \_|_____|_| \_|\_____| # 12 | # # 13 | # # 14 | ########################################################## 15 | # Never depend on any of the targets in this BUILD file # 16 | # manually. They are used within tools/build rules and # 17 | # and should actually be private, but Blaze does not # 18 | # support this yet, b/34359566. # 19 | ########################################################## 20 | 21 | package( 22 | default_applicable_licenses = ["//:license"], 23 | licenses = ["notice"], # Apache 2.0 24 | ) 25 | -------------------------------------------------------------------------------- /build_defs/internal_do_not_use/elemental_utils.bzl: -------------------------------------------------------------------------------- 1 | # Description: 2 | # utilities for Elemental2 Build. 3 | 4 | # Patch extern file. 5 | def patch_extern_file(name, src, patch_file): 6 | patched_file_name = "%s.js" % name 7 | patch_tool = "patch" 8 | 9 | native.genrule( 10 | name = name, 11 | srcs = [src, patch_file], 12 | outs = [patched_file_name], 13 | # GNU patch doesn't follow symbolic links and we need to use the options --follow_symlinks 14 | # the original patch command doesn't know that option but handle correctly symbolic links 15 | cmd = ( 16 | "[[ $$(%s --version) == \"GNU patch\"* ]] && extra_args='--follow-symlinks' || extra_args='';" % patch_tool + 17 | "%s $${extra_args} $(location %s) -i $(location %s) -o $@ " % (patch_tool, src, patch_file) 18 | ), 19 | visibility = ["//:__subpackages__"], 20 | ) 21 | -------------------------------------------------------------------------------- /build_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2019 Google Inc. All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS-IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Script that can be used by CI server for testing elemental2 builds. 17 | set -e 18 | 19 | bazel build ... 20 | -------------------------------------------------------------------------------- /java/elemental2/core/BUILD: -------------------------------------------------------------------------------- 1 | # This package contains the build rule to build elemental2-core. 2 | 3 | load( 4 | "//build_defs/internal_do_not_use:elemental_utils.bzl", 5 | "patch_extern_file", 6 | ) 7 | load("@rules_java//java:defs.bzl", "java_library") 8 | load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator") 9 | 10 | package( 11 | default_applicable_licenses = ["//:license"], 12 | default_visibility = [ 13 | "//:__subpackages__", 14 | ], 15 | # Apache2 16 | licenses = ["notice"], 17 | ) 18 | 19 | # Removes non-existing static methods defined in Array type. 20 | # TODO(b/36088884): clean-up the extern file directly 21 | # Make RegExp API stricter. 22 | # TODO(b/38034193): clean up the RegExp API in the extern file directly. 23 | patch_extern_file( 24 | name = "es3_patched", 25 | src = "//third_party:es3.js", 26 | patch_file = "es3.js.diff", 27 | ) 28 | 29 | filegroup( 30 | name = "externs", 31 | srcs = [ 32 | # order matters 33 | ":es3_patched", 34 | "//third_party:es5.js", 35 | "//third_party:es6.js", 36 | "//third_party:es6_collections.js", 37 | "//third_party:es6_proxy.js", 38 | ], 39 | ) 40 | 41 | java_library( 42 | name = "core-visitors", 43 | srcs = ["BuiltInClosureTypeCleaner.java"], 44 | visibility = ["//visibility:public"], 45 | deps = [ 46 | "//third_party:guava", 47 | "@com_google_jsinterop_generator//java/jsinterop/generator/helper", 48 | "@com_google_jsinterop_generator//java/jsinterop/generator/model", 49 | ], 50 | ) 51 | 52 | # Core of Elemental containing basic javascript types definitions 53 | jsinterop_generator( 54 | name = "core", 55 | srcs = [":externs"], 56 | custom_preprocessing_pass = [ 57 | "elemental2.core.BuiltInClosureTypeCleaner", 58 | ], 59 | # override auto generated js_deps since modified externs cause conflicts 60 | externs_deps = [], 61 | global_scope_class_name = "Global", 62 | gwt_java_deps = [ 63 | "//third_party:gwt-array-stamper", 64 | ], 65 | integer_entities_files = ["integer_entities.txt"], 66 | name_mapping_files = ["name_mappings.txt"], 67 | wildcard_types_files = ["wildcard_types.txt"], 68 | runtime_deps = [ 69 | ":core-visitors", 70 | ], 71 | deps = [ 72 | "//java/elemental2/promise", 73 | ], 74 | ) 75 | -------------------------------------------------------------------------------- /java/elemental2/core/BuiltInClosureTypeCleaner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package elemental2.core; 17 | 18 | import static com.google.common.base.Preconditions.checkState; 19 | import static java.util.stream.Collectors.toCollection; 20 | import static jsinterop.generator.model.PredefinedTypes.ARRAY_STAMPER; 21 | import static jsinterop.generator.model.PredefinedTypes.JS; 22 | import static jsinterop.generator.model.PredefinedTypes.OBJECT; 23 | 24 | import com.google.common.collect.ImmutableList; 25 | import com.google.common.collect.ImmutableSet; 26 | import com.google.common.collect.Iterables; 27 | import com.google.common.collect.MoreCollectors; 28 | import java.util.Collection; 29 | import java.util.HashSet; 30 | import java.util.List; 31 | import java.util.Objects; 32 | import java.util.Optional; 33 | import java.util.Set; 34 | import jsinterop.generator.helper.ModelHelper; 35 | import jsinterop.generator.model.AbstractRewriter; 36 | import jsinterop.generator.model.AbstractVisitor; 37 | import jsinterop.generator.model.Annotation; 38 | import jsinterop.generator.model.AnnotationType; 39 | import jsinterop.generator.model.ArrayTypeReference; 40 | import jsinterop.generator.model.Entity; 41 | import jsinterop.generator.model.Field; 42 | import jsinterop.generator.model.JavaTypeReference; 43 | import jsinterop.generator.model.LiteralExpression; 44 | import jsinterop.generator.model.Method; 45 | import jsinterop.generator.model.MethodInvocation; 46 | import jsinterop.generator.model.ModelVisitor; 47 | import jsinterop.generator.model.Parameter; 48 | import jsinterop.generator.model.ParametrizedTypeReference; 49 | import jsinterop.generator.model.Program; 50 | import jsinterop.generator.model.ReturnStatement; 51 | import jsinterop.generator.model.Type; 52 | import jsinterop.generator.model.TypeQualifier; 53 | import jsinterop.generator.model.TypeReference; 54 | import jsinterop.generator.model.TypeVariableReference; 55 | 56 | /** 57 | * Do some cleaning tasks around built-in Array and Object types: 58 | * 59 | * 67 | */ 68 | public class BuiltInClosureTypeCleaner implements ModelVisitor { 69 | private static final ImmutableSet TYPED_ARRAY_TYPES = 70 | ImmutableSet.of( 71 | "ArrayBufferView", 72 | "TypedArray", 73 | "Int8Array", 74 | "Uint8Array", 75 | "Uint8ClampedArray", 76 | "Int16Array", 77 | "Uint16Array", 78 | "Int32Array", 79 | "Uint32Array", 80 | "Float32Array", 81 | "Float64Array", 82 | "BigInt64Array", 83 | "BigUint64Array"); 84 | 85 | @Override 86 | public void applyTo(Program program) { 87 | program.accept( 88 | new AbstractVisitor() { 89 | @Override 90 | public void exitType(Type type) { 91 | String nativeFqn = type.getNativeFqn(); 92 | if (Objects.equals(nativeFqn, "ReadonlyMap") || Objects.equals(nativeFqn, "Map")) { 93 | cleanCommonMapMethods(type); 94 | } else if (Objects.equals(nativeFqn, "ReadonlyArray")) { 95 | cleanCommonArrayMethods(type); 96 | // Remove the length field. The field will be converted to a getLength method and will 97 | // conflict with the JsOverlay method defined on JsArrayLike. 98 | type.removeField( 99 | type.getFields().stream() 100 | .filter(f -> "length".equals(f.getName())) 101 | .collect(MoreCollectors.onlyElement())); 102 | } else if (Objects.equals(nativeFqn, "Array")) { 103 | cleanArrayType(type); 104 | addJavaArrayHelperMethods(type); 105 | } else if (Objects.equals(nativeFqn, "Object")) { 106 | // JsCompiler uses a hardcoded definition for the Object type, one with two type 107 | // parameters (from IObject). That makes the resulting java type to be generated as 108 | // the following parametrized type: 109 | // class JsObject {} 110 | // Since Object in elemental should not be a parameterized type, the type parameters 111 | // are cleared here. 112 | Collection typeParameters = type.getTypeParameters(); 113 | 114 | checkState( 115 | typeParameters.size() == 2, "Object is not defined with two type parameters"); 116 | 117 | type.getTypeParameters().clear(); 118 | } 119 | } 120 | }); 121 | 122 | // To mirror the type definitions in TypeScript, Typed Array in closure are parametrized with a 123 | // type parameter that is unused. To avoid parameterization in our generated Java code, we will 124 | // simply remove the type parameter. 125 | program.accept( 126 | new AbstractRewriter() { 127 | @Override 128 | public boolean shouldProcessType(Type type) { 129 | return TYPED_ARRAY_TYPES.contains(type.getNativeFqn()); 130 | } 131 | 132 | @Override 133 | public Entity rewriteType(Type type) { 134 | if (TYPED_ARRAY_TYPES.contains(type.getNativeFqn())) { 135 | Collection typeParameters = type.getTypeParameters(); 136 | 137 | checkState( 138 | typeParameters.isEmpty() 139 | || (typeParameters.size() == 1 140 | && typeParameters 141 | .iterator() 142 | .next() 143 | .getTypeName() 144 | .equals("TArrayBuffer"))); 145 | 146 | type.getTypeParameters().clear(); 147 | } 148 | return type; 149 | } 150 | 151 | @Override 152 | public TypeReference rewriteParametrizedTypeReference( 153 | ParametrizedTypeReference typeReference) { 154 | if (TYPED_ARRAY_TYPES.contains( 155 | typeReference.getMainType().getJsDocAnnotationString())) { 156 | // Some typed array instance functions are defined as returning the special `THIS` 157 | // template type. That will create some type reference to the enclosing type that are 158 | // automatically parametrized with the type parameter we removed above. 159 | List typeArgument = typeReference.getActualTypeArguments(); 160 | checkState( 161 | typeArgument.size() == 1 162 | && typeArgument.get(0).getTypeName().equals("TArrayBuffer")); 163 | return typeReference.getMainType(); 164 | } 165 | return typeReference; 166 | } 167 | }); 168 | 169 | program.accept( 170 | new AbstractRewriter() { 171 | @Override 172 | public boolean shouldProcessType(Type node) { 173 | return ModelHelper.isGlobalType(node); 174 | } 175 | 176 | @Override 177 | public Entity rewriteField(Field field) { 178 | // Remove "globalThis" field from the global type. 179 | return "globalThis".equals(field.getName()) ? null : field; 180 | } 181 | }); 182 | } 183 | 184 | private static void addJavaArrayHelperMethods(Type jsArrayType) { 185 | checkState(jsArrayType.getTypeParameters().size() == 1); 186 | TypeReference arrayTypeParameter = jsArrayType.getTypeParameters().stream().findFirst().get(); 187 | 188 | // Add {@code T[] asArray(T[] reference)} method to convert correctly JsArray to java array. 189 | // This method stamps correctly the java array. 190 | Method asArray = new Method(); 191 | asArray.addAnnotation(Annotation.builder().type(AnnotationType.JS_OVERLAY).build()); 192 | asArray.setFinal(true); 193 | asArray.setName("asArray"); 194 | asArray.setReturnType(new ArrayTypeReference(arrayTypeParameter)); 195 | asArray.addParameter( 196 | Parameter.builder() 197 | .setName("reference") 198 | .setType(new ArrayTypeReference(arrayTypeParameter)) 199 | .build()); 200 | asArray.setBody( 201 | new ReturnStatement( 202 | MethodInvocation.builder() 203 | .setInvocationTarget(new TypeQualifier(ARRAY_STAMPER.getReference(false))) 204 | .setMethodName("stampJavaTypeInfo") 205 | .setArgumentTypes( 206 | OBJECT.getReference(false), new ArrayTypeReference(arrayTypeParameter)) 207 | .setArguments(new LiteralExpression("this"), new LiteralExpression("reference")) 208 | .build())); 209 | jsArrayType.addMethod(asArray); 210 | 211 | // Add {@code static JsArray from(T[])} method to convert java array to JsArray. 212 | TypeVariableReference methodTypeVariable = new TypeVariableReference("T", null); 213 | Method from = new Method(); 214 | from.addAnnotation(Annotation.builder().type(AnnotationType.JS_OVERLAY).build()); 215 | from.setStatic(true); 216 | from.setFinal(true); 217 | from.setTypeParameters(ImmutableList.of(methodTypeVariable)); 218 | from.setName("asJsArray"); 219 | from.setReturnType( 220 | new ParametrizedTypeReference( 221 | new JavaTypeReference(jsArrayType), ImmutableList.of(methodTypeVariable))); 222 | from.addParameter( 223 | Parameter.builder() 224 | .setName("array") 225 | .setType(new ArrayTypeReference(methodTypeVariable)) 226 | .build()); 227 | from.setBody( 228 | new ReturnStatement( 229 | MethodInvocation.builder() 230 | .setInvocationTarget(new TypeQualifier(JS.getReference(false))) 231 | .setMethodName("uncheckedCast") 232 | .setArgumentTypes(OBJECT.getReference(false)) 233 | .setArguments(new LiteralExpression("array")) 234 | .build())); 235 | jsArrayType.addMethod(from); 236 | } 237 | 238 | private static void cleanArrayType(Type arrayType) { 239 | TypeReference arrayValueTypeParameter = getArrayValueTypeParameter(arrayType); 240 | 241 | // 1. Improve the typing of the Array constructor. Array constructor should be parameterized by 242 | // T (not Object). 243 | checkState(arrayType.getConstructors().size() == 1); 244 | Method arrayConstructor = arrayType.getConstructors().get(0); 245 | improveArrayMethodTyping(arrayConstructor, arrayValueTypeParameter); 246 | 247 | // 2. Improve the typing of Array.unshift. It must accept items of type T (not Object). 248 | Optional unshiftMethod = 249 | arrayType.getMethods().stream().filter(m -> "unshift".equals(m.getName())).findAny(); 250 | checkState(unshiftMethod.isPresent()); 251 | improveArrayMethodTyping(unshiftMethod.get(), arrayValueTypeParameter); 252 | 253 | // 3. Clean methods defined on Array and ReadonlyArray. 254 | cleanCommonArrayMethods(arrayType); 255 | } 256 | 257 | // TODO(dramaix): Add a logic to detect method that have a callback with an array as last 258 | // parameter. 259 | private static final ImmutableList ARRAY_METHODS_WITH_CLEANABLE_CALLBACKS = 260 | ImmutableList.of("filter", "forEach", "reduce", "map", "reduceRight", "every", "some"); 261 | 262 | private static final ImmutableList MAP_METHODS_WITH_CLEANABLE_CALLBACKS = 263 | ImmutableList.of("forEach"); 264 | 265 | private static final ImmutableSet METHODS_WITH_SINGULAR_VALUE_IN_FIRST_PARAMETER = 266 | ImmutableSet.of("indexOf", "lastIndexOf", "includes"); 267 | 268 | private static void cleanCommonArrayMethods(Type arrayType) { 269 | // 1. Change concat() method to accept items of type T and not Object and return an array of T. 270 | cleanArrayConcatMethod(arrayType); 271 | 272 | // 2. Fix some callback definition to remove the last parameter that represent the array itself. 273 | // This parameter causes inheritance issue between ReadOnlyArray and Array as the type of this 274 | // parameter is redefined to match the enclosing type. Java developers can easily capture the 275 | // array the method is applied on and do not need this parameter. 276 | cleanCallbacks( 277 | arrayType, 278 | ARRAY_METHODS_WITH_CLEANABLE_CALLBACKS.stream() 279 | .map(m -> getCallBackParameterType(m, arrayType)) 280 | .collect(toCollection(HashSet::new))); 281 | 282 | // Ensure that indexOf-like methods accept a typed value in their first argument, which is not 283 | // the case for ReadonlyArray. 284 | for (Method method : arrayType.getMethods()) { 285 | if (METHODS_WITH_SINGULAR_VALUE_IN_FIRST_PARAMETER.contains(method.getName())) { 286 | method.getParameters().get(0).setType(getArrayValueTypeParameter(arrayType)); 287 | } 288 | } 289 | } 290 | 291 | private static void cleanCommonMapMethods(Type mapType) { 292 | // Fix some callback definition to remove the last parameter that represent the map itself. 293 | // 294 | // This parameter causes inheritance issue between ReadonlyMap and Map as the type of this 295 | // parameter is redefined to match the enclosing type. Java developers can easily capture the 296 | // array the method is applied on and do not need this parameter. 297 | cleanCallbacks( 298 | mapType, 299 | MAP_METHODS_WITH_CLEANABLE_CALLBACKS.stream() 300 | .map(m -> getCallBackParameterType(m, mapType)) 301 | .collect(toCollection(HashSet::new))); 302 | } 303 | 304 | private static void cleanCallbacks(Type type, Set cleanableCallbackTypes) { 305 | for (Type callbackType : type.getInnerTypes()) { 306 | if (cleanableCallbackTypes.remove(callbackType.getJavaFqn())) { 307 | Method callbackMethod = callbackType.getMethods().get(0); 308 | checkState( 309 | Iterables.getLast(callbackMethod.getParameters()) 310 | .getType() 311 | .getJavaTypeFqn() 312 | .equals(type.getJavaFqn()), 313 | "Invalid callback found %s", 314 | callbackType.getJavaFqn()); 315 | 316 | checkState( 317 | callbackType.isInterface() && callbackType.getMethods().size() == 1, 318 | "Invalid callback found %s", 319 | callbackType.getJavaFqn()); 320 | 321 | callbackMethod.getParameters().remove(callbackMethod.getParameters().size() - 1); 322 | 323 | // clean the native fqn (closure js doc) of the callback because this will be used later in 324 | // DuplicatedTypesUnifier to identify the callback. 325 | String callbackNativeFqn = callbackType.getNativeFqn(); 326 | checkState(callbackNativeFqn != null && callbackNativeFqn.startsWith("function(")); 327 | callbackType.setNativeFqn( 328 | callbackNativeFqn.substring(0, callbackNativeFqn.lastIndexOf(',')) 329 | + callbackNativeFqn.substring(callbackNativeFqn.indexOf(')'))); 330 | } 331 | } 332 | 333 | checkState( 334 | cleanableCallbackTypes.isEmpty(), 335 | "The following callbacks %s are not been found.", 336 | cleanableCallbackTypes); 337 | } 338 | 339 | private static String getCallBackParameterType(String methodName, Type enclosingType) { 340 | Optional methodOptional = 341 | enclosingType.getMethods().stream().filter(m -> methodName.equals(m.getName())).findAny(); 342 | checkState(methodOptional.isPresent()); 343 | Method methodWithCallback = methodOptional.get(); 344 | 345 | for (Parameter p : methodWithCallback.getParameters()) { 346 | if ("callback".equals(p.getName())) { 347 | return p.getType().getJavaTypeFqn(); 348 | } 349 | } 350 | 351 | throw new IllegalStateException( 352 | "Callback parameter not found on " + enclosingType.getName() + "." + methodName); 353 | } 354 | /** 355 | * Improve the typing of Array.concat. It must accept items of type T (not Object) and return an 356 | * array of T. 357 | */ 358 | private static void cleanArrayConcatMethod(Type arrayType) { 359 | TypeReference arrayValueTypeParameter = getArrayValueTypeParameter(arrayType); 360 | 361 | Optional concatMethodOptional = 362 | arrayType.getMethods().stream().filter(m -> "concat".equals(m.getName())).findAny(); 363 | checkState(concatMethodOptional.isPresent()); 364 | Method concatMethod = concatMethodOptional.get(); 365 | 366 | improveArrayMethodTyping(concatMethod, arrayValueTypeParameter); 367 | 368 | checkState(concatMethod.getReturnType() instanceof ParametrizedTypeReference); 369 | ParametrizedTypeReference concatReturnType = 370 | (ParametrizedTypeReference) concatMethod.getReturnType(); 371 | checkState( 372 | concatReturnType.getActualTypeArguments().size() == 1 373 | && concatReturnType.getActualTypeArguments().get(0).isReferenceTo(OBJECT)); 374 | concatMethod.setReturnType( 375 | new ParametrizedTypeReference( 376 | concatReturnType.getMainType(), ImmutableList.of(arrayValueTypeParameter))); 377 | } 378 | 379 | /** 380 | * Improves the typing of Array methods that should accept items of type T (the type parameter of 381 | * the Array) instead of Object. 382 | */ 383 | private static void improveArrayMethodTyping(Method m, TypeReference arrayTypeParameter) { 384 | checkState(m.getParameters().size() == 1); 385 | Parameter firstParameter = m.getParameters().get(0); 386 | checkState(firstParameter.getType().isReferenceTo(OBJECT)); 387 | m.getParameters() 388 | .set(0, firstParameter.toBuilder().setName("items").setType(arrayTypeParameter).build()); 389 | } 390 | 391 | private static TypeReference getArrayValueTypeParameter(Type arrayType) { 392 | Collection typeParameters = arrayType.getTypeParameters(); 393 | checkState(typeParameters.size() == 1, "Unexpected array definitions from JsCompiler"); 394 | return typeParameters.iterator().next(); 395 | } 396 | } 397 | -------------------------------------------------------------------------------- /java/elemental2/core/es3.js.diff: -------------------------------------------------------------------------------- 1 | 2322c2322 2 | < * @param {*} pattern 3 | --- 4 | > * @param {string} pattern 5 | 2333c2333 6 | < * @param {*} str The string to search. 7 | --- 8 | > * @param {string} str The string to search. 9 | 2341c2341 10 | < * @param {*} str The string to search. 11 | --- 12 | > * @param {string} str The string to search. 13 | -------------------------------------------------------------------------------- /java/elemental2/core/integer_entities.txt: -------------------------------------------------------------------------------- 1 | elemental2.core.Arguments.length 2 | elemental2.core.Atomics.add.index 3 | elemental2.core.Atomics.and.index 4 | elemental2.core.Atomics.compareExchange.index 5 | elemental2.core.Atomics.exchange.index 6 | elemental2.core.Atomics.isLockFree.size 7 | elemental2.core.Atomics.load.index 8 | elemental2.core.Atomics.notify.index 9 | elemental2.core.Atomics.or.index 10 | elemental2.core.Atomics.store.index 11 | elemental2.core.Atomics.sub.index 12 | elemental2.core.Atomics.wait.index 13 | elemental2.core.Atomics.wake.index 14 | elemental2.core.Atomics.xor.index 15 | elemental2.core.JsArray.at.index 16 | elemental2.core.JsArray.index 17 | elemental2.core.JsArray.length 18 | elemental2.core.JsArray.copyWithin.target 19 | elemental2.core.JsArray.copyWithin.start 20 | elemental2.core.JsArray.copyWithin.end 21 | elemental2.core.JsArray.fill.begin 22 | elemental2.core.JsArray.fill.end 23 | elemental2.core.JsArray.flat.depth 24 | elemental2.core.JsArray.findIndex 25 | elemental2.core.JsArray.findLastIndex 26 | elemental2.core.JsArray.includes.fromIndex 27 | elemental2.core.JsArray.indexOf 28 | elemental2.core.JsArray.indexOf.fromIndex 29 | elemental2.core.JsArray.lastIndexOf 30 | elemental2.core.JsArray.lastIndexOf.fromIndex 31 | elemental2.core.JsArray.push 32 | elemental2.core.JsArray.slice.begin 33 | elemental2.core.JsArray.slice.end 34 | elemental2.core.JsArray.splice.index 35 | elemental2.core.JsArray.splice.howMany 36 | elemental2.core.JsArray.unshift 37 | elemental2.core.JsArray.EveryCallbackFn.onInvoke.p1 38 | elemental2.core.JsArray.FilterCallbackFn.onInvoke.p1 39 | elemental2.core.JsArray.FindIndexPredicateFn.onInvoke.p1 40 | elemental2.core.JsArray.FindPredicateFn.onInvoke.p1 41 | elemental2.core.JsArray.ForEachCallbackFn.onInvoke.p1 42 | elemental2.core.JsArray.FromMapFn.onInvoke.p1 43 | elemental2.core.JsArray.MapCallbackFn.onInvoke.p1 44 | elemental2.core.JsArray.ReduceCallbackFn.onInvoke.p2 45 | elemental2.core.JsArray.ReduceRightCallbackFn.onInvoke.p2 46 | elemental2.core.JsArray.SomeCallbackFn.onInvoke.p1 47 | elemental2.core.ArrayBuffer.byteLength 48 | elemental2.core.ArrayBuffer.constructor.length 49 | elemental2.core.ArrayBuffer.slice.begin 50 | elemental2.core.ArrayBuffer.slice.end 51 | elemental2.core.ArrayBufferView.byteLength 52 | elemental2.core.ArrayBufferView.byteOffset 53 | elemental2.core.BigUint64Array.FromMapFn.onInvoke.index 54 | elemental2.core.BigInt64Array.FromMapFn.onInvoke.index 55 | elemental2.core.DataView.constructor.byteOffset 56 | elemental2.core.DataView.constructor.byteLength 57 | elemental2.core.DataView.getFloat32.byteOffset 58 | elemental2.core.DataView.getFloat64.byteOffset 59 | elemental2.core.DataView.getInt16 60 | elemental2.core.DataView.getInt16.byteOffset 61 | elemental2.core.DataView.getInt32 62 | elemental2.core.DataView.getInt32.byteOffset 63 | elemental2.core.DataView.getInt8 64 | elemental2.core.DataView.getInt8.byteOffset 65 | elemental2.core.DataView.getUint16 66 | elemental2.core.DataView.getUint16.byteOffset 67 | elemental2.core.DataView.getUint32 68 | elemental2.core.DataView.getUint32.byteOffset 69 | elemental2.core.DataView.getUint8 70 | elemental2.core.DataView.getUint8.byteOffset 71 | elemental2.core.DataView.setFloat32.byteOffset 72 | elemental2.core.DataView.setFloat64.byteOffset 73 | elemental2.core.DataView.setInt16.byteOffset 74 | elemental2.core.DataView.setInt32.byteOffset 75 | elemental2.core.DataView.setInt8.byteOffset 76 | elemental2.core.DataView.setUint16.byteOffset 77 | elemental2.core.DataView.setUint32.byteOffset 78 | elemental2.core.DataView.setUint8.byteOffset 79 | elemental2.core.JsDate.getDate 80 | elemental2.core.JsDate.getDay 81 | elemental2.core.JsDate.getFullYear 82 | elemental2.core.JsDate.getHours 83 | elemental2.core.JsDate.getMilliseconds 84 | elemental2.core.JsDate.getMinutes 85 | elemental2.core.JsDate.getMonth 86 | elemental2.core.JsDate.getSeconds 87 | elemental2.core.JsDate.getTimezoneOffset 88 | elemental2.core.JsDate.getUTCDate 89 | elemental2.core.JsDate.getUTCDay 90 | elemental2.core.JsDate.getUTCFullYear 91 | elemental2.core.JsDate.getUTCHours 92 | elemental2.core.JsDate.getUTCMilliseconds 93 | elemental2.core.JsDate.getUTCMinutes 94 | elemental2.core.JsDate.getUTCMonth 95 | elemental2.core.JsDate.getUTCSeconds 96 | elemental2.core.JsDate.getYear 97 | elemental2.core.JsDate.setDate.dayValue 98 | elemental2.core.JsDate.setFullYear.yearValue 99 | elemental2.core.JsDate.setFullYear.monthValue 100 | elemental2.core.JsDate.setFullYear.dayValue 101 | elemental2.core.JsDate.setHours.hoursValue 102 | elemental2.core.JsDate.setHours.minutesValue 103 | elemental2.core.JsDate.setHours.secondsValue 104 | elemental2.core.JsDate.setHours.msValue 105 | elemental2.core.JsDate.setMilliseconds.millisecondsValue 106 | elemental2.core.JsDate.setMinutes.minutesValue 107 | elemental2.core.JsDate.setMinutes.secondsValue 108 | elemental2.core.JsDate.setMinutes.msValue 109 | elemental2.core.JsDate.setMonth.monthValue 110 | elemental2.core.JsDate.setMonth.dayValue 111 | elemental2.core.JsDate.setSeconds.secondsValue 112 | elemental2.core.JsDate.setSeconds.msValue 113 | elemental2.core.JsDate.setUTCDate.dayValue 114 | elemental2.core.JsDate.setUTCFullYear.yearValue 115 | elemental2.core.JsDate.setUTCFullYear.monthValue 116 | elemental2.core.JsDate.setUTCFullYear.dayValue 117 | elemental2.core.JsDate.setUTCHours.hoursValue 118 | elemental2.core.JsDate.setUTCHours.minutesValue 119 | elemental2.core.JsDate.setUTCHours.secondsValue 120 | elemental2.core.JsDate.setUTCHours.msValue 121 | elemental2.core.JsDate.setUTCMilliseconds.millisecondsValue 122 | elemental2.core.JsDate.setUTCMinutes.minutesValue 123 | elemental2.core.JsDate.setUTCMinutes.secondsValue 124 | elemental2.core.JsDate.setUTCMinutes.msValue 125 | elemental2.core.JsDate.setUTCMonth.monthValue 126 | elemental2.core.JsDate.setUTCMonth.dayValue 127 | elemental2.core.JsDate.setUTCSeconds.secondsValue 128 | elemental2.core.JsDate.setUTCSeconds.msValue 129 | elemental2.core.JsDate.setYear.yearValue 130 | elemental2.core.Float32Array.BYTES_PER_ELEMENT 131 | elemental2.core.Float32Array.FromMapFn.onInvoke.index 132 | elemental2.core.Float32Array.constructor.byteOffset 133 | elemental2.core.Float32Array.constructor.length 134 | elemental2.core.Float32Array.constructor.length0 135 | elemental2.core.Float64Array.BYTES_PER_ELEMENT 136 | elemental2.core.Float64Array.FromMapFn.onInvoke.index 137 | elemental2.core.Float64Array.constructor.byteOffset 138 | elemental2.core.Float64Array.constructor.length 139 | elemental2.core.Float64Array.constructor.length0 140 | elemental2.core.Function.length 141 | elemental2.core.Global.parseInt 142 | elemental2.core.Global.parseInt.base 143 | elemental2.core.Int8Array.BYTES_PER_ELEMENT 144 | elemental2.core.Int8Array.FromMapFn.onInvoke.index 145 | elemental2.core.Int8Array.constructor.byteOffset 146 | elemental2.core.Int8Array.constructor.length 147 | elemental2.core.Int8Array.constructor.length0 148 | elemental2.core.Int16Array.BYTES_PER_ELEMENT 149 | elemental2.core.Int16Array.FromMapFn.onInvoke.index 150 | elemental2.core.Int16Array.constructor.byteOffset 151 | elemental2.core.Int16Array.constructor.length 152 | elemental2.core.Int16Array.constructor.length0 153 | elemental2.core.Int32Array.constructor.byteOffset 154 | elemental2.core.Int32Array.BYTES_PER_ELEMENT 155 | elemental2.core.Int32Array.FromMapFn.onInvoke.index 156 | elemental2.core.Int32Array.constructor.length 157 | elemental2.core.Int32Array.constructor.length0 158 | elemental2.core.JSONType.stringify.space 159 | elemental2.core.JsMath.ceil 160 | elemental2.core.JsMath.clz32 161 | elemental2.core.JsMath.clz32.value 162 | elemental2.core.JsMath.floor 163 | elemental2.core.JsMath.round 164 | elemental2.core.JsMath.trunc 165 | elemental2.core.JsNumber.parseInt 166 | elemental2.core.JsNumber.parseInt.radix 167 | elemental2.core.JsNumber.toFixed.digits 168 | elemental2.core.JsNumber.toString.radix 169 | elemental2.core.JsString.at.index 170 | elemental2.core.JsString.fromCharCode.var_args 171 | elemental2.core.JsString.fromCodePoint.codePoint 172 | elemental2.core.JsString.fromCodePoint.var_args 173 | elemental2.core.JsString.length 174 | elemental2.core.JsString.charAt.index 175 | elemental2.core.JsString.charCodeAt 176 | elemental2.core.JsString.charCodeAt.index 177 | elemental2.core.JsString.codePointAt 178 | elemental2.core.JsString.codePointAt.index 179 | elemental2.core.JsString.endsWith.position 180 | elemental2.core.JsString.fontsize.size 181 | elemental2.core.JsString.includes.position 182 | elemental2.core.JsString.indexOf 183 | elemental2.core.JsString.indexOf.fromIndex 184 | elemental2.core.JsString.lastIndexOf 185 | elemental2.core.JsString.lastIndexOf.fromIndex 186 | elemental2.core.JsString.localeCompare 187 | elemental2.core.JsString.padEnd.targetLength 188 | elemental2.core.JsString.padStart.targetLength 189 | elemental2.core.JsString.repeat.count 190 | elemental2.core.JsString.search 191 | elemental2.core.JsString.slice.begin 192 | elemental2.core.JsString.slice.end 193 | elemental2.core.JsString.split.limit 194 | elemental2.core.JsString.startsWith.position 195 | elemental2.core.JsString.substr.start 196 | elemental2.core.JsString.substr.length 197 | elemental2.core.JsString.substring.start 198 | elemental2.core.JsString.substring.end 199 | elemental2.core.JsMap.size 200 | elemental2.core.JsRegExp.lastIndex 201 | elemental2.core.JsSet.size 202 | elemental2.core.ReadonlyArray.at.index 203 | elemental2.core.ReadonlyArray.findIndex 204 | elemental2.core.ReadonlyArray.findLastIndex 205 | elemental2.core.ReadonlyArray.flat.depth 206 | elemental2.core.ReadonlyArray.includes.fromIndex 207 | elemental2.core.ReadonlyArray.indexOf 208 | elemental2.core.ReadonlyArray.indexOf.fromIndex 209 | elemental2.core.ReadonlyArray.lastIndexOf 210 | elemental2.core.ReadonlyArray.lastIndexOf.fromIndex 211 | elemental2.core.ReadonlyArray.slice.begin 212 | elemental2.core.ReadonlyArray.slice.end 213 | elemental2.core.ReadonlyArray.EveryCallbackFn.onInvoke.p1 214 | elemental2.core.ReadonlyArray.FilterCallbackFn.onInvoke.p1 215 | elemental2.core.ReadonlyArray.ForEachCallbackFn.onInvoke.p1 216 | elemental2.core.ReadonlyArray.MapCallbackFn.onInvoke.p1 217 | elemental2.core.ReadonlyArray.ReduceCallbackFn.onInvoke.p2 218 | elemental2.core.ReadonlyArray.ReduceRightCallbackFn.onInvoke.p2 219 | elemental2.core.ReadonlyArray.SomeCallbackFn.onInvoke.p1 220 | elemental2.core.RegExpResult.index 221 | elemental2.core.RegExpResult.length 222 | elemental2.core.SetLike.getSize 223 | elemental2.core.SetLike.setSize.size 224 | elemental2.core.TypedArray.at.index 225 | elemental2.core.TypedArray.BYTES_PER_ELEMENT 226 | elemental2.core.TypedArray.length 227 | elemental2.core.TypedArray.copyWithin.target 228 | elemental2.core.TypedArray.copyWithin.start 229 | elemental2.core.TypedArray.copyWithin.end 230 | elemental2.core.TypedArray.fill.begin 231 | elemental2.core.TypedArray.fill.end 232 | elemental2.core.TypedArray.findIndex 233 | elemental2.core.TypedArray.findLastIndex 234 | elemental2.core.TypedArray.includes.fromIndex 235 | elemental2.core.TypedArray.indexOf 236 | elemental2.core.TypedArray.indexOf.fromIndex 237 | elemental2.core.TypedArray.lastIndexOf 238 | elemental2.core.TypedArray.lastIndexOf.fromIndex 239 | elemental2.core.TypedArray.set.offset 240 | elemental2.core.TypedArray.slice.begin 241 | elemental2.core.TypedArray.slice.end 242 | elemental2.core.TypedArray.subarray.begin 243 | elemental2.core.TypedArray.subarray.end 244 | elemental2.core.Uint8Array.BYTES_PER_ELEMENT 245 | elemental2.core.Uint8Array.FromMapFn.onInvoke.index 246 | elemental2.core.Uint8Array.constructor.byteOffset 247 | elemental2.core.Uint8Array.constructor.length 248 | elemental2.core.Uint8Array.constructor.length0 249 | elemental2.core.Uint8ClampedArray.BYTES_PER_ELEMENT 250 | elemental2.core.Uint8ClampedArray.FromMapFn.onInvoke.index 251 | elemental2.core.Uint8ClampedArray.constructor.byteOffset 252 | elemental2.core.Uint8ClampedArray.constructor.length 253 | elemental2.core.Uint8ClampedArray.constructor.length0 254 | elemental2.core.Uint16Array.BYTES_PER_ELEMENT 255 | elemental2.core.Uint16Array.FromMapFn.onInvoke.index 256 | elemental2.core.Uint16Array.constructor.byteOffset 257 | elemental2.core.Uint16Array.constructor.length 258 | elemental2.core.Uint16Array.constructor.length0 259 | elemental2.core.Uint32Array.BYTES_PER_ELEMENT 260 | elemental2.core.Uint32Array.FromMapFn.onInvoke.index 261 | elemental2.core.Uint32Array.constructor.byteOffset 262 | elemental2.core.Uint32Array.constructor.length 263 | elemental2.core.Uint32Array.constructor.length0 264 | elemental2.core.SharedArrayBuffer.byteLength 265 | elemental2.core.SharedArrayBuffer.constructor.length 266 | -------------------------------------------------------------------------------- /java/elemental2/core/name_mappings.txt: -------------------------------------------------------------------------------- 1 | elemental2.core.BigInt64Array.FromMapFn.onInvoke.p0=element 2 | elemental2.core.BigInt64Array.FromMapFn.onInvoke.p1=index 3 | elemental2.core.BigUint64Array.FromMapFn.onInvoke.p0=element 4 | elemental2.core.BigUint64Array.FromMapFn.onInvoke.p1=index 5 | elemental2.core.Float32Array.FromMapFn.onInvoke.p0=element 6 | elemental2.core.Float32Array.FromMapFn.onInvoke.p1=index 7 | elemental2.core.Float64Array.FromMapFn.onInvoke.p0=element 8 | elemental2.core.Float64Array.FromMapFn.onInvoke.p1=index 9 | elemental2.core.Int16Array.FromMapFn.onInvoke.p0=element 10 | elemental2.core.Int16Array.FromMapFn.onInvoke.p1=index 11 | elemental2.core.Int32Array.FromMapFn.onInvoke.p0=element 12 | elemental2.core.Int32Array.FromMapFn.onInvoke.p1=index 13 | elemental2.core.Int8Array.FromMapFn.onInvoke.p0=element 14 | elemental2.core.Int8Array.FromMapFn.onInvoke.p1=index 15 | elemental2.core.Uint16Array.FromMapFn.onInvoke.p0=element 16 | elemental2.core.Uint16Array.FromMapFn.onInvoke.p1=index 17 | elemental2.core.Uint32Array.FromMapFn.onInvoke.p0=element 18 | elemental2.core.Uint32Array.FromMapFn.onInvoke.p1=index 19 | elemental2.core.Uint8Array.FromMapFn.onInvoke.p0=element 20 | elemental2.core.Uint8Array.FromMapFn.onInvoke.p1=index 21 | elemental2.core.Uint8ClampedArray.FromMapFn.onInvoke.p0=element 22 | elemental2.core.Uint8ClampedArray.FromMapFn.onInvoke.p1=index 23 | -------------------------------------------------------------------------------- /java/elemental2/core/wildcard_types.txt: -------------------------------------------------------------------------------- 1 | elemental2.core.JsSet.forEach.callback#0=SUPER 2 | elemental2.core.JsSet.ForEachCallbackFn.onInvoke.p2#0=EXTENDS 3 | elemental2.core.JsMap.forEach.callback#0=SUPER 4 | elemental2.core.JsMap.forEach.callback#1=SUPER 5 | elemental2.core.ReadonlyMap.forEach.callback#0=SUPER 6 | elemental2.core.ReadonlyMap.forEach.callback#1=SUPER 7 | -------------------------------------------------------------------------------- /java/elemental2/dom/BUILD: -------------------------------------------------------------------------------- 1 | # This package contains the build rule to build elemental2-dom. 2 | 3 | load( 4 | "//build_defs/internal_do_not_use:elemental_utils.bzl", 5 | "patch_extern_file", 6 | ) 7 | load("@rules_java//java:defs.bzl", "java_library") 8 | load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator") 9 | 10 | package( 11 | default_applicable_licenses = ["//:license"], 12 | default_visibility = [ 13 | "//:__subpackages__", 14 | ], 15 | # Apache2 16 | licenses = ["notice"], 17 | ) 18 | 19 | # Patches for w3c_dom2.js and window.js: Add standard api of Window object that are not defined in 20 | # w3c_dom*.js but in browsers specific extern files. We've tried to fix that in the extern 21 | # files directly (http://cl/124712783) but moving API from one file to another make things 22 | # typechecked differently (but correctly) and breaks several apps. This cl will be roll forward 23 | # when the broken apps get fixed and the patch should be deleted. 24 | patch_extern_file( 25 | name = "w3c_dom2_patched", 26 | src = "//third_party:w3c_dom2.js", 27 | patch_file = "w3c_dom2.js.diff", 28 | ) 29 | 30 | # Patch for window.js: 31 | # - Improve setTimeout, setInterval methods for generating better java API. 32 | # TODO(b/36558100): cleanup extern file directly 33 | patch_extern_file( 34 | name = "window_patched", 35 | src = "//third_party:window.js", 36 | patch_file = "window.js.diff", 37 | ) 38 | 39 | # Patch for w3c_rtc.js: 40 | # - Remove dependency to w3c_webcrypto.js 41 | # TODO(b/288249420): remove when namespaced type definitions are supported. 42 | patch_extern_file( 43 | name = "w3c_rtc_patched", 44 | src = "//third_party:w3c_rtc.js", 45 | patch_file = "w3c_rtc.js.diff", 46 | ) 47 | 48 | # Patch for w3c_css.js: 49 | # - Exclude StylePropertyMapReadonly api that are not released. 50 | # TODO(b/422164865): Remove the patch when a new jscompiler release containing the change is 51 | # installed. 52 | patch_extern_file( 53 | name = "w3c_css_patched", 54 | src = "//third_party:w3c_css.js", 55 | patch_file = "w3c_css.js.diff", 56 | ) 57 | 58 | filegroup( 59 | name = "externs", 60 | srcs = [ 61 | # file order matters. 62 | "//third_party:w3c_event.js", 63 | "//third_party:w3c_event3.js", 64 | "//third_party:w3c_device_sensor_event.js", 65 | "//third_party:w3c_touch_event.js", 66 | "//third_party:mediakeys.js", 67 | "//third_party:w3c_trusted_types.js", 68 | "//third_party:w3c_dom1.js", 69 | ":w3c_dom2_patched", 70 | "//third_party:w3c_dom3.js", 71 | "//third_party:w3c_dom4.js", 72 | "//third_party:w3c_batterystatus.js", 73 | "//third_party:w3c_fileapi.js", 74 | "//third_party:page_visibility.js", 75 | ":w3c_rtc_patched", 76 | "//third_party:html5.js", 77 | ":window_patched", 78 | "//third_party:w3c_range.js", 79 | "//third_party:w3c_geometry1.js", 80 | ":w3c_css_patched", 81 | "//third_party:w3c_css3d.js", 82 | "//third_party:w3c_xml.js", 83 | "//third_party:flash.js", 84 | "//third_party:w3c_anim_timing.js", 85 | # TODO(dramaix): remove old webkit api and rename file to w3c_notifications.js 86 | "//third_party:webkit_notifications.js", 87 | "//third_party:mediasource.js", 88 | "//third_party:streamsapi.js", 89 | "//third_party:url.js", 90 | "//third_party:w3c_abort.js", 91 | "//third_party:fetchapi.js", 92 | "//third_party:whatwg_console.js", 93 | "//third_party:whatwg_encoding.js", 94 | "//third_party:w3c_serviceworker.js", 95 | "//third_party:w3c_navigation_timing.js", 96 | "//third_party:w3c_clipboardevent.js", 97 | "//third_party:w3c_clipboard.js", 98 | "//third_party:w3c_composition_event.js", 99 | "//third_party:w3c_eventsource.js", 100 | "//third_party:w3c_elementtraversal.js", 101 | "//third_party:w3c_pointer_events.js", 102 | "//third_party:w3c_permissions.js", 103 | "//third_party:w3c_selection.js", 104 | "//third_party:w3c_selectors.js", 105 | "//third_party:w3c_geolocation.js", 106 | "//third_party:w3c_requestidlecallback.js", 107 | "//third_party:w3c_pointerlock.js", 108 | "//third_party:wicg_resizeobserver.js", 109 | "//third_party:wicg_attribution_reporting.js", 110 | "//third_party:wicg_entries.js", 111 | "//third_party:w3c_gamepad.js", 112 | ], 113 | ) 114 | 115 | java_library( 116 | name = "EventListenerCleaner", 117 | srcs = ["EventListenerCleaner.java"], 118 | visibility = ["//visibility:public"], 119 | deps = [ 120 | "//third_party:guava", 121 | "@com_google_jsinterop_generator//java/jsinterop/generator/model", 122 | ], 123 | ) 124 | 125 | # Dom part of elemental 126 | # order of files in srcs attributes matters! 127 | jsinterop_generator( 128 | name = "dom", 129 | srcs = [":externs"], 130 | custom_preprocessing_pass = [ 131 | "elemental2.dom.EventListenerCleaner", 132 | ], 133 | # override auto generated js_deps since modified externs cause conflicts 134 | externs_deps = [], 135 | integer_entities_files = ["integer_entities.txt"], 136 | name_mapping_files = ["name_mappings.txt"], 137 | runtime_deps = [ 138 | ":EventListenerCleaner", 139 | ], 140 | deps = [ 141 | "//java/elemental2/core", 142 | "//java/elemental2/promise", 143 | ], 144 | ) 145 | -------------------------------------------------------------------------------- /java/elemental2/dom/EventListenerCleaner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package elemental2.dom; 17 | 18 | import static com.google.common.base.Preconditions.checkState; 19 | import static com.google.common.collect.MoreCollectors.onlyElement; 20 | 21 | import jsinterop.generator.model.AbstractRewriter; 22 | import jsinterop.generator.model.AbstractVisitor; 23 | import jsinterop.generator.model.Method; 24 | import jsinterop.generator.model.ModelVisitor; 25 | import jsinterop.generator.model.Parameter; 26 | import jsinterop.generator.model.Program; 27 | import jsinterop.generator.model.Type; 28 | import jsinterop.generator.model.TypeReference; 29 | import jsinterop.generator.model.UnionTypeReference; 30 | 31 | /** Remove ambiguous addEventListener/removeEventListener EventTarget api. */ 32 | public class EventListenerCleaner implements ModelVisitor { 33 | private static final String EVENT_TARGET_FQN = "elemental2.dom.EventTarget"; 34 | 35 | @Override 36 | public void applyTo(Program program) { 37 | program.accept( 38 | new AbstractVisitor() { 39 | @Override 40 | public void exitType(Type type) { 41 | if (implementsEventTarget(type)) { 42 | type.getMethods().stream() 43 | .filter(EventListenerCleaner::isAddOrRemoveEventListenerMethods) 44 | .forEach(EventListenerCleaner::cleanEventListenerMethod); 45 | } 46 | } 47 | }); 48 | } 49 | 50 | /** Returns true if the type is the EventTarget type or if the type implements EventTarget. */ 51 | private static boolean implementsEventTarget(Type type) { 52 | return EVENT_TARGET_FQN.equals(type.getJavaFqn()) 53 | || type.getImplementedTypes().stream() 54 | .anyMatch(t -> EVENT_TARGET_FQN.equals(t.getJavaTypeFqn())); 55 | } 56 | 57 | private static void cleanEventListenerMethod(Method method) { 58 | checkState(method.getParameters().size() >= 2); 59 | 60 | Parameter listenerParameter = method.getParameters().get(1); 61 | 62 | method.accept( 63 | new AbstractRewriter() { 64 | @Override 65 | public Parameter rewriteParameter(Parameter node) { 66 | if (node != listenerParameter) { 67 | return node; 68 | } 69 | 70 | checkState(node.getType() instanceof UnionTypeReference); 71 | UnionTypeReference parameterType = (UnionTypeReference) node.getType(); 72 | 73 | TypeReference eventListenerType = 74 | parameterType.getTypes().stream() 75 | .filter(t -> "elemental2.dom.EventListener".equals(t.getJavaTypeFqn())) 76 | .collect(onlyElement()); 77 | 78 | Parameter newParameter = Parameter.from(node); 79 | newParameter.setType(eventListenerType); 80 | 81 | return newParameter; 82 | } 83 | }); 84 | } 85 | 86 | private static boolean isAddOrRemoveEventListenerMethods(Method m) { 87 | return "addEventListener".equals(m.getName()) || "removeEventListener".equals(m.getName()); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /java/elemental2/dom/integer_entities.txt: -------------------------------------------------------------------------------- 1 | elemental2.dom.Blob.size 2 | elemental2.dom.Blob.slice.length 3 | elemental2.dom.Blob.slice.start 4 | elemental2.dom.ByteLengthQueuingStrategy.size 5 | elemental2.dom.ByteLengthQueuingStrategy.SizeChunkType.getByteLength 6 | elemental2.dom.ByteLengthQueuingStrategy.SizeChunkType.setByteLength.byteLength 7 | elemental2.dom.CloseEventInit.getCode 8 | elemental2.dom.CloseEventInit.setCode.code 9 | elemental2.dom.CloseEvent.code 10 | elemental2.dom.CSSMediaRule.deleteRule.index 11 | elemental2.dom.CSSMediaRule.insertRule.index 12 | elemental2.dom.CSSPrimitiveValue.CSS_UNKNOWN 13 | elemental2.dom.CSSPrimitiveValue.CSS_NUMBER 14 | elemental2.dom.CSSPrimitiveValue.CSS_PERCENTAGE 15 | elemental2.dom.CSSPrimitiveValue.CSS_EMS 16 | elemental2.dom.CSSPrimitiveValue.CSS_EXS 17 | elemental2.dom.CSSPrimitiveValue.CSS_PX 18 | elemental2.dom.CSSPrimitiveValue.CSS_CM 19 | elemental2.dom.CSSPrimitiveValue.CSS_MM 20 | elemental2.dom.CSSPrimitiveValue.CSS_IN 21 | elemental2.dom.CSSPrimitiveValue.CSS_PT 22 | elemental2.dom.CSSPrimitiveValue.CSS_PC 23 | elemental2.dom.CSSPrimitiveValue.CSS_DEG 24 | elemental2.dom.CSSPrimitiveValue.CSS_RAD 25 | elemental2.dom.CSSPrimitiveValue.CSS_GRAD 26 | elemental2.dom.CSSPrimitiveValue.CSS_MS 27 | elemental2.dom.CSSPrimitiveValue.CSS_S 28 | elemental2.dom.CSSPrimitiveValue.CSS_HZ 29 | elemental2.dom.CSSPrimitiveValue.CSS_KHZ 30 | elemental2.dom.CSSPrimitiveValue.CSS_DIMENSION 31 | elemental2.dom.CSSPrimitiveValue.CSS_STRING 32 | elemental2.dom.CSSPrimitiveValue.CSS_URI 33 | elemental2.dom.CSSPrimitiveValue.CSS_IDENT 34 | elemental2.dom.CSSPrimitiveValue.CSS_ATTR 35 | elemental2.dom.CSSPrimitiveValue.CSS_COUNTER 36 | elemental2.dom.CSSPrimitiveValue.CSS_RECT 37 | elemental2.dom.CSSPrimitiveValue.CSS_RGBCOLOR 38 | elemental2.dom.CSSRule.type 39 | elemental2.dom.CSSRule.STYLE_RULE 40 | elemental2.dom.CSSRule.CHARSET_RULE 41 | elemental2.dom.CSSRule.IMPORT_RULE 42 | elemental2.dom.CSSRule.MEDIA_RULE 43 | elemental2.dom.CSSRule.FONT_FACE_RULE 44 | elemental2.dom.CSSRule.PAGE_RULE 45 | elemental2.dom.CSSRule.UNKNOWN_RULE 46 | elemental2.dom.CSSRule.type 47 | elemental2.dom.CSSRuleList.length 48 | elemental2.dom.CSSRuleList.item.index 49 | elemental2.dom.CSSStyleDeclaration.length 50 | elemental2.dom.CSSStyleDeclaration.item.index 51 | elemental2.dom.CSSStyleSheet.deleteRule.index 52 | elemental2.dom.CSSStyleSheet.insertRule 53 | elemental2.dom.CSSStyleSheet.insertRule.index 54 | elemental2.dom.CSSValue.CSS_INHERIT 55 | elemental2.dom.CSSValue.CSS_PRIMITIVE_VALUE 56 | elemental2.dom.CSSValue.CSS_VALUE_LIST 57 | elemental2.dom.CSSValue.CSS_CUSTOM 58 | elemental2.dom.CSSValueList.length 59 | elemental2.dom.CSSValueList.item.index 60 | elemental2.dom.BaseRenderingContext2D.createImageData.sh 61 | elemental2.dom.BaseRenderingContext2D.createImageData.sh 62 | elemental2.dom.BaseRenderingContext2D.createImageData.sh 63 | elemental2.dom.BaseRenderingContext2D.createImageData.sw 64 | elemental2.dom.BaseRenderingContext2D.createImageData.sw 65 | elemental2.dom.BaseRenderingContext2D.createImageData.sw 66 | elemental2.dom.BaseRenderingContext2D.getImageData.sh 67 | elemental2.dom.BaseRenderingContext2D.getImageData.sw 68 | elemental2.dom.BaseRenderingContext2D.getImageData.sx 69 | elemental2.dom.BaseRenderingContext2D.getImageData.sy 70 | elemental2.dom.BaseRenderingContext2D.putImageData.dirtyHeight 71 | elemental2.dom.BaseRenderingContext2D.putImageData.dirtyWidth 72 | elemental2.dom.BaseRenderingContext2D.putImageData.dirtyX 73 | elemental2.dom.BaseRenderingContext2D.putImageData.dirtyY 74 | elemental2.dom.BaseRenderingContext2D.putImageData.dx 75 | elemental2.dom.BaseRenderingContext2D.putImageData.dx 76 | elemental2.dom.BaseRenderingContext2D.putImageData.dy 77 | elemental2.dom.BaseRenderingContext2D.putImageData.dy 78 | elemental2.dom.CharacterData.deleteData.count 79 | elemental2.dom.CharacterData.deleteData.offset 80 | elemental2.dom.CharacterData.insertData.offset 81 | elemental2.dom.CharacterData.length 82 | elemental2.dom.CharacterData.replaceData.count 83 | elemental2.dom.CharacterData.replaceData.offset 84 | elemental2.dom.CharacterData.substringData.count 85 | elemental2.dom.CharacterData.substringData.offset 86 | elemental2.dom.ClientRectList.item.index 87 | elemental2.dom.ClientRectList.length 88 | elemental2.dom.ConstrainLongRange.getExact 89 | elemental2.dom.ConstrainLongRange.getIdeal 90 | elemental2.dom.ConstrainLongRange.setExact.exact 91 | elemental2.dom.ConstrainLongRange.setIdeal.ideal 92 | elemental2.dom.CountQueuingStrategy.size 93 | elemental2.dom.DataTransfer.setDragImage.y 94 | elemental2.dom.DataTransferItemList.length 95 | elemental2.dom.DataTransferItemList.remove.i 96 | elemental2.dom.Document.caretPositionFromPoint.x 97 | elemental2.dom.Document.caretPositionFromPoint.y 98 | elemental2.dom.Document.createTouch.identifier 99 | elemental2.dom.Document.childElementCount 100 | elemental2.dom.DocumentFragment.childElementCount 101 | elemental2.dom.ApplicationCache.CHECKING 102 | elemental2.dom.ApplicationCache.DOWNLOADING 103 | elemental2.dom.ApplicationCache.IDLE 104 | elemental2.dom.ApplicationCache.OBSOLETE 105 | elemental2.dom.ApplicationCache.UNCACHED 106 | elemental2.dom.ApplicationCache.UPDATEREADY 107 | elemental2.dom.ApplicationCache.status 108 | elemental2.dom.DOMError.SEVERITY_ERROR 109 | elemental2.dom.DOMError.SEVERITY_FATAL_ERROR 110 | elemental2.dom.DOMError.SEVERITY_WARNING 111 | elemental2.dom.DOMException.code 112 | elemental2.dom.DOMException.ABORT_ERR 113 | elemental2.dom.DOMException.DATA_CLONE_ERR 114 | elemental2.dom.DOMException.DOMSTRING_SIZE_ERR 115 | elemental2.dom.DOMException.HIERARCHY_REQUEST_ERR 116 | elemental2.dom.DOMException.INDEX_SIZE_ERR 117 | elemental2.dom.DOMException.INUSE_ATTRIBUTE_ERR 118 | elemental2.dom.DOMException.INVALID_ACCESS_ERR 119 | elemental2.dom.DOMException.INVALID_CHARACTER_ERR 120 | elemental2.dom.DOMException.INVALID_MODIFICATION_ERR 121 | elemental2.dom.DOMException.INVALID_NODE_TYPE_ERR 122 | elemental2.dom.DOMException.INVALID_STATE_ERR 123 | elemental2.dom.DOMException.NAMESPACE_ERR 124 | elemental2.dom.DOMException.NETWORK_ERR 125 | elemental2.dom.DOMException.NOT_FOUND_ERR 126 | elemental2.dom.DOMException.NOT_SUPPORTED_ERR 127 | elemental2.dom.DOMException.NO_DATA_ALLOWED_ERR 128 | elemental2.dom.DOMException.NO_MODIFICATION_ALLOWED_ERR 129 | elemental2.dom.DOMException.QUOTA_EXCEEDED_ERR 130 | elemental2.dom.DOMException.SECURITY_ERR 131 | elemental2.dom.DOMException.SYNTAX_ERR 132 | elemental2.dom.DOMException.TIMEOUT_ERR 133 | elemental2.dom.DOMException.TYPE_MISMATCH_ERR 134 | elemental2.dom.DOMException.URL_MISMATCH_ERR 135 | elemental2.dom.DOMException.VALIDATION_ERR 136 | elemental2.dom.DOMException.WRONG_DOCUMENT_ERR 137 | elemental2.dom.DOMStringList.length 138 | elemental2.dom.DOMStringList.item.index 139 | elemental2.dom.DOMTokenList.length 140 | elemental2.dom.DOMTokenList.item.index 141 | elemental2.dom.DOMImplementationList.length 142 | elemental2.dom.DOMImplementationList.item.index 143 | elemental2.dom.Element.ALLOW_KEYBOARD_INPUT 144 | elemental2.dom.Element.childElementCount 145 | elemental2.dom.Element.clientHeight 146 | elemental2.dom.Element.clientLeft 147 | elemental2.dom.Element.clientTop 148 | elemental2.dom.Element.clientWidth 149 | elemental2.dom.Element.hasPointerCapture.pointerId 150 | elemental2.dom.Element.releasePointerCapture.pointerId 151 | elemental2.dom.Element.setPointerCapture.pointerId 152 | elemental2.dom.Element.scrollHeight 153 | elemental2.dom.Element.scrollWidth 154 | elemental2.dom.Element.webkitRequestFullScreen.allowKeyboardInput 155 | elemental2.dom.Element.webkitRequestFullscreen.allowKeyboardInput 156 | elemental2.dom.ErrorEvent.colno 157 | elemental2.dom.ErrorEvent.lineno 158 | elemental2.dom.ErrorEventInit.getColno 159 | elemental2.dom.ErrorEventInit.setColno.colno 160 | elemental2.dom.ErrorEventInit.getLineno 161 | elemental2.dom.ErrorEventInit.setLineno.lineno 162 | elemental2.dom.Event.eventPhase 163 | elemental2.dom.Event.AT_TARGET 164 | elemental2.dom.Event.BUBBLING_PHASE 165 | elemental2.dom.Event.CAPTURING_PHASE 166 | elemental2.dom.EventSource.readyState 167 | elemental2.dom.EventSource.CLOSED 168 | elemental2.dom.EventSource.CONNECTING 169 | elemental2.dom.EventSource.OPEN 170 | elemental2.dom.FileList.length 171 | elemental2.dom.FileReader.readyState 172 | elemental2.dom.FileReader.DONE 173 | elemental2.dom.FileReader.EMPTY 174 | elemental2.dom.FileReader.LOADING 175 | elemental2.dom.Gamepad.index 176 | elemental2.dom.Geolocation.clearWatch.watchId 177 | elemental2.dom.Geolocation.watchPosition 178 | elemental2.dom.Highlight.priority 179 | elemental2.dom.History.go.delta 180 | elemental2.dom.History.length 181 | elemental2.dom.HTMLAnchorElement.tabIndex 182 | elemental2.dom.HTMLAreaElement.tabIndex 183 | elemental2.dom.HTMLButtonElement.tabIndex 184 | elemental2.dom.HTMLBaseFontElement.size 185 | elemental2.dom.HTMLCanvasElement.height 186 | elemental2.dom.HTMLCanvasElement.width 187 | elemental2.dom.HTMLCollection.length 188 | elemental2.dom.HTMLCollection.item.index 189 | elemental2.dom.HTMLElement.offsetHeight 190 | elemental2.dom.HTMLElement.offsetLeft 191 | elemental2.dom.HTMLElement.offsetTop 192 | elemental2.dom.HTMLElement.offsetWidth 193 | elemental2.dom.HTMLElement.tabIndex 194 | elemental2.dom.HTMLFormElement.length 195 | elemental2.dom.HTMLImageElement.height 196 | elemental2.dom.HTMLImageElement.hspace 197 | elemental2.dom.HTMLImageElement.naturalHeight 198 | elemental2.dom.HTMLImageElement.naturalWidth 199 | elemental2.dom.HTMLImageElement.vspace 200 | elemental2.dom.HTMLImageElement.width 201 | elemental2.dom.HTMLInputElement.maxLength 202 | elemental2.dom.HTMLInputElement.selectionEnd 203 | elemental2.dom.HTMLInputElement.selectionStart 204 | elemental2.dom.HTMLInputElement.setRangeText.end 205 | elemental2.dom.HTMLInputElement.setRangeText.start 206 | elemental2.dom.HTMLInputElement.setSelectionRange.end 207 | elemental2.dom.HTMLInputElement.setSelectionRange.start 208 | elemental2.dom.HTMLInputElement.size 209 | elemental2.dom.HTMLInputElement.stepDown.n 210 | elemental2.dom.HTMLInputElement.stepUp.n 211 | elemental2.dom.HTMLInputElement.tabIndex 212 | elemental2.dom.HTMLLIElement.value 213 | elemental2.dom.HTMLMediaElement.NETWORK_EMPTY 214 | elemental2.dom.HTMLMediaElement.NETWORK_IDLE 215 | elemental2.dom.HTMLMediaElement.NETWORK_LOADING 216 | elemental2.dom.HTMLMediaElement.NETWORK_NO_SOURCE 217 | elemental2.dom.HTMLMediaElement.networkState 218 | elemental2.dom.HTMLMediaElement.HAVE_NOTHING 219 | elemental2.dom.HTMLMediaElement.HAVE_METADATA 220 | elemental2.dom.HTMLMediaElement.HAVE_CURRENT_DATA 221 | elemental2.dom.HTMLMediaElement.HAVE_FUTURE_DATA 222 | elemental2.dom.HTMLMediaElement.HAVE_ENOUGH_DATA 223 | elemental2.dom.HTMLMediaElement.readyState 224 | elemental2.dom.HTMLObjectElement.hspace 225 | elemental2.dom.HTMLObjectElement.vspace 226 | elemental2.dom.HTMLObjectElement.tabIndex 227 | elemental2.dom.HTMLOListElement.start 228 | elemental2.dom.HTMLOptionElement.index 229 | elemental2.dom.HTMLOptionsCollection.length 230 | elemental2.dom.HTMLOptionsCollection.item.index 231 | elemental2.dom.HTMLPreElement.width 232 | elemental2.dom.HTMLSelectElement.length 233 | elemental2.dom.HTMLSelectElement.remove.index 234 | elemental2.dom.HTMLSelectElement.selectedIndex 235 | elemental2.dom.HTMLSelectElement.size 236 | elemental2.dom.HTMLTableCellElement.cellIndex 237 | elemental2.dom.HTMLTableCellElement.colSpan 238 | elemental2.dom.HTMLTableCellElement.rowSpan 239 | elemental2.dom.HTMLTableColElement.span 240 | elemental2.dom.HTMLTableElement.deleteRow.index 241 | elemental2.dom.HTMLTableElement.insertRow.index 242 | elemental2.dom.HTMLTableRowElement.deleteCell.index 243 | elemental2.dom.HTMLTableRowElement.insertCell.index 244 | elemental2.dom.HTMLTableRowElement.rowIndex 245 | elemental2.dom.HTMLTableRowElement.sectionRowIndex 246 | elemental2.dom.HTMLTableSectionElement.deleteRow.index 247 | elemental2.dom.HTMLTableSectionElement.insertRow.index 248 | elemental2.dom.HTMLTextAreaElement.cols 249 | elemental2.dom.HTMLTextAreaElement.maxLength 250 | elemental2.dom.HTMLTextAreaElement.minLength 251 | elemental2.dom.HTMLTextAreaElement.rows 252 | elemental2.dom.HTMLTextAreaElement.tabIndex 253 | elemental2.dom.HTMLTextAreaElement.textLength 254 | elemental2.dom.HTMLTrackElement.readyState 255 | elemental2.dom.HTMLVideoElement.cancelVideoFrameCallback.handle 256 | elemental2.dom.HTMLVideoElement.height 257 | elemental2.dom.HTMLVideoElement.requestVideoFrameCallback 258 | elemental2.dom.HTMLVideoElement.videoHeight 259 | elemental2.dom.HTMLVideoElement.videoWidth 260 | elemental2.dom.HTMLVideoElement.webkitDecodedFrameCount 261 | elemental2.dom.HTMLVideoElement.webkitDroppedFrameCount 262 | elemental2.dom.HTMLVideoElement.width 263 | elemental2.dom.IdleCallbackOptions.getTimeout 264 | elemental2.dom.IdleCallbackOptions.setTimeout.timeout 265 | elemental2.dom.ImageBitmap.getHeight 266 | elemental2.dom.ImageBitmap.getWidth 267 | elemental2.dom.ImageData.height 268 | elemental2.dom.ImageData.width 269 | elemental2.dom.KeyboardEvent.DOM_KEY_LOCATION_LEFT 270 | elemental2.dom.KeyboardEvent.DOM_KEY_LOCATION_NUMPAD 271 | elemental2.dom.KeyboardEvent.DOM_KEY_LOCATION_RIGHT 272 | elemental2.dom.KeyboardEvent.DOM_KEY_LOCATION_STANDARD 273 | elemental2.dom.KeyboardEvent.initKeyboardEvent.locationArg 274 | elemental2.dom.KeyboardEvent.location 275 | elemental2.dom.KeyboardEventInit.getLocation 276 | elemental2.dom.KeyboardEventInit.setLocation.location 277 | elemental2.dom.LongRange.getMax 278 | elemental2.dom.LongRange.setMax.max 279 | elemental2.dom.LongRange.getMin 280 | elemental2.dom.LongRange.setMin.min 281 | elemental2.dom.MediaError.MEDIA_ERR_ABORTED 282 | elemental2.dom.MediaError.MEDIA_ERR_DECODE 283 | elemental2.dom.MediaError.MEDIA_ERR_NETWORK 284 | elemental2.dom.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED 285 | elemental2.dom.MediaError.code 286 | elemental2.dom.MediaKeyStatusMap.getSize 287 | elemental2.dom.MediaList.length 288 | elemental2.dom.MediaList.item.index 289 | elemental2.dom.MediaRecorder.audioBitsPerSecond 290 | elemental2.dom.MediaRecorder.start.timeslice 291 | elemental2.dom.MediaRecorder.videoBitsPerSecond 292 | elemental2.dom.MediaRecorderOptions.getAudioBitsPerSecond 293 | elemental2.dom.MediaRecorderOptions.setAudioBitsPerSecond.audioBitsPerSecond 294 | elemental2.dom.MediaRecorderOptions.getBitsPerSecond 295 | elemental2.dom.MediaRecorderOptions.setBitsPerSecond.bitsPerSecond 296 | elemental2.dom.MediaRecorderOptions.getVideoBitsPerSecond 297 | elemental2.dom.MediaRecorderOptions.setVideoBitsPerSecond.videoBitsPerSecond 298 | elemental2.dom.MediaTrackCapabilities.getSampleSize 299 | elemental2.dom.MediaTrackCapabilities.setSampleSize.sampleSize 300 | elemental2.dom.MediaTrackConstraintSet.getChannelCount 301 | elemental2.dom.MediaTrackConstraintSet.getHeight 302 | elemental2.dom.MediaTrackConstraintSet.getSampleRate 303 | elemental2.dom.MediaTrackConstraintSet.getSampleSize 304 | elemental2.dom.MediaTrackConstraintSet.getWidth 305 | elemental2.dom.MediaTrackSettings.getHeight 306 | elemental2.dom.MediaTrackSettings.setHeight.height 307 | elemental2.dom.MediaTrackSettings.getSampleSize 308 | elemental2.dom.MediaTrackSettings.setSampleSize.sampleSize 309 | elemental2.dom.MediaTrackSettings.getWidth 310 | elemental2.dom.MediaTrackSettings.setWidth.width 311 | elemental2.dom.MimeTypeArray.length 312 | elemental2.dom.MimeTypeArray.item.index 313 | elemental2.dom.MouseEvent.button 314 | elemental2.dom.MouseEvent.buttons 315 | elemental2.dom.MouseEventInit.getButton 316 | elemental2.dom.MouseEventInit.setButton.button 317 | elemental2.dom.MouseEventInit.getButtons 318 | elemental2.dom.MouseEventInit.setButtons.buttons 319 | elemental2.dom.MutationEvent.attrChange 320 | elemental2.dom.MutationEvent.initMutationEvent.attrChangeArg 321 | elemental2.dom.NamedNodeMap.length 322 | elemental2.dom.NamedNodeMap.item.index 323 | elemental2.dom.Navigator.hardwareConcurrency 324 | elemental2.dom.Navigator.maxTouchPoints 325 | elemental2.dom.Node.compareDocumentPosition 326 | elemental2.dom.Node.nodeType 327 | elemental2.dom.Node.ATTRIBUTE_NODE 328 | elemental2.dom.Node.ELEMENT_NODE 329 | elemental2.dom.Node.ATTRIBUTE_NODE 330 | elemental2.dom.Node.TEXT_NODE 331 | elemental2.dom.Node.CDATA_SECTION_NODE 332 | elemental2.dom.Node.ENTITY_REFERENCE_NODE 333 | elemental2.dom.Node.ENTITY_NODE 334 | elemental2.dom.Node.PROCESSING_INSTRUCTION_NODE 335 | elemental2.dom.Node.COMMENT_NODE 336 | elemental2.dom.Node.DOCUMENT_NODE 337 | elemental2.dom.Node.DOCUMENT_TYPE_NODE 338 | elemental2.dom.Node.DOCUMENT_FRAGMENT_NODE 339 | elemental2.dom.Node.NOTATION_NODE 340 | elemental2.dom.Node.DOCUMENT_POSITION_DISCONNECTED 341 | elemental2.dom.Node.DOCUMENT_POSITION_PRECEDING 342 | elemental2.dom.Node.DOCUMENT_POSITION_FOLLOWING 343 | elemental2.dom.Node.DOCUMENT_POSITION_CONTAINS 344 | elemental2.dom.Node.DOCUMENT_POSITION_CONTAINED_BY 345 | elemental2.dom.Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC 346 | elemental2.dom.NodeList.length 347 | elemental2.dom.NodeList.item.index 348 | elemental2.dom.OffscreenCanvas.height 349 | elemental2.dom.OffscreenCanvas.width 350 | elemental2.dom.Performance.setResourceTimingBufferSize.maxSize 351 | elemental2.dom.PerformanceResourceTiming.decodedBodySize 352 | elemental2.dom.PerformanceResourceTiming.encodedBodySize 353 | elemental2.dom.PerformanceResourceTiming.transferSize 354 | elemental2.dom.Plugin.length 355 | elemental2.dom.PluginArray.length 356 | elemental2.dom.PluginArray.item.index 357 | elemental2.dom.PointerEvent.pointerId 358 | elemental2.dom.PointerEvent.tiltX 359 | elemental2.dom.PointerEvent.tiltY 360 | elemental2.dom.PointerEventInit.getPointerId 361 | elemental2.dom.PointerEventInit.setPointerId.pointerId 362 | elemental2.dom.PointerEventInit.getTiltX 363 | elemental2.dom.PointerEventInit.setTiltX.tiltX 364 | elemental2.dom.PointerEventInit.getTiltY 365 | elemental2.dom.PointerEventInit.setTiltY.tiltY 366 | elemental2.dom.Range.compareBoundaryPoints 367 | elemental2.dom.Range.compareBoundaryPoints.how 368 | elemental2.dom.Range.endOffset 369 | elemental2.dom.Range.setEnd.offset 370 | elemental2.dom.Range.setStart.offset 371 | elemental2.dom.Range.startOffset 372 | elemental2.dom.Range.END_TO_END 373 | elemental2.dom.Range.END_TO_START 374 | elemental2.dom.Range.START_TO_END 375 | elemental2.dom.Range.START_TO_START 376 | elemental2.dom.ReadableByteStreamController.getDesiredSize 377 | elemental2.dom.ReadableByteStreamController.setDesiredSize.desiredSize 378 | elemental2.dom.ReadableStreamDefaultController.getDesiredSize 379 | elemental2.dom.ReadableStreamDefaultController.setDesiredSize.desiredSize 380 | elemental2.dom.ReadableStreamSource.getAutoAllocateChunkSize 381 | elemental2.dom.ReadableStreamSource.setAutoAllocateChunkSize.autoAllocateChunkSize 382 | elemental2.dom.Response.status 383 | elemental2.dom.Response.redirect.status 384 | elemental2.dom.ResponseInit.getStatus 385 | elemental2.dom.ResponseInit.setStatus.status 386 | elemental2.dom.RTCDataChannel.getBufferedAmount 387 | elemental2.dom.RTCError.getHttpRequestStatusCode 388 | elemental2.dom.RTCError.getReceivedAlert 389 | elemental2.dom.RTCError.getSctpCauseCode 390 | elemental2.dom.RTCError.getSdpLineNumber 391 | elemental2.dom.RTCError.getSentAlert 392 | elemental2.dom.RTCEncodedVideoFrameMetadata.getFrameId 393 | elemental2.dom.RTCEncodedVideoFrameMetadata.setFrameId.frameId 394 | elemental2.dom.RTCEncodedVideoFrameMetadata.getHeight 395 | elemental2.dom.RTCEncodedVideoFrameMetadata.setHeight.height 396 | elemental2.dom.RTCEncodedVideoFrameMetadata.getPayloadType 397 | elemental2.dom.RTCEncodedVideoFrameMetadata.setPayloadType.payloadType 398 | elemental2.dom.RTCEncodedVideoFrameMetadata.getSpatialIndex 399 | elemental2.dom.RTCEncodedVideoFrameMetadata.setSpatialIndex.spatialIndex 400 | elemental2.dom.RTCEncodedVideoFrameMetadata.getTemporalIndex 401 | elemental2.dom.RTCEncodedVideoFrameMetadata.setTemporalIndex.temporalIndex 402 | elemental2.dom.RTCEncodedVideoFrameMetadata.getWidth 403 | elemental2.dom.RTCEncodedVideoFrameMetadata.setWidth.width 404 | elemental2.dom.RTCIceCandidate.sdpMLineIndex 405 | elemental2.dom.RTCIceCandidateInit.getSdpMLineIndex 406 | elemental2.dom.RTCIceCandidateInit.setSdpMLineIndex.sdpMLineIndex 407 | elemental2.dom.RTCInboundRtpStreamStats.getFrameHeight 408 | elemental2.dom.RTCInboundRtpStreamStats.getFramesDecoded 409 | elemental2.dom.RTCInboundRtpStreamStats.getFramesReceived 410 | elemental2.dom.RTCInboundRtpStreamStats.getFrameWidth 411 | elemental2.dom.RTCInboundRtpStreamStats.getFreezeCount 412 | elemental2.dom.RTCInboundRtpStreamStats.getFirCount 413 | elemental2.dom.RTCInboundRtpStreamStats.getKeyFramesDecoded 414 | elemental2.dom.RTCInboundRtpStreamStats.getNackCount 415 | elemental2.dom.RTCInboundRtpStreamStats.getPliCount 416 | elemental2.dom.RTCOutboundRtpStreamStats.getFrameHeight 417 | elemental2.dom.RTCOutboundRtpStreamStats.getFrameWidth 418 | elemental2.dom.RTCOutboundRtpStreamStats.getFramesEncoded 419 | elemental2.dom.RTCOutboundRtpStreamStats.getFirCount 420 | elemental2.dom.RTCOutboundRtpStreamStats.getNackCount 421 | elemental2.dom.RTCOutboundRtpStreamStats.getPliCount 422 | elemental2.dom.RTCReceivedRtpStreamStats.getFramesDropped 423 | elemental2.dom.RTCRtpCodecCapability.getChannels 424 | elemental2.dom.RTCRtpCodecCapability.getClockRate 425 | elemental2.dom.RTCRtpCodecCapability.setChannels.channels 426 | elemental2.dom.RTCRtpCodecCapability.setClockRate.clockRate 427 | elemental2.dom.RTCRtpStreamStats.getSsrc 428 | elemental2.dom.RTCSentRtpStreamStats.getBytesSent 429 | elemental2.dom.RTCSentRtpStreamStats.getPacketsSent 430 | elemental2.dom.RTCTransportStats.getSelectedCandidatePairChanges 431 | elemental2.dom.RTCVideoSourceStats.getFrames 432 | elemental2.dom.RTCVideoSourceStats.getFramesPerSecond 433 | elemental2.dom.RTCVideoSourceStats.getHeight 434 | elemental2.dom.RTCVideoSourceStats.getWidth 435 | elemental2.dom.Screen.availHeight 436 | elemental2.dom.Screen.availWidth 437 | elemental2.dom.Screen.colorDepth 438 | elemental2.dom.Screen.height 439 | elemental2.dom.Screen.pixelDepth 440 | elemental2.dom.Screen.width 441 | elemental2.dom.SecurityPolicyViolationEvent.columnNumber 442 | elemental2.dom.SecurityPolicyViolationEvent.lineNumber 443 | elemental2.dom.SecurityPolicyViolationEvent.statusCode 444 | elemental2.dom.SecurityPolicyViolationEventInit.getColumnNumber 445 | elemental2.dom.SecurityPolicyViolationEventInit.getLineNumber 446 | elemental2.dom.SecurityPolicyViolationEventInit.getStatusCode 447 | elemental2.dom.SecurityPolicyViolationEventInit.setColumnNumber.columnNumber 448 | elemental2.dom.SecurityPolicyViolationEventInit.setLineNumber.lineNumber 449 | elemental2.dom.SecurityPolicyViolationEventInit.setStatusCode.statusCode 450 | elemental2.dom.Selection.anchorOffset 451 | elemental2.dom.Selection.collapse.offset 452 | elemental2.dom.Selection.extend.offset 453 | elemental2.dom.Selection.focusOffset 454 | elemental2.dom.Selection.getRangeAt.index 455 | elemental2.dom.Selection.rangeCount 456 | elemental2.dom.Selection.setBaseAndExtent.anchorOffset 457 | elemental2.dom.Selection.setBaseAndExtent.focusOffset 458 | elemental2.dom.Selection.setPosition.offset 459 | elemental2.dom.SQLError.code 460 | elemental2.dom.SQLResultSet.insertId 461 | elemental2.dom.SQLResultSet.rowsAffected 462 | elemental2.dom.SQLResultSetRowList.length 463 | elemental2.dom.SQLResultSetRowList.item.index 464 | elemental2.dom.StyleSheetList.length 465 | elemental2.dom.StyleSheetList.item.index 466 | elemental2.dom.Text.splitText.offset 467 | elemental2.dom.TextTrackCueList.length 468 | elemental2.dom.TextTrackList.length 469 | elemental2.dom.TimeRanges.end.index 470 | elemental2.dom.TimeRanges.length 471 | elemental2.dom.TimeRanges.start.index 472 | elemental2.dom.Touch.identifier 473 | elemental2.dom.TouchInitDict.setIdentifier.identifier 474 | elemental2.dom.TouchInitDict.getIdentifier 475 | elemental2.dom.TouchList.length 476 | elemental2.dom.TouchList.item.index 477 | elemental2.dom.UIEvent.detail 478 | elemental2.dom.UIEvent.initUIEvent.detailArg 479 | elemental2.dom.UIEventInit.getDetail 480 | elemental2.dom.UIEventInit.setDetail.detail 481 | elemental2.dom.VideoFrameMetadata.getHeight 482 | elemental2.dom.VideoFrameMetadata.getPresentedFrames 483 | elemental2.dom.VideoFrameMetadata.getRtpTimestamp 484 | elemental2.dom.VideoFrameMetadata.getWidth 485 | elemental2.dom.VideoPlaybackQuality.getCorruptedVideoFrames 486 | elemental2.dom.VideoPlaybackQuality.setCorruptedVideoFrames.corruptedVideoFrames 487 | elemental2.dom.VideoPlaybackQuality.getDroppedVideoFrames 488 | elemental2.dom.VideoPlaybackQuality.setDroppedVideoFrames.droppedVideoFrames 489 | elemental2.dom.VideoPlaybackQuality.getTotalVideoFrames 490 | elemental2.dom.VideoPlaybackQuality.setTotalVideoFrames.totalVideoFrames 491 | elemental2.dom.VTTCue.size 492 | elemental2.dom.VTTRegion.lines 493 | elemental2.dom.WebSocket.CLOSED 494 | elemental2.dom.WebSocket.CLOSING 495 | elemental2.dom.WebSocket.CONNECTING 496 | elemental2.dom.WebSocket.OPEN 497 | elemental2.dom.WebSocket.bufferedAmount 498 | elemental2.dom.WebSocket.close.code 499 | elemental2.dom.WebSocket.readyState 500 | elemental2.dom.WheelEvent.DOM_DELTA_LINE 501 | elemental2.dom.WheelEvent.DOM_DELTA_PAGE 502 | elemental2.dom.WheelEvent.DOM_DELTA_PIXEL 503 | elemental2.dom.WheelEvent.deltaMode 504 | elemental2.dom.WheelEventInit.getDeltaMode 505 | elemental2.dom.WheelEventInit.setDeltaMode.deltaMode 506 | elemental2.dom.Window.innerHeight 507 | elemental2.dom.Window.innerWidth 508 | elemental2.dom.Window.length 509 | elemental2.dom.Window.moveBy.x 510 | elemental2.dom.Window.moveBy.y 511 | elemental2.dom.Window.moveTo.x 512 | elemental2.dom.Window.moveTo.y 513 | elemental2.dom.Window.openDatabase.size 514 | elemental2.dom.Window.outerHeight 515 | elemental2.dom.Window.outerWidth 516 | elemental2.dom.Window.resizeBy.x 517 | elemental2.dom.Window.resizeBy.y 518 | elemental2.dom.Window.resizeTo.x 519 | elemental2.dom.Window.resizeTo.y 520 | elemental2.dom.Window.screenX 521 | elemental2.dom.Window.screenY 522 | elemental2.dom.WritableStreamDefaultWriter.getDesiredSize 523 | elemental2.dom.WritableStreamDefaultWriter.setDesiredSize.desiredSize 524 | elemental2.dom.XMLHttpRequest.readyState 525 | elemental2.dom.XMLHttpRequest.status 526 | elemental2.dom.XMLHttpRequest.timeout 527 | elemental2.dom.XMLHttpRequest.DONE 528 | elemental2.dom.XMLHttpRequest.HEADERS_RECEIVED 529 | elemental2.dom.XMLHttpRequest.LOADING 530 | elemental2.dom.XMLHttpRequest.OPENED 531 | elemental2.dom.XMLHttpRequest.UNSENT 532 | elemental2.dom.XPathEvaluator.evaluate.type 533 | elemental2.dom.XPathExpression.evaluate.type 534 | elemental2.dom.XPathException.INVALID_EXPRESSION_ERR 535 | elemental2.dom.XPathException.TYPE_ERR 536 | elemental2.dom.XPathException.code 537 | elemental2.dom.XPathNamespace.XPATH_NAMESPACE_NODE 538 | elemental2.dom.XPathResult.resultType 539 | elemental2.dom.XPathResult.snapshotItem.index 540 | elemental2.dom.XPathResult.snapshotLength 541 | elemental2.dom.XPathResult.ANY_TYPE 542 | elemental2.dom.XPathResult.NUMBER_TYPE 543 | elemental2.dom.XPathResult.STRING_TYPE 544 | elemental2.dom.XPathResult.BOOLEAN_TYPE 545 | elemental2.dom.XPathResult.UNORDERED_NODE_ITERATOR_TYPE 546 | elemental2.dom.XPathResult.ORDERED_NODE_ITERATOR_TYPE 547 | elemental2.dom.XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE 548 | elemental2.dom.XPathResult.ORDERED_NODE_SNAPSHOT_TYPE 549 | elemental2.dom.XPathResult.ANY_UNORDERED_NODE_TYPE 550 | elemental2.dom.XPathResult.FIRST_ORDERED_NODE_TYPE 551 | elemental2.dom.DomGlobal.openDatabase.size 552 | elemental2.dom.DomGlobal.requestAnimationFrame 553 | elemental2.dom.DomGlobal.cancelAnimationFrame.handle 554 | elemental2.dom.DomGlobal.cancelIdleCallback.handle 555 | elemental2.dom.DomGlobal.requestIdleCallback.options 556 | elemental2.dom.DomGlobal.requestIdleCallback 557 | elemental2.dom.NodeList.ForEachCallbackFn.onInvoke.currentIndex 558 | elemental2.dom.WorkerNavigator.hardwareConcurrency 559 | elemental2.dom.WorkerGlobalScope.OnerrorFn.onInvoke.colno 560 | elemental2.dom.WorkerGlobalScope.OnerrorFn.onInvoke.lineno 561 | -------------------------------------------------------------------------------- /java/elemental2/dom/name_mappings.txt: -------------------------------------------------------------------------------- 1 | elemental2.dom.FrameRequestCallback.onInvoke.p0=timestamp 2 | elemental2.dom.DomGlobal.RequestIdleCallbackCallbackFn.onInvoke.p0=deadline 3 | elemental2.dom.NodeList.ForEachCallbackFn.onInvoke.p0=currentValue 4 | elemental2.dom.NodeList.ForEachCallbackFn.onInvoke.p1=currentIndex 5 | elemental2.dom.NodeList.ForEachCallbackFn.onInvoke.p2=listObj 6 | elemental2.dom.URLSearchParams.ForEachCallbackFn.onInvoke.p0=value 7 | elemental2.dom.URLSearchParams.ForEachCallbackFn.onInvoke.p1=key 8 | elemental2.dom.VideoFrameRequestCallback.onInvoke.p0=now 9 | elemental2.dom.VideoFrameRequestCallback.onInvoke.p1=metadata 10 | elemental2.dom.WorkerGlobalScope.OnerrorFn.onInvoke.p0=event 11 | elemental2.dom.WorkerGlobalScope.OnerrorFn.onInvoke.p1=source 12 | elemental2.dom.WorkerGlobalScope.OnerrorFn.onInvoke.p2=lineno 13 | elemental2.dom.WorkerGlobalScope.OnerrorFn.onInvoke.p3=colno 14 | elemental2.dom.WorkerGlobalScope.OnerrorFn.onInvoke.p4=error 15 | elemental2.dom.WebSocket.OnopenFn.onInvoke.p0=event 16 | elemental2.dom.WebSocket.OnmessageFn.onInvoke.p0=event 17 | elemental2.dom.WebSocket.OncloseFn.onInvoke.p0=event 18 | -------------------------------------------------------------------------------- /java/elemental2/dom/w3c_css.js.diff: -------------------------------------------------------------------------------- 1 | 299,324d298 2 | < 3 | < /** 4 | < * @constructor 5 | < * @see https://developer.mozilla.org/docs/Web/API/StylePropertyMap 6 | < */ 7 | < function StylePropertyMapReadonly() {} 8 | < 9 | < /** 10 | < * @const {number} 11 | < * @see https://developer.mozilla.org/docs/Web/API/StylePropertyMapReadOnly/size 12 | < */ 13 | < StylePropertyMapReadonly.prototype.size; 14 | < 15 | < /** 16 | < * @param {string} property 17 | < * @return {(!CSSStyleValue|undefined)} 18 | < * @see https://developer.mozilla.org/docs/Web/API/StylePropertyMapReadOnly/get 19 | < */ 20 | < StylePropertyMapReadonly.prototype.get = function(property) {} 21 | < 22 | < /** 23 | < * @param {string} property 24 | < * @return {!Array} 25 | < * @see https://developer.mozilla.org/docs/Web/API/StylePropertyMapReadOnly/getAll 26 | < */ 27 | < StylePropertyMapReadonly.prototype.getAll = function(property) {} 28 | 327,340d300 29 | < * @param {string} property 30 | < * @return {boolean} 31 | < * @see https://developer.mozilla.org/docs/Web/API/StylePropertyMapReadOnly/has 32 | < */ 33 | < StylePropertyMapReadonly.prototype.has = function(property) {} 34 | < 35 | < /** 36 | < * @param {function(!Array, string, !StylePropertyMapReadOnly): void} callbackfn 37 | < * @param {*=} opt_thisArg 38 | < * @see https://developer.mozilla.org/docs/Web/API/StylePropertyMapReadOnly/forEach 39 | < */ 40 | < StylePropertyMapReadonly.prototype.forEach = function(callbackfn, opt_thisArg) {} 41 | < 42 | < /** 43 | -------------------------------------------------------------------------------- /java/elemental2/dom/w3c_dom2.js.diff: -------------------------------------------------------------------------------- 1 | 709d708 2 | < * @implements {IObject)>} 3 | 718c717 4 | < * @return {T|RadioNodeList|null} 5 | --- 6 | > * @return {T|null} 7 | -------------------------------------------------------------------------------- /java/elemental2/dom/w3c_rtc.js.diff: -------------------------------------------------------------------------------- 1 | 3367c3367 2 | < * @param {!webCrypto.AlgorithmIdentifier|!RTCCertificateExpiration} keygenAlgorithm 3 | --- 4 | > * @param {*} keygenAlgorithm 5 | -------------------------------------------------------------------------------- /java/elemental2/dom/window.js.diff: -------------------------------------------------------------------------------- 1 | 147c147 2 | < * @param {Function|!TrustedScript|string} callback 3 | --- 4 | > * @param {function(...?):undefined|!TrustedScript|string} callback 5 | 157c157 6 | < * @param {Function|!TrustedScript|string} callback 7 | --- 8 | > * @param {function(...?):undefined|!TrustedScript|string} callback 9 | -------------------------------------------------------------------------------- /java/elemental2/indexeddb/BUILD: -------------------------------------------------------------------------------- 1 | # This package contains the build rule to build elemental2-indexeddb. 2 | 3 | load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator") 4 | 5 | package( 6 | default_applicable_licenses = ["//:license"], 7 | default_visibility = [ 8 | "//:__subpackages__", 9 | ], 10 | # Apache2 11 | licenses = ["notice"], 12 | ) 13 | 14 | filegroup( 15 | name = "externs", 16 | srcs = ["//third_party:w3c_indexeddb.js"], 17 | ) 18 | 19 | jsinterop_generator( 20 | name = "indexeddb", 21 | srcs = [":externs"], 22 | custom_preprocessing_pass = [ 23 | "elemental2.dom.EventListenerCleaner", 24 | ], 25 | extension_type_prefix = "IndexedDb", 26 | # override auto generated js_deps in order not to provide extern files 27 | # Common extern file are included by default. 28 | externs_deps = [], 29 | integer_entities_files = ["integer_entities.txt"], 30 | runtime_deps = [ 31 | "//java/elemental2/dom:EventListenerCleaner", 32 | ], 33 | deps = [ 34 | "//java/elemental2/core", 35 | "//java/elemental2/dom", 36 | "//java/elemental2/promise", 37 | ], 38 | ) 39 | -------------------------------------------------------------------------------- /java/elemental2/indexeddb/integer_entities.txt: -------------------------------------------------------------------------------- 1 | elemental2.indexeddb.IDBCursor.advance.count 2 | elemental2.indexeddb.IDBFactory.cmp 3 | elemental2.indexeddb.IDBIndex.getAll.count 4 | elemental2.indexeddb.IDBIndex.getAllKeys.count 5 | elemental2.indexeddb.IDBObjectStore.getAll.count 6 | elemental2.indexeddb.IDBObjectStore.getAllKeys.count 7 | -------------------------------------------------------------------------------- /java/elemental2/media/BUILD: -------------------------------------------------------------------------------- 1 | # This package contains the build rule to build elemental2-media. 2 | 3 | load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator") 4 | 5 | package( 6 | default_applicable_licenses = ["//:license"], 7 | default_visibility = [ 8 | "//:__subpackages__", 9 | ], 10 | # Apache2 11 | licenses = ["notice"], 12 | ) 13 | 14 | filegroup( 15 | name = "externs", 16 | srcs = [ 17 | "//third_party:w3c_audio.js", 18 | "//third_party:w3c_worklets.js", 19 | ], 20 | ) 21 | 22 | jsinterop_generator( 23 | name = "media", 24 | srcs = [":externs"], 25 | custom_preprocessing_pass = [ 26 | "elemental2.dom.EventListenerCleaner", 27 | ], 28 | # override auto generated js_deps in order not to provide extern files 29 | # Common extern file are included by default. 30 | externs_deps = [], 31 | integer_entities_files = ["integer_entities.txt"], 32 | runtime_deps = [ 33 | "//java/elemental2/dom:EventListenerCleaner", 34 | ], 35 | deps = [ 36 | "//java/elemental2/core", 37 | "//java/elemental2/dom", 38 | "//java/elemental2/promise", 39 | ], 40 | ) 41 | -------------------------------------------------------------------------------- /java/elemental2/media/integer_entities.txt: -------------------------------------------------------------------------------- 1 | elemental2.media.AnalyserNode.fftSize 2 | elemental2.media.AnalyserNode.frequencyBinCount 3 | elemental2.media.AudioNode.numberOfInputs 4 | elemental2.media.AudioNode.numberOfOutputs 5 | elemental2.media.AudioNode.channelCount 6 | elemental2.media.AudioNode.connect.output 7 | elemental2.media.AudioNode.connect.input 8 | elemental2.media.AudioNode.connect.output 9 | elemental2.media.AudioNode.disconnect.output 10 | elemental2.media.AudioNode.disconnect.output 11 | elemental2.media.AudioNode.disconnect.output 12 | elemental2.media.AudioNode.disconnect.input 13 | elemental2.media.AudioNode.disconnect.output 14 | elemental2.media.AudioBuffer.copyFromChannel.channelNumber 15 | elemental2.media.AudioBuffer.copyFromChannel.startInChannel 16 | elemental2.media.AudioBuffer.copyToChannel.channelNumber 17 | elemental2.media.AudioBuffer.copyToChannel.startInChannel 18 | elemental2.media.AudioBuffer.getChannelData.channel 19 | elemental2.media.AudioBuffer.length 20 | elemental2.media.AudioBuffer.numberOfChannels 21 | elemental2.media.AudioContext.createJavaScriptNode.bufferSize 22 | elemental2.media.AudioContext.createJavaScriptNode.numberOfInputs 23 | elemental2.media.AudioContext.createJavaScriptNode.numberOfOuputs 24 | elemental2.media.BaseAudioContext.createBuffer.numberOfChannels 25 | elemental2.media.BaseAudioContext.createBuffer.length 26 | elemental2.media.BaseAudioContext.createChannelMerger.numberOfInputs 27 | elemental2.media.BaseAudioContext.createChannelSplitter.numberOfOutputs 28 | elemental2.media.BaseAudioContext.createScriptProcessor.bufferSize 29 | elemental2.media.BaseAudioContext.createScriptProcessor.numberOfInputChannels_opt 30 | elemental2.media.BaseAudioContext.createScriptProcessor.numberOfOutputChannels_opt 31 | elemental2.media.ChannelMergerOptions.getChannelCount 32 | elemental2.media.ChannelMergerOptions.getNumberOfInputs 33 | elemental2.media.ChannelMergerOptions.setChannelCount.channelCount 34 | elemental2.media.ChannelMergerOptions.setNumberOfInputs.numberOfInputs 35 | elemental2.media.ChannelSplitterOptions.getChannelCount 36 | elemental2.media.ChannelSplitterOptions.getNumberOfOutputs 37 | elemental2.media.ChannelSplitterOptions.setChannelCount.channelCount 38 | elemental2.media.ChannelSplitterOptions.setNumberOfOutputs.numberOfOutputs 39 | elemental2.media.JavaScriptAudioNode.bufferSize 40 | elemental2.media.OfflineAudioContext.constructor.length 41 | elemental2.media.OfflineAudioContext.constructor.numberOfChannels 42 | elemental2.media.ScriptProcessorNode.bufferSize 43 | -------------------------------------------------------------------------------- /java/elemental2/promise/BUILD: -------------------------------------------------------------------------------- 1 | # This package contains the harcoded source for Promise API. 2 | # This API is hard to generate automaticaly with the JsInterop generator 3 | # and the resulting API is not user friendly 4 | 5 | load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library") 6 | load("@com_google_jsinterop_generator//:jsinterop_generator_import.bzl", "jsinterop_generator_import") 7 | 8 | package( 9 | default_applicable_licenses = ["//:license"], 10 | default_visibility = [ 11 | "//:__subpackages__", 12 | ], 13 | # Apache2 14 | licenses = ["notice"], 15 | ) 16 | 17 | jsinterop_generator_import( 18 | name = "promise", 19 | srcs = glob(["*.java"]), 20 | enable_jspecify_support = True, 21 | gwt_module_name = "elemental2.promise.Promise", 22 | gwt_xml = "Promise.gwt.xml", 23 | types_mapping_files = ["promise.types"], 24 | ) 25 | 26 | javadoc_library( 27 | name = "promise-javadoc", 28 | srcs = glob(["*.java"]), 29 | tags = [ 30 | "manual", 31 | "notap", 32 | ], 33 | deps = [ 34 | "@com_google_j2cl//:jsinterop-annotations", 35 | "@com_google_jsinterop_base//:jsinterop-base", 36 | "@com_google_jsinterop_generator//third_party:jspecify_annotations", 37 | ], 38 | ) 39 | -------------------------------------------------------------------------------- /java/elemental2/promise/IThenable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | * 16 | */ 17 | package elemental2.promise; 18 | import jsinterop.annotations.JsFunction; 19 | import jsinterop.annotations.JsPackage; 20 | import jsinterop.annotations.JsType; 21 | import org.jspecify.annotations.NullMarked; 22 | import org.jspecify.annotations.Nullable; 23 | 24 | /** 25 | * Base contract of IThenable promise provided for compatibility with non-official Promise 26 | * implementations. 27 | */ 28 | @JsType(isNative = true, namespace = JsPackage.GLOBAL) 29 | @NullMarked 30 | public interface IThenable { 31 | @JsFunction 32 | interface ThenOnFulfilledCallbackFn { 33 | @Nullable IThenable onInvoke(T p0); 34 | } 35 | 36 | @JsFunction 37 | interface ThenOnRejectedCallbackFn { 38 | @Nullable IThenable onInvoke(Object p0); 39 | } 40 | 41 | IThenable then( 42 | @Nullable ThenOnFulfilledCallbackFn onFulfilled); 43 | 44 | IThenable then( 45 | @Nullable ThenOnFulfilledCallbackFn onFulfilled, 46 | @Nullable ThenOnRejectedCallbackFn onRejected); 47 | } 48 | -------------------------------------------------------------------------------- /java/elemental2/promise/Promise.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /java/elemental2/promise/Promise.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | * 16 | */ 17 | package elemental2.promise; 18 | 19 | import jsinterop.annotations.JsFunction; 20 | import jsinterop.annotations.JsMethod; 21 | import jsinterop.annotations.JsOverlay; 22 | import jsinterop.annotations.JsPackage; 23 | import jsinterop.annotations.JsType; 24 | import jsinterop.base.Js; 25 | import org.jspecify.annotations.NullMarked; 26 | import org.jspecify.annotations.Nullable; 27 | 28 | /** 29 | * The Promise object is used for asynchronous computations. A Promise represents a value which may 30 | * be available now, or in the future, or never. 31 | * 32 | * @see Promise 34 | */ 35 | @JsType(isNative = true, namespace = JsPackage.GLOBAL) 36 | @NullMarked 37 | public class Promise implements IThenable { 38 | @JsFunction 39 | public interface FinallyOnFinallyCallbackFn { 40 | void onInvoke(); 41 | } 42 | 43 | @JsFunction 44 | public interface CatchOnRejectedCallbackFn { 45 | @Nullable IThenable onInvoke(Object error); 46 | } 47 | 48 | @JsFunction 49 | public interface PromiseExecutorCallbackFn { 50 | @JsFunction 51 | interface RejectCallbackFn { 52 | void onInvoke(Object error); 53 | } 54 | 55 | @JsFunction 56 | interface ResolveCallbackFn { 57 | @JsType(isNative = true, name = "?", namespace = JsPackage.GLOBAL) 58 | interface ResolveUnionType { 59 | @JsOverlay 60 | static @Nullable ResolveUnionType of(@Nullable Object o) { 61 | return Js.cast(o); 62 | } 63 | 64 | @JsOverlay 65 | default @Nullable IThenable asIThenable() { 66 | return Js.cast(this); 67 | } 68 | 69 | @JsOverlay 70 | default @Nullable T asT() { 71 | return Js.cast(this); 72 | } 73 | } 74 | 75 | @JsOverlay 76 | default void onInvoke(@Nullable IThenable value) { 77 | onInvoke(Js.>uncheckedCast(value)); 78 | } 79 | 80 | void onInvoke(@Nullable ResolveUnionType p0); 81 | 82 | @JsOverlay 83 | default void onInvoke(@Nullable T value) { 84 | onInvoke(Js.>uncheckedCast(value)); 85 | } 86 | } 87 | 88 | void onInvoke(ResolveCallbackFn resolve, RejectCallbackFn reject); 89 | } 90 | 91 | @JsType(isNative = true, name = "?", namespace = JsPackage.GLOBAL) 92 | public interface ResolveValueUnionType { 93 | @JsOverlay 94 | static @Nullable ResolveValueUnionType of(@Nullable Object o) { 95 | return Js.cast(o); 96 | } 97 | 98 | @JsOverlay 99 | default @Nullable IThenable asIThenable() { 100 | return Js.cast(this); 101 | } 102 | 103 | @JsOverlay 104 | default @Nullable V asV() { 105 | return Js.cast(this); 106 | } 107 | } 108 | 109 | @JsOverlay 110 | public static Promise all(IThenable... promises) { 111 | return allInternal(promises); 112 | } 113 | 114 | @JsMethod(name = "all") 115 | private static native Promise allInternal( 116 | IThenable[] promises); 117 | 118 | @JsOverlay 119 | public static Promise race(IThenable... promises) { 120 | return raceInternal(promises); 121 | } 122 | 123 | @JsMethod(name = "race") 124 | private static native Promise raceInternal( 125 | IThenable[] promises); 126 | 127 | public static native Promise reject(@Nullable Object error); 128 | 129 | @JsOverlay 130 | public static final Promise resolve( 131 | @Nullable IThenable value) { 132 | return resolve(Js.>uncheckedCast(value)); 133 | } 134 | 135 | public static native Promise resolve( 136 | @Nullable ResolveValueUnionType value); 137 | 138 | @JsOverlay 139 | public static final Promise resolve(@Nullable V value) { 140 | return resolve(Js.>uncheckedCast(value)); 141 | } 142 | 143 | public Promise(PromiseExecutorCallbackFn executor) {} 144 | 145 | @JsMethod(name = "catch") 146 | public native Promise catch_( 147 | CatchOnRejectedCallbackFn onRejected); 148 | 149 | @Override 150 | public native Promise then( 151 | @Nullable ThenOnFulfilledCallbackFn onFulfilled, 152 | @Nullable ThenOnRejectedCallbackFn onRejected); 153 | 154 | @Override 155 | public native Promise then( 156 | @Nullable ThenOnFulfilledCallbackFn onFulfilled); 157 | 158 | @JsMethod(name = "finally") 159 | public native Promise finally_(FinallyOnFinallyCallbackFn onFinally); 160 | } 161 | -------------------------------------------------------------------------------- /java/elemental2/promise/promise.types: -------------------------------------------------------------------------------- 1 | IThenable=elemental2.promise.IThenable 2 | Promise=elemental2.promise.Promise -------------------------------------------------------------------------------- /java/elemental2/svg/BUILD: -------------------------------------------------------------------------------- 1 | # This package contains the build rule to build elemental2-svg. 2 | 3 | load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator") 4 | 5 | package( 6 | default_applicable_licenses = ["//:license"], 7 | default_visibility = [ 8 | "//:__subpackages__", 9 | ], 10 | # Apache2 11 | licenses = ["notice"], 12 | ) 13 | 14 | filegroup( 15 | name = "externs", 16 | srcs = ["//third_party:svg.js"], 17 | ) 18 | 19 | # SVG api 20 | jsinterop_generator( 21 | name = "svg", 22 | srcs = [":externs"], 23 | custom_preprocessing_pass = [ 24 | "elemental2.dom.EventListenerCleaner", 25 | ], 26 | # override auto generated js_deps since modified externs cause conflicts 27 | externs_deps = [], 28 | integer_entities_files = ["integer_entities.txt"], 29 | runtime_deps = [ 30 | "//java/elemental2/dom:EventListenerCleaner", 31 | ], 32 | deps = [ 33 | "//java/elemental2/core", 34 | "//java/elemental2/dom", 35 | ], 36 | ) 37 | -------------------------------------------------------------------------------- /java/elemental2/svg/integer_entities.txt: -------------------------------------------------------------------------------- 1 | elemental2.svg.SVGTextContentElement.getNumberOfChars 2 | elemental2.svg.SVGTextContentElement.getSubStringLength.offset 3 | elemental2.svg.SVGTextContentElement.getSubStringLength.length 4 | elemental2.svg.SVGTextContentElement.getStartPositionOfChar.offset 5 | elemental2.svg.SVGTextContentElement.getEndPositionOfChar.offset 6 | elemental2.svg.SVGTextContentElement.getExtentOfChar.offset 7 | elemental2.svg.SVGTextContentElement.getRotationOfChar.offset 8 | elemental2.svg.SVGTextContentElement.getCharNumAtPosition 9 | elemental2.svg.SVGTextContentElement.selectSubString.offset 10 | elemental2.svg.SVGTextContentElement.selectSubString.length 11 | elemental2.svg.SVGAngle.convertToSpecifiedUnits.unitType 12 | elemental2.svg.SVGAngle.newValueSpecifiedUnits.unitType 13 | elemental2.svg.SVGAngle.unitType 14 | elemental2.svg.SVGAnimatedEnumeration.animVal 15 | elemental2.svg.SVGAnimatedEnumeration.baseVal 16 | elemental2.svg.SVGAnimatedInteger.animVal 17 | elemental2.svg.SVGAnimatedInteger.baseVal 18 | elemental2.svg.SVGElement.tabIndex 19 | elemental2.svg.SVGElementInstanceList.length 20 | elemental2.svg.SVGElementInstanceList.item.index 21 | elemental2.svg.SVGLength.convertToSpecifiedUnits.unitType 22 | elemental2.svg.SVGLength.newValueSpecifiedUnits.unitType 23 | elemental2.svg.SVGLength.unitType 24 | elemental2.svg.SVGLengthList.getItem.index 25 | elemental2.svg.SVGLengthList.insertItemBefore.index 26 | elemental2.svg.SVGLengthList.numberOfItems 27 | elemental2.svg.SVGLengthList.removeItem.index 28 | elemental2.svg.SVGLengthList.replaceItem.index 29 | elemental2.svg.SVGNumberList.getItem.index 30 | elemental2.svg.SVGNumberList.insertItemBefore.index 31 | elemental2.svg.SVGNumberList.numberOfItems 32 | elemental2.svg.SVGNumberList.removeItem.index 33 | elemental2.svg.SVGNumberList.replaceItem.index 34 | elemental2.svg.SVGPathElement.getPathSegAtLength 35 | elemental2.svg.SVGPathElement.getTotalLength 36 | elemental2.svg.SVGPathSegList.getItem.index 37 | elemental2.svg.SVGPathSegList.insertItemBefore.index 38 | elemental2.svg.SVGPathSegList.numberOfItems 39 | elemental2.svg.SVGPathSegList.removeItem.index 40 | elemental2.svg.SVGPathSegList.replaceItem.index 41 | elemental2.svg.SVGPointList.getItem.index 42 | elemental2.svg.SVGPointList.insertItemBefore.index 43 | elemental2.svg.SVGPointList.numberOfItems 44 | elemental2.svg.SVGPointList.removeItem.index 45 | elemental2.svg.SVGPointList.replaceItem.index 46 | elemental2.svg.SVGPreserveAspectRatio.align 47 | elemental2.svg.SVGPreserveAspectRatio.meetOrSlice 48 | elemental2.svg.SVGStringList.getItem.index 49 | elemental2.svg.SVGStringList.insertItemBefore.index 50 | elemental2.svg.SVGStringList.numberOfItems 51 | elemental2.svg.SVGStringList.removeItem.index 52 | elemental2.svg.SVGStringList.replaceItem.index 53 | elemental2.svg.SVGSVGElement.suspendRedraw 54 | elemental2.svg.SVGSVGElement.suspendRedraw.maxWaitMilliseconds 55 | elemental2.svg.SVGSVGElement.unsuspendRedraw.suspendHandleId 56 | elemental2.svg.SVGTextContentElement.getComputedTextLength 57 | elemental2.svg.SVGTextContentElement.getSubStringLength 58 | elemental2.svg.SVGTransform.type 59 | elemental2.svg.SVGTransformList.getItem.index 60 | elemental2.svg.SVGTransformList.insertItemBefore.index 61 | elemental2.svg.SVGTransformList.numberOfItems 62 | elemental2.svg.SVGTransformList.removeItem.index 63 | elemental2.svg.SVGTransformList.replaceItem.index 64 | elemental2.svg.SVGZoomAndPan.getZoomAndPan 65 | elemental2.svg.SVGZoomAndPan.setZoomAndPan.zoomAndPan 66 | elemental2.svg.SVGSVGElement.getZoomAndPan 67 | elemental2.svg.SVGSVGElement.setZoomAndPan.zoomAndPan 68 | elemental2.svg.SVGViewSpec.getZoomAndPan 69 | elemental2.svg.SVGViewSpec.setZoomAndPan.zoomAndPan 70 | elemental2.svg.SVGViewElement.getZoomAndPan 71 | elemental2.svg.SVGViewElement.setZoomAndPan.zoomAndPan 72 | -------------------------------------------------------------------------------- /java/elemental2/webassembly/BUILD: -------------------------------------------------------------------------------- 1 | # This package contains the build rule to build elemental2-webassembly. 2 | 3 | load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator") 4 | 5 | package( 6 | default_applicable_licenses = ["//:license"], 7 | default_visibility = [ 8 | "//:__subpackages__", 9 | ], 10 | # Apache2 11 | licenses = ["notice"], 12 | ) 13 | 14 | filegroup( 15 | name = "externs", 16 | srcs = ["//third_party:webassembly.js"], 17 | ) 18 | 19 | jsinterop_generator( 20 | name = "webassembly", 21 | srcs = [":externs"], 22 | extension_type_prefix = "WebAssembly", 23 | # override auto generated js_deps in order not to provide extern files 24 | # Common extern file are included by default. 25 | externs_deps = [], 26 | integer_entities_files = ["integer_entities.txt"], 27 | name_mapping_files = ["name_mappings.txt"], 28 | deps = [ 29 | "//java/elemental2/core", 30 | "//java/elemental2/dom", 31 | "//java/elemental2/promise", 32 | ], 33 | ) 34 | -------------------------------------------------------------------------------- /java/elemental2/webassembly/integer_entities.txt: -------------------------------------------------------------------------------- 1 | elemental2.webassembly.MemoryDescriptor.getInitial 2 | elemental2.webassembly.MemoryDescriptor.getMaximum 3 | elemental2.webassembly.MemoryDescriptor.setInitial.initial 4 | elemental2.webassembly.MemoryDescriptor.setMaximum.maximum 5 | elemental2.webassembly.TableDescriptor.getInitial 6 | elemental2.webassembly.TableDescriptor.getMaximum 7 | elemental2.webassembly.TableDescriptor.setInitial.initial 8 | elemental2.webassembly.TableDescriptor.setMaximum.maximum 9 | elemental2.webassembly.webassembly.Memory.grow 10 | elemental2.webassembly.webassembly.Memory.grow.delta 11 | elemental2.webassembly.webassembly.RuntimeError.constructor.lineNumber 12 | elemental2.webassembly.webassembly.Table.get.index 13 | elemental2.webassembly.webassembly.Table.grow 14 | elemental2.webassembly.webassembly.Table.grow.delta 15 | elemental2.webassembly.webassembly.Table.length 16 | elemental2.webassembly.webassembly.Table.set.index 17 | -------------------------------------------------------------------------------- /java/elemental2/webassembly/name_mappings.txt: -------------------------------------------------------------------------------- 1 | elemental2.webassembly.TableFunction.onInvoke.p0=parameters 2 | -------------------------------------------------------------------------------- /java/elemental2/webcrypto/BUILD: -------------------------------------------------------------------------------- 1 | # This package contains the build rule to build elemental2-dom. 2 | 3 | load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator") 4 | 5 | package( 6 | default_applicable_licenses = ["//:license"], 7 | default_visibility = [ 8 | "//:__subpackages__", 9 | ], 10 | # Apache2 11 | licenses = ["notice"], 12 | ) 13 | 14 | filegroup( 15 | name = "externs", 16 | srcs = [ 17 | "//third_party:w3c_webcrypto.js", 18 | ], 19 | ) 20 | 21 | jsinterop_generator( 22 | name = "webcrypto", 23 | srcs = [":externs"], 24 | # override auto generated js_deps since modified externs cause conflicts 25 | externs_deps = [], 26 | deps = [ 27 | "//java/elemental2/core", 28 | "//java/elemental2/promise", 29 | ], 30 | ) 31 | -------------------------------------------------------------------------------- /java/elemental2/webgl/BUILD: -------------------------------------------------------------------------------- 1 | # This package contains the build rule to build elemental2-webgl. 2 | 3 | load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator") 4 | 5 | package( 6 | default_applicable_licenses = ["//:license"], 7 | default_visibility = [ 8 | "//:__subpackages__", 9 | ], 10 | # Apache2 11 | licenses = ["notice"], 12 | ) 13 | 14 | filegroup( 15 | name = "externs", 16 | srcs = ["//third_party:webgl.js"], 17 | ) 18 | 19 | jsinterop_generator( 20 | name = "webgl", 21 | srcs = [":externs"], 22 | extension_type_prefix = "WebGl", 23 | # override auto generated js_deps in order not to provide extern files 24 | # Common extern file are included by default. 25 | externs_deps = [], 26 | integer_entities_files = ["integer_entities.txt"], 27 | deps = [ 28 | "//java/elemental2/core", 29 | "//java/elemental2/dom", 30 | ], 31 | ) 32 | -------------------------------------------------------------------------------- /java/elemental2/webgl/integer_entities.txt: -------------------------------------------------------------------------------- 1 | elemental2.webgl.WebGLRenderingContext.ACTIVE_ATTRIBUTES 2 | elemental2.webgl.WebGLRenderingContext.ACTIVE_TEXTURE 3 | elemental2.webgl.WebGLRenderingContext.ACTIVE_UNIFORMS 4 | elemental2.webgl.WebGLRenderingContext.ALIASED_LINE_WIDTH_RANGE 5 | elemental2.webgl.WebGLRenderingContext.ALIASED_POINT_SIZE_RANGE 6 | elemental2.webgl.WebGLRenderingContext.ALPHA 7 | elemental2.webgl.WebGLRenderingContext.ALPHA_BITS 8 | elemental2.webgl.WebGLRenderingContext.ALWAYS 9 | elemental2.webgl.WebGLRenderingContext.ARRAY_BUFFER 10 | elemental2.webgl.WebGLRenderingContext.ARRAY_BUFFER_BINDING 11 | elemental2.webgl.WebGLRenderingContext.ATTACHED_SHADERS 12 | elemental2.webgl.WebGLRenderingContext.BACK 13 | elemental2.webgl.WebGLRenderingContext.BLEND 14 | elemental2.webgl.WebGLRenderingContext.BLEND_COLOR 15 | elemental2.webgl.WebGLRenderingContext.BLEND_DST_ALPHA 16 | elemental2.webgl.WebGLRenderingContext.BLEND_DST_RGB 17 | elemental2.webgl.WebGLRenderingContext.BLEND_EQUATION 18 | elemental2.webgl.WebGLRenderingContext.BLEND_EQUATION_ALPHA 19 | elemental2.webgl.WebGLRenderingContext.BLEND_EQUATION_RGB 20 | elemental2.webgl.WebGLRenderingContext.BLEND_SRC_ALPHA 21 | elemental2.webgl.WebGLRenderingContext.BLEND_SRC_RGB 22 | elemental2.webgl.WebGLRenderingContext.BLUE_BITS 23 | elemental2.webgl.WebGLRenderingContext.BOOL 24 | elemental2.webgl.WebGLRenderingContext.BOOL_VEC2 25 | elemental2.webgl.WebGLRenderingContext.BOOL_VEC3 26 | elemental2.webgl.WebGLRenderingContext.BOOL_VEC4 27 | elemental2.webgl.WebGLRenderingContext.BROWSER_DEFAULT_WEBGL 28 | elemental2.webgl.WebGLRenderingContext.BUFFER_SIZE 29 | elemental2.webgl.WebGLRenderingContext.BUFFER_USAGE 30 | elemental2.webgl.WebGLRenderingContext.BYTE 31 | elemental2.webgl.WebGLRenderingContext.CCW 32 | elemental2.webgl.WebGLRenderingContext.CLAMP_TO_EDGE 33 | elemental2.webgl.WebGLRenderingContext.COLOR_ATTACHMENT0 34 | elemental2.webgl.WebGLRenderingContext.COLOR_BUFFER_BIT 35 | elemental2.webgl.WebGLRenderingContext.COLOR_CLEAR_VALUE 36 | elemental2.webgl.WebGLRenderingContext.COLOR_WRITEMASK 37 | elemental2.webgl.WebGLRenderingContext.COMPILE_STATUS 38 | elemental2.webgl.WebGLRenderingContext.COMPRESSED_TEXTURE_FORMATS 39 | elemental2.webgl.WebGLRenderingContext.CONSTANT_ALPHA 40 | elemental2.webgl.WebGLRenderingContext.CONSTANT_COLOR 41 | elemental2.webgl.WebGLRenderingContext.CONTEXT_LOST_WEBGL 42 | elemental2.webgl.WebGLRenderingContext.CULL_FACE 43 | elemental2.webgl.WebGLRenderingContext.CULL_FACE_MODE 44 | elemental2.webgl.WebGLRenderingContext.CURRENT_PROGRAM 45 | elemental2.webgl.WebGLRenderingContext.CURRENT_VERTEX_ATTRIB 46 | elemental2.webgl.WebGLRenderingContext.CW 47 | elemental2.webgl.WebGLRenderingContext.DECR 48 | elemental2.webgl.WebGLRenderingContext.DECR_WRAP 49 | elemental2.webgl.WebGLRenderingContext.DELETE_STATUS 50 | elemental2.webgl.WebGLRenderingContext.DEPTH_ATTACHMENT 51 | elemental2.webgl.WebGLRenderingContext.DEPTH_BITS 52 | elemental2.webgl.WebGLRenderingContext.DEPTH_BUFFER_BIT 53 | elemental2.webgl.WebGLRenderingContext.DEPTH_CLEAR_VALUE 54 | elemental2.webgl.WebGLRenderingContext.DEPTH_COMPONENT 55 | elemental2.webgl.WebGLRenderingContext.DEPTH_COMPONENT16 56 | elemental2.webgl.WebGLRenderingContext.DEPTH_FUNC 57 | elemental2.webgl.WebGLRenderingContext.DEPTH_RANGE 58 | elemental2.webgl.WebGLRenderingContext.DEPTH_STENCIL 59 | elemental2.webgl.WebGLRenderingContext.DEPTH_STENCIL_ATTACHMENT 60 | elemental2.webgl.WebGLRenderingContext.DEPTH_TEST 61 | elemental2.webgl.WebGLRenderingContext.DEPTH_WRITEMASK 62 | elemental2.webgl.WebGLRenderingContext.DITHER 63 | elemental2.webgl.WebGLRenderingContext.DONT_CARE 64 | elemental2.webgl.WebGLRenderingContext.DST_ALPHA 65 | elemental2.webgl.WebGLRenderingContext.DST_COLOR 66 | elemental2.webgl.WebGLRenderingContext.DYNAMIC_DRAW 67 | elemental2.webgl.WebGLRenderingContext.ELEMENT_ARRAY_BUFFER 68 | elemental2.webgl.WebGLRenderingContext.ELEMENT_ARRAY_BUFFER_BINDING 69 | elemental2.webgl.WebGLRenderingContext.EQUAL 70 | elemental2.webgl.WebGLRenderingContext.FASTEST 71 | elemental2.webgl.WebGLRenderingContext.FLOAT 72 | elemental2.webgl.WebGLRenderingContext.FLOAT_MAT2 73 | elemental2.webgl.WebGLRenderingContext.FLOAT_MAT3 74 | elemental2.webgl.WebGLRenderingContext.FLOAT_MAT4 75 | elemental2.webgl.WebGLRenderingContext.FLOAT_VEC2 76 | elemental2.webgl.WebGLRenderingContext.FLOAT_VEC3 77 | elemental2.webgl.WebGLRenderingContext.FLOAT_VEC4 78 | elemental2.webgl.WebGLRenderingContext.FRAGMENT_SHADER 79 | elemental2.webgl.WebGLRenderingContext.FRAMEBUFFER 80 | elemental2.webgl.WebGLRenderingContext.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 81 | elemental2.webgl.WebGLRenderingContext.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 82 | elemental2.webgl.WebGLRenderingContext.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 83 | elemental2.webgl.WebGLRenderingContext.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 84 | elemental2.webgl.WebGLRenderingContext.FRAMEBUFFER_BINDING 85 | elemental2.webgl.WebGLRenderingContext.FRAMEBUFFER_COMPLETE 86 | elemental2.webgl.WebGLRenderingContext.FRAMEBUFFER_INCOMPLETE_ATTACHMENT 87 | elemental2.webgl.WebGLRenderingContext.FRAMEBUFFER_INCOMPLETE_DIMENSIONS 88 | elemental2.webgl.WebGLRenderingContext.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 89 | elemental2.webgl.WebGLRenderingContext.FRAMEBUFFER_UNSUPPORTED 90 | elemental2.webgl.WebGLRenderingContext.FRONT 91 | elemental2.webgl.WebGLRenderingContext.FRONT_AND_BACK 92 | elemental2.webgl.WebGLRenderingContext.FRONT_FACE 93 | elemental2.webgl.WebGLRenderingContext.FUNC_ADD 94 | elemental2.webgl.WebGLRenderingContext.FUNC_REVERSE_SUBTRACT 95 | elemental2.webgl.WebGLRenderingContext.FUNC_SUBTRACT 96 | elemental2.webgl.WebGLRenderingContext.GENERATE_MIPMAP_HINT 97 | elemental2.webgl.WebGLRenderingContext.GEQUAL 98 | elemental2.webgl.WebGLRenderingContext.GREATER 99 | elemental2.webgl.WebGLRenderingContext.GREEN_BITS 100 | elemental2.webgl.WebGLRenderingContext.HIGH_FLOAT 101 | elemental2.webgl.WebGLRenderingContext.HIGH_INT 102 | elemental2.webgl.WebGLRenderingContext.IMPLEMENTATION_COLOR_READ_FORMAT 103 | elemental2.webgl.WebGLRenderingContext.IMPLEMENTATION_COLOR_READ_TYPE 104 | elemental2.webgl.WebGLRenderingContext.INCR 105 | elemental2.webgl.WebGLRenderingContext.INCR_WRAP 106 | elemental2.webgl.WebGLRenderingContext.INT 107 | elemental2.webgl.WebGLRenderingContext.INT_VEC2 108 | elemental2.webgl.WebGLRenderingContext.INT_VEC3 109 | elemental2.webgl.WebGLRenderingContext.INT_VEC4 110 | elemental2.webgl.WebGLRenderingContext.INVALID_ENUM 111 | elemental2.webgl.WebGLRenderingContext.INVALID_FRAMEBUFFER_OPERATION 112 | elemental2.webgl.WebGLRenderingContext.INVALID_OPERATION 113 | elemental2.webgl.WebGLRenderingContext.INVALID_VALUE 114 | elemental2.webgl.WebGLRenderingContext.INVERT 115 | elemental2.webgl.WebGLRenderingContext.KEEP 116 | elemental2.webgl.WebGLRenderingContext.LEQUAL 117 | elemental2.webgl.WebGLRenderingContext.LESS 118 | elemental2.webgl.WebGLRenderingContext.LINEAR 119 | elemental2.webgl.WebGLRenderingContext.LINEAR_MIPMAP_LINEAR 120 | elemental2.webgl.WebGLRenderingContext.LINEAR_MIPMAP_NEAREST 121 | elemental2.webgl.WebGLRenderingContext.LINE_LOOP 122 | elemental2.webgl.WebGLRenderingContext.LINES 123 | elemental2.webgl.WebGLRenderingContext.LINE_STRIP 124 | elemental2.webgl.WebGLRenderingContext.LINE_WIDTH 125 | elemental2.webgl.WebGLRenderingContext.LINK_STATUS 126 | elemental2.webgl.WebGLRenderingContext.LOW_FLOAT 127 | elemental2.webgl.WebGLRenderingContext.LOW_INT 128 | elemental2.webgl.WebGLRenderingContext.LUMINANCE 129 | elemental2.webgl.WebGLRenderingContext.LUMINANCE_ALPHA 130 | elemental2.webgl.WebGLRenderingContext.MAX_COMBINED_TEXTURE_IMAGE_UNITS 131 | elemental2.webgl.WebGLRenderingContext.MAX_CUBE_MAP_TEXTURE_SIZE 132 | elemental2.webgl.WebGLRenderingContext.MAX_FRAGMENT_UNIFORM_VECTORS 133 | elemental2.webgl.WebGLRenderingContext.MAX_RENDERBUFFER_SIZE 134 | elemental2.webgl.WebGLRenderingContext.MAX_TEXTURE_IMAGE_UNITS 135 | elemental2.webgl.WebGLRenderingContext.MAX_TEXTURE_SIZE 136 | elemental2.webgl.WebGLRenderingContext.MAX_VARYING_VECTORS 137 | elemental2.webgl.WebGLRenderingContext.MAX_VERTEX_ATTRIBS 138 | elemental2.webgl.WebGLRenderingContext.MAX_VERTEX_TEXTURE_IMAGE_UNITS 139 | elemental2.webgl.WebGLRenderingContext.MAX_VERTEX_UNIFORM_VECTORS 140 | elemental2.webgl.WebGLRenderingContext.MAX_VIEWPORT_DIMS 141 | elemental2.webgl.WebGLRenderingContext.MEDIUM_FLOAT 142 | elemental2.webgl.WebGLRenderingContext.MEDIUM_INT 143 | elemental2.webgl.WebGLRenderingContext.MIRRORED_REPEAT 144 | elemental2.webgl.WebGLRenderingContext.NEAREST 145 | elemental2.webgl.WebGLRenderingContext.NEAREST_MIPMAP_LINEAR 146 | elemental2.webgl.WebGLRenderingContext.NEAREST_MIPMAP_NEAREST 147 | elemental2.webgl.WebGLRenderingContext.NEVER 148 | elemental2.webgl.WebGLRenderingContext.NICEST 149 | elemental2.webgl.WebGLRenderingContext.NO_ERROR 150 | elemental2.webgl.WebGLRenderingContext.NONE 151 | elemental2.webgl.WebGLRenderingContext.NOTEQUAL 152 | elemental2.webgl.WebGLRenderingContext.ONE 153 | elemental2.webgl.WebGLRenderingContext.ONE_MINUS_CONSTANT_ALPHA 154 | elemental2.webgl.WebGLRenderingContext.ONE_MINUS_CONSTANT_COLOR 155 | elemental2.webgl.WebGLRenderingContext.ONE_MINUS_DST_ALPHA 156 | elemental2.webgl.WebGLRenderingContext.ONE_MINUS_DST_COLOR 157 | elemental2.webgl.WebGLRenderingContext.ONE_MINUS_SRC_ALPHA 158 | elemental2.webgl.WebGLRenderingContext.ONE_MINUS_SRC_COLOR 159 | elemental2.webgl.WebGLRenderingContext.OUT_OF_MEMORY 160 | elemental2.webgl.WebGLRenderingContext.PACK_ALIGNMENT 161 | elemental2.webgl.WebGLRenderingContext.POINTS 162 | elemental2.webgl.WebGLRenderingContext.POLYGON_OFFSET_FACTOR 163 | elemental2.webgl.WebGLRenderingContext.POLYGON_OFFSET_FILL 164 | elemental2.webgl.WebGLRenderingContext.POLYGON_OFFSET_UNITS 165 | elemental2.webgl.WebGLRenderingContext.RED_BITS 166 | elemental2.webgl.WebGLRenderingContext.RENDERBUFFER 167 | elemental2.webgl.WebGLRenderingContext.RENDERBUFFER_ALPHA_SIZE 168 | elemental2.webgl.WebGLRenderingContext.RENDERBUFFER_BINDING 169 | elemental2.webgl.WebGLRenderingContext.RENDERBUFFER_BLUE_SIZE 170 | elemental2.webgl.WebGLRenderingContext.RENDERBUFFER_DEPTH_SIZE 171 | elemental2.webgl.WebGLRenderingContext.RENDERBUFFER_GREEN_SIZE 172 | elemental2.webgl.WebGLRenderingContext.RENDERBUFFER_HEIGHT 173 | elemental2.webgl.WebGLRenderingContext.RENDERBUFFER_INTERNAL_FORMAT 174 | elemental2.webgl.WebGLRenderingContext.RENDERBUFFER_RED_SIZE 175 | elemental2.webgl.WebGLRenderingContext.RENDERBUFFER_STENCIL_SIZE 176 | elemental2.webgl.WebGLRenderingContext.RENDERBUFFER_WIDTH 177 | elemental2.webgl.WebGLRenderingContext.RENDERER 178 | elemental2.webgl.WebGLRenderingContext.REPEAT 179 | elemental2.webgl.WebGLRenderingContext.REPLACE 180 | elemental2.webgl.WebGLRenderingContext.RGB 181 | elemental2.webgl.WebGLRenderingContext.RGB565 182 | elemental2.webgl.WebGLRenderingContext.RGB5_A1 183 | elemental2.webgl.WebGLRenderingContext.RGBA 184 | elemental2.webgl.WebGLRenderingContext.RGBA4 185 | elemental2.webgl.WebGLRenderingContext.SAMPLE_ALPHA_TO_COVERAGE 186 | elemental2.webgl.WebGLRenderingContext.SAMPLE_BUFFERS 187 | elemental2.webgl.WebGLRenderingContext.SAMPLE_COVERAGE 188 | elemental2.webgl.WebGLRenderingContext.SAMPLE_COVERAGE_INVERT 189 | elemental2.webgl.WebGLRenderingContext.SAMPLE_COVERAGE_VALUE 190 | elemental2.webgl.WebGLRenderingContext.SAMPLER_2D 191 | elemental2.webgl.WebGLRenderingContext.SAMPLER_CUBE 192 | elemental2.webgl.WebGLRenderingContext.SAMPLES 193 | elemental2.webgl.WebGLRenderingContext.SCISSOR_BOX 194 | elemental2.webgl.WebGLRenderingContext.SCISSOR_TEST 195 | elemental2.webgl.WebGLRenderingContext.SHADER_TYPE 196 | elemental2.webgl.WebGLRenderingContext.SHADING_LANGUAGE_VERSION 197 | elemental2.webgl.WebGLRenderingContext.SHORT 198 | elemental2.webgl.WebGLRenderingContext.SRC_ALPHA 199 | elemental2.webgl.WebGLRenderingContext.SRC_ALPHA_SATURATE 200 | elemental2.webgl.WebGLRenderingContext.SRC_COLOR 201 | elemental2.webgl.WebGLRenderingContext.STATIC_DRAW 202 | elemental2.webgl.WebGLRenderingContext.STENCIL_ATTACHMENT 203 | elemental2.webgl.WebGLRenderingContext.STENCIL_BACK_FAIL 204 | elemental2.webgl.WebGLRenderingContext.STENCIL_BACK_FUNC 205 | elemental2.webgl.WebGLRenderingContext.STENCIL_BACK_PASS_DEPTH_FAIL 206 | elemental2.webgl.WebGLRenderingContext.STENCIL_BACK_PASS_DEPTH_PASS 207 | elemental2.webgl.WebGLRenderingContext.STENCIL_BACK_REF 208 | elemental2.webgl.WebGLRenderingContext.STENCIL_BACK_VALUE_MASK 209 | elemental2.webgl.WebGLRenderingContext.STENCIL_BACK_WRITEMASK 210 | elemental2.webgl.WebGLRenderingContext.STENCIL_BITS 211 | elemental2.webgl.WebGLRenderingContext.STENCIL_BUFFER_BIT 212 | elemental2.webgl.WebGLRenderingContext.STENCIL_CLEAR_VALUE 213 | elemental2.webgl.WebGLRenderingContext.STENCIL_FAIL 214 | elemental2.webgl.WebGLRenderingContext.STENCIL_FUNC 215 | elemental2.webgl.WebGLRenderingContext.STENCIL_INDEX8 216 | elemental2.webgl.WebGLRenderingContext.STENCIL_PASS_DEPTH_FAIL 217 | elemental2.webgl.WebGLRenderingContext.STENCIL_PASS_DEPTH_PASS 218 | elemental2.webgl.WebGLRenderingContext.STENCIL_REF 219 | elemental2.webgl.WebGLRenderingContext.STENCIL_TEST 220 | elemental2.webgl.WebGLRenderingContext.STENCIL_VALUE_MASK 221 | elemental2.webgl.WebGLRenderingContext.STENCIL_WRITEMASK 222 | elemental2.webgl.WebGLRenderingContext.STREAM_DRAW 223 | elemental2.webgl.WebGLRenderingContext.SUBPIXEL_BITS 224 | elemental2.webgl.WebGLRenderingContext.TEXTURE 225 | elemental2.webgl.WebGLRenderingContext.TEXTURE0 226 | elemental2.webgl.WebGLRenderingContext.TEXTURE1 227 | elemental2.webgl.WebGLRenderingContext.TEXTURE10 228 | elemental2.webgl.WebGLRenderingContext.TEXTURE11 229 | elemental2.webgl.WebGLRenderingContext.TEXTURE12 230 | elemental2.webgl.WebGLRenderingContext.TEXTURE13 231 | elemental2.webgl.WebGLRenderingContext.TEXTURE14 232 | elemental2.webgl.WebGLRenderingContext.TEXTURE15 233 | elemental2.webgl.WebGLRenderingContext.TEXTURE16 234 | elemental2.webgl.WebGLRenderingContext.TEXTURE17 235 | elemental2.webgl.WebGLRenderingContext.TEXTURE18 236 | elemental2.webgl.WebGLRenderingContext.TEXTURE19 237 | elemental2.webgl.WebGLRenderingContext.TEXTURE2 238 | elemental2.webgl.WebGLRenderingContext.TEXTURE20 239 | elemental2.webgl.WebGLRenderingContext.TEXTURE21 240 | elemental2.webgl.WebGLRenderingContext.TEXTURE22 241 | elemental2.webgl.WebGLRenderingContext.TEXTURE23 242 | elemental2.webgl.WebGLRenderingContext.TEXTURE24 243 | elemental2.webgl.WebGLRenderingContext.TEXTURE25 244 | elemental2.webgl.WebGLRenderingContext.TEXTURE26 245 | elemental2.webgl.WebGLRenderingContext.TEXTURE27 246 | elemental2.webgl.WebGLRenderingContext.TEXTURE28 247 | elemental2.webgl.WebGLRenderingContext.TEXTURE29 248 | elemental2.webgl.WebGLRenderingContext.TEXTURE_2D 249 | elemental2.webgl.WebGLRenderingContext.TEXTURE3 250 | elemental2.webgl.WebGLRenderingContext.TEXTURE30 251 | elemental2.webgl.WebGLRenderingContext.TEXTURE31 252 | elemental2.webgl.WebGLRenderingContext.TEXTURE4 253 | elemental2.webgl.WebGLRenderingContext.TEXTURE5 254 | elemental2.webgl.WebGLRenderingContext.TEXTURE6 255 | elemental2.webgl.WebGLRenderingContext.TEXTURE7 256 | elemental2.webgl.WebGLRenderingContext.TEXTURE8 257 | elemental2.webgl.WebGLRenderingContext.TEXTURE9 258 | elemental2.webgl.WebGLRenderingContext.TEXTURE_BINDING_2D 259 | elemental2.webgl.WebGLRenderingContext.TEXTURE_BINDING_CUBE_MAP 260 | elemental2.webgl.WebGLRenderingContext.TEXTURE_CUBE_MAP 261 | elemental2.webgl.WebGLRenderingContext.TEXTURE_CUBE_MAP_NEGATIVE_X 262 | elemental2.webgl.WebGLRenderingContext.TEXTURE_CUBE_MAP_NEGATIVE_Y 263 | elemental2.webgl.WebGLRenderingContext.TEXTURE_CUBE_MAP_NEGATIVE_Z 264 | elemental2.webgl.WebGLRenderingContext.TEXTURE_CUBE_MAP_POSITIVE_X 265 | elemental2.webgl.WebGLRenderingContext.TEXTURE_CUBE_MAP_POSITIVE_Y 266 | elemental2.webgl.WebGLRenderingContext.TEXTURE_CUBE_MAP_POSITIVE_Z 267 | elemental2.webgl.WebGLRenderingContext.TEXTURE_MAG_FILTER 268 | elemental2.webgl.WebGLRenderingContext.TEXTURE_MIN_FILTER 269 | elemental2.webgl.WebGLRenderingContext.TEXTURE_WRAP_S 270 | elemental2.webgl.WebGLRenderingContext.TEXTURE_WRAP_T 271 | elemental2.webgl.WebGLRenderingContext.TRIANGLE_FAN 272 | elemental2.webgl.WebGLRenderingContext.TRIANGLES 273 | elemental2.webgl.WebGLRenderingContext.TRIANGLE_STRIP 274 | elemental2.webgl.WebGLRenderingContext.UNPACK_ALIGNMENT 275 | elemental2.webgl.WebGLRenderingContext.UNPACK_COLORSPACE_CONVERSION_WEBGL 276 | elemental2.webgl.WebGLRenderingContext.UNPACK_FLIP_Y_WEBGL 277 | elemental2.webgl.WebGLRenderingContext.UNPACK_PREMULTIPLY_ALPHA_WEBGL 278 | elemental2.webgl.WebGLRenderingContext.UNSIGNED_BYTE 279 | elemental2.webgl.WebGLRenderingContext.UNSIGNED_INT 280 | elemental2.webgl.WebGLRenderingContext.UNSIGNED_SHORT 281 | elemental2.webgl.WebGLRenderingContext.UNSIGNED_SHORT_4_4_4_4 282 | elemental2.webgl.WebGLRenderingContext.UNSIGNED_SHORT_5_5_5_1 283 | elemental2.webgl.WebGLRenderingContext.UNSIGNED_SHORT_5_6_5 284 | elemental2.webgl.WebGLRenderingContext.VALIDATE_STATUS 285 | elemental2.webgl.WebGLRenderingContext.VENDOR 286 | elemental2.webgl.WebGLRenderingContext.VERSION 287 | elemental2.webgl.WebGLRenderingContext.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 288 | elemental2.webgl.WebGLRenderingContext.VERTEX_ATTRIB_ARRAY_ENABLED 289 | elemental2.webgl.WebGLRenderingContext.VERTEX_ATTRIB_ARRAY_NORMALIZED 290 | elemental2.webgl.WebGLRenderingContext.VERTEX_ATTRIB_ARRAY_POINTER 291 | elemental2.webgl.WebGLRenderingContext.VERTEX_ATTRIB_ARRAY_SIZE 292 | elemental2.webgl.WebGLRenderingContext.VERTEX_ATTRIB_ARRAY_STRIDE 293 | elemental2.webgl.WebGLRenderingContext.VERTEX_ATTRIB_ARRAY_TYPE 294 | elemental2.webgl.WebGLRenderingContext.VERTEX_SHADER 295 | elemental2.webgl.WebGLRenderingContext.VIEWPORT 296 | elemental2.webgl.WebGLRenderingContext.ZERO 297 | elemental2.webgl.WebGLRenderingContext.drawingBufferWidth 298 | elemental2.webgl.WebGLRenderingContext.drawingBufferHeight 299 | elemental2.webgl.WebGLRenderingContext.activeTexture.texture 300 | elemental2.webgl.WebGLRenderingContext.bindAttribLocation.index 301 | elemental2.webgl.WebGLRenderingContext.bindBuffer.target 302 | elemental2.webgl.WebGLRenderingContext.bindFramebuffer.target 303 | elemental2.webgl.WebGLRenderingContext.bindRenderbuffer.target 304 | elemental2.webgl.WebGLRenderingContext.bindTexture.target 305 | elemental2.webgl.WebGLRenderingContext.blendEquation.mode 306 | elemental2.webgl.WebGLRenderingContext.blendEquationSeparate.modeRGB 307 | elemental2.webgl.WebGLRenderingContext.blendEquationSeparate.modeAlpha 308 | elemental2.webgl.WebGLRenderingContext.blendFunc.sfactor 309 | elemental2.webgl.WebGLRenderingContext.blendFunc.dfactor 310 | elemental2.webgl.WebGLRenderingContext.blendFuncSeparate.srcRGB 311 | elemental2.webgl.WebGLRenderingContext.blendFuncSeparate.dstRGB 312 | elemental2.webgl.WebGLRenderingContext.blendFuncSeparate.srcAlpha 313 | elemental2.webgl.WebGLRenderingContext.blendFuncSeparate.dstAlpha 314 | elemental2.webgl.WebGLRenderingContext.bufferData.target 315 | elemental2.webgl.WebGLRenderingContext.bufferData.usage 316 | elemental2.webgl.WebGLRenderingContext.bufferData.target 317 | elemental2.webgl.WebGLRenderingContext.bufferData.usage 318 | elemental2.webgl.WebGLRenderingContext.bufferData.target 319 | elemental2.webgl.WebGLRenderingContext.bufferData.usage 320 | elemental2.webgl.WebGLRenderingContext.bufferSubData.target 321 | elemental2.webgl.WebGLRenderingContext.bufferSubData.target 322 | elemental2.webgl.WebGLRenderingContext.checkFramebufferStatus 323 | elemental2.webgl.WebGLRenderingContext.checkFramebufferStatus.target 324 | elemental2.webgl.WebGLRenderingContext.clear.mask 325 | elemental2.webgl.WebGLRenderingContext.clearStencil.s 326 | elemental2.webgl.WebGLRenderingContext.compressedTexImage2D.target 327 | elemental2.webgl.WebGLRenderingContext.compressedTexImage2D.level 328 | elemental2.webgl.WebGLRenderingContext.compressedTexImage2D.internalformat 329 | elemental2.webgl.WebGLRenderingContext.compressedTexImage2D.width 330 | elemental2.webgl.WebGLRenderingContext.compressedTexImage2D.height 331 | elemental2.webgl.WebGLRenderingContext.compressedTexImage2D.border 332 | elemental2.webgl.WebGLRenderingContext.compressedTexSubImage2D.target 333 | elemental2.webgl.WebGLRenderingContext.compressedTexSubImage2D.level 334 | elemental2.webgl.WebGLRenderingContext.compressedTexSubImage2D.xoffset 335 | elemental2.webgl.WebGLRenderingContext.compressedTexSubImage2D.yoffset 336 | elemental2.webgl.WebGLRenderingContext.compressedTexSubImage2D.width 337 | elemental2.webgl.WebGLRenderingContext.compressedTexSubImage2D.height 338 | elemental2.webgl.WebGLRenderingContext.compressedTexSubImage2D.format 339 | elemental2.webgl.WebGLRenderingContext.copyTexImage2D.target 340 | elemental2.webgl.WebGLRenderingContext.copyTexImage2D.level 341 | elemental2.webgl.WebGLRenderingContext.copyTexImage2D.format 342 | elemental2.webgl.WebGLRenderingContext.copyTexImage2D.x 343 | elemental2.webgl.WebGLRenderingContext.copyTexImage2D.y 344 | elemental2.webgl.WebGLRenderingContext.copyTexImage2D.width 345 | elemental2.webgl.WebGLRenderingContext.copyTexImage2D.height 346 | elemental2.webgl.WebGLRenderingContext.copyTexImage2D.border 347 | elemental2.webgl.WebGLRenderingContext.copyTexSubImage2D.target 348 | elemental2.webgl.WebGLRenderingContext.copyTexSubImage2D.level 349 | elemental2.webgl.WebGLRenderingContext.copyTexSubImage2D.xoffset 350 | elemental2.webgl.WebGLRenderingContext.copyTexSubImage2D.yoffset 351 | elemental2.webgl.WebGLRenderingContext.copyTexSubImage2D.x 352 | elemental2.webgl.WebGLRenderingContext.copyTexSubImage2D.y 353 | elemental2.webgl.WebGLRenderingContext.copyTexSubImage2D.width 354 | elemental2.webgl.WebGLRenderingContext.copyTexSubImage2D.height 355 | elemental2.webgl.WebGLRenderingContext.createShader.type 356 | elemental2.webgl.WebGLRenderingContext.cullFace.mode 357 | elemental2.webgl.WebGLRenderingContext.depthFunc.func 358 | elemental2.webgl.WebGLRenderingContext.disable.flags 359 | elemental2.webgl.WebGLRenderingContext.disableVertexAttribArray.index 360 | elemental2.webgl.WebGLRenderingContext.drawArrays.mode 361 | elemental2.webgl.WebGLRenderingContext.drawArrays.first 362 | elemental2.webgl.WebGLRenderingContext.drawArrays.count 363 | elemental2.webgl.WebGLRenderingContext.drawElements.mode 364 | elemental2.webgl.WebGLRenderingContext.drawElements.count 365 | elemental2.webgl.WebGLRenderingContext.drawElements.type 366 | elemental2.webgl.WebGLRenderingContext.enable.cap 367 | elemental2.webgl.WebGLRenderingContext.enableVertexAttribArray.index 368 | elemental2.webgl.WebGLRenderingContext.framebufferRenderbuffer.target 369 | elemental2.webgl.WebGLRenderingContext.framebufferRenderbuffer.attachment 370 | elemental2.webgl.WebGLRenderingContext.framebufferRenderbuffer.renderbuffertarget 371 | elemental2.webgl.WebGLRenderingContext.framebufferTexture2D.target 372 | elemental2.webgl.WebGLRenderingContext.framebufferTexture2D.attachment 373 | elemental2.webgl.WebGLRenderingContext.framebufferTexture2D.textarget 374 | elemental2.webgl.WebGLRenderingContext.framebufferTexture2D.level 375 | elemental2.webgl.WebGLRenderingContext.frontFace.mode 376 | elemental2.webgl.WebGLRenderingContext.generateMipmap.target 377 | elemental2.webgl.WebGLRenderingContext.getActiveAttrib.index 378 | elemental2.webgl.WebGLRenderingContext.getActiveUniform.index 379 | elemental2.webgl.WebGLRenderingContext.getAttribLocation 380 | elemental2.webgl.WebGLRenderingContext.getBufferParameter.target 381 | elemental2.webgl.WebGLRenderingContext.getBufferParameter.pname 382 | elemental2.webgl.WebGLRenderingContext.getError 383 | elemental2.webgl.WebGLRenderingContext.getFramebufferAttachmentParameter.target 384 | elemental2.webgl.WebGLRenderingContext.getFramebufferAttachmentParameter.attachment 385 | elemental2.webgl.WebGLRenderingContext.getFramebufferAttachmentParameter.pname 386 | elemental2.webgl.WebGLRenderingContext.getParameter.pname 387 | elemental2.webgl.WebGLRenderingContext.getProgramParameter.pname 388 | elemental2.webgl.WebGLRenderingContext.getRenderbufferParameter.target 389 | elemental2.webgl.WebGLRenderingContext.getRenderbufferParameter.pname 390 | elemental2.webgl.WebGLRenderingContext.getShaderParameter.pname 391 | elemental2.webgl.WebGLRenderingContext.getShaderPrecisionFormat.shadertype 392 | elemental2.webgl.WebGLRenderingContext.getShaderPrecisionFormat.precisiontype 393 | elemental2.webgl.WebGLRenderingContext.getTexParameter.target 394 | elemental2.webgl.WebGLRenderingContext.getTexParameter.pname 395 | elemental2.webgl.WebGLRenderingContext.getVertexAttrib.index 396 | elemental2.webgl.WebGLRenderingContext.getVertexAttrib.pname 397 | elemental2.webgl.WebGLRenderingContext.getVertexAttribOffset.index 398 | elemental2.webgl.WebGLRenderingContext.getVertexAttribOffset.pname 399 | elemental2.webgl.WebGLRenderingContext.hint.target 400 | elemental2.webgl.WebGLRenderingContext.hint.mode 401 | elemental2.webgl.WebGLRenderingContext.isEnabled.cap 402 | elemental2.webgl.WebGLRenderingContext.pixelStorei.pname 403 | elemental2.webgl.WebGLRenderingContext.pixelStorei.param 404 | elemental2.webgl.WebGLRenderingContext.readPixels.x 405 | elemental2.webgl.WebGLRenderingContext.readPixels.y 406 | elemental2.webgl.WebGLRenderingContext.readPixels.width 407 | elemental2.webgl.WebGLRenderingContext.readPixels.height 408 | elemental2.webgl.WebGLRenderingContext.readPixels.format 409 | elemental2.webgl.WebGLRenderingContext.readPixels.type 410 | elemental2.webgl.WebGLRenderingContext.renderbufferStorage.target 411 | elemental2.webgl.WebGLRenderingContext.renderbufferStorage.internalformat 412 | elemental2.webgl.WebGLRenderingContext.renderbufferStorage.width 413 | elemental2.webgl.WebGLRenderingContext.renderbufferStorage.height 414 | elemental2.webgl.WebGLRenderingContext.scissor.x 415 | elemental2.webgl.WebGLRenderingContext.scissor.y 416 | elemental2.webgl.WebGLRenderingContext.scissor.width 417 | elemental2.webgl.WebGLRenderingContext.scissor.height 418 | elemental2.webgl.WebGLRenderingContext.stencilFunc.func 419 | elemental2.webgl.WebGLRenderingContext.stencilFunc.ref 420 | elemental2.webgl.WebGLRenderingContext.stencilFunc.mask 421 | elemental2.webgl.WebGLRenderingContext.stencilFuncSeparate.face 422 | elemental2.webgl.WebGLRenderingContext.stencilFuncSeparate.func 423 | elemental2.webgl.WebGLRenderingContext.stencilFuncSeparate.ref 424 | elemental2.webgl.WebGLRenderingContext.stencilFuncSeparate.mask 425 | elemental2.webgl.WebGLRenderingContext.stencilMask.mask 426 | elemental2.webgl.WebGLRenderingContext.stencilMaskSeparate.face 427 | elemental2.webgl.WebGLRenderingContext.stencilMaskSeparate.mask 428 | elemental2.webgl.WebGLRenderingContext.stencilOp.fail 429 | elemental2.webgl.WebGLRenderingContext.stencilOp.zfail 430 | elemental2.webgl.WebGLRenderingContext.stencilOp.zpass 431 | elemental2.webgl.WebGLRenderingContext.stencilOpSeparate.face 432 | elemental2.webgl.WebGLRenderingContext.stencilOpSeparate.fail 433 | elemental2.webgl.WebGLRenderingContext.stencilOpSeparate.zfail 434 | elemental2.webgl.WebGLRenderingContext.stencilOpSeparate.zpass 435 | elemental2.webgl.WebGLRenderingContext.texParameterf.target 436 | elemental2.webgl.WebGLRenderingContext.texParameterf.pname 437 | elemental2.webgl.WebGLRenderingContext.texParameteri.target 438 | elemental2.webgl.WebGLRenderingContext.texParameteri.pname 439 | elemental2.webgl.WebGLRenderingContext.texParameteri.param 440 | elemental2.webgl.WebGLRenderingContext.texImage2D.target 441 | elemental2.webgl.WebGLRenderingContext.texImage2D.level 442 | elemental2.webgl.WebGLRenderingContext.texImage2D.internalformat 443 | elemental2.webgl.WebGLRenderingContext.texImage2D.format 444 | elemental2.webgl.WebGLRenderingContext.texImage2D.type 445 | elemental2.webgl.WebGLRenderingContext.texImage2D.img 446 | elemental2.webgl.WebGLRenderingContext.texImage2D.format0 447 | elemental2.webgl.WebGLRenderingContext.texImage2D.type0 448 | elemental2.webgl.WebGLRenderingContext.texSubImage2D.target 449 | elemental2.webgl.WebGLRenderingContext.texSubImage2D.level 450 | elemental2.webgl.WebGLRenderingContext.texSubImage2D.xoffset 451 | elemental2.webgl.WebGLRenderingContext.texSubImage2D.yoffset 452 | elemental2.webgl.WebGLRenderingContext.texSubImage2D.format 453 | elemental2.webgl.WebGLRenderingContext.texSubImage2D.type 454 | elemental2.webgl.WebGLRenderingContext.texSubImage2D.type0 455 | elemental2.webgl.WebGLRenderingContext.uniform1i.value 456 | elemental2.webgl.WebGLRenderingContext.uniform2i.value1 457 | elemental2.webgl.WebGLRenderingContext.uniform2i.value2 458 | elemental2.webgl.WebGLRenderingContext.uniform3i.value1 459 | elemental2.webgl.WebGLRenderingContext.uniform3i.value2 460 | elemental2.webgl.WebGLRenderingContext.uniform3i.value3 461 | elemental2.webgl.WebGLRenderingContext.uniform4i.value1 462 | elemental2.webgl.WebGLRenderingContext.uniform4i.value2 463 | elemental2.webgl.WebGLRenderingContext.uniform4i.value3 464 | elemental2.webgl.WebGLRenderingContext.uniform4i.value4 465 | elemental2.webgl.WebGLRenderingContext.vertexAttrib1f.indx 466 | elemental2.webgl.WebGLRenderingContext.vertexAttrib1fv.indx 467 | elemental2.webgl.WebGLRenderingContext.vertexAttrib1fv.indx 468 | elemental2.webgl.WebGLRenderingContext.vertexAttrib2f.indx 469 | elemental2.webgl.WebGLRenderingContext.vertexAttrib2fv.indx 470 | elemental2.webgl.WebGLRenderingContext.vertexAttrib2fv.indx 471 | elemental2.webgl.WebGLRenderingContext.vertexAttrib3f.indx 472 | elemental2.webgl.WebGLRenderingContext.vertexAttrib3fv.indx 473 | elemental2.webgl.WebGLRenderingContext.vertexAttrib3fv.indx 474 | elemental2.webgl.WebGLRenderingContext.vertexAttrib4f.indx 475 | elemental2.webgl.WebGLRenderingContext.vertexAttrib4fv.indx 476 | elemental2.webgl.WebGLRenderingContext.vertexAttrib4fv.indx 477 | elemental2.webgl.WebGLRenderingContext.vertexAttribPointer.indx 478 | elemental2.webgl.WebGLRenderingContext.vertexAttribPointer.size 479 | elemental2.webgl.WebGLRenderingContext.vertexAttribPointer.type 480 | elemental2.webgl.WebGLRenderingContext.vertexAttribPointer.stride 481 | elemental2.webgl.WebGLRenderingContext.viewport.x 482 | elemental2.webgl.WebGLRenderingContext.viewport.y 483 | elemental2.webgl.WebGLRenderingContext.viewport.width 484 | elemental2.webgl.WebGLRenderingContext.viewport.height 485 | elemental2.webgl.WebGLShaderPrecisionFormat.rangeMin 486 | elemental2.webgl.WebGLShaderPrecisionFormat.rangeMax 487 | elemental2.webgl.WebGLShaderPrecisionFormat.precision 488 | elemental2.webgl.ANGLE_instanced_arrays.drawArraysInstancedANGLE.mode 489 | elemental2.webgl.ANGLE_instanced_arrays.drawArraysInstancedANGLE.first 490 | elemental2.webgl.ANGLE_instanced_arrays.drawArraysInstancedANGLE.count 491 | elemental2.webgl.ANGLE_instanced_arrays.drawArraysInstancedANGLE.primcount 492 | elemental2.webgl.ANGLE_instanced_arrays.drawElementsInstancedANGLE.mode 493 | elemental2.webgl.ANGLE_instanced_arrays.drawElementsInstancedANGLE.count 494 | elemental2.webgl.ANGLE_instanced_arrays.drawElementsInstancedANGLE.type 495 | elemental2.webgl.ANGLE_instanced_arrays.drawElementsInstancedANGLE.primcount 496 | elemental2.webgl.ANGLE_instanced_arrays.vertexAttribDivisorANGLE.index 497 | elemental2.webgl.ANGLE_instanced_arrays.vertexAttribDivisorANGLE.divisor 498 | elemental2.webgl.WebGLActiveInfo.size 499 | elemental2.webgl.WebGLActiveInfo.type 500 | -------------------------------------------------------------------------------- /java/elemental2/webstorage/BUILD: -------------------------------------------------------------------------------- 1 | # This package contains the build rule to build elemental2-webstorage. 2 | 3 | load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator") 4 | 5 | package( 6 | default_applicable_licenses = ["//:license"], 7 | default_visibility = [ 8 | "//:__subpackages__", 9 | ], 10 | # Apache2 11 | licenses = ["notice"], 12 | ) 13 | 14 | filegroup( 15 | name = "externs", 16 | srcs = ["//third_party:webstorage.js"], 17 | ) 18 | 19 | jsinterop_generator( 20 | name = "webstorage", 21 | srcs = [":externs"], 22 | extension_type_prefix = "WebStorage", 23 | # override auto generated js_deps in order not to provide extern files 24 | # Common extern file are included by default. 25 | externs_deps = [], 26 | integer_entities_files = ["integer_entities.txt"], 27 | deps = [ 28 | "//java/elemental2/core", 29 | "//java/elemental2/dom", 30 | ], 31 | ) 32 | -------------------------------------------------------------------------------- /java/elemental2/webstorage/integer_entities.txt: -------------------------------------------------------------------------------- 1 | elemental2.webstorage.Storage.key.index 2 | elemental2.webstorage.Storage.getLength 3 | -------------------------------------------------------------------------------- /maven/license.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | -------------------------------------------------------------------------------- /maven/pom-core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | __GROUP_ID__ 7 | __ARTIFACT_ID__ 8 | __VERSION__ 9 | jar 10 | 11 | Elemental2 Core 12 | Thin Java abstractions for the standard built-in objects for Javascript. 13 | https://www.gwtproject.org 14 | 15 | 16 | 17 | The Apache Software License, Version 2.0 18 | http://www.apache.org/licenses/LICENSE-2.0.txt 19 | repo 20 | 21 | 22 | 23 | 24 | scm:git:https://github.com/google/elemental2.git 25 | scm:git:git@github.com:google/elemental2.git 26 | https://github.com/google/elemental2 27 | 28 | 29 | 30 | https://github.com/google/elemental2/issues 31 | GitHub Issues 32 | 33 | 34 | 35 | 36 | J2CL Team 37 | Google 38 | http://www.google.com 39 | 40 | 41 | 42 | 43 | 44 | com.google.jsinterop 45 | jsinterop-annotations 46 | 2.0.2 47 | 48 | 49 | com.google.jsinterop 50 | base 51 | 1.0.1 52 | 53 | 54 | __GROUP_ID__ 55 | elemental2-promise 56 | __VERSION__ 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /maven/pom-dom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | __GROUP_ID__ 7 | __ARTIFACT_ID__ 8 | __VERSION__ 9 | jar 10 | 11 | Elemental2 Dom 12 | Thin Java abstractions for the native Browser APIs. 13 | https://www.gwtproject.org 14 | 15 | 16 | 17 | The Apache Software License, Version 2.0 18 | http://www.apache.org/licenses/LICENSE-2.0.txt 19 | repo 20 | 21 | 22 | 23 | 24 | scm:git:https://github.com/google/elemental2.git 25 | scm:git:git@github.com:google/elemental2.git 26 | https://github.com/google/elemental2 27 | 28 | 29 | 30 | https://github.com/google/elemental2/issues 31 | GitHub Issues 32 | 33 | 34 | 35 | 36 | J2CL Team 37 | Google 38 | http://www.google.com 39 | 40 | 41 | 42 | 43 | 44 | com.google.jsinterop 45 | jsinterop-annotations 46 | 2.0.2 47 | 48 | 49 | com.google.jsinterop 50 | base 51 | 1.0.1 52 | 53 | 54 | __GROUP_ID__ 55 | elemental2-core 56 | __VERSION__ 57 | 58 | 59 | __GROUP_ID__ 60 | elemental2-promise 61 | __VERSION__ 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /maven/pom-indexeddb.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | __GROUP_ID__ 7 | __ARTIFACT_ID__ 8 | __VERSION__ 9 | jar 10 | 11 | Elemental2 IndexedDb 12 | Thin Java abstractions for the IndexedDB APIs 13 | https://www.gwtproject.org 14 | 15 | 16 | 17 | The Apache Software License, Version 2.0 18 | http://www.apache.org/licenses/LICENSE-2.0.txt 19 | repo 20 | 21 | 22 | 23 | 24 | scm:git:https://github.com/google/elemental2.git 25 | scm:git:git@github.com:google/elemental2.git 26 | https://github.com/google/elemental2 27 | 28 | 29 | 30 | https://github.com/google/elemental2/issues 31 | GitHub Issues 32 | 33 | 34 | 35 | 36 | J2CL Team 37 | Google 38 | http://www.google.com 39 | 40 | 41 | 42 | 43 | 44 | com.google.jsinterop 45 | jsinterop-annotations 46 | 2.0.2 47 | 48 | 49 | com.google.jsinterop 50 | base 51 | 1.0.1 52 | 53 | 54 | __GROUP_ID__ 55 | elemental2-core 56 | __VERSION__ 57 | 58 | 59 | __GROUP_ID__ 60 | elemental2-dom 61 | __VERSION__ 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /maven/pom-media.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | __GROUP_ID__ 7 | __ARTIFACT_ID__ 8 | __VERSION__ 9 | jar 10 | 11 | Elemental2 Media 12 | Thin Java abstractions for the native media APIs provided by the browser. 13 | https://www.gwtproject.org 14 | 15 | 16 | 17 | The Apache Software License, Version 2.0 18 | http://www.apache.org/licenses/LICENSE-2.0.txt 19 | repo 20 | 21 | 22 | 23 | 24 | scm:git:https://github.com/google/elemental2.git 25 | scm:git:git@github.com:google/elemental2.git 26 | https://github.com/google/elemental2 27 | 28 | 29 | 30 | https://github.com/google/elemental2/issues 31 | GitHub Issues 32 | 33 | 34 | 35 | 36 | J2CL Team 37 | Google 38 | http://www.google.com 39 | 40 | 41 | 42 | 43 | 44 | com.google.jsinterop 45 | jsinterop-annotations 46 | 2.0.2 47 | 48 | 49 | com.google.jsinterop 50 | base 51 | 1.0.1 52 | 53 | 54 | __GROUP_ID__ 55 | elemental2-core 56 | __VERSION__ 57 | 58 | 59 | __GROUP_ID__ 60 | elemental2-dom 61 | __VERSION__ 62 | 63 | 64 | __GROUP_ID__ 65 | elemental2-promise 66 | __VERSION__ 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /maven/pom-promise.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | __GROUP_ID__ 7 | __ARTIFACT_ID__ 8 | __VERSION__ 9 | jar 10 | 11 | Elemental2 Promise 12 | Thin Java abstractions for the native promise APIs provided by JavaScript engine. 13 | https://www.gwtproject.org 14 | 15 | 16 | 17 | The Apache Software License, Version 2.0 18 | http://www.apache.org/licenses/LICENSE-2.0.txt 19 | repo 20 | 21 | 22 | 23 | 24 | scm:git:https://github.com/google/elemental2.git 25 | scm:git:git@github.com:google/elemental2.git 26 | https://github.com/google/elemental2 27 | 28 | 29 | 30 | https://github.com/google/elemental2/issues 31 | GitHub Issues 32 | 33 | 34 | 35 | 36 | J2CL Team 37 | Google 38 | http://www.google.com 39 | 40 | 41 | 42 | 43 | 44 | com.google.jsinterop 45 | jsinterop-annotations 46 | 2.0.2 47 | 48 | 49 | com.google.jsinterop 50 | base 51 | 1.0.1 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /maven/pom-svg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | __GROUP_ID__ 7 | __ARTIFACT_ID__ 8 | __VERSION__ 9 | jar 10 | 11 | Elemental2 SVG 12 | Thin Java abstractions for the native SVG APIs. 13 | https://www.gwtproject.org 14 | 15 | 16 | 17 | The Apache Software License, Version 2.0 18 | http://www.apache.org/licenses/LICENSE-2.0.txt 19 | repo 20 | 21 | 22 | 23 | 24 | scm:git:https://github.com/google/elemental2.git 25 | scm:git:git@github.com:google/elemental2.git 26 | https://github.com/google/elemental2 27 | 28 | 29 | 30 | https://github.com/google/elemental2/issues 31 | GitHub Issues 32 | 33 | 34 | 35 | 36 | J2CL Team 37 | Google 38 | http://www.google.com 39 | 40 | 41 | 42 | 43 | 44 | com.google.jsinterop 45 | jsinterop-annotations 46 | 2.0.2 47 | 48 | 49 | com.google.jsinterop 50 | base 51 | 1.0.1 52 | 53 | 54 | __GROUP_ID__ 55 | elemental2-core 56 | __VERSION__ 57 | 58 | 59 | __GROUP_ID__ 60 | elemental2-dom 61 | __VERSION__ 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /maven/pom-webassembly.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | __GROUP_ID__ 7 | __ARTIFACT_ID__ 8 | __VERSION__ 9 | jar 10 | 11 | Elemental2 WebAssembly 12 | Thin Java abstractions for the native Web Assembly APIs. 13 | https://www.gwtproject.org 14 | 15 | 16 | 17 | The Apache Software License, Version 2.0 18 | http://www.apache.org/licenses/LICENSE-2.0.txt 19 | repo 20 | 21 | 22 | 23 | 24 | scm:git:git@github.com:google/elemental2.git 25 | scm:git:git@github.com:google/elemental2.git 26 | git@github.com:google/elemental2.git 27 | 28 | 29 | 30 | https://github.com/google/elemental2/issues 31 | GitHub Issues 32 | 33 | 34 | 35 | 36 | J2CL Team 37 | Google 38 | http://www.google.com 39 | 40 | 41 | 42 | 43 | 44 | com.google.jsinterop 45 | jsinterop-annotations 46 | 2.0.2 47 | 48 | 49 | com.google.jsinterop 50 | base 51 | 1.0.1 52 | 53 | 54 | __GROUP_ID__ 55 | elemental2-core 56 | __VERSION__ 57 | 58 | 59 | __GROUP_ID__ 60 | elemental2-promise 61 | __VERSION__ 62 | 63 | 64 | __GROUP_ID__ 65 | elemental2-dom 66 | __VERSION__ 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /maven/pom-webgl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | __GROUP_ID__ 7 | __ARTIFACT_ID__ 8 | __VERSION__ 9 | jar 10 | 11 | Elemental2 WebGL 12 | Thin Java abstractions for the native Web Graphics Library APIs. 13 | https://www.gwtproject.org 14 | 15 | 16 | 17 | The Apache Software License, Version 2.0 18 | http://www.apache.org/licenses/LICENSE-2.0.txt 19 | repo 20 | 21 | 22 | 23 | 24 | scm:git:https://github.com/google/elemental2.git 25 | scm:git:git@github.com:google/elemental2.git 26 | https://github.com/google/elemental2 27 | 28 | 29 | 30 | https://github.com/google/elemental2/issues 31 | GitHub Issues 32 | 33 | 34 | 35 | 36 | J2CL Team 37 | Google 38 | http://www.google.com 39 | 40 | 41 | 42 | 43 | 44 | com.google.jsinterop 45 | jsinterop-annotations 46 | 2.0.2 47 | 48 | 49 | com.google.jsinterop 50 | base 51 | 1.0.1 52 | 53 | 54 | __GROUP_ID__ 55 | elemental2-core 56 | __VERSION__ 57 | 58 | 59 | __GROUP_ID__ 60 | elemental2-dom 61 | __VERSION__ 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /maven/pom-webstorage.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | __GROUP_ID__ 7 | __ARTIFACT_ID__ 8 | __VERSION__ 9 | jar 10 | 11 | Elemental2 WebStorage 12 | Thin Java abstractions for the native Web Storage APIs. 13 | https://www.gwtproject.org 14 | 15 | 16 | 17 | The Apache Software License, Version 2.0 18 | http://www.apache.org/licenses/LICENSE-2.0.txt 19 | repo 20 | 21 | 22 | 23 | 24 | scm:git:https://github.com/google/elemental2.git 25 | scm:git:git@github.com:google/elemental2.git 26 | https://github.com/google/elemental2 27 | 28 | 29 | 30 | https://github.com/google/elemental2/issues 31 | GitHub Issues 32 | 33 | 34 | 35 | 36 | J2CL Team 37 | Google 38 | http://www.google.com 39 | 40 | 41 | 42 | 43 | 44 | com.google.jsinterop 45 | jsinterop-annotations 46 | 2.0.2 47 | 48 | 49 | com.google.jsinterop 50 | base 51 | 1.0.1 52 | 53 | 54 | __GROUP_ID__ 55 | elemental2-core 56 | __VERSION__ 57 | 58 | 59 | __GROUP_ID__ 60 | elemental2-dom 61 | __VERSION__ 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /maven/release_elemental.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -i 2 | # Copyright 2019 Google Inc. All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS-IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # 17 | # The script generates the open source artifacts for elemental and 18 | # uploads them to sonatype. 19 | # 20 | set -e 21 | 22 | usage() { 23 | echo "" 24 | echo "$(basename $0): Build and deploy script for Elemental2." 25 | echo "" 26 | echo "$(basename $0) --version [--no-deploy]" 27 | echo " --help" 28 | echo " Print this help output and exit." 29 | echo " --version " 30 | echo " Maven version of the library to use for deploying to sonatype." 31 | echo " --no-deploy" 32 | echo " Skip the deployment part but build all artifacts." 33 | echo " --no-git-tag" 34 | echo " Skip the creation of git tag." 35 | echo "" 36 | } 37 | 38 | deploy=true 39 | git_tag=true 40 | lib_version="" 41 | 42 | while [[ "$1" != "" ]]; do 43 | case $1 in 44 | --version ) if [[ -z "$2" ]] || [[ "$2" == "--"* ]]; then 45 | echo "Error: Incorrect version value." 46 | usage 47 | exit 1 48 | fi 49 | shift 50 | lib_version=$1 51 | ;; 52 | --no-deploy ) deploy=false 53 | ;; 54 | --no-git-tag ) git_tag=false 55 | ;; 56 | --help ) usage 57 | exit 1 58 | ;; 59 | * ) echo "Error: unexpected option $1" 60 | usage 61 | exit 1 62 | ;; 63 | esac 64 | shift 65 | done 66 | 67 | if [[ -z "$lib_version" ]]; then 68 | echo "Error: --version flag is missing" 69 | usage 70 | exit 1 71 | fi 72 | 73 | if [ ! -f "MODULE.bazel" ]; then 74 | echo "Error: should be run from the root of the Bazel repository" 75 | exit 1 76 | fi 77 | 78 | bazel_root=$(pwd) 79 | 80 | deploy_target='@com_google_j2cl//maven:deploy' 81 | license_header="${bazel_root}/maven/license.txt" 82 | group_id="com.google.elemental2" 83 | gpg_flag="" 84 | deploy_flag="" 85 | artifact_directory_flag="" 86 | 87 | if [[ ${deploy} == true ]]; then 88 | echo "enter your gpg passphrase:" 89 | read -s gpg_passphrase 90 | if [[ -n "$gpg_passphrase" ]]; then 91 | gpg_flag="--gpg-passphrase ${gpg_passphrase}" 92 | fi 93 | else 94 | deploy_flag="--no-deploy" 95 | artifact_directory_flag="--artifact_dir $(mktemp -d)" 96 | fi 97 | 98 | cd ${bazel_root} 99 | 100 | elemental_artifacts="core dom indexeddb media promise svg webgl webstorage webassembly" 101 | 102 | for artifact in ${elemental_artifacts}; do 103 | artifact_path=${bazel_root}/bazel-bin/java/elemental2/${artifact} 104 | artifact_bazel_path=//java/elemental2/${artifact} 105 | jar_file=lib${artifact}.jar 106 | src_jar=lib${artifact}-src.jar 107 | javadoc_jar=${artifact}-javadoc.jar 108 | 109 | # ask bazel to explicitly build both jar files 110 | bazel build ${artifact_bazel_path}:${jar_file} 111 | bazel build ${artifact_bazel_path}:${src_jar} 112 | bazel build ${artifact_bazel_path}:${javadoc_jar} 113 | 114 | pom_template=${bazel_root}/maven/pom-${artifact}.xml 115 | maven_artifact="elemental2-${artifact}" 116 | 117 | # run that script with bazel as its a dependency of this project 118 | bazel run ${deploy_target} -- ${deploy_flag} ${gpg_flag} ${artifact_directory_flag} \ 119 | --artifact ${maven_artifact} \ 120 | --jar-file ${artifact_path}/${jar_file} \ 121 | --src-jar ${artifact_path}/${src_jar} \ 122 | --javadoc-jar ${artifact_path}/${javadoc_jar} \ 123 | --license-header ${license_header} \ 124 | --pom-template ${pom_template} \ 125 | --lib-version ${lib_version} \ 126 | --group-id ${group_id} 127 | 128 | done 129 | 130 | if [[ ${git_tag} == true ]]; then 131 | git tag -a ${lib_version} -m "${lib_version} release" 132 | git push origin ${lib_version} 133 | fi 134 | -------------------------------------------------------------------------------- /samples/helloworld/java/com/google/elemental2/samples/helloworld/BUILD: -------------------------------------------------------------------------------- 1 | load("@com_google_j2cl//build_defs:rules.bzl", "j2cl_application", "j2cl_library") 2 | 3 | package( 4 | default_applicable_licenses = ["//:license"], 5 | licenses = ["notice"], # Apache 2.0 6 | ) 7 | 8 | j2cl_library( 9 | name = "helloworld", 10 | srcs = glob([ 11 | "*.java", 12 | "*.js", 13 | ]), 14 | deps = [ 15 | "//:elemental2-dom-j2cl", 16 | "@com_google_j2cl//:jsinterop-annotations-j2cl", 17 | ], 18 | ) 19 | 20 | j2cl_application( 21 | name = "helloworld_app", 22 | entry_points = ["elemental2.samples.app"], 23 | deps = [":helloworld"], 24 | ) 25 | -------------------------------------------------------------------------------- /samples/helloworld/java/com/google/elemental2/samples/helloworld/HelloWorld.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Google LLC. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.google.elemental2.samples.helloworld; 17 | 18 | import static elemental2.dom.DomGlobal.document; 19 | import static elemental2.dom.DomGlobal.window; 20 | 21 | import jsinterop.annotations.JsType; 22 | 23 | /** A simple hello world example. */ 24 | @JsType 25 | public class HelloWorld { 26 | 27 | public static void printHelloWorld() { 28 | window.addEventListener("load", e -> addHellowWorld()); 29 | } 30 | 31 | private static void addHellowWorld() { 32 | document 33 | .body 34 | .appendChild(document.createElement("div")) 35 | .appendChild(document.createTextNode("Hello from Java!")); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /samples/helloworld/java/com/google/elemental2/samples/helloworld/app.js: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Google LLC. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | goog.module('elemental2.samples.app'); 15 | 16 | const HelloWorld = goog.require('com.google.elemental2.samples.helloworld.HelloWorld'); 17 | 18 | HelloWorld.printHelloWorld(); 19 | -------------------------------------------------------------------------------- /samples/promise/java/com/google/elemental2/samples/promise/BUILD: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Elemental Sample app playing with Promise 3 | 4 | load("@com_google_j2cl//build_defs:rules.bzl", "j2cl_application", "j2cl_library") 5 | 6 | package( 7 | default_applicable_licenses = ["//:license"], 8 | # Apache2 9 | licenses = ["notice"], 10 | ) 11 | 12 | j2cl_library( 13 | name = "promise", 14 | srcs = glob([ 15 | "*.java", 16 | "*.js", 17 | ]), 18 | deps = [ 19 | "//:elemental2-core-j2cl", 20 | "//:elemental2-dom-j2cl", 21 | "//:elemental2-promise-j2cl", 22 | "@com_google_j2cl//:jsinterop-annotations-j2cl", 23 | "@com_google_jsinterop_base//:jsinterop-base-j2cl", 24 | ], 25 | ) 26 | 27 | j2cl_application( 28 | name = "promise_app", 29 | entry_points = ["elemental2.samples.app"], 30 | deps = [":promise"], 31 | ) 32 | -------------------------------------------------------------------------------- /samples/promise/java/com/google/elemental2/samples/promise/PromiseSample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Google LLC. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.google.elemental2.samples.promise; 17 | 18 | import static elemental2.dom.DomGlobal.document; 19 | import static elemental2.dom.DomGlobal.setTimeout; 20 | import static elemental2.dom.DomGlobal.window; 21 | 22 | import elemental2.core.JsMath; 23 | import elemental2.dom.Element; 24 | import elemental2.promise.Promise; 25 | import jsinterop.annotations.JsMethod; 26 | 27 | /** Entry point. */ 28 | public class PromiseSample { 29 | @JsMethod 30 | public static void install() { 31 | window.addEventListener("load", evt -> onLoad()); 32 | } 33 | 34 | // GWT entry point 35 | static void onLoad() { 36 | installUi(); 37 | 38 | Promise promise = 39 | new Promise<>( 40 | (resolve, reject) -> { 41 | log("Promise executor starts..."); 42 | setTimeout((args) -> resolve.onInvoke("Promise resolved"), JsMath.random() * 2000); 43 | log("log(\"Promise executor ends...\");"); 44 | }); 45 | 46 | promise 47 | .then( 48 | (value) -> { 49 | log(value); 50 | return Promise.resolve(value + " again"); 51 | }) 52 | .then( 53 | (value) -> { 54 | log(value); 55 | return Promise.reject("A fake error occurs"); 56 | }) 57 | .catch_( 58 | (error) -> { 59 | log("" + error); 60 | return null; 61 | }); 62 | } 63 | 64 | private static void installUi() { 65 | Element section = document.createElement("section"); 66 | 67 | Element logs = document.createElement("div"); 68 | logs.id = "logs"; 69 | 70 | section.appendChild(logs); 71 | 72 | document.body.appendChild(section); 73 | } 74 | 75 | private static void log(String msg) { 76 | Element div = document.createElement("div"); 77 | div.textContent = msg; 78 | 79 | document.getElementById("logs").appendChild(div); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /samples/promise/java/com/google/elemental2/samples/promise/app.js: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Google LLC. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | goog.module('elemental2.samples.app'); 15 | 16 | const Sample = goog.require('com.google.elemental2.samples.promise.PromiseSample'); 17 | 18 | Sample.install(); -------------------------------------------------------------------------------- /samples/regexp/java/com/google/elemental2/samples/regexp/BUILD: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Elemental Sample app playing with RegExp and dom manipulation 3 | 4 | load("@com_google_j2cl//build_defs:rules.bzl", "j2cl_application", "j2cl_library") 5 | 6 | package( 7 | default_applicable_licenses = ["//:license"], 8 | # Apache2 9 | licenses = ["notice"], 10 | ) 11 | 12 | j2cl_library( 13 | name = "regexp", 14 | srcs = glob([ 15 | "*.java", 16 | "*.js", 17 | ]), 18 | deps = [ 19 | "//:elemental2-core-j2cl", 20 | "//:elemental2-dom-j2cl", 21 | "@com_google_j2cl//:jsinterop-annotations-j2cl", 22 | "@com_google_jsinterop_base//:jsinterop-base-j2cl", 23 | ], 24 | ) 25 | 26 | j2cl_application( 27 | name = "regexp_app", 28 | entry_points = ["elemental2.samples.app"], 29 | deps = [":regexp"], 30 | ) 31 | -------------------------------------------------------------------------------- /samples/regexp/java/com/google/elemental2/samples/regexp/RegExpSample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Google LLC. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.google.elemental2.samples.regexp; 17 | 18 | import static elemental2.dom.DomGlobal.document; 19 | import static elemental2.dom.DomGlobal.window; 20 | 21 | import elemental2.core.JsRegExp; 22 | import elemental2.core.JsString; 23 | import elemental2.core.RegExpResult; 24 | import elemental2.dom.Element; 25 | import elemental2.dom.HTMLInputElement; 26 | import jsinterop.annotations.JsMethod; 27 | import jsinterop.base.Js; 28 | 29 | /** Entry point. */ 30 | public class RegExpSample { 31 | @JsMethod 32 | public static void install() { 33 | window.addEventListener("load", evt -> onLoad()); 34 | } 35 | 36 | private static void onLoad() { 37 | installUi(); 38 | 39 | document 40 | .getElementsByTagName("form") 41 | .getAt(0) 42 | .addEventListener( 43 | "submit", 44 | evt -> { 45 | evt.preventDefault(); 46 | onFormSubmitted(); 47 | }); 48 | } 49 | 50 | private static void installUi() { 51 | Element section = document.createElement("section"); 52 | 53 | section.innerHTML = 54 | "
" 55 | + " " 56 | + " " 57 | + " " 58 | + " " 59 | + " " 60 | + "
" 61 | + "
"; 62 | 63 | document.body.appendChild(section); 64 | } 65 | 66 | private static void onFormSubmitted() { 67 | HTMLInputElement testTextInput = (HTMLInputElement) document.getElementById("testText"); 68 | HTMLInputElement regExpInput = (HTMLInputElement) document.getElementById("regexp"); 69 | 70 | clearResults(); 71 | 72 | JsRegExp regExp = new JsRegExp(regExpInput.value, "g"); 73 | 74 | addResult("RegExp.prototype.test()", regExp.test(testTextInput.value)); 75 | 76 | RegExpResult execs = regExp.exec(testTextInput.value); 77 | 78 | if (execs == null || execs.length == 0) { 79 | addResult("RegExp.prototype.exec()", "null"); 80 | } else { 81 | int i = 0; 82 | for (String exec : execs.asList()) { 83 | addResult("RegExp.prototype.exec()[" + i + "]", exec); 84 | i++; 85 | } 86 | } 87 | 88 | JsString string = Js.uncheckedCast(testTextInput.value); 89 | String[] matches = string.match(regExp).asArray(new String[] {}); 90 | if (matches == null || matches.length == 0) { 91 | addResult("String.prototype.match()", "null"); 92 | } else { 93 | int i = 0; 94 | for (String match : matches) { 95 | addResult("String.prototype.match()[" + i + "]", match); 96 | i++; 97 | } 98 | } 99 | 100 | addResult("RegExp.prototype.source", regExp.source); 101 | addResult("RegExp.prototype.multiline", regExp.multiline); 102 | addResult("RegExp.prototype.global", regExp.global); 103 | addResult("RegExp.prototype.ignoreCase", regExp.ignoreCase); 104 | addResult("RegExp.prototype.lastIndex", regExp.lastIndex); 105 | } 106 | 107 | private static void addResult(String label, Object value) { 108 | Element div = document.createElement("div"); 109 | div.textContent = label + ": " + value; 110 | 111 | document.getElementById("results").appendChild(div); 112 | } 113 | 114 | private static void clearResults() { 115 | document.getElementById("results").innerHTML = ""; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /samples/regexp/java/com/google/elemental2/samples/regexp/app.js: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Google LLC. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | goog.module('elemental2.samples.app'); 15 | 16 | 17 | const Sample = goog.require('com.google.elemental2.samples.regexp.RegExpSample'); 18 | 19 | Sample.install(); 20 | -------------------------------------------------------------------------------- /third_party/BUILD: -------------------------------------------------------------------------------- 1 | load(":extern.bzl", "extern") 2 | 3 | package(default_visibility = [ 4 | "//:__subpackages__", 5 | ]) 6 | 7 | licenses(["notice"]) # Apache2 8 | 9 | extern( 10 | name = "es3", 11 | ) 12 | 13 | extern( 14 | name = "es5", 15 | ) 16 | 17 | extern( 18 | name = "es6", 19 | ) 20 | 21 | extern( 22 | name = "es6_collections", 23 | ) 24 | 25 | extern( 26 | name = "es6_proxy.js", 27 | path = "browser/es6_proxy.js", 28 | ) 29 | 30 | extern( 31 | name = "w3c_event", 32 | path = "browser/w3c_event.js", 33 | ) 34 | 35 | extern( 36 | name = "w3c_event3", 37 | path = "browser/w3c_event3.js", 38 | ) 39 | 40 | extern( 41 | name = "w3c_device_sensor_event", 42 | path = "browser/w3c_device_sensor_event.js", 43 | ) 44 | 45 | extern( 46 | name = "w3c_touch_event", 47 | path = "browser/w3c_touch_event.js", 48 | ) 49 | 50 | extern( 51 | name = "w3c_trusted_types", 52 | path = "browser/w3c_trusted_types.js", 53 | ) 54 | 55 | extern( 56 | name = "w3c_dom1", 57 | path = "browser/w3c_dom1.js", 58 | ) 59 | 60 | extern( 61 | name = "w3c_dom2", 62 | path = "browser/w3c_dom2.js", 63 | ) 64 | 65 | extern( 66 | name = "w3c_dom3", 67 | path = "browser/w3c_dom3.js", 68 | ) 69 | 70 | extern( 71 | name = "w3c_dom4", 72 | path = "browser/w3c_dom4.js", 73 | ) 74 | 75 | extern( 76 | name = "w3c_batterystatus", 77 | path = "browser/w3c_batterystatus.js", 78 | ) 79 | 80 | extern( 81 | name = "w3c_fileapi", 82 | path = "browser/w3c_fileapi.js", 83 | ) 84 | 85 | extern( 86 | name = "page_visibility", 87 | path = "browser/page_visibility.js", 88 | ) 89 | 90 | extern( 91 | name = "w3c_rtc", 92 | path = "browser/w3c_rtc.js", 93 | ) 94 | 95 | extern( 96 | name = "html5", 97 | path = "browser/html5.js", 98 | ) 99 | 100 | extern( 101 | name = "window", 102 | path = "browser/window.js", 103 | ) 104 | 105 | extern( 106 | name = "w3c_range", 107 | path = "browser/w3c_range.js", 108 | ) 109 | 110 | extern( 111 | name = "w3c_geometry1", 112 | path = "browser/w3c_geometry1.js", 113 | ) 114 | 115 | extern( 116 | name = "w3c_css", 117 | path = "browser/w3c_css.js", 118 | ) 119 | 120 | extern( 121 | name = "w3c_css3d", 122 | path = "browser/w3c_css3d.js", 123 | ) 124 | 125 | extern( 126 | name = "w3c_xml", 127 | path = "browser/w3c_xml.js", 128 | ) 129 | 130 | extern( 131 | name = "flash", 132 | path = "browser/flash.js", 133 | ) 134 | 135 | extern( 136 | name = "w3c_anim_timing", 137 | path = "browser/w3c_anim_timing.js", 138 | ) 139 | 140 | extern( 141 | name = "webkit_notifications", 142 | path = "browser/webkit_notifications.js", 143 | ) 144 | 145 | extern( 146 | name = "w3c_abort", 147 | path = "browser/w3c_abort.js", 148 | ) 149 | 150 | extern( 151 | name = "fetchapi", 152 | path = "browser/fetchapi.js", 153 | ) 154 | 155 | extern( 156 | name = "w3c_serviceworker", 157 | path = "browser/w3c_serviceworker.js", 158 | ) 159 | 160 | extern( 161 | name = "w3c_requestidlecallback", 162 | path = "browser/w3c_requestidlecallback.js", 163 | ) 164 | 165 | extern( 166 | name = "w3c_navigation_timing", 167 | path = "browser/w3c_navigation_timing.js", 168 | ) 169 | 170 | extern( 171 | name = "w3c_clipboard", 172 | path = "browser/w3c_clipboard.js", 173 | ) 174 | 175 | extern( 176 | name = "w3c_composition_event.js", 177 | path = "browser/w3c_composition_event.js", 178 | ) 179 | 180 | extern( 181 | name = "w3c_clipboardevent", 182 | path = "browser/w3c_clipboardevent.js", 183 | ) 184 | 185 | extern( 186 | name = "w3c_eventsource", 187 | path = "browser/w3c_eventsource.js", 188 | ) 189 | 190 | extern( 191 | name = "w3c_elementtraversal", 192 | path = "browser/w3c_elementtraversal.js", 193 | ) 194 | 195 | extern( 196 | name = "w3c_selectors", 197 | path = "browser/w3c_selectors.js", 198 | ) 199 | 200 | extern( 201 | name = "w3c_geolocation", 202 | path = "browser/w3c_geolocation.js", 203 | ) 204 | 205 | extern( 206 | name = "w3c_indexeddb", 207 | path = "browser/w3c_indexeddb.js", 208 | ) 209 | 210 | extern( 211 | name = "w3c_audio", 212 | path = "browser/w3c_audio.js", 213 | ) 214 | 215 | extern( 216 | name = "w3c_gamepad.js", 217 | path = "browser/w3c_gamepad.js", 218 | ) 219 | 220 | extern( 221 | name = "w3c_permissions.js", 222 | path = "browser/w3c_permissions.js", 223 | ) 224 | 225 | extern( 226 | name = "w3c_pointerlock.js", 227 | path = "browser/w3c_pointerlock.js", 228 | ) 229 | 230 | extern( 231 | name = "w3c_pointer_events.js", 232 | path = "browser/w3c_pointer_events.js", 233 | ) 234 | 235 | extern( 236 | name = "wicg_resizeobserver.js", 237 | path = "browser/wicg_resizeobserver.js", 238 | ) 239 | 240 | extern( 241 | name = "w3c_worklets.js", 242 | path = "browser/w3c_worklets.js", 243 | ) 244 | 245 | extern( 246 | name = "w3c_webcrypto.js", 247 | path = "browser/w3c_webcrypto.js", 248 | ) 249 | 250 | extern( 251 | name = "webgl", 252 | path = "browser/webgl.js", 253 | ) 254 | 255 | extern( 256 | name = "webstorage", 257 | path = "browser/webstorage.js", 258 | ) 259 | 260 | extern( 261 | name = "whatwg_console", 262 | path = "browser/whatwg_console.js", 263 | ) 264 | 265 | extern( 266 | name = "mediakeys", 267 | path = "browser/mediakeys.js", 268 | ) 269 | 270 | extern( 271 | name = "streamsapi", 272 | path = "browser/streamsapi.js", 273 | ) 274 | 275 | extern( 276 | name = "url", 277 | path = "browser/url.js", 278 | ) 279 | 280 | extern( 281 | name = "mediasource", 282 | path = "browser/mediasource.js", 283 | ) 284 | 285 | extern( 286 | name = "w3c_selection", 287 | path = "browser/w3c_selection.js", 288 | ) 289 | 290 | extern( 291 | name = "svg.js", 292 | path = "browser/svg.js", 293 | ) 294 | 295 | extern( 296 | name = "webassembly.js", 297 | path = "browser/webassembly.js", 298 | ) 299 | 300 | extern( 301 | name = "whatwg_encoding.js", 302 | path = "browser/whatwg_encoding.js", 303 | ) 304 | 305 | extern( 306 | name = "wicg_attribution_reporting.js", 307 | path = "browser/wicg_attribution_reporting.js", 308 | ) 309 | 310 | extern( 311 | name = "wicg_entries.js", 312 | path = "browser/wicg_entries.js", 313 | ) 314 | 315 | extern( 316 | name = "web_animations.js", 317 | path = "browser/web_animations.js", 318 | ) 319 | 320 | java_library( 321 | name = "gwt-array-stamper", 322 | srcs = [ 323 | "@org_gwtproject_gwt//user:super/com/google/gwt/emul/javaemul/internal/ArrayStamper.java", 324 | ], 325 | ) 326 | 327 | java_library( 328 | name = "guava", 329 | exports = ["@google_bazel_common//third_party/java/guava"], 330 | ) 331 | -------------------------------------------------------------------------------- /third_party/extern.bzl: -------------------------------------------------------------------------------- 1 | """Utility macro used for extracting an specific extern file from js-compiler binary.""" 2 | 3 | def extern(name, path = None): 4 | """Extract a specific extern file from the extern files provided by the jscompiler binary""" 5 | if not path: 6 | path = "%s.js" % name 7 | 8 | native.genrule( 9 | name = name, 10 | srcs = ["@maven//:com_google_javascript_closure_compiler"], 11 | outs = ["%s.js" % name], 12 | tools = ["@bazel_tools//tools/zip:zipper"], 13 | cmd = """ 14 | TMP=$$(mktemp -d) 15 | WD=$$(pwd) 16 | ZIPPER=$$WD/$(location @bazel_tools//tools/zip:zipper) 17 | # Switch to temp since zipper only works with relative paths. 18 | cd $$TMP 19 | $$ZIPPER x $$WD/$(location @maven//:com_google_javascript_closure_compiler) externs.zip 20 | $$ZIPPER x externs.zip %s 21 | mv $$TMP/%s $$WD/$@ 22 | rm -rf $$TMP 23 | """ % (path, path), 24 | ) 25 | --------------------------------------------------------------------------------