Showing preview only (9,757K chars total). Download the full file or copy to clipboard to get everything.
Repository: bep/gr
Branch: master
Commit: 52c9d7f2f11a
Files: 64
Total size: 9.3 MB
Directory structure:
gitextract_4b8_jk_d/
├── .gitignore
├── .travis.yml
├── LICENSE.md
├── Makefile
├── README.md
├── attr/
│ ├── generate.go
│ ├── htmlattributes.autogen.go
│ └── htmlattributes.source.txt
├── component.go
├── el/
│ ├── elements.autogen.go
│ └── generate.go
├── element.go
├── event.go
├── evt/
│ ├── event.autogen.go
│ └── generate.go
├── examples/
│ ├── .gitignore
│ ├── ajax/
│ │ ├── ajax.js
│ │ ├── index.html
│ │ └── main.go
│ ├── basic/
│ │ ├── basic.js
│ │ ├── index.html
│ │ └── main.go
│ ├── basic-click-counter/
│ │ ├── basic-click-counter.js
│ │ ├── index.html
│ │ └── main.go
│ ├── build.sh
│ ├── composition/
│ │ ├── composition.js
│ │ ├── index.html
│ │ └── main.go
│ ├── debounce/
│ │ ├── debounce.js
│ │ ├── index.html
│ │ └── main.go
│ ├── helpers.go
│ ├── interop/
│ │ ├── index.html
│ │ ├── interop-ext-global.js
│ │ ├── interop-ext-module-bundle.js
│ │ ├── interop-ext-module.js
│ │ ├── interop-ext-reverse-bundle.js
│ │ ├── interop-ext-reverse.js
│ │ ├── interop.js
│ │ └── main.go
│ ├── lifecycle/
│ │ ├── index.html
│ │ ├── lifecycle.js
│ │ └── main.go
│ └── router/
│ ├── index.html
│ ├── main.go
│ └── router.js
├── helpers.go
├── lifecycle.go
├── modifiers.go
├── package.json
├── render.go
├── support/
│ └── support.go
├── tests/
│ ├── component_test.go
│ ├── component_tests.inc.js
│ ├── doc.go
│ ├── element_test.go
│ ├── event_test.go
│ ├── grt/
│ │ ├── test_helpers.go
│ │ ├── test_helpers.inc.js
│ │ └── test_helpers_test.go
│ ├── modifier_test.go
│ └── this_test.go
└── this.go
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof
test.*
node_modules/
nohup.out
================================================
FILE: .travis.yml
================================================
sudo: false
language: go
env:
- SOURCE_MAP_SUPPORT=false TRAVIS_NODE_VERSION="5.1" CXX="g++-4.8"
go:
- 1.8
install:
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
- node -v
- go get -u github.com/gopherjs/gopherjs
- npm install
- npm install --global node-gyp
- pushd $HOME/gopath/src/github.com/gopherjs/gopherjs/node-syscall && node-gyp rebuild && mkdir -p ~/.node_libraries/ && cp build/Release/syscall.node ~/.node_libraries/syscall.node && popd
script:
- make check
os:
- linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
notifications:
email: true
================================================
FILE: LICENSE.md
================================================
Apache License
==============
_Version 2.0, January 2004_
_<<http://www.apache.org/licenses/>>_
### Terms and Conditions for use, reproduction, and distribution
#### 1. Definitions
“License” shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
“Licensor” shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
“Legal Entity” shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, “control” means **(i)** the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
outstanding shares, or **(iii)** beneficial ownership of such entity.
“You” (or “Your”) shall mean an individual or Legal Entity exercising
permissions granted by this License.
“Source” form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
“Object” form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
“Work” shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
“Derivative Works” shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
“Contribution” shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
“submitted” means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as “Not a Contribution.”
“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
#### 2. Grant of Copyright License
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
#### 3. Grant of Patent License
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
#### 4. Redistribution
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
this License; and
* **(b)** You must cause any modified files to carry prominent notices stating that You
changed the files; and
* **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
#### 5. Submission of Contributions
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
#### 6. Trademarks
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
#### 7. Disclaimer of Warranty
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
#### 8. Limitation of Liability
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
#### 9. Accepting Warranty or Additional Liability
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
_END OF TERMS AND CONDITIONS_
### APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets `[]` replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same “printed page” as the copyright notice for easier identification within
third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: Makefile
================================================
DIRS=$(shell go list -f {{.Dir}} ./...)
check: fmt vet lint test
cyclo:
@for d in $(DIRS) ; do \
if [ "`gocyclo -over 20 $$d | tee /dev/stderr`" ]; then \
echo "^ cyclomatic complexity exceeds 20, refactor the code!" && echo && exit 1; \
fi \
done
fmt:
@for d in $(DIRS) ; do \
if [ "`gofmt -l -s $$d/*.go | tee /dev/stderr`" ]; then \
echo "^ improperly formatted go files" && echo && exit 1; \
fi \
done
lint:
@if [ "`golint -min_confidence 0.85 ./... | tee /dev/stderr`" ]; then \
echo "^ golint errors!" && echo && exit 1; \
fi
test:
gopherjs test github.com/bep/gr/tests
vet:
@if [ "`go vet ./... | tee /dev/stderr`" ]; then \
echo "^ go vet errors!" && echo && exit 1; \
fi
================================================
FILE: README.md
================================================
# Go React
[](https://travis-ci.org/bep/gr)
[](https://godoc.org/github.com/bep/gr)
[](https://goreportcard.com/report/github.com/bep/gr)
**See Also:**
* https://github.com/bep/grcomponents
* [grouter: react-router bindings](https://github.com/bep/grouter)
[GopherJS](https://github.com/gopherjs/gopherjs) bindings for Facebook React.
**NOTE: Still early and not production ready.**
## Examples
**NOTE: Make sure that your GopherJS is up-to-date before running these: `go get -u github.com/gopherjs/gopherjs`**
For a live demo of the examples below, see [http://bego.io/gr/](http://bego.io/gr/) (may not be up-to-date).
There are some runnable examples in `/examples`. Just navigate to that folder and do a:
```bash
gopherjs serve
```
Then navigate to [http://localhost:8080/github.com/bep/gr/examples/](http://localhost:8080/github.com/bep/gr/examples/).
To get a sense of the API, here is the [click-counter](https://github.com/bep/gr/blob/master/examples/basic-click-counter/main.go) example:
```go
func main() {
component := gr.New(new(clickCounter))
gr.RenderLoop(func() {
component.Render("react", gr.Props{})
})
}
type clickCounter struct {
*gr.This
}
// Implements the StateInitializer interface.
func (c clickCounter) GetInitialState() gr.State {
return gr.State{"counter": 0}
}
// Implements the Renderer interface.
func (c clickCounter) Render() gr.Component {
counter := c.State()["counter"]
message := fmt.Sprintf(" Click me! Number of clicks: %v", counter)
elem := el.Div(
el.Button(
gr.CSS("btn", "btn-lg", "btn-primary"),
gr.Style("color", "orange"),
gr.Text(message),
evt.Click(c.onClick)))
return examples.Example("Click Counter", elem)
}
func (c clickCounter) onClick(event *gr.Event) {
c.SetState(gr.State{"counter": c.State().Int("counter") + 1})
}
// Implements the ShouldComponentUpdate interface.
func (c clickCounter) ShouldComponentUpdate(next gr.Cops) bool {
return c.State().HasChanged(next.State, "counter")
}
```
For help installing GopherJS, please visit [that cool project](https://github.com/gopherjs/gopherjs).
## Inspiration
This project is highly inspired by [Vecty](https://github.com/gopherjs/vecty), a *promising and pure* Go React-like framework. If you're not heavily invested in Facebook's React, take that for a spin.
================================================
FILE: attr/generate.go
================================================
// +build ignore
/*
Copyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"sort"
"strings"
)
var altDoc = map[string]string{
"key": `Key adds an optional, unique identifier.
When your component shuffles around during render passes, it might be destroyed
and recreated due to the diff algorithm. Assigning it a key that persists makes
sure the component stays.`,
"ref": "Ref adds an ref to a component, see http://facebook.github.io/react/docs/more-about-refs.html",
"dangerouslySetInnerHTML": `DangerouslySetInnerHTML Provides the ability to insert raw HTML,
mainly for cooperating with DOM string manipulation libraries.`,
"defaultValue": `DefaultValue can be used to initialize an uncontrolled React component with a non-empty value.
See https://facebook.github.io/react/docs/forms.html`,
}
var altType = map[string]string{
"key": "interface{}",
"ref": "interface{}",
"dangerouslySetInnerHTML": "interface{}",
}
func main() {
b, err := ioutil.ReadFile("htmlattributes.source.txt")
if err != nil {
log.Fatal(err)
}
replacements := strings.NewReplacer(
"Html", "HTML", "Http", "HTTP",
"Href", "HRef", "Id", "ID",
"Wmode", "WMode")
source := string(b)
file, err := os.Create("htmlattributes.autogen.go")
if err != nil {
panic(err)
}
defer file.Close()
fmt.Fprint(file, `//go:generate go run generate.go
// Package attr defines markup to create HTML attributes supported by Facebook React.
//
// Created from "HTML Attributes" as defined by Facebook in
// - https://facebook.github.io/react/docs/tags-and-attributes.html
// - http://facebook.github.io/react/docs/special-non-dom-attributes.html
package attr
import "github.com/bep/gr"
`)
words := strings.Fields(source)
sort.Strings(words)
for _, w := range words {
funcName := strings.Title(w)
funcName = replacements.Replace(funcName)
docString := fmt.Sprintf("%s creates an HTML attribute for '%s'.", funcName, w)
propType := "interface{}"
if alt, ok := altDoc[w]; ok {
docString = strings.Replace(alt, "\n", "\n// ", -1)
}
if alt, ok := altType[w]; ok {
propType = alt
}
funcBody := fmt.Sprintf(`
// %s
func %s(v %s) gr.Modifier {
return gr.Prop("%s", v)
}
`, docString, funcName, propType, w)
fmt.Fprintf(file, "%s", funcBody)
}
}
================================================
FILE: attr/htmlattributes.autogen.go
================================================
//go:generate go run generate.go
// Package attr defines markup to create HTML attributes supported by Facebook React.
//
// Created from "HTML Attributes" as defined by Facebook in
// - https://facebook.github.io/react/docs/tags-and-attributes.html
// - http://facebook.github.io/react/docs/special-non-dom-attributes.html
package attr
import "github.com/bep/gr"
// About creates an HTML attribute for 'about'.
func About(v interface{}) gr.Modifier {
return gr.Prop("about", v)
}
// Accept creates an HTML attribute for 'accept'.
func Accept(v interface{}) gr.Modifier {
return gr.Prop("accept", v)
}
// AcceptCharset creates an HTML attribute for 'acceptCharset'.
func AcceptCharset(v interface{}) gr.Modifier {
return gr.Prop("acceptCharset", v)
}
// AccessKey creates an HTML attribute for 'accessKey'.
func AccessKey(v interface{}) gr.Modifier {
return gr.Prop("accessKey", v)
}
// Action creates an HTML attribute for 'action'.
func Action(v interface{}) gr.Modifier {
return gr.Prop("action", v)
}
// AllowFullScreen creates an HTML attribute for 'allowFullScreen'.
func AllowFullScreen(v interface{}) gr.Modifier {
return gr.Prop("allowFullScreen", v)
}
// AllowTransparency creates an HTML attribute for 'allowTransparency'.
func AllowTransparency(v interface{}) gr.Modifier {
return gr.Prop("allowTransparency", v)
}
// Alt creates an HTML attribute for 'alt'.
func Alt(v interface{}) gr.Modifier {
return gr.Prop("alt", v)
}
// Async creates an HTML attribute for 'async'.
func Async(v interface{}) gr.Modifier {
return gr.Prop("async", v)
}
// AutoCapitalize creates an HTML attribute for 'autoCapitalize'.
func AutoCapitalize(v interface{}) gr.Modifier {
return gr.Prop("autoCapitalize", v)
}
// AutoComplete creates an HTML attribute for 'autoComplete'.
func AutoComplete(v interface{}) gr.Modifier {
return gr.Prop("autoComplete", v)
}
// AutoCorrect creates an HTML attribute for 'autoCorrect'.
func AutoCorrect(v interface{}) gr.Modifier {
return gr.Prop("autoCorrect", v)
}
// AutoFocus creates an HTML attribute for 'autoFocus'.
func AutoFocus(v interface{}) gr.Modifier {
return gr.Prop("autoFocus", v)
}
// AutoPlay creates an HTML attribute for 'autoPlay'.
func AutoPlay(v interface{}) gr.Modifier {
return gr.Prop("autoPlay", v)
}
// AutoSave creates an HTML attribute for 'autoSave'.
func AutoSave(v interface{}) gr.Modifier {
return gr.Prop("autoSave", v)
}
// Capture creates an HTML attribute for 'capture'.
func Capture(v interface{}) gr.Modifier {
return gr.Prop("capture", v)
}
// CellPadding creates an HTML attribute for 'cellPadding'.
func CellPadding(v interface{}) gr.Modifier {
return gr.Prop("cellPadding", v)
}
// CellSpacing creates an HTML attribute for 'cellSpacing'.
func CellSpacing(v interface{}) gr.Modifier {
return gr.Prop("cellSpacing", v)
}
// Challenge creates an HTML attribute for 'challenge'.
func Challenge(v interface{}) gr.Modifier {
return gr.Prop("challenge", v)
}
// CharSet creates an HTML attribute for 'charSet'.
func CharSet(v interface{}) gr.Modifier {
return gr.Prop("charSet", v)
}
// Checked creates an HTML attribute for 'checked'.
func Checked(v interface{}) gr.Modifier {
return gr.Prop("checked", v)
}
// Cite creates an HTML attribute for 'cite'.
func Cite(v interface{}) gr.Modifier {
return gr.Prop("cite", v)
}
// ClassID creates an HTML attribute for 'classID'.
func ClassID(v interface{}) gr.Modifier {
return gr.Prop("classID", v)
}
// ClassName creates an HTML attribute for 'className'.
func ClassName(v interface{}) gr.Modifier {
return gr.Prop("className", v)
}
// ColSpan creates an HTML attribute for 'colSpan'.
func ColSpan(v interface{}) gr.Modifier {
return gr.Prop("colSpan", v)
}
// Color creates an HTML attribute for 'color'.
func Color(v interface{}) gr.Modifier {
return gr.Prop("color", v)
}
// Cols creates an HTML attribute for 'cols'.
func Cols(v interface{}) gr.Modifier {
return gr.Prop("cols", v)
}
// Content creates an HTML attribute for 'content'.
func Content(v interface{}) gr.Modifier {
return gr.Prop("content", v)
}
// ContentEditable creates an HTML attribute for 'contentEditable'.
func ContentEditable(v interface{}) gr.Modifier {
return gr.Prop("contentEditable", v)
}
// ContextMenu creates an HTML attribute for 'contextMenu'.
func ContextMenu(v interface{}) gr.Modifier {
return gr.Prop("contextMenu", v)
}
// Controls creates an HTML attribute for 'controls'.
func Controls(v interface{}) gr.Modifier {
return gr.Prop("controls", v)
}
// Coords creates an HTML attribute for 'coords'.
func Coords(v interface{}) gr.Modifier {
return gr.Prop("coords", v)
}
// CrossOrigin creates an HTML attribute for 'crossOrigin'.
func CrossOrigin(v interface{}) gr.Modifier {
return gr.Prop("crossOrigin", v)
}
// DangerouslySetInnerHTML Provides the ability to insert raw HTML,
// mainly for cooperating with DOM string manipulation libraries.
func DangerouslySetInnerHTML(v interface{}) gr.Modifier {
return gr.Prop("dangerouslySetInnerHTML", v)
}
// Data creates an HTML attribute for 'data'.
func Data(v interface{}) gr.Modifier {
return gr.Prop("data", v)
}
// Datatype creates an HTML attribute for 'datatype'.
func Datatype(v interface{}) gr.Modifier {
return gr.Prop("datatype", v)
}
// DateTime creates an HTML attribute for 'dateTime'.
func DateTime(v interface{}) gr.Modifier {
return gr.Prop("dateTime", v)
}
// Default creates an HTML attribute for 'default'.
func Default(v interface{}) gr.Modifier {
return gr.Prop("default", v)
}
// DefaultValue can be used to initialize an uncontrolled React component with a non-empty value.
//
// See https://facebook.github.io/react/docs/forms.html
func DefaultValue(v interface{}) gr.Modifier {
return gr.Prop("defaultValue", v)
}
// Defer creates an HTML attribute for 'defer'.
func Defer(v interface{}) gr.Modifier {
return gr.Prop("defer", v)
}
// Dir creates an HTML attribute for 'dir'.
func Dir(v interface{}) gr.Modifier {
return gr.Prop("dir", v)
}
// Disabled creates an HTML attribute for 'disabled'.
func Disabled(v interface{}) gr.Modifier {
return gr.Prop("disabled", v)
}
// Download creates an HTML attribute for 'download'.
func Download(v interface{}) gr.Modifier {
return gr.Prop("download", v)
}
// Draggable creates an HTML attribute for 'draggable'.
func Draggable(v interface{}) gr.Modifier {
return gr.Prop("draggable", v)
}
// EncType creates an HTML attribute for 'encType'.
func EncType(v interface{}) gr.Modifier {
return gr.Prop("encType", v)
}
// Form creates an HTML attribute for 'form'.
func Form(v interface{}) gr.Modifier {
return gr.Prop("form", v)
}
// FormAction creates an HTML attribute for 'formAction'.
func FormAction(v interface{}) gr.Modifier {
return gr.Prop("formAction", v)
}
// FormEncType creates an HTML attribute for 'formEncType'.
func FormEncType(v interface{}) gr.Modifier {
return gr.Prop("formEncType", v)
}
// FormMethod creates an HTML attribute for 'formMethod'.
func FormMethod(v interface{}) gr.Modifier {
return gr.Prop("formMethod", v)
}
// FormNoValidate creates an HTML attribute for 'formNoValidate'.
func FormNoValidate(v interface{}) gr.Modifier {
return gr.Prop("formNoValidate", v)
}
// FormTarget creates an HTML attribute for 'formTarget'.
func FormTarget(v interface{}) gr.Modifier {
return gr.Prop("formTarget", v)
}
// FrameBorder creates an HTML attribute for 'frameBorder'.
func FrameBorder(v interface{}) gr.Modifier {
return gr.Prop("frameBorder", v)
}
// Headers creates an HTML attribute for 'headers'.
func Headers(v interface{}) gr.Modifier {
return gr.Prop("headers", v)
}
// Height creates an HTML attribute for 'height'.
func Height(v interface{}) gr.Modifier {
return gr.Prop("height", v)
}
// Hidden creates an HTML attribute for 'hidden'.
func Hidden(v interface{}) gr.Modifier {
return gr.Prop("hidden", v)
}
// High creates an HTML attribute for 'high'.
func High(v interface{}) gr.Modifier {
return gr.Prop("high", v)
}
// HRef creates an HTML attribute for 'href'.
func HRef(v interface{}) gr.Modifier {
return gr.Prop("href", v)
}
// HRefLang creates an HTML attribute for 'hrefLang'.
func HRefLang(v interface{}) gr.Modifier {
return gr.Prop("hrefLang", v)
}
// HTMLFor creates an HTML attribute for 'htmlFor'.
func HTMLFor(v interface{}) gr.Modifier {
return gr.Prop("htmlFor", v)
}
// HTTPEquiv creates an HTML attribute for 'httpEquiv'.
func HTTPEquiv(v interface{}) gr.Modifier {
return gr.Prop("httpEquiv", v)
}
// Icon creates an HTML attribute for 'icon'.
func Icon(v interface{}) gr.Modifier {
return gr.Prop("icon", v)
}
// ID creates an HTML attribute for 'id'.
func ID(v interface{}) gr.Modifier {
return gr.Prop("id", v)
}
// Inlist creates an HTML attribute for 'inlist'.
func Inlist(v interface{}) gr.Modifier {
return gr.Prop("inlist", v)
}
// InputMode creates an HTML attribute for 'inputMode'.
func InputMode(v interface{}) gr.Modifier {
return gr.Prop("inputMode", v)
}
// Integrity creates an HTML attribute for 'integrity'.
func Integrity(v interface{}) gr.Modifier {
return gr.Prop("integrity", v)
}
// Is creates an HTML attribute for 'is'.
func Is(v interface{}) gr.Modifier {
return gr.Prop("is", v)
}
// ItemProp creates an HTML attribute for 'itemProp'.
func ItemProp(v interface{}) gr.Modifier {
return gr.Prop("itemProp", v)
}
// Key adds an optional, unique identifier.
// When your component shuffles around during render passes, it might be destroyed
// and recreated due to the diff algorithm. Assigning it a key that persists makes
// sure the component stays.
func Key(v interface{}) gr.Modifier {
return gr.Prop("key", v)
}
// KeyParams creates an HTML attribute for 'keyParams'.
func KeyParams(v interface{}) gr.Modifier {
return gr.Prop("keyParams", v)
}
// KeyType creates an HTML attribute for 'keyType'.
func KeyType(v interface{}) gr.Modifier {
return gr.Prop("keyType", v)
}
// Kind creates an HTML attribute for 'kind'.
func Kind(v interface{}) gr.Modifier {
return gr.Prop("kind", v)
}
// Label creates an HTML attribute for 'label'.
func Label(v interface{}) gr.Modifier {
return gr.Prop("label", v)
}
// Lang creates an HTML attribute for 'lang'.
func Lang(v interface{}) gr.Modifier {
return gr.Prop("lang", v)
}
// List creates an HTML attribute for 'list'.
func List(v interface{}) gr.Modifier {
return gr.Prop("list", v)
}
// Loop creates an HTML attribute for 'loop'.
func Loop(v interface{}) gr.Modifier {
return gr.Prop("loop", v)
}
// Low creates an HTML attribute for 'low'.
func Low(v interface{}) gr.Modifier {
return gr.Prop("low", v)
}
// Manifest creates an HTML attribute for 'manifest'.
func Manifest(v interface{}) gr.Modifier {
return gr.Prop("manifest", v)
}
// MarginHeight creates an HTML attribute for 'marginHeight'.
func MarginHeight(v interface{}) gr.Modifier {
return gr.Prop("marginHeight", v)
}
// MarginWidth creates an HTML attribute for 'marginWidth'.
func MarginWidth(v interface{}) gr.Modifier {
return gr.Prop("marginWidth", v)
}
// Max creates an HTML attribute for 'max'.
func Max(v interface{}) gr.Modifier {
return gr.Prop("max", v)
}
// MaxLength creates an HTML attribute for 'maxLength'.
func MaxLength(v interface{}) gr.Modifier {
return gr.Prop("maxLength", v)
}
// Media creates an HTML attribute for 'media'.
func Media(v interface{}) gr.Modifier {
return gr.Prop("media", v)
}
// MediaGroup creates an HTML attribute for 'mediaGroup'.
func MediaGroup(v interface{}) gr.Modifier {
return gr.Prop("mediaGroup", v)
}
// Method creates an HTML attribute for 'method'.
func Method(v interface{}) gr.Modifier {
return gr.Prop("method", v)
}
// Min creates an HTML attribute for 'min'.
func Min(v interface{}) gr.Modifier {
return gr.Prop("min", v)
}
// MinLength creates an HTML attribute for 'minLength'.
func MinLength(v interface{}) gr.Modifier {
return gr.Prop("minLength", v)
}
// Multiple creates an HTML attribute for 'multiple'.
func Multiple(v interface{}) gr.Modifier {
return gr.Prop("multiple", v)
}
// Muted creates an HTML attribute for 'muted'.
func Muted(v interface{}) gr.Modifier {
return gr.Prop("muted", v)
}
// Name creates an HTML attribute for 'name'.
func Name(v interface{}) gr.Modifier {
return gr.Prop("name", v)
}
// NoValidate creates an HTML attribute for 'noValidate'.
func NoValidate(v interface{}) gr.Modifier {
return gr.Prop("noValidate", v)
}
// Nonce creates an HTML attribute for 'nonce'.
func Nonce(v interface{}) gr.Modifier {
return gr.Prop("nonce", v)
}
// Open creates an HTML attribute for 'open'.
func Open(v interface{}) gr.Modifier {
return gr.Prop("open", v)
}
// Optimum creates an HTML attribute for 'optimum'.
func Optimum(v interface{}) gr.Modifier {
return gr.Prop("optimum", v)
}
// Pattern creates an HTML attribute for 'pattern'.
func Pattern(v interface{}) gr.Modifier {
return gr.Prop("pattern", v)
}
// Placeholder creates an HTML attribute for 'placeholder'.
func Placeholder(v interface{}) gr.Modifier {
return gr.Prop("placeholder", v)
}
// Poster creates an HTML attribute for 'poster'.
func Poster(v interface{}) gr.Modifier {
return gr.Prop("poster", v)
}
// Prefix creates an HTML attribute for 'prefix'.
func Prefix(v interface{}) gr.Modifier {
return gr.Prop("prefix", v)
}
// Preload creates an HTML attribute for 'preload'.
func Preload(v interface{}) gr.Modifier {
return gr.Prop("preload", v)
}
// Profile creates an HTML attribute for 'profile'.
func Profile(v interface{}) gr.Modifier {
return gr.Prop("profile", v)
}
// Property creates an HTML attribute for 'property'.
func Property(v interface{}) gr.Modifier {
return gr.Prop("property", v)
}
// RadioGroup creates an HTML attribute for 'radioGroup'.
func RadioGroup(v interface{}) gr.Modifier {
return gr.Prop("radioGroup", v)
}
// ReadOnly creates an HTML attribute for 'readOnly'.
func ReadOnly(v interface{}) gr.Modifier {
return gr.Prop("readOnly", v)
}
// Ref adds an ref to a component, see http://facebook.github.io/react/docs/more-about-refs.html
func Ref(v interface{}) gr.Modifier {
return gr.Prop("ref", v)
}
// Rel creates an HTML attribute for 'rel'.
func Rel(v interface{}) gr.Modifier {
return gr.Prop("rel", v)
}
// Required creates an HTML attribute for 'required'.
func Required(v interface{}) gr.Modifier {
return gr.Prop("required", v)
}
// Resource creates an HTML attribute for 'resource'.
func Resource(v interface{}) gr.Modifier {
return gr.Prop("resource", v)
}
// Results creates an HTML attribute for 'results'.
func Results(v interface{}) gr.Modifier {
return gr.Prop("results", v)
}
// Reversed creates an HTML attribute for 'reversed'.
func Reversed(v interface{}) gr.Modifier {
return gr.Prop("reversed", v)
}
// Role creates an HTML attribute for 'role'.
func Role(v interface{}) gr.Modifier {
return gr.Prop("role", v)
}
// RowSpan creates an HTML attribute for 'rowSpan'.
func RowSpan(v interface{}) gr.Modifier {
return gr.Prop("rowSpan", v)
}
// Rows creates an HTML attribute for 'rows'.
func Rows(v interface{}) gr.Modifier {
return gr.Prop("rows", v)
}
// Sandbox creates an HTML attribute for 'sandbox'.
func Sandbox(v interface{}) gr.Modifier {
return gr.Prop("sandbox", v)
}
// Scope creates an HTML attribute for 'scope'.
func Scope(v interface{}) gr.Modifier {
return gr.Prop("scope", v)
}
// Scoped creates an HTML attribute for 'scoped'.
func Scoped(v interface{}) gr.Modifier {
return gr.Prop("scoped", v)
}
// Scrolling creates an HTML attribute for 'scrolling'.
func Scrolling(v interface{}) gr.Modifier {
return gr.Prop("scrolling", v)
}
// Seamless creates an HTML attribute for 'seamless'.
func Seamless(v interface{}) gr.Modifier {
return gr.Prop("seamless", v)
}
// Security creates an HTML attribute for 'security'.
func Security(v interface{}) gr.Modifier {
return gr.Prop("security", v)
}
// Selected creates an HTML attribute for 'selected'.
func Selected(v interface{}) gr.Modifier {
return gr.Prop("selected", v)
}
// Shape creates an HTML attribute for 'shape'.
func Shape(v interface{}) gr.Modifier {
return gr.Prop("shape", v)
}
// Size creates an HTML attribute for 'size'.
func Size(v interface{}) gr.Modifier {
return gr.Prop("size", v)
}
// Sizes creates an HTML attribute for 'sizes'.
func Sizes(v interface{}) gr.Modifier {
return gr.Prop("sizes", v)
}
// Span creates an HTML attribute for 'span'.
func Span(v interface{}) gr.Modifier {
return gr.Prop("span", v)
}
// SpellCheck creates an HTML attribute for 'spellCheck'.
func SpellCheck(v interface{}) gr.Modifier {
return gr.Prop("spellCheck", v)
}
// Src creates an HTML attribute for 'src'.
func Src(v interface{}) gr.Modifier {
return gr.Prop("src", v)
}
// SrcDoc creates an HTML attribute for 'srcDoc'.
func SrcDoc(v interface{}) gr.Modifier {
return gr.Prop("srcDoc", v)
}
// SrcLang creates an HTML attribute for 'srcLang'.
func SrcLang(v interface{}) gr.Modifier {
return gr.Prop("srcLang", v)
}
// SrcSet creates an HTML attribute for 'srcSet'.
func SrcSet(v interface{}) gr.Modifier {
return gr.Prop("srcSet", v)
}
// Start creates an HTML attribute for 'start'.
func Start(v interface{}) gr.Modifier {
return gr.Prop("start", v)
}
// Step creates an HTML attribute for 'step'.
func Step(v interface{}) gr.Modifier {
return gr.Prop("step", v)
}
// Style creates an HTML attribute for 'style'.
func Style(v interface{}) gr.Modifier {
return gr.Prop("style", v)
}
// Summary creates an HTML attribute for 'summary'.
func Summary(v interface{}) gr.Modifier {
return gr.Prop("summary", v)
}
// TabIndex creates an HTML attribute for 'tabIndex'.
func TabIndex(v interface{}) gr.Modifier {
return gr.Prop("tabIndex", v)
}
// Target creates an HTML attribute for 'target'.
func Target(v interface{}) gr.Modifier {
return gr.Prop("target", v)
}
// Title creates an HTML attribute for 'title'.
func Title(v interface{}) gr.Modifier {
return gr.Prop("title", v)
}
// Type creates an HTML attribute for 'type'.
func Type(v interface{}) gr.Modifier {
return gr.Prop("type", v)
}
// Typeof creates an HTML attribute for 'typeof'.
func Typeof(v interface{}) gr.Modifier {
return gr.Prop("typeof", v)
}
// Unselectable creates an HTML attribute for 'unselectable'.
func Unselectable(v interface{}) gr.Modifier {
return gr.Prop("unselectable", v)
}
// UseMap creates an HTML attribute for 'useMap'.
func UseMap(v interface{}) gr.Modifier {
return gr.Prop("useMap", v)
}
// Value creates an HTML attribute for 'value'.
func Value(v interface{}) gr.Modifier {
return gr.Prop("value", v)
}
// Vocab creates an HTML attribute for 'vocab'.
func Vocab(v interface{}) gr.Modifier {
return gr.Prop("vocab", v)
}
// Width creates an HTML attribute for 'width'.
func Width(v interface{}) gr.Modifier {
return gr.Prop("width", v)
}
// WMode creates an HTML attribute for 'wmode'.
func WMode(v interface{}) gr.Modifier {
return gr.Prop("wmode", v)
}
// Wrap creates an HTML attribute for 'wrap'.
func Wrap(v interface{}) gr.Modifier {
return gr.Prop("wrap", v)
}
================================================
FILE: attr/htmlattributes.source.txt
================================================
accept acceptCharset accessKey action allowFullScreen allowTransparency alt
async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge
charSet checked cite classID className colSpan cols content contentEditable
contextMenu controls coords crossOrigin data dateTime default defer dir
disabled download draggable encType form formAction formEncType formMethod
formNoValidate formTarget frameBorder headers height hidden high href hrefLang
htmlFor httpEquiv icon id inputMode integrity is keyParams keyType kind label
lang list loop low manifest marginHeight marginWidth max maxLength media
mediaGroup method min minLength multiple muted name noValidate nonce open
optimum pattern placeholder poster preload profile radioGroup readOnly rel
required reversed role rowSpan rows sandbox scope scoped scrolling seamless
selected shape size sizes span spellCheck src srcDoc srcLang srcSet start step
style summary tabIndex target title type useMap value width wmode wrap
about datatype inlist prefix property resource typeof vocab
autoCapitalize autoCorrect color itemProp security unselectable results autoSave
key ref dangerouslySetInnerHTML defaultValue
================================================
FILE: component.go
================================================
/*
Copyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gr
import (
"errors"
"fmt"
"strings"
"reflect"
"github.com/bep/gr/support"
"github.com/gopherjs/gopherjs/js"
)
var (
react = js.Global.Get("React")
reactDOM = js.Global.Get("ReactDOM")
)
func init() {
if react == js.Undefined || reactDOM == js.Undefined {
// Require as a fallback
var err error
if react, err = support.Require("react"); err != nil {
panic(fmt.Sprintf("Cannot find React"))
}
if reactDOM, err = support.Require("react-dom"); err != nil {
panic(fmt.Sprintf("Cannot find ReactDOM"))
}
}
}
// A Component represents a React JS component.
//
// http://facebook.github.io/react/docs/glossary.html#react-nodes for a reference.
//
// A Component can be either a constructed element (analogous to a ReactElement)
// or a factory (a ReactClass or a ReactFactory). Factories are identified by their
// implementation of the Factory interface.
type Component interface {
Node() *js.Object
}
// A Factory is a Component that can construct Elements (analogous to a ReactClass or a ReactFactory).
type Factory interface {
Component
CreateElement(props Props, children ...Component) *Element
}
// ReactComponent wraps a Facebook React component.
// This component can either be constructed from a Go implementation (see New) or
// loaded from JavaScript (see FromGlobal and Require).
type ReactComponent struct {
// The React.createClass response.
node *js.Object
// Prototype cached for the cloning purpose.
elementPrototype *js.Object
// The minimum interface needed to display something.
r Renderer
reactClass *reactClass
// Options
exportName string
globalName string
componentConfig ComponentConfig
// Needs to be created by createElement as opposed to standalone React factories.
// TODO(bep) figure a way to extract that info from the JS object.
needsCreate bool
}
// FromGlobal loads a React component from JavaScript's global object
// ("window" for browsers and "GLOBAL" for Node.js)
func FromGlobal(path ...string) *ReactComponent {
var component *js.Object
for _, p := range path {
if component != nil {
component = component.Get(p)
} else {
component = js.Global.Get(p)
}
}
if component == nil || component == js.Undefined {
panic(fmt.Sprintf("JS component in path %v not found", path))
}
// TODO(bep): No concept of a Renderer implementation here. Do we need it?
return &ReactComponent{node: component, needsCreate: true}
}
// Require loads a module the Node.js way.
// Note that this requires that the require function is present; if in the browser,
// and not in Node.js, try Browserify.
func Require(path ...string) *ReactComponent {
m, err := support.Require(path...)
if err != nil {
panic(err)
}
return &ReactComponent{node: m, needsCreate: true}
}
// ComponentConfig is used to add optional static configuration to a component.
type ComponentConfig struct {
ContextTypesTemplate Context
}
// Option is used to configure a component.
type Option struct {
action func(*ReactComponent) error
// Whether to apply this option on the created React component or not.
preparePhase bool
}
// WithConfig adds optional static configuration to the component.
func WithConfig(config ComponentConfig) Option {
// This needs to run before createClass
return Option{preparePhase: true, action: func(r *ReactComponent) error {
r.componentConfig = config
return nil
}}
}
// Export is an option used to mark that the component should be exported to the
// JavaScript world as a Node.js module export.
func Export(name string) Option {
return Option{action: func(r *ReactComponent) error {
if name == "" {
return errors.New("Must provide export name")
}
r.exportName = name
return nil
}}
}
// Global is an option used to mark that the component should be exported to the
// JavaScript world as a global with the given name.
func Global(name string) Option {
return Option{action: func(r *ReactComponent) error {
if name == "" {
return errors.New("Must provide global name")
}
r.globalName = name
return nil
}}
}
// Apply the func to the newly created React component.
func Apply(f func(o *js.Object) *js.Object) Option {
return Option{action: func(r *ReactComponent) error {
r.node = f(r.node)
return nil
}}
}
// NewSimpleRenderer can be used for quickly putting together components that only
// need to implement Renderer with no need of the owner (this) argument.
func NewSimpleRenderer(c Component) Renderer {
return simpleRenderer{c}
}
type simpleRenderer struct {
c Component
}
// Implements the Renderer interface.
func (s simpleRenderer) Render() Component {
return s.c
}
// NewSimpleComponent can be used for quickly putting together components that only
// need to implement Renderer with no need of the owner (this) argument.
// Especially convenient for testing.
func NewSimpleComponent(c Component, options ...Option) *ReactComponent {
return New(NewSimpleRenderer(c), options...)
}
type reactClass struct {
*js.Object
displayName string `js:"displayName"`
render *js.Object `js:"render"`
getDefaultProps *js.Object `js:"getDefaultProps"`
getInitialState *js.Object `js:"getInitialState"`
getChildContext *js.Object `js:"getChildContext"`
childContextTypes js.M `js:"childContextTypes"`
contextTypes js.M `js:"contextTypes"`
shouldComponentUpdate *js.Object `js:"shouldComponentUpdate"`
componentWillUpdate *js.Object `js:"componentWillUpdate"`
componentDidUpdate *js.Object `js:"componentDidUpdate"`
componentWillReceiveProps *js.Object `js:"componentWillReceiveProps"`
componentWillMount *js.Object `js:"componentWillMount"`
componentDidMount *js.Object `js:"componentDidMount"`
componentWillUnmount *js.Object `js:"componentWillUnmount"`
}
type delegateRenderer struct {
delegate func() Component
}
// Render implements the Renderer interface.
func (d delegateRenderer) Render() Component {
return d.delegate()
}
// NewRenderer creates a Renderer with the provided func as the implementation.
func NewRenderer(renderFunc func() Component) Renderer {
return delegateRenderer{renderFunc}
}
// New creates a new Component given a Renderer and optional option(s).
// Note that the Renderer is the minimum interface that needs to be implemented,
// but New will perform interface upgrades for other lifecycle interfaces.
func New(r Renderer, options ...Option) *ReactComponent {
root := &ReactComponent{r: r, reactClass: &reactClass{Object: js.Global.Get("Object").New()}}
typ := fmt.Sprintf("%T", r)
displayName := strings.TrimLeft(typ, "*")
root.reactClass.displayName = displayName
// TODO(bep)
// getDefaultProps propTypes https://github.com/bep/gr/issues/23
// mixins https://github.com/bep/gr/issues/24
// statics https://github.com/bep/gr/issues/25
ts := extractThisSetter(r)
// Every component needs to render itself.
root.reactClass.render = makeRenderFunc(ts, displayName, r.Render)
// Optional lifecycle implementations below.
if v, ok := r.(StateInitializer); ok {
root.reactClass.getInitialState = makeStateFunc(ts, v.GetInitialState)
} else if ts != nil {
root.reactClass.getInitialState = js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
ts.SetThis(this)
return nil
})
}
if v, ok := r.(ChildContextProvider); ok {
root.reactClass.getChildContext, root.reactClass.childContextTypes = makeChildContextFunc(ts, v.GetChildContext)
}
if v, ok := r.(ShouldComponentUpdate); ok {
root.reactClass.shouldComponentUpdate = makeComponentUpdateFunc(ts, v.ShouldComponentUpdate)
}
if v, ok := r.(ComponentWillUpdate); ok {
root.reactClass.componentWillUpdate = makeComponentUpdateVoidFunc(ts, v.ComponentWillUpdate)
}
if v, ok := r.(ComponentDidUpdate); ok {
root.reactClass.componentDidUpdate = makeComponentUpdateVoidFunc(ts, v.ComponentDidUpdate)
}
if v, ok := r.(ComponentWillReceiveProps); ok {
root.reactClass.componentWillReceiveProps = makeComponentPropertyReceiverFunc(ts, v.ComponentWillReceiveProps)
}
if v, ok := r.(ComponentWillMount); ok {
root.reactClass.componentWillMount = makeVoidFunc(ts, v.ComponentWillMount, true)
}
if v, ok := r.(ComponentDidMount); ok {
root.reactClass.componentDidMount = makeVoidFunc(ts, v.ComponentDidMount, true)
}
if v, ok := r.(ComponentWillUnmount); ok {
root.reactClass.componentWillUnmount = makeVoidFunc(ts, v.ComponentWillUnmount, true)
}
for _, opt := range options {
if !opt.preparePhase {
continue
}
err := opt.action(root)
if err != nil {
panic(err)
}
}
root.handleOptionsOnPrepare()
class := react.Call("createClass", root.reactClass.Object)
root.node = react.Call("createFactory", class)
for _, opt := range options {
if opt.preparePhase {
continue
}
err := opt.action(root)
if err != nil {
panic(err)
}
}
root.handleOptionsOnCreate()
return root
}
// CreateIfNeeded evaluates the given Component and returns an Element, creating
// a new instance if needed. This is a convenience method; if you need to pass
// properties, use the factory directly.
func CreateIfNeeded(c Component) *Element {
switch v := c.(type) {
case *Element:
return v
case Factory:
return v.CreateElement(nil)
default:
return NewPreparedElement(c.Node())
}
}
// Node implements the Component interface.
func (r *ReactComponent) Node() *js.Object {
return r.node
}
// Render the Component in the DOM with the given element ID and props.
func (r *ReactComponent) Render(elementID string, props Props) {
container := js.Global.Get("document").Call("getElementById", elementID)
elem := r.CreateElement(props)
// TODO(bep) evaluate if the need the "this" returned on render.
reactDOM.Call("render", elem.Node(), container)
}
// CreateElement implements the Factory interface.
// TODO(bep) consolidate and clean
func (r *ReactComponent) CreateElement(props Props, children ...Component) *Element {
return &Element{properties: props, children: children, elFactory: createElementElementFactory(r)}
}
// CloneElement will, provided that an element has already been created for this component, clone that element with the
// original element's props with the new props merged in shallowly.
// New children will replace existing children.
// If this is the first invocation, a new element will be created.
// This may be be slightly faster when creating elements in a tight loop.
//
// See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement
func (r *ReactComponent) CloneElement(props Props, children ...Component) *Element {
return &Element{properties: props, children: children, elFactory: cloneOrCreateElementElementFactory(r)}
}
func cloneOrCreateElementElementFactory(r *ReactComponent) func(e *Element) *js.Object {
return func(e *Element) *js.Object {
if r.elementPrototype == nil {
r.elementPrototype = createOrInvoke(r.Node(), e, r.needsCreate)
return r.elementPrototype
}
return cloneElement(r.elementPrototype, e)
}
}
func createElementElementFactory(r *ReactComponent) func(e *Element) *js.Object {
return func(e *Element) *js.Object {
elem := createOrInvoke(r.Node(), e, r.needsCreate)
r.elementPrototype = elem
return elem
}
}
func cloneElement(prototype *js.Object, e *Element) *js.Object {
var elem *js.Object
var args []interface{}
if len(e.children) > 0 {
for _, c := range e.children {
args = append(args, c.Node())
}
}
elem = react.Call("cloneElement", prototype, e.properties, args)
return elem
}
func createOrInvoke(node *js.Object, e *Element, needsCreate bool) *js.Object {
var elem *js.Object
var args []interface{}
if len(e.children) > 0 {
for _, c := range e.children {
args = append(args, c.Node())
}
}
if needsCreate {
elem = react.Call("createElement", node, e.properties, args)
} else {
elem = node.Invoke(e.properties, args)
}
return elem
}
func extractThisSetter(r Renderer) ThisSetter {
var thisSetter ThisSetter
rv := reflect.ValueOf(r)
if rv.Kind() == reflect.Ptr {
rv = rv.Elem()
}
rt := rv.Type()
if rt.Kind() == reflect.Struct {
for i := 0; i < rt.NumField(); i++ {
fv := rv.Field(i)
if fv.CanInterface() {
if init, ok := fv.Interface().(ThisSetter); ok {
if fv.IsNil() {
newVal := reflect.New(rt.Field(i).Type.Elem())
fv.Set(newVal)
thisSetter = newVal.Interface().(ThisSetter)
} else {
thisSetter = init
}
// We should maybe check for others and report an error, but for now the first one wins.
break
}
}
}
}
return thisSetter
}
func makeComponentUpdateFunc(ts ThisSetter, f func(c Cops) bool) *js.Object {
return js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
if ts != nil {
ts.SetThis(this)
}
return f(extractComponentUpdateArgs(arguments))
})
}
func makeComponentUpdateVoidFunc(ts ThisSetter, f func(c Cops)) *js.Object {
return js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
if ts != nil {
ts.SetThis(this)
}
f(extractComponentUpdateArgs(arguments))
return nil
})
}
func makeComponentPropertyReceiverFunc(ts ThisSetter, f func(c Cops)) *js.Object {
return js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
if ts != nil {
ts.SetThis(this)
}
data := extractComponentUpdateArgs(arguments)
f(data)
return nil
})
}
func extractComponentUpdateArgs(arguments []*js.Object) Cops {
var (
props Props
state State
context Context
)
if len(arguments) > 0 && arguments[0] != nil {
props = objectToMap(arguments[0])
}
if len(arguments) > 1 && arguments[1] != nil {
state = objectToMap(arguments[1])
}
if len(arguments) > 2 && arguments[2] != nil {
context = objectToMap(arguments[2])
}
return Cops{Props: props, State: state, Context: context}
}
func makeVoidFunc(ts ThisSetter, f func(), assumeBlocking bool) *js.Object {
return js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
if ts != nil {
ts.SetThis(this)
}
if assumeBlocking {
go func() {
f()
}()
} else {
f()
}
return nil
})
}
func makeStateFunc(ts ThisSetter, f func() State) *js.Object {
return js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
if ts != nil {
ts.SetThis(this)
}
return f()
})
}
func makeChildContextFunc(ts ThisSetter, f func() Context) (*js.Object, js.M) {
getChildContext := js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
if ts != nil {
ts.SetThis(this)
}
return f()
})
childContextTypes := extractPropTypesFromTemplate(f())
return getChildContext, childContextTypes
}
func extractPropTypesFromTemplate(t map[string]interface{}) js.M {
propTypes := js.M{}
for k, v := range t {
switch v.(type) {
case string:
propTypes[k] = react.Get("PropTypes").Get("string")
case int:
propTypes[k] = react.Get("PropTypes").Get("number")
default:
// See: https://facebook.github.io/react/docs/reusable-components.html
// TODO(bep): Reconsider all of this.
panic("Context type not implemented")
}
}
return propTypes
}
type incrementer struct {
counter int
}
func (i *incrementer) next() int {
i.counter++
return i.counter
}
func makeRenderFunc(ts ThisSetter, s string, f func() Component) *js.Object {
return js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
if ts != nil {
ts.SetThis(this)
}
comp := f()
if comp == nil {
return nil
}
that := NewThis(this)
// TODO(bep) refactor
if e, ok := comp.(*Element); ok {
addEventListeners(ts, comp, that)
idFactory := &incrementer{}
addMissingKeys(s, e, idFactory)
}
if _, ok := comp.(Factory); ok {
panic("Render should return a ready-to-use Element.")
}
return comp.Node()
})
}
func addEventListeners(ts ThisSetter, c Component, that *This) {
if e, ok := c.(*Element); ok {
for _, l := range e.eventListeners {
l.delegate = func(event *js.Object) {
if ts != nil {
ts.SetThis(that.This)
}
if l.preventDefault {
event.Call("preventDefault")
}
if l.stopPropagation {
event.Call("stopPropagation")
}
l.listener(&Event{Object: event, This: that})
}
e.properties[l.name] = l.delegate
}
for _, child := range e.children {
addEventListeners(ts, child, that)
}
}
}
func (r *ReactComponent) handleOptionsOnCreate() {
if r.exportName != "" {
exports := js.Module.Get("exports")
if exports == js.Undefined {
panic("module.exports not present.")
}
exports.Set(r.exportName, r.node)
}
if r.globalName != "" {
js.Global.Set(r.globalName, r.node)
}
}
func (r *ReactComponent) handleOptionsOnPrepare() {
if r.componentConfig.ContextTypesTemplate != nil {
r.reactClass.contextTypes = extractPropTypesFromTemplate(r.componentConfig.ContextTypesTemplate)
}
}
func addMissingKeys(s string, e *Element, id *incrementer) {
if !e.dynamic {
if e.properties == nil {
e.properties = make(map[string]interface{})
}
if _, ok := e.properties["key"]; !ok {
key := fmt.Sprintf("%s-%d", s, id.next())
e.properties["key"] = key
}
}
for _, c2 := range e.children {
if e2, ok := c2.(*Element); ok {
addMissingKeys(s, e2, id)
}
}
}
================================================
FILE: el/elements.autogen.go
================================================
//go:generate go run generate.go
// Package el defines markup to create DOM elements.
//
// Generated from "HTML element reference" by Mozilla Contributors, https://developer.mozilla.org/en-US/docs/Web/HTML/Element, licensed under CC-BY-SA 2.5.
package el
import "github.com/bep/gr"
// Anchor — The HTML Anchor Element (<a>) defines a hyperlink to a location on the same page or any other page on the Web. It can also be used (in an obsolete way) to create an anchor point—a destination for hyperlinks within the content of a page, so that links aren't limited to connecting simply to the top of a page.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
func Anchor(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("a")
gr.Modifiers(mods).Modify(e)
return e
}
// Abbreviation — The HTML <abbr> element (or HTML Abbreviation Element) represents an abbreviation and optionally provides a full description for it. If present, the title attribute must contain this full description and nothing else.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/abbr
func Abbreviation(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("abbr")
gr.Modifiers(mods).Modify(e)
return e
}
// Address — The HTML <address> element supplies contact information for its nearest <article> or <body> ancestor; in the latter case, it applies to the whole document.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/address
func Address(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("address")
gr.Modifiers(mods).Modify(e)
return e
}
// Area — The HTML <area> element defines a hot-spot region on an image, and optionally associates it with a hypertext link. This element is used only within a <map> element.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/area
func Area(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("area")
gr.Modifiers(mods).Modify(e)
return e
}
// Article — The HTML <article> element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication). This could be a forum post, a magazine or newspaper article, a blog entry, an object, or any other independent item of content. Each <article> should be identified, typically by including a heading (<h1>-<h6> element) as a child of the <article> element.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article
func Article(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("article")
gr.Modifiers(mods).Modify(e)
return e
}
// Aside — The HTML <aside> element represents a section of the page with content connected tangentially to the rest, which could be considered separate from that content. These sections are often represented as sidebars or inserts. They often contain the definitions on the sidebars, such as definitions from the glossary; there may also be other types of information, such as related advertisements; the biography of the author; web applications; profile information or related links on the blog.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside
func Aside(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("aside")
gr.Modifiers(mods).Modify(e)
return e
}
// Audio — The HTML <audio> element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or the <source> element; the browser will choose the most suitable one.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio
func Audio(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("audio")
gr.Modifiers(mods).Modify(e)
return e
}
// Bold — The HTML <b> Element represents a span of text stylistically different from normal text, without conveying any special importance or relevance. It is typically used for keywords in a summary, product names in a review, or other spans of text whose typical presentation would be boldfaced. Another example of its use is to mark the lead sentence of each paragraph of an article.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/b
func Bold(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("b")
gr.Modifiers(mods).Modify(e)
return e
}
// Base — The HTML <base> element specifies the base URL to use for all relative URLs contained within a document. There can be only one <base> element in a document.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
func Base(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("base")
gr.Modifiers(mods).Modify(e)
return e
}
// BidirectionalIsolation — The HTML <bdi> Element (or Bi-Directional Isolation Element) isolates a span of text that might be formatted in a different direction from other text outside it.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdi
func BidirectionalIsolation(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("bdi")
gr.Modifiers(mods).Modify(e)
return e
}
// BidirectionalOverride — The HTML <bdo> Element (or HTML bidirectional override element) is used to override the current directionality of text. It causes the directionality of the characters to be ignored in favor of the specified directionality.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdo
func BidirectionalOverride(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("bdo")
gr.Modifiers(mods).Modify(e)
return e
}
// BlockQuote — The HTML <blockquote> Element (or HTML Block Quotation Element) indicates that the enclosed text is an extended quotation. Usually, this is rendered visually by indentation (see Notes for how to change it). A URL for the source of the quotation may be given using the cite attribute, while a text representation of the source can be given using the <cite> element.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote
func BlockQuote(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("blockquote")
gr.Modifiers(mods).Modify(e)
return e
}
// Break — The HTML element line break <br> produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br
func Break(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("br")
gr.Modifiers(mods).Modify(e)
return e
}
// Button — The HTML <button> Element represents a clickable button.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
func Button(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("button")
gr.Modifiers(mods).Modify(e)
return e
}
// Canvas — The HTML <canvas> Element can be used to draw graphics via scripting (usually JavaScript). For example, it can be used to draw graphs, make photo compositions or even perform animations. You may (and should) provide alternate content inside the <canvas> block. That content will be rendered both on older browsers that don't support canvas and in browsers with JavaScript disabled.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas
func Canvas(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("canvas")
gr.Modifiers(mods).Modify(e)
return e
}
// Caption — The HTML <caption> Element (or HTML Table Caption Element) represents the title of a table. Though it is always the first descendant of a <table>, its styling, using CSS, may place it elsewhere, relative to the table.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption
func Caption(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("caption")
gr.Modifiers(mods).Modify(e)
return e
}
// Citation — The HTML Citation Element (<cite>) represents a reference to a creative work. It must include the title of a work or a URL reference, which may be in an abbreviated form according to the conventions used for the addition of citation metadata.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/cite
func Citation(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("cite")
gr.Modifiers(mods).Modify(e)
return e
}
// Code — The HTML Code Element (<code>) represents a fragment of computer code. By default, it is displayed in the browser's default monospace font.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code
func Code(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("code")
gr.Modifiers(mods).Modify(e)
return e
}
// Column — The HTML Table Column Element (<col>) defines a column within a table and is used for defining common semantics on all common cells. It is generally found within a <colgroup> element.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col
func Column(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("col")
gr.Modifiers(mods).Modify(e)
return e
}
// ColumnGroup — The HTML Table Column Group Element (<colgroup>) defines a group of columns within a table.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup
func ColumnGroup(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("colgroup")
gr.Modifiers(mods).Modify(e)
return e
}
// Data — The HTML <data> Element links a given content with a machine-readable translation. If the content is time- or date-related, the <time> must be used.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data
func Data(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("data")
gr.Modifiers(mods).Modify(e)
return e
}
// DataList — The HTML Datalist Element (<datalist>) contains a set of <option> elements that represent the values available for other controls.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist
func DataList(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("datalist")
gr.Modifiers(mods).Modify(e)
return e
}
// Description — The HTML <dd> element (HTML Description Element) indicates the description of a term in a description list (<dl>) element. This element can occur only as a child element of a description list and it must follow a <dt> element.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dd
func Description(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("dd")
gr.Modifiers(mods).Modify(e)
return e
}
// DeletedText — The HTML Deleted Text Element (<del>) represents a range of text that has been deleted from a document. This element is often (but need not be) rendered with strike-through text.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/del
func DeletedText(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("del")
gr.Modifiers(mods).Modify(e)
return e
}
// Details — The HTML Details Element (<details>) is used as a disclosure widget from which the user can retrieve additional information.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
func Details(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("details")
gr.Modifiers(mods).Modify(e)
return e
}
// Definition — The HTML Definition Element (<dfn>) represents the defining instance of a term.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dfn
func Definition(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("dfn")
gr.Modifiers(mods).Modify(e)
return e
}
// Dialog — The HTML <dialog> element represents a dialog box or other interactive component, such as an inspector or window. <form> elements can be integrated within a dialog by specifying them with the attribute method="dialog". When such a form is submitted, the dialog is closed with a returnValue attribute set to the value of the submit button used.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
func Dialog(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("dialog")
gr.Modifiers(mods).Modify(e)
return e
}
// Div — The HTML <div> element (or HTML Document Division Element) is the generic container for flow content, which does not inherently represent anything. It can be used to group elements for styling purposes (using the class or id attributes), or because they share attribute values, such as lang. It should be used only when no other semantic element (such as <article> or <nav>) is appropriate.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div
func Div(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("div")
gr.Modifiers(mods).Modify(e)
return e
}
// DescriptionList — The HTML <dl> element (or HTML Description List Element) encloses a list of pairs of terms and descriptions. Common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs).
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl
func DescriptionList(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("dl")
gr.Modifiers(mods).Modify(e)
return e
}
// DefinitionTerm — The HTML <dt> element (or HTML Definition Term Element) identifies a term in a definition list. This element can occur only as a child element of a <dl>. It is usually followed by a <dd> element; however, multiple <dt> elements in a row indicate several terms that are all defined by the immediate next <dd> element.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dt
func DefinitionTerm(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("dt")
gr.Modifiers(mods).Modify(e)
return e
}
// Element — The HTML <element> element is used to define new custom DOM elements.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/element
func Element(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("element")
gr.Modifiers(mods).Modify(e)
return e
}
// Emphasis — The HTML element emphasis <em> marks text that has stress emphasis. The <em> element can be nested, with each level of nesting indicating a greater degree of emphasis.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em
func Emphasis(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("em")
gr.Modifiers(mods).Modify(e)
return e
}
// Embed — The HTML <embed> Element represents an integration point for an external application or interactive content (in other words, a plug-in).
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed
func Embed(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("embed")
gr.Modifiers(mods).Modify(e)
return e
}
// FieldSet — The HTML <fieldset> element is used to group several controls as well as labels (<label>) within a web form.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset
func FieldSet(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("fieldset")
gr.Modifiers(mods).Modify(e)
return e
}
// FigureCaption — The HTML <figcaption> element represents a caption or a legend associated with a figure or an illustration described by the rest of the data of the <figure> element which is its immediate ancestor which means <figcaption> can be the first or last element inside a <figure> block. Also, the HTML Figcaption Element is optional; if not provided, then the parent figure element will have no caption.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figcaption
func FigureCaption(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("figcaption")
gr.Modifiers(mods).Modify(e)
return e
}
// Figure — The HTML <figure> element represents self-contained content, frequently with a caption (<figcaption>), and is typically referenced as a single unit. While it is related to the main flow, its position is independent of the main flow. Usually this is an image, an illustration, a diagram, a code snippet, or a schema that is referenced in the main text, but that can be moved to another page or to an appendix without affecting the main flow.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figure
func Figure(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("figure")
gr.Modifiers(mods).Modify(e)
return e
}
// Footer — The HTML <footer> element represents a footer for its nearest sectioning content or sectioning root element. A footer typically contains information about the author of the section, copyright data or links to related documents.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/footer
func Footer(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("footer")
gr.Modifiers(mods).Modify(e)
return e
}
// Form — The HTML <form> element represents a document section that contains interactive controls to submit information to a web server.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form
func Form(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("form")
gr.Modifiers(mods).Modify(e)
return e
}
// Header — The HTML <header> element represents a group of introductory or navigational aids. It may contain some heading elements but also other elements like a logo, wrapped section's header, a search form, and so on.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header
func Header(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("header")
gr.Modifiers(mods).Modify(e)
return e
}
// HeadingsGroup — The HTML <hgroup> Element (HTML Headings Group Element) represents the heading of a section. It defines a single title that participates in the outline of the document as the heading of the implicit or explicit section that it belongs to.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hgroup
func HeadingsGroup(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("hgroup")
gr.Modifiers(mods).Modify(e)
return e
}
// HorizontalRule — The HTML <hr> element represents a thematic break between paragraph-level elements (for example, a change of scene in a story, or a shift of topic with a section). In previous versions of HTML, it represented a horizontal rule. It may still be displayed as a horizontal rule in visual browsers, but is now defined in semantic terms, rather than presentational terms.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr
func HorizontalRule(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("hr")
gr.Modifiers(mods).Modify(e)
return e
}
// Italic — The HTML <i> Element represents a range of text that is set off from the normal text for some reason, for example, technical terms, foreign language phrases, or fictional character thoughts. It is typically displayed in italic type.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/i
func Italic(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("i")
gr.Modifiers(mods).Modify(e)
return e
}
// InlineFrame — The HTML Inline Frame Element (<iframe>) represents a nested browsing context, effectively embedding another HTML page into the current page. In HTML 4.01, a document may contain a head and a body or a head and a frameset, but not both a body and a frameset. However, an <iframe> can be used within a normal document body. Each browsing context has its own session history and active document. The browsing context that contains the embedded content is called the parent browsing context. The top-level browsing context (which has no parent) is typically the browser window.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
func InlineFrame(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("iframe")
gr.Modifiers(mods).Modify(e)
return e
}
// Image — The HTML <img> element represents an image in the document.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img
func Image(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("img")
gr.Modifiers(mods).Modify(e)
return e
}
// Input — The HTML element <input> is used to create interactive controls for web-based forms in order to accept data from the user. How an <input> works varies considerably depending on the value of its type attribute.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input
func Input(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("input")
gr.Modifiers(mods).Modify(e)
return e
}
// InsertedText — The HTML <ins> Element (or HTML Inserted Text) HTML represents a range of text that has been added to a document.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ins
func InsertedText(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("ins")
gr.Modifiers(mods).Modify(e)
return e
}
// KeyboardInput — The HTML Keyboard Input Element (<kbd>) represents user input and produces an inline element displayed in the browser's default monospace font.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd
func KeyboardInput(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("kbd")
gr.Modifiers(mods).Modify(e)
return e
}
// Label — The HTML Label Element (<label>) represents a caption for an item in a user interface. It can be associated with a control either by placing the control element inside the <label> element, or by using the for attribute. Such a control is called the labeled control of the label element. One input can be associated with multiple labels.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label
func Label(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("label")
gr.Modifiers(mods).Modify(e)
return e
}
// Legend — The HTML <legend> Element (or HTML Legend Field Element) represents a caption for the content of its parent <fieldset>.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend
func Legend(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("legend")
gr.Modifiers(mods).Modify(e)
return e
}
// ListItem — The HTML <li> element (or HTML List Item Element) is used to represent an item in a list. It must be contained in a parent element: an ordered list (<ol>), an unordered list (<ul>), or a menu (<menu>). In menus and unordered lists, list items are usually displayed using bullet points. In ordered lists, they are usually displayed with an ascending counter on the left, such as a number or letter.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li
func ListItem(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("li")
gr.Modifiers(mods).Modify(e)
return e
}
// Link — The HTML <link> element specifies relationships between the current document and an external resource. Possible uses for this element include defining a relational framework for navigation. This Element is most used to link to style sheets.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link
func Link(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("link")
gr.Modifiers(mods).Modify(e)
return e
}
// Main — The HTML <main> element represents the main content of the <body> of a document or application. The main content area consists of content that is directly related to, or expands upon the central topic of a document or the central functionality of an application. This content should be unique to the document, excluding any content that is repeated across a set of documents such as sidebars, navigation links, copyright information, site logos, and search forms (unless the document's main function is as a search form).
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main
func Main(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("main")
gr.Modifiers(mods).Modify(e)
return e
}
// Map — The HTML <map> element is used with <area> elements to define an image map (a clickable link area).
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/map
func Map(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("map")
gr.Modifiers(mods).Modify(e)
return e
}
// Mark — The HTML Mark Element (<mark>) represents highlighted text, i.e., a run of text marked for reference purpose, due to its relevance in a particular context. For example it can be used in a page showing search results to highlight every instance of the searched-for word.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark
func Mark(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("mark")
gr.Modifiers(mods).Modify(e)
return e
}
// Menu — The HTML <menu> element represents a group of commands that a user can perform or activate. This includes both list menus, which might appear across the top of a screen, as well as context menus, such as those that might appear underneath a button after it has been clicked.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menu
func Menu(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("menu")
gr.Modifiers(mods).Modify(e)
return e
}
// MenuItem — The HTML <menuitem> element represents a command that a user is able to invoke through a popup menu. This includes context menus, as well as menus that might be attached to a menu button.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menuitem
func MenuItem(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("menuitem")
gr.Modifiers(mods).Modify(e)
return e
}
// Meta — The HTML <meta> element represents any metadata information that cannot be represented by one of the other HTML meta-related elements (<base>, <link>, <script>, <style> or <title>).
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
func Meta(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("meta")
gr.Modifiers(mods).Modify(e)
return e
}
// Meter — The HTML <meter> Element represents either a scalar value within a known range or a fractional value.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meter
func Meter(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("meter")
gr.Modifiers(mods).Modify(e)
return e
}
// Multicol — The HTML <multicol> element was an experimental element designed to allow multi-column layouts. It never got any significant traction and is not implemented in any major browsers.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/multicol
func Multicol(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("multicol")
gr.Modifiers(mods).Modify(e)
return e
}
// Navigation — The HTML <nav> element (HTML Navigation Element) represents a section of a page that links to other pages or to parts within the page: a section with navigation links.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/nav
func Navigation(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("nav")
gr.Modifiers(mods).Modify(e)
return e
}
// NoFrames — <noframes> is an HTML element which is used to supporting browsers which are not able to support <frame> elements or configured to do so.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noframes
func NoFrames(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("noframes")
gr.Modifiers(mods).Modify(e)
return e
}
// NoScript — The HTML <noscript> Element defines a section of html to be inserted if a script type on the page is unsupported or if scripting is currently turned off in the browser.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
func NoScript(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("noscript")
gr.Modifiers(mods).Modify(e)
return e
}
// Object — The HTML Embedded Object Element (<object>) represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object
func Object(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("object")
gr.Modifiers(mods).Modify(e)
return e
}
// OrderedList — The HTML <ol> Element (or HTML Ordered List Element) represents an ordered list of items. Typically, ordered-list items are displayed with a preceding numbering, which can be of any form, like numerals, letters or Romans numerals or even simple bullets. This numbered style is not defined in the HTML description of the page, but in its associated CSS, using the list-style-type property.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol
func OrderedList(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("ol")
gr.Modifiers(mods).Modify(e)
return e
}
// OptionsGroup — In a Web form, the HTML <optgroup> element creates a grouping of options within a <select> element.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup
func OptionsGroup(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("optgroup")
gr.Modifiers(mods).Modify(e)
return e
}
// Option — In a Web form, the HTML <option> element is used to create a control representing an item within a <select>, an <optgroup> or a <datalist> HTML5 element.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option
func Option(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("option")
gr.Modifiers(mods).Modify(e)
return e
}
// Output — The HTML <output> element represents the result of a calculation or user action.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/output
func Output(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("output")
gr.Modifiers(mods).Modify(e)
return e
}
// Paragraph — The HTML <p> element (or HTML Paragraph Element) represents a paragraph of text.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p
func Paragraph(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("p")
gr.Modifiers(mods).Modify(e)
return e
}
// Parameter — The HTML <param> Element (or HTML Parameter Element) defines parameters for <object>.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/param
func Parameter(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("param")
gr.Modifiers(mods).Modify(e)
return e
}
// Picture — The HTML <picture> element is a container used to specify multiple <source> elements for a specific <img> contained in it. The browser will choose the most suitable source according to the current layout of the page (the constraints of the box the image will appear in) and the device it will be displayed on (e.g. a normal or hiDPI device.)
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture
func Picture(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("picture")
gr.Modifiers(mods).Modify(e)
return e
}
// Preformatted — The HTML <pre> element (or HTML Preformatted Text) represents preformatted text. Text within this element is typically displayed in a non-proportional ("monospace") font exactly as it is laid out in the file. Whitespace inside this element is displayed as typed.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre
func Preformatted(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("pre")
gr.Modifiers(mods).Modify(e)
return e
}
// Progress — The HTML <progress> Element is used to view the completion progress of a task. While the specifics of how it's displayed is left up to the browser developer, it's typically displayed as a progress bar. Javascript can be used to manipulate the value of progress bar.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress
func Progress(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("progress")
gr.Modifiers(mods).Modify(e)
return e
}
// Quote — The HTML Quote Element (<q>) indicates that the enclosed text is a short inline quotation. This element is intended for short quotations that don't require paragraph breaks; for long quotations use <blockquote> element.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q
func Quote(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("q")
gr.Modifiers(mods).Modify(e)
return e
}
// RubyParenthesis — The HTML <rp> element is used to provide fall-back parenthesis for browsers non-supporting ruby annotations. Ruby annotations are for showing pronunciation of East Asian characters, like using Japanese furigana or Taiwainese bopomofo characters. The <rp> element is used in the case of lack of <ruby> element support its content has what should be displayed in order to indicate the presence of a ruby annotation, usually parentheses.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/rp
func RubyParenthesis(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("rp")
gr.Modifiers(mods).Modify(e)
return e
}
// RubyText — The HTML <rt> Element embraces pronunciation of characters presented in a ruby annotations, which are used to describe the pronunciation of East Asian characters. This element is always used inside a <ruby> element.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/rt
func RubyText(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("rt")
gr.Modifiers(mods).Modify(e)
return e
}
// RubyTextContainer — The HTML <rtc> Element embraces semantic annotations of characters presented in a ruby of <rb> elements used inside of <ruby> element. <rb> elements can have both pronunciation (<rt>) and semantic (<rtc>) annotations.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/rtc
func RubyTextContainer(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("rtc")
gr.Modifiers(mods).Modify(e)
return e
}
// Ruby — The HTML <ruby> Element represents a ruby annotation. Ruby annotations are for showing pronunciation of East Asian characters.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ruby
func Ruby(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("ruby")
gr.Modifiers(mods).Modify(e)
return e
}
// Strikethrough — The HTML Strikethrough Element (<s>) renders text with a strikethrough, or a line through it. Use the <s> element to represent things that are no longer relevant or no longer accurate. However, <s> is not appropriate when indicating document edits; for that, use the <del> and <ins> elements, as appropriate.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/s
func Strikethrough(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("s")
gr.Modifiers(mods).Modify(e)
return e
}
// Sample — The HTML <samp> element is an element intended to identify sample output from a computer program. It is usually displayed in the browser's default monotype font (such as Lucida Console).
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/samp
func Sample(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("samp")
gr.Modifiers(mods).Modify(e)
return e
}
// Script — The HTML Script Element (<script>) is used to embed or reference an executable script within an HTML or XHTML document.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
func Script(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("script")
gr.Modifiers(mods).Modify(e)
return e
}
// Section — The HTML <section> element represents a generic section of a document, i.e., a thematic grouping of content, typically with a heading. Each <section> should be identified, typically by including a heading (<h1>-<h6> element) as a child of the <section> element.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section
func Section(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("section")
gr.Modifiers(mods).Modify(e)
return e
}
// Select — The HTML select (<select>) element represents a control that presents a menu of options. The options within the menu are represented by <option> elements, which can be grouped by <optgroup> elements. Options can be pre-selected for the user.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
func Select(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("select")
gr.Modifiers(mods).Modify(e)
return e
}
// Shadow — The HTML <shadow> element is used as a shadow DOM insertion point. You might use it if you have created multiple shadow roots under a shadow host. It is not useful in ordinary HTML. It is used with Web Components.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Shadow
func Shadow(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("shadow")
gr.Modifiers(mods).Modify(e)
return e
}
// Small — The HTML Small Element (<small>) makes the text font size one size smaller (for example, from large to medium, or from small to x-small) down to the browser's minimum font size. In HTML5, this element is repurposed to represent side-comments and small print, including copyright and legal text, independent of its styled presentation.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/small
func Small(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("small")
gr.Modifiers(mods).Modify(e)
return e
}
// Source — Editorial review completed.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source
func Source(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("source")
gr.Modifiers(mods).Modify(e)
return e
}
// Span — The HTML <span> element is a generic inline container for phrasing content, which does not inherently represent anything. It can be used to group elements for styling purposes (using the class or id attributes), or because they share attribute values, such as lang.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span
func Span(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("span")
gr.Modifiers(mods).Modify(e)
return e
}
// Strong — The HTML Strong Element (<strong>) gives text strong importance, and is typically displayed in bold.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong
func Strong(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("strong")
gr.Modifiers(mods).Modify(e)
return e
}
// Style — The HTML <style> element contains style information for a document, or part of a document. By default, the style instructions written inside that element are expected to be CSS.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
func Style(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("style")
gr.Modifiers(mods).Modify(e)
return e
}
// Subscript — The HTML Subscript Element (<sub>) defines a span of text that should be displayed, for typographic reasons, lower, and often smaller, than the main span of text.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub
func Subscript(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("sub")
gr.Modifiers(mods).Modify(e)
return e
}
// Summary — The HTML summary element (<summary>) is used as a summary, caption, or legend for the content of a <details> element.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary
func Summary(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("summary")
gr.Modifiers(mods).Modify(e)
return e
}
// Superscript — The HTML Superscript Element (<sup>) defines a span of text that should be displayed, for typographic reasons, higher, and often smaller, than the main span of text.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup
func Superscript(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("sup")
gr.Modifiers(mods).Modify(e)
return e
}
// Table — The HTML Table Element (<table>) represents tabular data: information expressed via two dimensions or more.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table
func Table(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("table")
gr.Modifiers(mods).Modify(e)
return e
}
// TableBody — The HTML Table Body Element (<tbody>) defines one or more <tr> element data-rows to be the body of its parent <table> element (as long as no <tr> elements are immediate children of that table element.) In conjunction with a preceding <thead> and/or <tfoot> element, <tbody> provides additional semantic information for devices such as printers and displays. Of the parent table's child elements, <tbody> represents the content which, when longer than a page, will most likely differ for each page printed; while the content of <thead> and <tfoot> will be the same or similar for each page printed. For displays, <tbody> will enable separate scrolling of the <thead>, <tfoot>, and <caption> elements of the same parent <table> element. Note that unlike the <thead>, <tfoot>, and <caption> elements however, multiple <tbody> elements are permitted (if consecutive), allowing the data-rows in long tables to be divided into different sections, each separately formatted as needed.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody
func TableBody(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("tbody")
gr.Modifiers(mods).Modify(e)
return e
}
// TableData — The Table cell HTML element (<td>) defines a cell of a table that contains data. It participates in the table model.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td
func TableData(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("td")
gr.Modifiers(mods).Modify(e)
return e
}
// Template — The HTML template element <template> is a mechanism for holding client-side content that is not to be rendered when a page is loaded but may subsequently be instantiated during runtime using JavaScript.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template
func Template(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("template")
gr.Modifiers(mods).Modify(e)
return e
}
// TextArea — The HTML <textarea> element represents a multi-line plain-text editing control.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
func TextArea(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("textarea")
gr.Modifiers(mods).Modify(e)
return e
}
// TableFoot — The HTML Table Foot Element (<tfoot>) defines a set of rows summarizing the columns of the table.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tfoot
func TableFoot(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("tfoot")
gr.Modifiers(mods).Modify(e)
return e
}
// TableHeader — The HTML element table header cell <th> defines a cell as a header for a group of cells of a table. The group of cells that the header refers to is defined by the scope and headers attribute.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th
func TableHeader(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("th")
gr.Modifiers(mods).Modify(e)
return e
}
// TableHead — The HTML Table Head Element (<thead>) defines a set of rows defining the head of the columns of the table.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead
func TableHead(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("thead")
gr.Modifiers(mods).Modify(e)
return e
}
// Time — Technical review completed.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time
func Time(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("time")
gr.Modifiers(mods).Modify(e)
return e
}
// Title — The HTML <title> element defines the title of the document, shown in a browser's title bar or on the page's tab. It can only contain text, and any contained tags are ignored.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
func Title(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("title")
gr.Modifiers(mods).Modify(e)
return e
}
// TableRow — The HTML element table row <tr> defines a row of cells in a table. Those can be a mix of <td> and <th> elements.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr
func TableRow(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("tr")
gr.Modifiers(mods).Modify(e)
return e
}
// Track — The HTML <track> element is used as a child of the media elements—<audio> and <video>. It lets you specify timed text tracks (or time-based data), for example to automatically handle subtitles. The tracks are formatted in WebVTT format (.vtt files) — Web Video Text Tracks.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track
func Track(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("track")
gr.Modifiers(mods).Modify(e)
return e
}
// Underline — The HTML Underline Element (<u>) renders text with an underline, a line under the baseline of its content.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/u
func Underline(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("u")
gr.Modifiers(mods).Modify(e)
return e
}
// UnorderedList — The HTML <ul> element (or HTML Unordered List Element) represents an unordered list of items, namely a collection of items that do not have a numerical ordering, and their order in the list is meaningless. Typically, unordered-list items are displayed with a bullet, which can be of several forms, like a dot, a circle or a squared. The bullet style is not defined in the HTML description of the page, but in its associated CSS, using the list-style-type property.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul
func UnorderedList(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("ul")
gr.Modifiers(mods).Modify(e)
return e
}
// Variable — The HTML Variable Element (<var>) represents a variable in a mathematical expression or a programming context.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/var
func Variable(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("var")
gr.Modifiers(mods).Modify(e)
return e
}
// Video — Editorial review completed.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
func Video(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("video")
gr.Modifiers(mods).Modify(e)
return e
}
// WordBreakOpportunity — The HTML element word break opportunity <wbr> represents a position within text where the browser may optionally break a line, though its line-breaking rules would not otherwise create a break at that location.
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/wbr
func WordBreakOpportunity(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("wbr")
gr.Modifiers(mods).Modify(e)
return e
}
// Header1 — Heading elements implement six levels of document headings, <h1> is the most important and <h6> is the least. A heading element briefly describes the topic of the section it introduces. Heading information may be used by user agents, for example, to construct a table of contents for a document automatically( just like the fixed sider bar of this page on the right).
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements
func Header1(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("h1")
gr.Modifiers(mods).Modify(e)
return e
}
// Header2 — Heading elements implement six levels of document headings, <h1> is the most important and <h6> is the least. A heading element briefly describes the topic of the section it introduces. Heading information may be used by user agents, for example, to construct a table of contents for a document automatically( just like the fixed sider bar of this page on the right).
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements
func Header2(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("h2")
gr.Modifiers(mods).Modify(e)
return e
}
// Header3 — Heading elements implement six levels of document headings, <h1> is the most important and <h6> is the least. A heading element briefly describes the topic of the section it introduces. Heading information may be used by user agents, for example, to construct a table of contents for a document automatically( just like the fixed sider bar of this page on the right).
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements
func Header3(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("h3")
gr.Modifiers(mods).Modify(e)
return e
}
// Header4 — Heading elements implement six levels of document headings, <h1> is the most important and <h6> is the least. A heading element briefly describes the topic of the section it introduces. Heading information may be used by user agents, for example, to construct a table of contents for a document automatically( just like the fixed sider bar of this page on the right).
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements
func Header4(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("h4")
gr.Modifiers(mods).Modify(e)
return e
}
// Header5 — Heading elements implement six levels of document headings, <h1> is the most important and <h6> is the least. A heading element briefly describes the topic of the section it introduces. Heading information may be used by user agents, for example, to construct a table of contents for a document automatically( just like the fixed sider bar of this page on the right).
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements
func Header5(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("h5")
gr.Modifiers(mods).Modify(e)
return e
}
// Header6 — Heading elements implement six levels of document headings, <h1> is the most important and <h6> is the least. A heading element briefly describes the topic of the section it introduces. Heading information may be used by user agents, for example, to construct a table of contents for a document automatically( just like the fixed sider bar of this page on the right).
//
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements
func Header6(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("h6")
gr.Modifiers(mods).Modify(e)
return e
}
================================================
FILE: el/generate.go
================================================
// +build ignore
/*
Copyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Portions Copyright (c) 2016 The Vecty Authors. All rights reserved.
// See https://github.com/gopherjs/vecty for the origin of this clever
// code generator.
package main
import (
"fmt"
"io"
"os"
"strings"
"github.com/PuerkitoBio/goquery"
)
var elemNameMap = map[string]string{
"a": "Anchor",
"abbr": "Abbreviation",
"b": "Bold",
"bdi": "BidirectionalIsolation",
"bdo": "BidirectionalOverride",
"blockquote": "BlockQuote",
"br": "Break",
"cite": "Citation",
"col": "Column",
"colgroup": "ColumnGroup",
"datalist": "DataList",
"dd": "Description",
"del": "DeletedText",
"dfn": "Definition",
"dl": "DescriptionList",
"dt": "DefinitionTerm",
"em": "Emphasis",
"fieldset": "FieldSet",
"figcaption": "FigureCaption",
"h1": "Header1",
"h2": "Header2",
"h3": "Header3",
"h4": "Header4",
"h5": "Header5",
"h6": "Header6",
"hgroup": "HeadingsGroup",
"hr": "HorizontalRule",
"i": "Italic",
"iframe": "InlineFrame",
"img": "Image",
"ins": "InsertedText",
"kbd": "KeyboardInput",
"li": "ListItem",
"menuitem": "MenuItem",
"nav": "Navigation",
"noframes": "NoFrames",
"noscript": "NoScript",
"ol": "OrderedList",
"optgroup": "OptionsGroup",
"p": "Paragraph",
"param": "Parameter",
"pre": "Preformatted",
"q": "Quote",
"rp": "RubyParenthesis",
"rt": "RubyText",
"rtc": "RubyTextContainer",
"s": "Strikethrough",
"samp": "Sample",
"sub": "Subscript",
"sup": "Superscript",
"tbody": "TableBody",
"textarea": "TextArea",
"td": "TableData",
"tfoot": "TableFoot",
"th": "TableHeader",
"thead": "TableHead",
"tr": "TableRow",
"u": "Underline",
"ul": "UnorderedList",
"var": "Variable",
"wbr": "WordBreakOpportunity",
}
func main() {
doc, err := goquery.NewDocument("https://developer.mozilla.org/en-US/docs/Web/HTML/Element")
if err != nil {
panic(err)
}
file, err := os.Create("elements.autogen.go")
if err != nil {
panic(err)
}
defer file.Close()
fmt.Fprint(file, `//go:generate go run generate.go
// Package el defines markup to create DOM elements.
//
// Generated from "HTML element reference" by Mozilla Contributors, https://developer.mozilla.org/en-US/docs/Web/HTML/Element, licensed under CC-BY-SA 2.5.
package el
import "github.com/bep/gr"
`)
doc.Find(".quick-links a").Each(func(i int, s *goquery.Selection) {
link, _ := s.Attr("href")
if !strings.HasPrefix(link, "/en-US/docs/Web/HTML/Element/") {
return
}
if s.Parent().Find(".icon-trash, .icon-thumbs-down-alt, .icon-warning-sign").Length() > 0 {
return
}
desc, _ := s.Attr("title")
text := s.Text()
if text == "Heading elements" {
writeElem(file, "h1", desc, link)
writeElem(file, "h2", desc, link)
writeElem(file, "h3", desc, link)
writeElem(file, "h4", desc, link)
writeElem(file, "h5", desc, link)
writeElem(file, "h6", desc, link)
return
}
if strings.HasPrefix(text, "webkit") {
return
}
name := text[1 : len(text)-1]
if name == "html" || name == "head" || name == "body" {
return
}
writeElem(file, name, desc, link)
})
}
func writeElem(w io.Writer, name, desc, link string) {
funName := elemNameMap[name]
if funName == "" {
funName = capitalize(name)
}
//TODO(bep) Make nicer description.
fmt.Fprintf(w, `
// %s — %s
//
// https://developer.mozilla.org%s
func %s(mods ...gr.Modifier) *gr.Element {
e := gr.NewElement("%s")
gr.Modifiers(mods).Modify(e)
return e
}
`, funName, desc, link, funName, name)
}
func capitalize(s string) string {
return strings.ToUpper(s[:1]) + s[1:]
}
================================================
FILE: element.go
================================================
/*
Copyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gr
import (
"github.com/gopherjs/gopherjs/js"
)
// A Modifier modifies an element, adding attributes, style or child elements etc.
type Modifier interface {
Modify(element *Element)
}
type elementFactory func(e *Element) *js.Object
var (
defaultElementFactory = (*Element).createElement
returnStoredElement = func(e *Element) *js.Object {
return e.element
}
)
// Element represents a builder for a ReactElement.
// An Element can be a simple text node or a HTML element with children, attributes etc.
type Element struct {
tag string
properties map[string]interface{}
style map[string]interface{}
eventListeners []*EventListener
children []Component
elFactory elementFactory
// We assume that this element is static, and as such we help by
// adding auto generated keys when missing, to work around
// annyoing warnings in the console.
// This can be switched with the Dynamic modifier.
dynamic bool
// This is the actual ReactJS element.
// ReactElement, ReactText or a ReactFragment
element *js.Object
}
// NewElement creates a new Element with the given tag.
func NewElement(tag string) *Element {
return &Element{tag: tag, properties: Props{}, elFactory: defaultElementFactory}
}
// NewPreparedElement creates an Element from a ready-to-use React element.
func NewPreparedElement(o *js.Object) *Element {
return &Element{element: o, elFactory: returnStoredElement}
}
// Node returns the resulting ReactElement.
func (e *Element) Node() *js.Object {
if e.element == nil {
e.element = e.elFactory(e)
}
return e.element
}
// Modify implements the Modifier interface.
func (e *Element) Modify(in *Element) {
in.children = append(in.children, e)
}
// Modifiers is used to Modify a list of elements (children).
type Modifiers []Modifier
// Modify implements the Modifier interface.
func (mods Modifiers) Modify(e *Element) {
for _, m := range mods {
if m != nil {
m.Modify(e)
}
}
}
func (e *Element) createElement() *js.Object {
if e.properties == nil {
e.properties = make(map[string]interface{})
}
if len(e.style) != 0 {
// TODO(bep) merge with existing?
e.properties["style"] = e.style
}
var args []interface{}
if len(e.children) > 0 {
for _, c := range e.children {
args = append(args, c.Node())
}
}
return createElement(e.tag, e.properties, args)
}
func createElement(tag string, props map[string]interface{}, args []interface{}) *js.Object {
if len(args) == 0 {
return react.Call("createElement", tag, props)
}
return react.Call("createElement", tag, props, args)
}
================================================
FILE: event.go
================================================
/*
Copyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gr
import (
"github.com/gopherjs/gopherjs/js"
)
// Event represents a browser event. See https://developer.mozilla.org/en-US/docs/Web/Events
type Event struct {
*js.Object
This *This
}
// Persist can be used to make sure the event survives Facebook React's recycling of
// events. Useful to avoid confusing debugging sessions in the console.
func (e *Event) Persist() {
e.Call("persist")
}
// Target gives the target triggering this event.
func (e *Event) Target() *js.Object {
return e.Get("target")
}
// TargetValue gives the target triggering this event's value. For a input select, this will be the selected value.
func (e *Event) TargetValue() *js.Object {
return e.Target().Get("value")
}
// CurrentTarget gives the currentTarget, i.e. the container triggering this event.
func (e *Event) CurrentTarget() *js.Object {
return e.Get("currentTarget")
}
// Int is a convenience method to get an Event attribute as an Int value, e.g. screenX.
func (e *Event) Int(key string) int {
return e.Get(key).Int()
}
// An EventListener can be attached to a HTML element to listen for events, mouse clicks etc.
type EventListener struct {
name string
listener func(*Event)
preventDefault bool
stopPropagation bool
delegate func(jsEvent *js.Object)
}
// PreventDefault prevents the default event behaviour in the browser.
func (l *EventListener) PreventDefault() *EventListener {
l.preventDefault = true
return l
}
// StopPropagation prevents further propagation of the current event in the capturing and bubbling phases.
//
// See https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation.
func (l *EventListener) StopPropagation() *EventListener {
l.stopPropagation = true
return l
}
// Listener is the signature for the func that needs to be implemented by the
// listener, e.g. the clickHandler etc.
type Listener func(*Event)
// NewEventListener creates a new EventListener. In most cases you will use the
// predefined event listeners in the evt package.
func NewEventListener(name string, listener func(*Event)) *EventListener {
l := &EventListener{name: name, listener: listener}
return l
}
// Modify implements the Modifier interface.
func (l *EventListener) Modify(element *Element) {
element.eventListeners = append(element.eventListeners, l)
}
================================================
FILE: evt/event.autogen.go
================================================
//go:generate go run generate.go
// Package evt defines markup to bind DOM events.
//
// Generated from "Event reference" by Mozilla Contributors, https://developer.mozilla.org/en-US/docs/Web/Events, licensed under CC-BY-SA 2.5.
package evt
import "github.com/bep/gr"
// Abort gets notified when a transaction has been aborted.
//
// https://developer.mozilla.org/docs/Web/Reference/Events/abort_indexedDB
func Abort(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onAbort", listener)
}
// AfterPrint gets notified when the associated document has started printing or the print preview has been closed.
//
// https://developer.mozilla.org/docs/Web/Events/afterprint
func AfterPrint(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onAfterPrint", listener)
}
// AnimationEnd gets notified when a CSS animation has completed.
//
// https://developer.mozilla.org/docs/Web/Events/animationend
func AnimationEnd(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onAnimationEnd", listener)
}
// AnimationIteration gets notified when a CSS animation is repeated.
//
// https://developer.mozilla.org/docs/Web/Events/animationiteration
func AnimationIteration(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onAnimationIteration", listener)
}
// AnimationStart gets notified when a CSS animation has started.
//
// https://developer.mozilla.org/docs/Web/Events/animationstart
func AnimationStart(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onAnimationStart", listener)
}
// AudioEnd gets notified when the user agent has finished capturing audio for speech recognition.
//
// https://developer.mozilla.org/docs/Web/Events/audioend
func AudioEnd(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onAudioEnd", listener)
}
// AudioProcess gets notified when the input buffer of a ScriptProcessorNode is ready to be processed.
//
// https://developer.mozilla.org/docs/Web/Events/audioprocess
func AudioProcess(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onAudioProcess", listener)
}
// AudioStart gets notified when the user agent has started to capture audio for speech recognition.
//
// https://developer.mozilla.org/docs/Web/Events/audiostart
func AudioStart(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onAudioStart", listener)
}
// BeforePrint gets notified when the associated document is about to be printed or previewed for printing.
//
// https://developer.mozilla.org/docs/Web/Events/beforeprint
func BeforePrint(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onBeforePrint", listener)
}
// BeforeUnload gets notified when (no documentation)
//
// https://developer.mozilla.org/docs/Web/Events/beforeunload
func BeforeUnload(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onBeforeUnload", listener)
}
// BeginEvent gets notified when a SMIL animation element begins.
//
// https://developer.mozilla.org/docs/Web/Events/beginEvent
func BeginEvent(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onBeginEvent", listener)
}
// Blocked gets notified when an open connection to a database is blocking a versionchange transaction on the same database.
//
// https://developer.mozilla.org/docs/Web/Reference/Events/blocked_indexedDB
func Blocked(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onBlocked", listener)
}
// Blur gets notified when an element has lost focus (does not bubble).
//
// https://developer.mozilla.org/docs/Web/Events/blur
func Blur(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onBlur", listener)
}
// Boundary gets notified when the spoken utterance reaches a word or sentence boundary
//
// https://developer.mozilla.org/docs/Web/Events/boundary
func Boundary(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onBoundary", listener)
}
// Cached gets notified when the resources listed in the manifest have been downloaded, and the application is now cached.
//
// https://developer.mozilla.org/docs/Web/Events/cached
func Cached(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onCached", listener)
}
// CanPlay gets notified when the user agent can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content.
//
// https://developer.mozilla.org/docs/Web/Events/canplay
func CanPlay(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onCanPlay", listener)
}
// CanPlayThrough gets notified when the user agent can play the media, and estimates that enough data has been loaded to play the media up to its end without having to stop for further buffering of content.
//
// https://developer.mozilla.org/docs/Web/Events/canplaythrough
func CanPlayThrough(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onCanPlayThrough", listener)
}
// Change gets notified when the change event is fired for <input>, <select>, and <textarea> elements when a change to the element's value is committed by the user.
//
// https://developer.mozilla.org/docs/Web/Events/change
func Change(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onChange", listener)
}
// ChargingChange gets notified when the battery begins or stops charging.
//
// https://developer.mozilla.org/docs/Web/Events/chargingchange
func ChargingChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onChargingChange", listener)
}
// ChargingTimeChange gets notified when the chargingTime attribute has been updated.
//
// https://developer.mozilla.org/docs/Web/Events/chargingtimechange
func ChargingTimeChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onChargingTimeChange", listener)
}
// Checking gets notified when the user agent is checking for an update, or attempting to download the cache manifest for the first time.
//
// https://developer.mozilla.org/docs/Web/Events/checking
func Checking(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onChecking", listener)
}
// Click gets notified when a pointing device button has been pressed and released on an element.
//
// https://developer.mozilla.org/docs/Web/Events/click
func Click(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onClick", listener)
}
// Close gets notified when a WebSocket connection has been closed.
//
// https://developer.mozilla.org/docs/Web/Reference/Events/close_websocket
func Close(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onClose", listener)
}
// Complete gets notified when the rendering of an OfflineAudioContext is terminated.
//
// https://developer.mozilla.org/docs/Web/Events/complete
func Complete(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onComplete", listener)
}
// CompositionEnd gets notified when the composition of a passage of text has been completed or canceled.
//
// https://developer.mozilla.org/docs/Web/Events/compositionend
func CompositionEnd(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onCompositionEnd", listener)
}
// CompositionStart gets notified when the composition of a passage of text is prepared (similar to keydown for a keyboard input, but works with other inputs such as speech recognition).
//
// https://developer.mozilla.org/docs/Web/Events/compositionstart
func CompositionStart(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onCompositionStart", listener)
}
// CompositionUpdate gets notified when a character is added to a passage of text being composed.
//
// https://developer.mozilla.org/docs/Web/Events/compositionupdate
func CompositionUpdate(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onCompositionUpdate", listener)
}
// ContextMenu gets notified when the right button of the mouse is clicked (before the context menu is displayed).
//
// https://developer.mozilla.org/docs/Web/Events/contextmenu
func ContextMenu(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onContextMenu", listener)
}
// Copy gets notified when the text selection has been added to the clipboard.
//
// https://developer.mozilla.org/docs/Web/Events/copy
func Copy(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onCopy", listener)
}
// Cut gets notified when the text selection has been removed from the document and added to the clipboard.
//
// https://developer.mozilla.org/docs/Web/Events/cut
func Cut(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onCut", listener)
}
// DOMContentLoaded gets notified when the document has finished loading (but not its dependent resources).
//
// https://developer.mozilla.org/docs/Web/Events/DOMContentLoaded
func DOMContentLoaded(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDOMContentLoaded", listener)
}
// DeviceLight gets notified when fresh data is available from a light sensor.
//
// https://developer.mozilla.org/docs/Web/Events/devicelight
func DeviceLight(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDeviceLight", listener)
}
// DeviceMotion gets notified when fresh data is available from a motion sensor.
//
// https://developer.mozilla.org/docs/Web/Events/devicemotion
func DeviceMotion(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDeviceMotion", listener)
}
// DeviceOrientation gets notified when fresh data is available from an orientation sensor.
//
// https://developer.mozilla.org/docs/Web/Events/deviceorientation
func DeviceOrientation(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDeviceOrientation", listener)
}
// DeviceProximity gets notified when fresh data is available from a proximity sensor (indicates an approximated distance between the device and a nearby object).
//
// https://developer.mozilla.org/docs/Web/Events/deviceproximity
func DeviceProximity(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDeviceProximity", listener)
}
// DischargingTimeChange gets notified when the dischargingTime attribute has been updated.
//
// https://developer.mozilla.org/docs/Web/Events/dischargingtimechange
func DischargingTimeChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDischargingTimeChange", listener)
}
// DoubleClick gets notified when a pointing device button is clicked twice on an element.
//
// https://developer.mozilla.org/docs/Web/Events/dblclick
func DoubleClick(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDoubleClick", listener)
}
// Downloading gets notified when the user agent has found an update and is fetching it, or is downloading the resources listed by the cache manifest for the first time.
//
// https://developer.mozilla.org/docs/Web/Events/downloading
func Downloading(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDownloading", listener)
}
// Drag gets notified when an element or text selection is being dragged (every 350ms).
//
// https://developer.mozilla.org/docs/Web/Events/drag
func Drag(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDrag", listener)
}
// DragEnd gets notified when a drag operation is being ended (by releasing a mouse button or hitting the escape key).
//
// https://developer.mozilla.org/docs/Web/Events/dragend
func DragEnd(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDragEnd", listener)
}
// DragEnter gets notified when a dragged element or text selection enters a valid drop target.
//
// https://developer.mozilla.org/docs/Web/Events/dragenter
func DragEnter(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDragEnter", listener)
}
// DragLeave gets notified when a dragged element or text selection leaves a valid drop target.
//
// https://developer.mozilla.org/docs/Web/Events/dragleave
func DragLeave(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDragLeave", listener)
}
// DragOver gets notified when an element or text selection is being dragged over a valid drop target (every 350ms).
//
// https://developer.mozilla.org/docs/Web/Events/dragover
func DragOver(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDragOver", listener)
}
// DragStart gets notified when the user starts dragging an element or text selection.
//
// https://developer.mozilla.org/docs/Web/Events/dragstart
func DragStart(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDragStart", listener)
}
// Drop gets notified when an element is dropped on a valid drop target.
//
// https://developer.mozilla.org/docs/Web/Events/drop
func Drop(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDrop", listener)
}
// DurationChange gets notified when the duration attribute has been updated.
//
// https://developer.mozilla.org/docs/Web/Events/durationchange
func DurationChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onDurationChange", listener)
}
// Emptied gets notified when the media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it.
//
// https://developer.mozilla.org/docs/Web/Events/emptied
func Emptied(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onEmptied", listener)
}
// End gets notified when the utterance has finished being spoken.
//
// https://developer.mozilla.org/docs/Web/Events/end_(SpeechSynthesis)
func End(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onEnd", listener)
}
// EndEvent gets notified when a SMIL animation element ends.
//
// https://developer.mozilla.org/docs/Web/Events/endEvent
func EndEvent(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onEndEvent", listener)
}
// Ended gets notified when (no documentation)
//
// https://developer.mozilla.org/docs/Web/Events/ended_(Web_Audio)
func Ended(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onEnded", listener)
}
// Error gets notified when an error occurs that prevents the utterance from being successfully spoken.
//
// https://developer.mozilla.org/docs/Web/Events/error_(SpeechSynthesisError)
func Error(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onError", listener)
}
// Focus gets notified when an element has received focus (does not bubble).
//
// https://developer.mozilla.org/docs/Web/Events/focus
func Focus(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onFocus", listener)
}
// FocusIn gets notified when an element is about to receive focus (bubbles).
//
// https://developer.mozilla.org/docs/Web/Events/focusin
func FocusIn(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onFocusIn", listener)
}
// FocusOut gets notified when an element is about to lose focus (bubbles).
//
// https://developer.mozilla.org/docs/Web/Events/focusout
func FocusOut(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onFocusOut", listener)
}
// FullScreenChange gets notified when an element was turned to fullscreen mode or back to normal mode.
//
// https://developer.mozilla.org/docs/Web/Events/fullscreenchange
func FullScreenChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onFullScreenChange", listener)
}
// FullScreenError gets notified when it was impossible to switch to fullscreen mode for technical reasons or because the permission was denied.
//
// https://developer.mozilla.org/docs/Web/Events/fullscreenerror
func FullScreenError(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onFullScreenError", listener)
}
// GamepadConnected gets notified when a gamepad has been connected.
//
// https://developer.mozilla.org/docs/Web/Events/gamepadconnected
func GamepadConnected(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onGamepadConnected", listener)
}
// GamepadDisconnected gets notified when a gamepad has been disconnected.
//
// https://developer.mozilla.org/docs/Web/Events/gamepaddisconnected
func GamepadDisconnected(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onGamepadDisconnected", listener)
}
// GotPointerCapture gets notified when element receives pointer capture.
//
// https://developer.mozilla.org/docs/Web/Events/gotpointercapture
func GotPointerCapture(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onGotPointerCapture", listener)
}
// HashChange gets notified when the fragment identifier of the URL has changed (the part of the URL after the #).
//
// https://developer.mozilla.org/docs/Web/Events/hashchange
func HashChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onHashChange", listener)
}
// Input gets notified when the value of an element changes or the content of an element with the attribute contenteditable is modified.
//
// https://developer.mozilla.org/docs/Web/Events/input
func Input(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onInput", listener)
}
// Invalid gets notified when a submittable element has been checked and doesn't satisfy its constraints.
//
// https://developer.mozilla.org/docs/Web/Events/invalid
func Invalid(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onInvalid", listener)
}
// KeyDown gets notified when a key is pressed down.
//
// https://developer.mozilla.org/docs/Web/Events/keydown
func KeyDown(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onKeyDown", listener)
}
// KeyPress gets notified when a key is pressed down and that key normally produces a character value (use input instead).
//
// https://developer.mozilla.org/docs/Web/Events/keypress
func KeyPress(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onKeyPress", listener)
}
// KeyUp gets notified when a key is released.
//
// https://developer.mozilla.org/docs/Web/Events/keyup
func KeyUp(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onKeyUp", listener)
}
// LanguageChange gets notified when (no documentation)
//
// https://developer.mozilla.org/docs/Web/Events/languagechange
func LanguageChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onLanguageChange", listener)
}
// LevelChange gets notified when the level attribute has been updated.
//
// https://developer.mozilla.org/docs/Web/Events/levelchange
func LevelChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onLevelChange", listener)
}
// Load gets notified when progression has been successful.
//
// https://developer.mozilla.org/docs/Web/Reference/Events/load_(ProgressEvent)
func Load(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onLoad", listener)
}
// LoadEnd gets notified when progress has stopped (after "error", "abort" or "load" have been dispatched).
//
// https://developer.mozilla.org/docs/Web/Events/loadend
func LoadEnd(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onLoadEnd", listener)
}
// LoadStart gets notified when progress has begun.
//
// https://developer.mozilla.org/docs/Web/Events/loadstart
func LoadStart(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onLoadStart", listener)
}
// LoadedData gets notified when the first frame of the media has finished loading.
//
// https://developer.mozilla.org/docs/Web/Events/loadeddata
func LoadedData(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onLoadedData", listener)
}
// LoadedMetadata gets notified when the metadata has been loaded.
//
// https://developer.mozilla.org/docs/Web/Events/loadedmetadata
func LoadedMetadata(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onLoadedMetadata", listener)
}
// LostPointerCapture gets notified when element lost pointer capture.
//
// https://developer.mozilla.org/docs/Web/Events/lostpointercapture
func LostPointerCapture(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onLostPointerCapture", listener)
}
// Mark gets notified when the spoken utterance reaches a named SSML "mark" tag.
//
// https://developer.mozilla.org/docs/Web/Events/mark
func Mark(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onMark", listener)
}
// Message gets notified when a message is received from a service worker, or a message is received in a service worker from another context.
//
// https://developer.mozilla.org/docs/Web/Events/message_(ServiceWorker)
func Message(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onMessage", listener)
}
// MouseDown gets notified when a pointing device button (usually a mouse) is pressed on an element.
//
// https://developer.mozilla.org/docs/Web/Events/mousedown
func MouseDown(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onMouseDown", listener)
}
// MouseEnter gets notified when a pointing device is moved onto the element that has the listener attached.
//
// https://developer.mozilla.org/docs/Web/Events/mouseenter
func MouseEnter(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onMouseEnter", listener)
}
// MouseLeave gets notified when a pointing device is moved off the element that has the listener attached.
//
// https://developer.mozilla.org/docs/Web/Events/mouseleave
func MouseLeave(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onMouseLeave", listener)
}
// MouseMove gets notified when a pointing device is moved over an element.
//
// https://developer.mozilla.org/docs/Web/Events/mousemove
func MouseMove(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onMouseMove", listener)
}
// MouseOut gets notified when a pointing device is moved off the element that has the listener attached or off one of its children.
//
// https://developer.mozilla.org/docs/Web/Events/mouseout
func MouseOut(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onMouseOut", listener)
}
// MouseOver gets notified when a pointing device is moved onto the element that has the listener attached or onto one of its children.
//
// https://developer.mozilla.org/docs/Web/Events/mouseover
func MouseOver(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onMouseOver", listener)
}
// MouseUp gets notified when a pointing device button is released over an element.
//
// https://developer.mozilla.org/docs/Web/Events/mouseup
func MouseUp(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onMouseUp", listener)
}
// NoMatch gets notified when the speech recognition service returns a final result with no significant recognition.
//
// https://developer.mozilla.org/docs/Web/Events/nomatch
func NoMatch(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onNoMatch", listener)
}
// NoUpdate gets notified when the manifest hadn't changed.
//
// https://developer.mozilla.org/docs/Web/Events/noupdate
func NoUpdate(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onNoUpdate", listener)
}
// NotificationClick gets notified when a system notification spawned by ServiceWorkerRegistration.showNotification() has been clicked.
//
// https://developer.mozilla.org/docs/Web/Events/notificationclick
func NotificationClick(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onNotificationClick", listener)
}
// Obsolete gets notified when the manifest was found to have become a 404 or 410 page, so the application cache is being deleted.
//
// https://developer.mozilla.org/docs/Web/Events/obsolete
func Obsolete(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onObsolete", listener)
}
// Offline gets notified when the browser has lost access to the network.
//
// https://developer.mozilla.org/docs/Web/Events/offline
func Offline(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onOffline", listener)
}
// Online gets notified when the browser has gained access to the network (but particular websites might be unreachable).
//
// https://developer.mozilla.org/docs/Web/Events/online
func Online(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onOnline", listener)
}
// Open gets notified when an event source connection has been established.
//
// https://developer.mozilla.org/docs/Web/Reference/Events/open_serversentevents
func Open(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onOpen", listener)
}
// OrientationChange gets notified when the orientation of the device (portrait/landscape) has changed
//
// https://developer.mozilla.org/docs/Web/Events/orientationchange
func OrientationChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onOrientationChange", listener)
}
// PageHide gets notified when a session history entry is being traversed from.
//
// https://developer.mozilla.org/docs/Web/Events/pagehide
func PageHide(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPageHide", listener)
}
// PageShow gets notified when a session history entry is being traversed to.
//
// https://developer.mozilla.org/docs/Web/Events/pageshow
func PageShow(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPageShow", listener)
}
// Paste gets notified when data has been transferred from the system clipboard to the document.
//
// https://developer.mozilla.org/docs/Web/Events/paste
func Paste(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPaste", listener)
}
// Pause gets notified when the utterance is paused part way through.
//
// https://developer.mozilla.org/docs/Web/Events/pause_(SpeechSynthesis)
func Pause(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPause", listener)
}
// Play gets notified when playback has begun.
//
// https://developer.mozilla.org/docs/Web/Events/play
func Play(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPlay", listener)
}
// Playing gets notified when playback is ready to start after having been paused or delayed due to lack of data.
//
// https://developer.mozilla.org/docs/Web/Events/playing
func Playing(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPlaying", listener)
}
// PointerCancel gets notified when the pointer is unlikely to produce any more events.
//
// https://developer.mozilla.org/docs/Web/Events/pointercancel
func PointerCancel(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPointerCancel", listener)
}
// PointerDown gets notified when the pointer enters the active buttons state.
//
// https://developer.mozilla.org/docs/Web/Events/pointerdown
func PointerDown(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPointerDown", listener)
}
// PointerEnter gets notified when pointing device is moved inside the hit-testing boundary.
//
// https://developer.mozilla.org/docs/Web/Events/pointerenter
func PointerEnter(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPointerEnter", listener)
}
// PointerLeave gets notified when pointing device is moved out of the hit-testing boundary.
//
// https://developer.mozilla.org/docs/Web/Events/pointerleave
func PointerLeave(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPointerLeave", listener)
}
// PointerLockChange gets notified when the pointer was locked or released.
//
// https://developer.mozilla.org/docs/Web/Events/pointerlockchange
func PointerLockChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPointerLockChange", listener)
}
// PointerLockError gets notified when it was impossible to lock the pointer for technical reasons or because the permission was denied.
//
// https://developer.mozilla.org/docs/Web/Events/pointerlockerror
func PointerLockError(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPointerLockError", listener)
}
// PointerMove gets notified when the pointer changed coordinates.
//
// https://developer.mozilla.org/docs/Web/Events/pointermove
func PointerMove(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPointerMove", listener)
}
// PointerOut gets notified when the pointing device moved out of hit-testing boundary or leaves detectable hover range.
//
// https://developer.mozilla.org/docs/Web/Events/pointerout
func PointerOut(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPointerOut", listener)
}
// PointerOver gets notified when the pointing device is moved into the hit-testing boundary.
//
// https://developer.mozilla.org/docs/Web/Events/pointerover
func PointerOver(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPointerOver", listener)
}
// PointerUp gets notified when the pointer leaves the active buttons state.
//
// https://developer.mozilla.org/docs/Web/Events/pointerup
func PointerUp(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPointerUp", listener)
}
// PopState gets notified when a session history entry is being navigated to (in certain cases).
//
// https://developer.mozilla.org/docs/Web/Events/popstate
func PopState(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPopState", listener)
}
// Progress gets notified when the user agent is downloading resources listed by the manifest.
//
// https://developer.mozilla.org/docs/Web/Reference/Events/progress_(appcache_event)
func Progress(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onProgress", listener)
}
// Push gets notified when a Service Worker has received a push message.
//
// https://developer.mozilla.org/docs/Web/Events/push
func Push(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPush", listener)
}
// PushSubscriptionChange gets notified when a PushSubscription has expired.
//
// https://developer.mozilla.org/docs/Web/Events/pushsubscriptionchange
func PushSubscriptionChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onPushSubscriptionChange", listener)
}
// RateChange gets notified when the playback rate has changed.
//
// https://developer.mozilla.org/docs/Web/Events/ratechange
func RateChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onRateChange", listener)
}
// ReadyStateChange gets notified when the readyState attribute of a document has changed.
//
// https://developer.mozilla.org/docs/Web/Events/readystatechange
func ReadyStateChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onReadyStateChange", listener)
}
// RepeatEvent gets notified when a SMIL animation element is repeated.
//
// https://developer.mozilla.org/docs/Web/Events/repeatEvent
func RepeatEvent(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onRepeatEvent", listener)
}
// Reset gets notified when a form is reset.
//
// https://developer.mozilla.org/docs/Web/Events/reset
func Reset(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onReset", listener)
}
// Resize gets notified when the document view has been resized.
//
// https://developer.mozilla.org/docs/Web/Events/resize
func Resize(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onResize", listener)
}
// ResourceTimingBufferFull gets notified when the browser's resource timing buffer is full.
//
// https://developer.mozilla.org/docs/Web/Events/resourcetimingbufferfull
func ResourceTimingBufferFull(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onResourceTimingBufferFull", listener)
}
// Result gets notified when the speech recognition service returns a result — a word or phrase has been positively recognized and this has been communicated back to the app.
//
// https://developer.mozilla.org/docs/Web/Events/result
func Result(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onResult", listener)
}
// Resume gets notified when a paused utterance is resumed.
//
// https://developer.mozilla.org/docs/Web/Events/resume
func Resume(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onResume", listener)
}
// SVGAbort gets notified when page loading has been stopped before the SVG was loaded.
//
// https://developer.mozilla.org/docs/Web/Events/SVGAbort
func SVGAbort(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSVGAbort", listener)
}
// SVGError gets notified when an error has occurred before the SVG was loaded.
//
// https://developer.mozilla.org/docs/Web/Events/SVGError
func SVGError(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSVGError", listener)
}
// SVGLoad gets notified when an SVG document has been loaded and parsed.
//
// https://developer.mozilla.org/docs/Web/Events/SVGLoad
func SVGLoad(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSVGLoad", listener)
}
// SVGResize gets notified when an SVG document is being resized.
//
// https://developer.mozilla.org/docs/Web/Events/SVGResize
func SVGResize(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSVGResize", listener)
}
// SVGScroll gets notified when an SVG document is being scrolled.
//
// https://developer.mozilla.org/docs/Web/Events/SVGScroll
func SVGScroll(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSVGScroll", listener)
}
// SVGUnload gets notified when an SVG document has been removed from a window or frame.
//
// https://developer.mozilla.org/docs/Web/Events/SVGUnload
func SVGUnload(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSVGUnload", listener)
}
// SVGZoom gets notified when an SVG document is being zoomed.
//
// https://developer.mozilla.org/docs/Web/Events/SVGZoom
func SVGZoom(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSVGZoom", listener)
}
// Scroll gets notified when the document view or an element has been scrolled.
//
// https://developer.mozilla.org/docs/Web/Events/scroll
func Scroll(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onScroll", listener)
}
// Seeked gets notified when a seek operation completed.
//
// https://developer.mozilla.org/docs/Web/Events/seeked
func Seeked(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSeeked", listener)
}
// Seeking gets notified when a seek operation began.
//
// https://developer.mozilla.org/docs/Web/Events/seeking
func Seeking(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSeeking", listener)
}
// Select gets notified when some text is being selected.
//
// https://developer.mozilla.org/docs/Web/Events/select
func Select(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSelect", listener)
}
// SelectStart gets notified when a selection just started.
//
// https://developer.mozilla.org/docs/Web/Events/selectstart
func SelectStart(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSelectStart", listener)
}
// SelectionChange gets notified when the selection in the document has been changed.
//
// https://developer.mozilla.org/docs/Web/Events/selectionchange
func SelectionChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSelectionChange", listener)
}
// Show gets notified when a contextmenu event was fired on/bubbled to an element that has a contextmenu attribute
//
// https://developer.mozilla.org/docs/Web/Events/show
func Show(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onShow", listener)
}
// SoundEnd gets notified when any sound — recognisable speech or not — has stopped being detected.
//
// https://developer.mozilla.org/docs/Web/Events/soundend
func SoundEnd(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSoundEnd", listener)
}
// SoundStart gets notified when any sound — recognisable speech or not — has been detected.
//
// https://developer.mozilla.org/docs/Web/Events/soundstart
func SoundStart(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSoundStart", listener)
}
// SpeechEnd gets notified when speech recognised by the speech recognition service has stopped being detected.
//
// https://developer.mozilla.org/docs/Web/Events/speechend
func SpeechEnd(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSpeechEnd", listener)
}
// SpeechStart gets notified when sound that is recognised by the speech recognition service as speech has been detected.
//
// https://developer.mozilla.org/docs/Web/Events/speechstart
func SpeechStart(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSpeechStart", listener)
}
// Stalled gets notified when the user agent is trying to fetch media data, but data is unexpectedly not forthcoming.
//
// https://developer.mozilla.org/docs/Web/Events/stalled
func Stalled(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onStalled", listener)
}
// Start gets notified when the utterance has begun to be spoken.
//
// https://developer.mozilla.org/docs/Web/Events/start_(SpeechSynthesis)
func Start(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onStart", listener)
}
// Storage gets notified when a storage area (localStorage or sessionStorage) has changed.
//
// https://developer.mozilla.org/docs/Web/Events/storage
func Storage(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onStorage", listener)
}
// Submit gets notified when a form is submitted.
//
// https://developer.mozilla.org/docs/Web/Events/submit
func Submit(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSubmit", listener)
}
// Success gets notified when a request successfully completed.
//
// https://developer.mozilla.org/docs/Web/Reference/Events/success_indexedDB
func Success(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSuccess", listener)
}
// Suspend gets notified when media data loading has been suspended.
//
// https://developer.mozilla.org/docs/Web/Events/suspend
func Suspend(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onSuspend", listener)
}
// TimeUpdate gets notified when the time indicated by the currentTime attribute has been updated.
//
// https://developer.mozilla.org/docs/Web/Events/timeupdate
func TimeUpdate(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onTimeUpdate", listener)
}
// Timeout gets notified when (no documentation)
//
// https://developer.mozilla.org/docs/Web/Events/timeout
func Timeout(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onTimeout", listener)
}
// TouchCancel gets notified when a touch point has been disrupted in an implementation-specific manners (too many touch points for example).
//
// https://developer.mozilla.org/docs/Web/Events/touchcancel
func TouchCancel(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onTouchCancel", listener)
}
// TouchEnd gets notified when a touch point is removed from the touch surface.
//
// https://developer.mozilla.org/docs/Web/Events/touchend
func TouchEnd(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onTouchEnd", listener)
}
// TouchEnter gets notified when a touch point is moved onto the interactive area of an element.
//
// https://developer.mozilla.org/docs/Web/Events/touchenter
func TouchEnter(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onTouchEnter", listener)
}
// TouchLeave gets notified when a touch point is moved off the interactive area of an element.
//
// https://developer.mozilla.org/docs/Web/Events/touchleave
func TouchLeave(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onTouchLeave", listener)
}
// TouchMove gets notified when a touch point is moved along the touch surface.
//
// https://developer.mozilla.org/docs/Web/Events/touchmove
func TouchMove(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onTouchMove", listener)
}
// TouchStart gets notified when a touch point is placed on the touch surface.
//
// https://developer.mozilla.org/docs/Web/Events/touchstart
func TouchStart(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onTouchStart", listener)
}
// TransitionEnd gets notified when a CSS transition has completed.
//
// https://developer.mozilla.org/docs/Web/Events/transitionend
func TransitionEnd(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onTransitionEnd", listener)
}
// Unload gets notified when the document or a dependent resource is being unloaded.
//
// https://developer.mozilla.org/docs/Web/Events/unload
func Unload(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onUnload", listener)
}
// UpdateReady gets notified when the resources listed in the manifest have been newly redownloaded, and the script can use swapCache() to switch to the new cache.
//
// https://developer.mozilla.org/docs/Web/Events/updateready
func UpdateReady(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onUpdateReady", listener)
}
// UpgradeNeeded gets notified when an attempt was made to open a database with a version number higher than its current version. A versionchange transaction has been created.
//
// https://developer.mozilla.org/docs/Web/Reference/Events/upgradeneeded_indexedDB
func UpgradeNeeded(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onUpgradeNeeded", listener)
}
// UserProximity gets notified when fresh data is available from a proximity sensor (indicates whether the nearby object is near the device or not).
//
// https://developer.mozilla.org/docs/Web/Events/userproximity
func UserProximity(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onUserProximity", listener)
}
// VersionChange gets notified when a versionchange transaction completed.
//
// https://developer.mozilla.org/docs/Web/Reference/Events/versionchange_indexedDB
func VersionChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onVersionChange", listener)
}
// VisibilityChange gets notified when the content of a tab has become visible or has been hidden.
//
// https://developer.mozilla.org/docs/Web/Events/visibilitychange
func VisibilityChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onVisibilityChange", listener)
}
// VoicesChanged gets notified when the list of SpeechSynthesisVoice objects that would be returned by the SpeechSynthesis.getVoices() method has changed (when the voiceschanged event fires.)
//
// https://developer.mozilla.org/docs/Web/Events/voiceschanged
func VoicesChanged(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onVoicesChanged", listener)
}
// VolumeChange gets notified when the volume has changed.
//
// https://developer.mozilla.org/docs/Web/Events/volumechange
func VolumeChange(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onVolumeChange", listener)
}
// Waiting gets notified when playback has stopped because of a temporary lack of data.
//
// https://developer.mozilla.org/docs/Web/Events/waiting
func Waiting(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onWaiting", listener)
}
// Wheel gets notified when a wheel button of a pointing device is rotated in any direction.
//
// https://developer.mozilla.org/docs/Web/Events/wheel
func Wheel(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("onWheel", listener)
}
================================================
FILE: evt/generate.go
================================================
// +build ignore
/*
Copyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Portions Copyright (c) 2016 The Vecty Authors. All rights reserved.
// See https://github.com/gopherjs/vecty for the origin of this clever
// code generator.
package main
import (
"fmt"
"os"
"sort"
"strings"
"unicode"
"github.com/PuerkitoBio/goquery"
)
type Event struct {
Name string
Link string
Desc string
}
func main() {
nameMap := map[string]string{
"afterprint": "AfterPrint",
"animationend": "AnimationEnd",
"animationiteration": "AnimationIteration",
"animationstart": "AnimationStart",
"audioprocess": "AudioProcess",
"audioend": "AudioEnd",
"audiostart": "AudioStart",
"beforeprint": "BeforePrint",
"beforeunload": "BeforeUnload",
"canplay": "CanPlay",
"canplaythrough": "CanPlayThrough",
"chargingchange": "ChargingChange",
"chargingtimechange": "ChargingTimeChange",
"compassneedscalibration": "CompassNeedsCalibration",
"compositionend": "CompositionEnd",
"compositionstart": "CompositionStart",
"compositionupdate": "CompositionUpdate",
"contextmenu": "ContextMenu",
"dblclick": "DoubleClick",
"devicelight": "DeviceLight",
"devicemotion": "DeviceMotion",
"deviceorientation": "DeviceOrientation",
"deviceproximity": "DeviceProximity",
"dischargingtimechange": "DischargingTimeChange",
"dragend": "DragEnd",
"dragenter": "DragEnter",
"dragleave": "DragLeave",
"dragover": "DragOver",
"dragstart": "DragStart",
"durationchange": "DurationChange",
"focusin": "FocusIn",
"focusout": "FocusOut",
"fullscreenchange": "FullScreenChange",
"fullscreenerror": "FullScreenError",
"gamepadconnected": "GamepadConnected",
"gamepaddisconnected": "GamepadDisconnected",
"gotpointercapture": "GotPointerCapture",
"hashchange": "HashChange",
"keydown": "KeyDown",
"keypress": "KeyPress",
"keyup": "KeyUp",
"languagechange": "LanguageChange",
"levelchange": "LevelChange",
"loadeddata": "LoadedData",
"loadedmetadata": "LoadedMetadata",
"loadend": "LoadEnd",
"loadstart": "LoadStart",
"lostpointercapture": "LostPointerCapture",
"mousedown": "MouseDown",
"mouseenter": "MouseEnter",
"mouseleave": "MouseLeave",
"mousemove": "MouseMove",
"mouseout": "MouseOut",
"mouseover": "MouseOver",
"mouseup": "MouseUp",
"noupdate": "NoUpdate",
"nomatch": "NoMatch",
"notificationclick": "NotificationClick",
"orientationchange": "OrientationChange",
"pagehide": "PageHide",
"pageshow": "PageShow",
"pointercancel": "PointerCancel",
"pointerdown": "PointerDown",
"pointerenter": "PointerEnter",
"pointerleave": "PointerLeave",
"pointerlockchange": "PointerLockChange",
"pointerlockerror": "PointerLockError",
"pointermove": "PointerMove",
"pointerout": "PointerOut",
"pointerover": "PointerOver",
"pointerup": "PointerUp",
"popstate": "PopState",
"pushsubscriptionchange": "PushSubscriptionChange",
"ratechange": "RateChange",
"readystatechange": "ReadyStateChange",
"resourcetimingbufferfull": "ResourceTimingBufferFull",
"selectstart": "SelectStart",
"selectionchange": "SelectionChange",
"soundend": "SoundEnd",
"soundstart": "SoundStart",
"speechend": "SpeechEnd",
"speechstart": "SpeechStart",
"timeupdate": "TimeUpdate",
"touchcancel": "TouchCancel",
"touchend": "TouchEnd",
"touchenter": "TouchEnter",
"touchleave": "TouchLeave",
"touchmove": "TouchMove",
"touchstart": "TouchStart",
"transitionend": "TransitionEnd",
"updateready": "UpdateReady",
"upgradeneeded": "UpgradeNeeded",
"userproximity": "UserProximity",
"versionchange": "VersionChange",
"visibilitychange": "VisibilityChange",
"voiceschanged": "VoicesChanged",
"volumechange": "VolumeChange",
}
doc, err := goquery.NewDocument("https://developer.mozilla.org/en-US/docs/Web/Events")
if err != nil {
panic(err)
}
events := make(map[string]*Event)
doc.Find(".standard-table").Eq(0).Find("tr").Each(func(i int, s *goquery.Selection) {
cols := s.Find("td")
if cols.Length() == 0 || cols.Find(".icon-thumbs-down-alt").Length() != 0 {
return
}
link := cols.Eq(0).Find("a").Eq(0)
var e Event
e.Name = link.Text()
e.Link, _ = link.Attr("href")
e.Desc = strings.TrimSpace(cols.Eq(3).Text())
if e.Desc == "" {
e.Desc = "(no documentation)"
}
funName := nameMap[e.Name]
if funName == "" {
funName = capitalize(e.Name)
}
events[funName] = &e
})
var names []string
for name := range events {
names = append(names, name)
}
sort.Strings(names)
file, err := os.Create("event.autogen.go")
if err != nil {
panic(err)
}
defer file.Close()
fmt.Fprint(file, `//go:generate go run generate.go
// Package evt defines markup to bind DOM events.
//
// Generated from "Event reference" by Mozilla Contributors, https://developer.mozilla.org/en-US/docs/Web/Events, licensed under CC-BY-SA 2.5.
package evt
import "github.com/bep/gr"
`)
for _, name := range names {
e := events[name]
fmt.Fprintf(file, `
// %s gets notified when %s
//
// https://developer.mozilla.org%s
func %s(listener gr.Listener) *gr.EventListener {
return gr.NewEventListener("on%s", listener)
}
`, name, firstToLower(e.Desc), e.Link[6:], name, name)
}
}
func capitalize(s string) string {
return strings.ToUpper(s[:1]) + s[1:]
}
func firstToLower(s string) string {
a := []rune(s)
a[0] = unicode.ToLower(a[0])
return string(a)
}
================================================
FILE: examples/.gitignore
================================================
# Avoid the binaries (there may be a better .gitignore pattern for this)
**/ajax/ajax
**/basic/basic
**/basic-click-counter/basic-click-counter
**/lifecycle/lifecycle
**/composition/composition
**/interop/interop
**/router/router
**/debounce/debounce
================================================
FILE: examples/ajax/ajax.js
================================================
"use strict";
(function() {
Error.stackTraceLimit=Infinity;var $global,$module;if(typeof window!=="undefined"){$global=window;}else if(typeof self!=="undefined"){$global=self;}else if(typeof global!=="undefined"){$global=global;$global.require=require;}else{$global=this;}if($global===undefined||$global.Array===undefined){throw new Error("no global object found");}if(typeof module!=="undefined"){$module=module;}var $packages={},$idCounter=0;var $keys=function(m){return m?Object.keys(m):[];};var $flushConsole=function(){};var $throwRuntimeError;var $throwNilPointerError=function(){$throwRuntimeError("invalid memory address or nil pointer dereference");};var $call=function(fn,rcvr,args){return fn.apply(rcvr,args);};var $makeFunc=function(fn){return function(){return $externalize(fn(this,new($sliceType($jsObjectPtr))($global.Array.prototype.slice.call(arguments,[]))),$emptyInterface);};};var $unused=function(v){};var $mapArray=function(array,f){var newArray=new array.constructor(array.length);for(var i=0;i<array.length;i++){newArray[i]=f(array[i]);}return newArray;};var $methodVal=function(recv,name){var vals=recv.$methodVals||{};recv.$methodVals=vals;var f=vals[name];if(f!==undefined){return f;}var method=recv[name];f=function(){$stackDepthOffset--;try{return method.apply(recv,arguments);}finally{$stackDepthOffset++;}};vals[name]=f;return f;};var $methodExpr=function(typ,name){var method=typ.prototype[name];if(method.$expr===undefined){method.$expr=function(){$stackDepthOffset--;try{if(typ.wrapped){arguments[0]=new typ(arguments[0]);}return Function.call.apply(method,arguments);}finally{$stackDepthOffset++;}};}return method.$expr;};var $ifaceMethodExprs={};var $ifaceMethodExpr=function(name){var expr=$ifaceMethodExprs["$"+name];if(expr===undefined){expr=$ifaceMethodExprs["$"+name]=function(){$stackDepthOffset--;try{return Function.call.apply(arguments[0][name],arguments);}finally{$stackDepthOffset++;}};}return expr;};var $subslice=function(slice,low,high,max){if(low<0||high<low||max<high||high>slice.$capacity||max>slice.$capacity){$throwRuntimeError("slice bounds out of range");}var s=new slice.constructor(slice.$array);s.$offset=slice.$offset+low;s.$length=slice.$length-low;s.$capacity=slice.$capacity-low;if(high!==undefined){s.$length=high-low;}if(max!==undefined){s.$capacity=max-low;}return s;};var $substring=function(str,low,high){if(low<0||high<low||high>str.length){$throwRuntimeError("slice bounds out of range");}return str.substring(low,high);};var $sliceToArray=function(slice){if(slice.$array.constructor!==Array){return slice.$array.subarray(slice.$offset,slice.$offset+slice.$length);}return slice.$array.slice(slice.$offset,slice.$offset+slice.$length);};var $decodeRune=function(str,pos){var c0=str.charCodeAt(pos);if(c0<0x80){return[c0,1];}if(c0!==c0||c0<0xC0){return[0xFFFD,1];}var c1=str.charCodeAt(pos+1);if(c1!==c1||c1<0x80||0xC0<=c1){return[0xFFFD,1];}if(c0<0xE0){var r=(c0&0x1F)<<6|(c1&0x3F);if(r<=0x7F){return[0xFFFD,1];}return[r,2];}var c2=str.charCodeAt(pos+2);if(c2!==c2||c2<0x80||0xC0<=c2){return[0xFFFD,1];}if(c0<0xF0){var r=(c0&0x0F)<<12|(c1&0x3F)<<6|(c2&0x3F);if(r<=0x7FF){return[0xFFFD,1];}if(0xD800<=r&&r<=0xDFFF){return[0xFFFD,1];}return[r,3];}var c3=str.charCodeAt(pos+3);if(c3!==c3||c3<0x80||0xC0<=c3){return[0xFFFD,1];}if(c0<0xF8){var r=(c0&0x07)<<18|(c1&0x3F)<<12|(c2&0x3F)<<6|(c3&0x3F);if(r<=0xFFFF||0x10FFFF<r){return[0xFFFD,1];}return[r,4];}return[0xFFFD,1];};var $encodeRune=function(r){if(r<0||r>0x10FFFF||(0xD800<=r&&r<=0xDFFF)){r=0xFFFD;}if(r<=0x7F){return String.fromCharCode(r);}if(r<=0x7FF){return String.fromCharCode(0xC0|r>>6,0x80|(r&0x3F));}if(r<=0xFFFF){return String.fromCharCode(0xE0|r>>12,0x80|(r>>6&0x3F),0x80|(r&0x3F));}return String.fromCharCode(0xF0|r>>18,0x80|(r>>12&0x3F),0x80|(r>>6&0x3F),0x80|(r&0x3F));};var $stringToBytes=function(str){var array=new Uint8Array(str.length);for(var i=0;i<str.length;i++){array[i]=str.charCodeAt(i);}return array;};var $bytesToString=function(slice){if(slice.$length===0){return"";}var str="";for(var i=0;i<slice.$length;i+=10000){str+=String.fromCharCode.apply(undefined,slice.$array.subarray(slice.$offset+i,slice.$offset+Math.min(slice.$length,i+10000)));}return str;};var $stringToRunes=function(str){var array=new Int32Array(str.length);var rune,j=0;for(var i=0;i<str.length;i+=rune[1],j++){rune=$decodeRune(str,i);array[j]=rune[0];}return array.subarray(0,j);};var $runesToString=function(slice){if(slice.$length===0){return"";}var str="";for(var i=0;i<slice.$length;i++){str+=$encodeRune(slice.$array[slice.$offset+i]);}return str;};var $copyString=function(dst,src){var n=Math.min(src.length,dst.$length);for(var i=0;i<n;i++){dst.$array[dst.$offset+i]=src.charCodeAt(i);}return n;};var $copySlice=function(dst,src){var n=Math.min(src.$length,dst.$length);$copyArray(dst.$array,src.$array,dst.$offset,src.$offset,n,dst.constructor.elem);return n;};var $copyArray=function(dst,src,dstOffset,srcOffset,n,elem){if(n===0||(dst===src&&dstOffset===srcOffset)){return;}if(src.subarray){dst.set(src.subarray(srcOffset,srcOffset+n),dstOffset);return;}switch(elem.kind){case $kindArray:case $kindStruct:if(dst===src&&dstOffset>srcOffset){for(var i=n-1;i>=0;i--){elem.copy(dst[dstOffset+i],src[srcOffset+i]);}return;}for(var i=0;i<n;i++){elem.copy(dst[dstOffset+i],src[srcOffset+i]);}return;}if(dst===src&&dstOffset>srcOffset){for(var i=n-1;i>=0;i--){dst[dstOffset+i]=src[srcOffset+i];}return;}for(var i=0;i<n;i++){dst[dstOffset+i]=src[srcOffset+i];}};var $clone=function(src,type){var clone=type.zero();type.copy(clone,src);return clone;};var $pointerOfStructConversion=function(obj,type){if(obj.$proxies===undefined){obj.$proxies={};obj.$proxies[obj.constructor.string]=obj;}var proxy=obj.$proxies[type.string];if(proxy===undefined){var properties={};for(var i=0;i<type.elem.fields.length;i++){(function(fieldProp){properties[fieldProp]={get:function(){return obj[fieldProp];},set:function(value){obj[fieldProp]=value;}};})(type.elem.fields[i].prop);}proxy=Object.create(type.prototype,properties);proxy.$val=proxy;obj.$proxies[type.string]=proxy;proxy.$proxies=obj.$proxies;}return proxy;};var $append=function(slice){return $internalAppend(slice,arguments,1,arguments.length-1);};var $appendSlice=function(slice,toAppend){if(toAppend.constructor===String){var bytes=$stringToBytes(toAppend);return $internalAppend(slice,bytes,0,bytes.length);}return $internalAppend(slice,toAppend.$array,toAppend.$offset,toAppend.$length);};var $internalAppend=function(slice,array,offset,length){if(length===0){return slice;}var newArray=slice.$array;var newOffset=slice.$offset;var newLength=slice.$length+length;var newCapacity=slice.$capacity;if(newLength>newCapacity){newOffset=0;newCapacity=Math.max(newLength,slice.$capacity<1024?slice.$capacity*2:Math.floor(slice.$capacity*5/4));if(slice.$array.constructor===Array){newArray=slice.$array.slice(slice.$offset,slice.$offset+slice.$length);newArray.length=newCapacity;var zero=slice.constructor.elem.zero;for(var i=slice.$length;i<newCapacity;i++){newArray[i]=zero();}}else{newArray=new slice.$array.constructor(newCapacity);newArray.set(slice.$array.subarray(slice.$offset,slice.$offset+slice.$length));}}$copyArray(newArray,array,newOffset+slice.$length,offset,length,slice.constructor.elem);var newSlice=new slice.constructor(newArray);newSlice.$offset=newOffset;newSlice.$length=newLength;newSlice.$capacity=newCapacity;return newSlice;};var $equal=function(a,b,type){if(type===$jsObjectPtr){return a===b;}switch(type.kind){case $kindComplex64:case $kindComplex128:return a.$real===b.$real&&a.$imag===b.$imag;case $kindInt64:case $kindUint64:return a.$high===b.$high&&a.$low===b.$low;case $kindArray:if(a.length!==b.length){return false;}for(var i=0;i<a.length;i++){if(!$equal(a[i],b[i],type.elem)){return false;}}return true;case $kindStruct:for(var i=0;i<type.fields.length;i++){var f=type.fields[i];if(!$equal(a[f.prop],b[f.prop],f.typ)){return false;}}return true;case $kindInterface:return $interfaceIsEqual(a,b);default:return a===b;}};var $interfaceIsEqual=function(a,b){if(a===$ifaceNil||b===$ifaceNil){return a===b;}if(a.constructor!==b.constructor){return false;}if(a.constructor===$jsObjectPtr){return a.object===b.object;}if(!a.constructor.comparable){$throwRuntimeError("comparing uncomparable type "+a.constructor.string);}return $equal(a.$val,b.$val,a.constructor);};var $min=Math.min;var $mod=function(x,y){return x%y;};var $parseInt=parseInt;var $parseFloat=function(f){if(f!==undefined&&f!==null&&f.constructor===Number){return f;}return parseFloat(f);};var $froundBuf=new Float32Array(1);var $fround=Math.fround||function(f){$froundBuf[0]=f;return $froundBuf[0];};var $imul=Math.imul||function(a,b){var ah=(a>>>16)&0xffff;var al=a&0xffff;var bh=(b>>>16)&0xffff;var bl=b&0xffff;return((al*bl)+(((ah*bl+al*bh)<<16)>>>0)>>0);};var $floatKey=function(f){if(f!==f){$idCounter++;return"NaN$"+$idCounter;}return String(f);};var $flatten64=function(x){return x.$high*4294967296+x.$low;};var $shiftLeft64=function(x,y){if(y===0){return x;}if(y<32){return new x.constructor(x.$high<<y|x.$low>>>(32-y),(x.$low<<y)>>>0);}if(y<64){return new x.constructor(x.$low<<(y-32),0);}return new x.constructor(0,0);};var $shiftRightInt64=function(x,y){if(y===0){return x;}if(y<32){return new x.constructor(x.$high>>y,(x.$low>>>y|x.$high<<(32-y))>>>0);}if(y<64){return new x.constructor(x.$high>>31,(x.$high>>(y-32))>>>0);}if(x.$high<0){return new x.constructor(-1,4294967295);}return new x.constructor(0,0);};var $shiftRightUint64=function(x,y){if(y===0){return x;}if(y<32){return new x.constructor(x.$high>>>y,(x.$low>>>y|x.$high<<(32-y))>>>0);}if(y<64){return new x.constructor(0,x.$high>>>(y-32));}return new x.constructor(0,0);};var $mul64=function(x,y){var high=0,low=0;if((y.$low&1)!==0){high=x.$high;low=x.$low;}for(var i=1;i<32;i++){if((y.$low&1<<i)!==0){high+=x.$high<<i|x.$low>>>(32-i);low+=(x.$low<<i)>>>0;}}for(var i=0;i<32;i++){if((y.$high&1<<i)!==0){high+=x.$low<<i;}}return new x.constructor(high,low);};var $div64=function(x,y,returnRemainder){if(y.$high===0&&y.$low===0){$throwRuntimeError("integer divide by zero");}var s=1;var rs=1;var xHigh=x.$high;var xLow=x.$low;if(xHigh<0){s=-1;rs=-1;xHigh=-xHigh;if(xLow!==0){xHigh--;xLow=4294967296-xLow;}}var yHigh=y.$high;var yLow=y.$low;if(y.$high<0){s*=-1;yHigh=-yHigh;if(yLow!==0){yHigh--;yLow=4294967296-yLow;}}var high=0,low=0,n=0;while(yHigh<2147483648&&((xHigh>yHigh)||(xHigh===yHigh&&xLow>yLow))){yHigh=(yHigh<<1|yLow>>>31)>>>0;yLow=(yLow<<1)>>>0;n++;}for(var i=0;i<=n;i++){high=high<<1|low>>>31;low=(low<<1)>>>0;if((xHigh>yHigh)||(xHigh===yHigh&&xLow>=yLow)){xHigh=xHigh-yHigh;xLow=xLow-yLow;if(xLow<0){xHigh--;xLow+=4294967296;}low++;if(low===4294967296){high++;low=0;}}yLow=(yLow>>>1|yHigh<<(32-1))>>>0;yHigh=yHigh>>>1;}if(returnRemainder){return new x.constructor(xHigh*rs,xLow*rs);}return new x.constructor(high*s,low*s);};var $divComplex=function(n,d){var ninf=n.$real===Infinity||n.$real===-Infinity||n.$imag===Infinity||n.$imag===-Infinity;var dinf=d.$real===Infinity||d.$real===-Infinity||d.$imag===Infinity||d.$imag===-Infinity;var nnan=!ninf&&(n.$real!==n.$real||n.$imag!==n.$imag);var dnan=!dinf&&(d.$real!==d.$real||d.$imag!==d.$imag);if(nnan||dnan){return new n.constructor(NaN,NaN);}if(ninf&&!dinf){return new n.constructor(Infinity,Infinity);}if(!ninf&&dinf){return new n.constructor(0,0);}if(d.$real===0&&d.$imag===0){if(n.$real===0&&n.$imag===0){return new n.constructor(NaN,NaN);}return new n.constructor(Infinity,Infinity);}var a=Math.abs(d.$real);var b=Math.abs(d.$imag);if(a<=b){var ratio=d.$real/d.$imag;var denom=d.$real*ratio+d.$imag;return new n.constructor((n.$real*ratio+n.$imag)/denom,(n.$imag*ratio-n.$real)/denom);}var ratio=d.$imag/d.$real;var denom=d.$imag*ratio+d.$real;return new n.constructor((n.$imag*ratio+n.$real)/denom,(n.$imag-n.$real*ratio)/denom);};var $kindBool=1;var $kindInt=2;var $kindInt8=3;var $kindInt16=4;var $kindInt32=5;var $kindInt64=6;var $kindUint=7;var $kindUint8=8;var $kindUint16=9;var $kindUint32=10;var $kindUint64=11;var $kindUintptr=12;var $kindFloat32=13;var $kindFloat64=14;var $kindComplex64=15;var $kindComplex128=16;var $kindArray=17;var $kindChan=18;var $kindFunc=19;var $kindInterface=20;var $kindMap=21;var $kindPtr=22;var $kindSlice=23;var $kindString=24;var $kindStruct=25;var $kindUnsafePointer=26;var $methodSynthesizers=[];var $addMethodSynthesizer=function(f){if($methodSynthesizers===null){f();return;}$methodSynthesizers.push(f);};var $synthesizeMethods=function(){$methodSynthesizers.forEach(function(f){f();});$methodSynthesizers=null;};var $ifaceKeyFor=function(x){if(x===$ifaceNil){return'nil';}var c=x.constructor;return c.string+'$'+c.keyFor(x.$val);};var $identity=function(x){return x;};var $typeIDCounter=0;var $idKey=function(x){if(x.$id===undefined){$idCounter++;x.$id=$idCounter;}return String(x.$id);};var $newType=function(size,kind,string,named,pkg,exported,constructor){var typ;switch(kind){case $kindBool:case $kindInt:case $kindInt8:case $kindInt16:case $kindInt32:case $kindUint:case $kindUint8:case $kindUint16:case $kindUint32:case $kindUintptr:case $kindUnsafePointer:typ=function(v){this.$val=v;};typ.wrapped=true;typ.keyFor=$identity;break;case $kindString:typ=function(v){this.$val=v;};typ.wrapped=true;typ.keyFor=function(x){return"$"+x;};break;case $kindFloat32:case $kindFloat64:typ=function(v){this.$val=v;};typ.wrapped=true;typ.keyFor=function(x){return $floatKey(x);};break;case $kindInt64:typ=function(high,low){this.$high=(high+Math.floor(Math.ceil(low)/4294967296))>>0;this.$low=low>>>0;this.$val=this;};typ.keyFor=function(x){return x.$high+"$"+x.$low;};break;case $kindUint64:typ=function(high,low){this.$high=(high+Math.floor(Math.ceil(low)/4294967296))>>>0;this.$low=low>>>0;this.$val=this;};typ.keyFor=function(x){return x.$high+"$"+x.$low;};break;case $kindComplex64:typ=function(real,imag){this.$real=$fround(real);this.$imag=$fround(imag);this.$val=this;};typ.keyFor=function(x){return x.$real+"$"+x.$imag;};break;case $kindComplex128:typ=function(real,imag){this.$real=real;this.$imag=imag;this.$val=this;};typ.keyFor=function(x){return x.$real+"$"+x.$imag;};break;case $kindArray:typ=function(v){this.$val=v;};typ.wrapped=true;typ.ptr=$newType(4,$kindPtr,"*"+string,false,"",false,function(array){this.$get=function(){return array;};this.$set=function(v){typ.copy(this,v);};this.$val=array;});typ.init=function(elem,len){typ.elem=elem;typ.len=len;typ.comparable=elem.comparable;typ.keyFor=function(x){return Array.prototype.join.call($mapArray(x,function(e){return String(elem.keyFor(e)).replace(/\\/g,"\\\\").replace(/\$/g,"\\$");}),"$");};typ.copy=function(dst,src){$copyArray(dst,src,0,0,src.length,elem);};typ.ptr.init(typ);Object.defineProperty(typ.ptr.nil,"nilCheck",{get:$throwNilPointerError});};break;case $kindChan:typ=function(v){this.$val=v;};typ.wrapped=true;typ.keyFor=$idKey;typ.init=function(elem,sendOnly,recvOnly){typ.elem=elem;typ.sendOnly=sendOnly;typ.recvOnly=recvOnly;};break;case $kindFunc:typ=function(v){this.$val=v;};typ.wrapped=true;typ.init=function(params,results,variadic){typ.params=params;typ.results=results;typ.variadic=variadic;typ.comparable=false;};break;case $kindInterface:typ={implementedBy:{},missingMethodFor:{}};typ.keyFor=$ifaceKeyFor;typ.init=function(methods){typ.methods=methods;methods.forEach(function(m){$ifaceNil[m.prop]=$throwNilPointerError;});};break;case $kindMap:typ=function(v){this.$val=v;};typ.wrapped=true;typ.init=function(key,elem){typ.key=key;typ.elem=elem;typ.comparable=false;};break;case $kindPtr:typ=constructor||function(getter,setter,target){this.$get=getter;this.$set=setter;this.$target=target;this.$val=this;};typ.keyFor=$idKey;typ.init=function(elem){typ.elem=elem;typ.wrapped=(elem.kind===$kindArray);typ.nil=new typ($throwNilPointerError,$throwNilPointerError);};break;case $kindSlice:typ=function(array){if(array.constructor!==typ.nativeArray){array=new typ.nativeArray(array);}this.$array=array;this.$offset=0;this.$length=array.length;this.$capacity=array.length;this.$val=this;};typ.init=function(elem){typ.elem=elem;typ.comparable=false;typ.nativeArray=$nativeArray(elem.kind);typ.nil=new typ([]);};break;case $kindStruct:typ=function(v){this.$val=v;};typ.wrapped=true;typ.ptr=$newType(4,$kindPtr,"*"+string,false,"",exported,constructor);typ.ptr.elem=typ;typ.ptr.prototype.$get=function(){return this;};typ.ptr.prototype.$set=function(v){typ.copy(this,v);};typ.init=function(pkgPath,fields){typ.pkgPath=pkgPath;typ.fields=fields;fields.forEach(function(f){if(!f.typ.comparable){typ.comparable=false;}});typ.keyFor=function(x){var val=x.$val;return $mapArray(fields,function(f){return String(f.typ.keyFor(val[f.prop])).replace(/\\/g,"\\\\").replace(/\$/g,"\\$");}).join("$");};typ.copy=function(dst,src){for(var i=0;i<fields.length;i++){var f=fields[i];switch(f.typ.kind){case $kindArray:case $kindStruct:f.typ.copy(dst[f.prop],src[f.prop]);continue;default:dst[f.prop]=src[f.prop];continue;}}};var properties={};fields.forEach(function(f){properties[f.prop]={get:$throwNilPointerError,set:$throwNilPointerError};});typ.ptr.nil=Object.create(constructor.prototype,properties);typ.ptr.nil.$val=typ.ptr.nil;$addMethodSynthesizer(function(){var synthesizeMethod=function(target,m,f){if(target.prototype[m.prop]!==undefined){return;}target.prototype[m.prop]=function(){var v=this.$val[f.prop];if(f.typ===$jsObjectPtr){v=new $jsObjectPtr(v);}if(v.$val===undefined){v=new f.typ(v);}return v[m.prop].apply(v,arguments);};};fields.forEach(function(f){if(f.name===""){$methodSet(f.typ).forEach(function(m){synthesizeMethod(typ,m,f);synthesizeMethod(typ.ptr,m,f);});$methodSet($ptrType(f.typ)).forEach(function(m){synthesizeMethod(typ.ptr,m,f);});}});});};break;default:$panic(new $String("invalid kind: "+kind));}switch(kind){case $kindBool:case $kindMap:typ.zero=function(){return false;};break;case $kindInt:case $kindInt8:case $kindInt16:case $kindInt32:case $kindUint:case $kindUint8:case $kindUint16:case $kindUint32:case $kindUintptr:case $kindUnsafePointer:case $kindFloat32:case $kindFloat64:typ.zero=function(){return 0;};break;case $kindString:typ.zero=function(){return"";};break;case $kindInt64:case $kindUint64:case $kindComplex64:case $kindComplex128:var zero=new typ(0,0);typ.zero=function(){return zero;};break;case $kindPtr:case $kindSlice:typ.zero=function(){return typ.nil;};break;case $kindChan:typ.zero=function(){return $chanNil;};break;case $kindFunc:typ.zero=function(){return $throwNilPointerError;};break;case $kindInterface:typ.zero=function(){return $ifaceNil;};break;case $kindArray:typ.zero=function(){var arrayClass=$nativeArray(typ.elem.kind);if(arrayClass!==Array){return new arrayClass(typ.len);}var array=new Array(typ.len);for(var i=0;i<typ.len;i++){array[i]=typ.elem.zero();}return array;};break;case $kindStruct:typ.zero=function(){return new typ.ptr();};break;default:$panic(new $String("invalid kind: "+kind));}typ.id=$typeIDCounter;$typeIDCounter++;typ.size=size;typ.kind=kind;typ.string=string;typ.named=named;typ.pkg=pkg;typ.exported=exported;typ.methods=[];typ.methodSetCache=null;typ.comparable=true;return typ;};var $methodSet=function(typ){if(typ.methodSetCache!==null){return typ.methodSetCache;}var base={};var isPtr=(typ.kind===$kindPtr);if(isPtr&&typ.elem.kind===$kindInterface){typ.methodSetCache=[];return[];}var current=[{typ:isPtr?typ.elem:typ,indirect:isPtr}];var seen={};while(current.length>0){var next=[];var mset=[];current.forEach(function(e){if(seen[e.typ.string]){return;}seen[e.typ.string]=true;if(e.typ.named){mset=mset.concat(e.typ.methods);if(e.indirect){mset=mset.concat($ptrType(e.typ).methods);}}switch(e.typ.kind){case $kindStruct:e.typ.fields.forEach(function(f){if(f.name===""){var fTyp=f.typ;var fIsPtr=(fTyp.kind===$kindPtr);next.push({typ:fIsPtr?fTyp.elem:fTyp,indirect:e.indirect||fIsPtr});}});break;case $kindInterface:mset=mset.concat(e.typ.methods);break;}});mset.forEach(function(m){if(base[m.name]===undefined){base[m.name]=m;}});current=next;}typ.methodSetCache=[];Object.keys(base).sort().forEach(function(name){typ.methodSetCache.push(base[name]);});return typ.methodSetCache;};var $Bool=$newType(1,$kindBool,"bool",true,"",false,null);var $Int=$newType(4,$kindInt,"int",true,"",false,null);var $Int8=$newType(1,$kindInt8,"int8",true,"",false,null);var $Int16=$newType(2,$kindInt16,"int16",true,"",false,null);var $Int32=$newType(4,$kindInt32,"int32",true,"",false,null);var $Int64=$newType(8,$kindInt64,"int64",true,"",false,null);var $Uint=$newType(4,$kindUint,"uint",true,"",false,null);var $Uint8=$newType(1,$kindUint8,"uint8",true,"",false,null);var $Uint16=$newType(2,$kindUint16,"uint16",true,"",false,null);var $Uint32=$newType(4,$kindUint32,"uint32",true,"",false,null);var $Uint64=$newType(8,$kindUint64,"uint64",true,"",false,null);var $Uintptr=$newType(4,$kindUintptr,"uintptr",true,"",false,null);var $Float32=$newType(4,$kindFloat32,"float32",true,"",false,null);var $Float64=$newType(8,$kindFloat64,"float64",true,"",false,null);var $Complex64=$newType(8,$kindComplex64,"complex64",true,"",false,null);var $Complex128=$newType(16,$kindComplex128,"complex128",true,"",false,null);var $String=$newType(8,$kindString,"string",true,"",false,null);var $UnsafePointer=$newType(4,$kindUnsafePointer,"unsafe.Pointer",true,"",false,null);var $nativeArray=function(elemKind){switch(elemKind){case $kindInt:return Int32Array;case $kindInt8:return Int8Array;case $kindInt16:return Int16Array;case $kindInt32:return Int32Array;case $kindUint:return Uint32Array;case $kindUint8:return Uint8Array;case $kindUint16:return Uint16Array;case $kindUint32:return Uint32Array;case $kindUintptr:return Uint32Array;case $kindFloat32:return Float32Array;case $kindFloat64:return Float64Array;default:return Array;}};var $toNativeArray=function(elemKind,array){var nativeArray=$nativeArray(elemKind);if(nativeArray===Array){return array;}return new nativeArray(array);};var $arrayTypes={};var $arrayType=function(elem,len){var typeKey=elem.id+"$"+len;var typ=$arrayTypes[typeKey];if(typ===undefined){typ=$newType(12,$kindArray,"["+len+"]"+elem.string,false,"",false,null);$arrayTypes[typeKey]=typ;typ.init(elem,len);}return typ;};var $chanType=function(elem,sendOnly,recvOnly){var string=(recvOnly?"<-":"")+"chan"+(sendOnly?"<- ":" ")+elem.string;var field=sendOnly?"SendChan":(recvOnly?"RecvChan":"Chan");var typ=elem[field];if(typ===undefined){typ=$newType(4,$kindChan,string,false,"",false,null);elem[field]=typ;typ.init(elem,sendOnly,recvOnly);}return typ;};var $Chan=function(elem,capacity){if(capacity<0||capacity>2147483647){$throwRuntimeError("makechan: size out of range");}this.$elem=elem;this.$capacity=capacity;this.$buffer=[];this.$sendQueue=[];this.$recvQueue=[];this.$closed=false;};var $chanNil=new $Chan(null,0);$chanNil.$sendQueue=$chanNil.$recvQueue={length:0,push:function(){},shift:function(){return undefined;},indexOf:function(){return-1;}};var $funcTypes={};var $funcType=function(params,results,variadic){var typeKey=$mapArray(params,function(p){return p.id;}).join(",")+"$"+$mapArray(results,function(r){return r.id;}).join(",")+"$"+variadic;var typ=$funcTypes[typeKey];if(typ===undefined){var paramTypes=$mapArray(params,function(p){return p.string;});if(variadic){paramTypes[paramTypes.length-1]="..."+paramTypes[paramTypes.length-1].substr(2);}var string="func("+paramTypes.join(", ")+")";if(results.length===1){string+=" "+results[0].string;}else if(results.length>1){string+=" ("+$mapArray(results,function(r){return r.string;}).join(", ")+")";}typ=$newType(4,$kindFunc,string,false,"",false,null);$funcTypes[typeKey]=typ;typ.init(params,results,variadic);}return typ;};var $interfaceTypes={};var $interfaceType=function(methods){var typeKey=$mapArray(methods,function(m){return m.pkg+","+m.name+","+m.typ.id;}).join("$");var typ=$interfaceTypes[typeKey];if(typ===undefined){var string="interface {}";if(methods.length!==0){string="interface { "+$mapArray(methods,function(m){return(m.pkg!==""?m.pkg+".":"")+m.name+m.typ.string.substr(4);}).join("; ")+" }";}typ=$newType(8,$kindInterface,string,false,"",false,null);$interfaceTypes[typeKey]=typ;typ.init(methods);}return typ;};var $emptyInterface=$interfaceType([]);var $ifaceNil={};var $error=$newType(8,$kindInterface,"error",true,"",false,null);$error.init([{prop:"Error",name:"Error",pkg:"",typ:$funcType([],[$String],false)}]);var $mapTypes={};var $mapType=function(key,elem){var typeKey=key.id+"$"+elem.id;var typ=$mapTypes[typeKey];if(typ===undefined){typ=$newType(4,$kindMap,"map["+key.string+"]"+elem.string,false,"",false,null);$mapTypes[typeKey]=typ;typ.init(key,elem);}return typ;};var $makeMap=function(keyForFunc,entries){var m={};for(var i=0;i<entries.length;i++){var e=entries[i];m[keyForFunc(e.k)]=e;}return m;};var $ptrType=function(elem){var typ=elem.ptr;if(typ===undefined){typ=$newType(4,$kindPtr,"*"+elem.string,false,"",elem.exported,null);elem.ptr=typ;typ.init(elem);}return typ;};var $newDataPointer=function(data,constructor){if(constructor.elem.kind===$kindStruct){return data;}return new constructor(function(){return data;},function(v){data=v;});};var $indexPtr=function(array,index,constructor){array.$ptr=array.$ptr||{};return array.$ptr[index]||(array.$ptr[index]=new constructor(function(){return array[index];},function(v){array[index]=v;}));};var $sliceType=function(elem){var typ=elem.slice;if(typ===undefined){typ=$newType(12,$kindSlice,"[]"+elem.string,false,"",false,null);elem.slice=typ;typ.init(elem);}return typ;};var $makeSlice=function(typ,length,capacity){capacity=capacity||length;if(length<0||length>2147483647){$throwRuntimeError("makeslice: len out of range");}if(capacity<0||capacity<length||capacity>2147483647){$throwRuntimeError("makeslice: cap out of range");}var array=new typ.nativeArray(capacity);if(typ.nativeArray===Array){for(var i=0;i<capacity;i++){array[i]=typ.elem.zero();}}var slice=new typ(array);slice.$length=length;return slice;};var $structTypes={};var $structType=function(pkgPath,fields){var typeKey=$mapArray(fields,function(f){return f.name+","+f.typ.id+","+f.tag;}).join("$");var typ=$structTypes[typeKey];if(typ===undefined){var string="struct { "+$mapArray(fields,function(f){return f.name+" "+f.typ.string+(f.tag!==""?(" \""+f.tag.replace(/\\/g,"\\\\").replace(/"/g, "\\\"")+"\""):"");}).join("; ")+" }";if(fields.length===0){string="struct {}";}typ=$newType(0,$kindStruct,string,false,"",false,function(){this.$val=this;for(var i=0;i<fields.length;i++){var f=fields[i];var arg=arguments[i];this[f.prop]=arg!==undefined?arg:f.typ.zero();}});$structTypes[typeKey]=typ;typ.init(pkgPath,fields);}return typ;};var $assertType=function(value,type,returnTuple){var isInterface=(type.kind===$kindInterface),ok,missingMethod="";if(value===$ifaceNil){ok=false;}else if(!isInterface){ok=value.constructor===type;}else{var valueTypeString=value.constructor.string;ok=type.implementedBy[valueTypeString];if(ok===undefined){ok=true;var valueMethodSet=$methodSet(value.constructor);var interfaceMethods=type.methods;for(var i=0;i<interfaceMethods.length;i++){var tm=interfaceMethods[i];var found=false;for(var j=0;j<valueMethodSet.length;j++){var vm=valueMethodSet[j];if(vm.name===tm.name&&vm.pkg===tm.pkg&&vm.typ===tm.typ){found=true;break;}}if(!found){ok=false;type.missingMethodFor[valueTypeString]=tm.name;break;}}type.implementedBy[valueTypeString]=ok;}if(!ok){missingMethod=type.missingMethodFor[valueTypeString];}}if(!ok){if(returnTuple){return[type.zero(),false];}$panic(new $packages["runtime"].TypeAssertionError.ptr("",(value===$ifaceNil?"":value.constructor.string),type.string,missingMethod));}if(!isInterface){value=value.$val;}if(type===$jsObjectPtr){value=value.object;}return returnTuple?[value,true]:value;};var $stackDepthOffset=0;var $getStackDepth=function(){var err=new Error();if(err.stack===undefined){return undefined;}return $stackDepthOffset+err.stack.split("\n").length;};var $panicStackDepth=null,$panicValue;var $callDeferred=function(deferred,jsErr,fromPanic){if(!fromPanic&&deferred!==null&&deferred.index>=$curGoroutine.deferStack.length){throw jsErr;}if(jsErr!==null){var newErr=null;try{$curGoroutine.deferStack.push(deferred);$panic(new $jsErrorPtr(jsErr));}catch(err){newErr=err;}$curGoroutine.deferStack.pop();$callDeferred(deferred,newErr);return;}if($curGoroutine.asleep){return;}$stackDepthOffset--;var outerPanicStackDepth=$panicStackDepth;var outerPanicValue=$panicValue;var localPanicValue=$curGoroutine.panicStack.pop();if(localPanicValue!==undefined){$panicStackDepth=$getStackDepth();$panicValue=localPanicValue;}try{while(true){if(deferred===null){deferred=$curGoroutine.deferStack[$curGoroutine.deferStack.length-1];if(deferred===undefined){$panicStackDepth=null;if(localPanicValue.Object instanceof Error){throw localPanicValue.Object;}var msg;if(localPanicValue.constructor===$String){msg=localPanicValue.$val;}else if(localPanicValue.Error!==undefined){msg=localPanicValue.Error();}else if(localPanicValue.String!==undefined){msg=localPanicValue.String();}else{msg=localPanicValue;}throw new Error(msg);}}var call=deferred.pop();if(call===undefined){$curGoroutine.deferStack.pop();if(localPanicValue!==undefined){deferred=null;continue;}return;}var r=call[0].apply(call[2],call[1]);if(r&&r.$blk!==undefined){deferred.push([r.$blk,[],r]);if(fromPanic){throw null;}return;}if(localPanicValue!==undefined&&$panicStackDepth===null){throw null;}}}finally{if(localPanicValue!==undefined){if($panicStackDepth!==null){$curGoroutine.panicStack.push(localPanicValue);}$panicStackDepth=outerPanicStackDepth;$panicValue=outerPanicValue;}$stackDepthOffset++;}};var $panic=function(value){$curGoroutine.panicStack.push(value);$callDeferred(null,null,true);};var $recover=function(){if($panicStackDepth===null||($panicStackDepth!==undefined&&$panicStackDepth!==$getStackDepth()-2)){return $ifaceNil;}$panicStackDepth=null;return $panicValue;};var $throw=function(err){throw err;};var $noGoroutine={asleep:false,exit:false,deferStack:[],panicStack:[]};var $curGoroutine=$noGoroutine,$totalGoroutines=0,$awakeGoroutines=0,$checkForDeadlock=true;var $mainFinished=false;var $go=function(fun,args,direct){$totalGoroutines++;$awakeGoroutines++;var $goroutine=function(){try{$curGoroutine=$goroutine;var r=fun.apply(undefined,args);if(r&&r.$blk!==undefined){fun=function(){return r.$blk();};args=[];return;}$goroutine.exit=true;}catch(err){if(!$goroutine.exit){throw err;}}finally{$curGoroutine=$noGoroutine;if($goroutine.exit){$totalGoroutines--;$goroutine.asleep=true;}if($goroutine.asleep){$awakeGoroutines--;if(!$mainFinished&&$awakeGoroutines===0&&$checkForDeadlock){console.error("fatal error: all goroutines are asleep - deadlock!");if($global.process!==undefined){$global.process.exit(2);}}}}};$goroutine.asleep=false;$g
gitextract_4b8_jk_d/ ├── .gitignore ├── .travis.yml ├── LICENSE.md ├── Makefile ├── README.md ├── attr/ │ ├── generate.go │ ├── htmlattributes.autogen.go │ └── htmlattributes.source.txt ├── component.go ├── el/ │ ├── elements.autogen.go │ └── generate.go ├── element.go ├── event.go ├── evt/ │ ├── event.autogen.go │ └── generate.go ├── examples/ │ ├── .gitignore │ ├── ajax/ │ │ ├── ajax.js │ │ ├── index.html │ │ └── main.go │ ├── basic/ │ │ ├── basic.js │ │ ├── index.html │ │ └── main.go │ ├── basic-click-counter/ │ │ ├── basic-click-counter.js │ │ ├── index.html │ │ └── main.go │ ├── build.sh │ ├── composition/ │ │ ├── composition.js │ │ ├── index.html │ │ └── main.go │ ├── debounce/ │ │ ├── debounce.js │ │ ├── index.html │ │ └── main.go │ ├── helpers.go │ ├── interop/ │ │ ├── index.html │ │ ├── interop-ext-global.js │ │ ├── interop-ext-module-bundle.js │ │ ├── interop-ext-module.js │ │ ├── interop-ext-reverse-bundle.js │ │ ├── interop-ext-reverse.js │ │ ├── interop.js │ │ └── main.go │ ├── lifecycle/ │ │ ├── index.html │ │ ├── lifecycle.js │ │ └── main.go │ └── router/ │ ├── index.html │ ├── main.go │ └── router.js ├── helpers.go ├── lifecycle.go ├── modifiers.go ├── package.json ├── render.go ├── support/ │ └── support.go ├── tests/ │ ├── component_test.go │ ├── component_tests.inc.js │ ├── doc.go │ ├── element_test.go │ ├── event_test.go │ ├── grt/ │ │ ├── test_helpers.go │ │ ├── test_helpers.inc.js │ │ └── test_helpers_test.go │ ├── modifier_test.go │ └── this_test.go └── this.go
SYMBOL INDEX (726 symbols across 33 files)
FILE: attr/generate.go
function main (line 49) | func main() {
FILE: attr/htmlattributes.autogen.go
function About (line 13) | func About(v interface{}) gr.Modifier {
function Accept (line 18) | func Accept(v interface{}) gr.Modifier {
function AcceptCharset (line 23) | func AcceptCharset(v interface{}) gr.Modifier {
function AccessKey (line 28) | func AccessKey(v interface{}) gr.Modifier {
function Action (line 33) | func Action(v interface{}) gr.Modifier {
function AllowFullScreen (line 38) | func AllowFullScreen(v interface{}) gr.Modifier {
function AllowTransparency (line 43) | func AllowTransparency(v interface{}) gr.Modifier {
function Alt (line 48) | func Alt(v interface{}) gr.Modifier {
function Async (line 53) | func Async(v interface{}) gr.Modifier {
function AutoCapitalize (line 58) | func AutoCapitalize(v interface{}) gr.Modifier {
function AutoComplete (line 63) | func AutoComplete(v interface{}) gr.Modifier {
function AutoCorrect (line 68) | func AutoCorrect(v interface{}) gr.Modifier {
function AutoFocus (line 73) | func AutoFocus(v interface{}) gr.Modifier {
function AutoPlay (line 78) | func AutoPlay(v interface{}) gr.Modifier {
function AutoSave (line 83) | func AutoSave(v interface{}) gr.Modifier {
function Capture (line 88) | func Capture(v interface{}) gr.Modifier {
function CellPadding (line 93) | func CellPadding(v interface{}) gr.Modifier {
function CellSpacing (line 98) | func CellSpacing(v interface{}) gr.Modifier {
function Challenge (line 103) | func Challenge(v interface{}) gr.Modifier {
function CharSet (line 108) | func CharSet(v interface{}) gr.Modifier {
function Checked (line 113) | func Checked(v interface{}) gr.Modifier {
function Cite (line 118) | func Cite(v interface{}) gr.Modifier {
function ClassID (line 123) | func ClassID(v interface{}) gr.Modifier {
function ClassName (line 128) | func ClassName(v interface{}) gr.Modifier {
function ColSpan (line 133) | func ColSpan(v interface{}) gr.Modifier {
function Color (line 138) | func Color(v interface{}) gr.Modifier {
function Cols (line 143) | func Cols(v interface{}) gr.Modifier {
function Content (line 148) | func Content(v interface{}) gr.Modifier {
function ContentEditable (line 153) | func ContentEditable(v interface{}) gr.Modifier {
function ContextMenu (line 158) | func ContextMenu(v interface{}) gr.Modifier {
function Controls (line 163) | func Controls(v interface{}) gr.Modifier {
function Coords (line 168) | func Coords(v interface{}) gr.Modifier {
function CrossOrigin (line 173) | func CrossOrigin(v interface{}) gr.Modifier {
function DangerouslySetInnerHTML (line 179) | func DangerouslySetInnerHTML(v interface{}) gr.Modifier {
function Data (line 184) | func Data(v interface{}) gr.Modifier {
function Datatype (line 189) | func Datatype(v interface{}) gr.Modifier {
function DateTime (line 194) | func DateTime(v interface{}) gr.Modifier {
function Default (line 199) | func Default(v interface{}) gr.Modifier {
function DefaultValue (line 206) | func DefaultValue(v interface{}) gr.Modifier {
function Defer (line 211) | func Defer(v interface{}) gr.Modifier {
function Dir (line 216) | func Dir(v interface{}) gr.Modifier {
function Disabled (line 221) | func Disabled(v interface{}) gr.Modifier {
function Download (line 226) | func Download(v interface{}) gr.Modifier {
function Draggable (line 231) | func Draggable(v interface{}) gr.Modifier {
function EncType (line 236) | func EncType(v interface{}) gr.Modifier {
function Form (line 241) | func Form(v interface{}) gr.Modifier {
function FormAction (line 246) | func FormAction(v interface{}) gr.Modifier {
function FormEncType (line 251) | func FormEncType(v interface{}) gr.Modifier {
function FormMethod (line 256) | func FormMethod(v interface{}) gr.Modifier {
function FormNoValidate (line 261) | func FormNoValidate(v interface{}) gr.Modifier {
function FormTarget (line 266) | func FormTarget(v interface{}) gr.Modifier {
function FrameBorder (line 271) | func FrameBorder(v interface{}) gr.Modifier {
function Headers (line 276) | func Headers(v interface{}) gr.Modifier {
function Height (line 281) | func Height(v interface{}) gr.Modifier {
function Hidden (line 286) | func Hidden(v interface{}) gr.Modifier {
function High (line 291) | func High(v interface{}) gr.Modifier {
function HRef (line 296) | func HRef(v interface{}) gr.Modifier {
function HRefLang (line 301) | func HRefLang(v interface{}) gr.Modifier {
function HTMLFor (line 306) | func HTMLFor(v interface{}) gr.Modifier {
function HTTPEquiv (line 311) | func HTTPEquiv(v interface{}) gr.Modifier {
function Icon (line 316) | func Icon(v interface{}) gr.Modifier {
function ID (line 321) | func ID(v interface{}) gr.Modifier {
function Inlist (line 326) | func Inlist(v interface{}) gr.Modifier {
function InputMode (line 331) | func InputMode(v interface{}) gr.Modifier {
function Integrity (line 336) | func Integrity(v interface{}) gr.Modifier {
function Is (line 341) | func Is(v interface{}) gr.Modifier {
function ItemProp (line 346) | func ItemProp(v interface{}) gr.Modifier {
function Key (line 354) | func Key(v interface{}) gr.Modifier {
function KeyParams (line 359) | func KeyParams(v interface{}) gr.Modifier {
function KeyType (line 364) | func KeyType(v interface{}) gr.Modifier {
function Kind (line 369) | func Kind(v interface{}) gr.Modifier {
function Label (line 374) | func Label(v interface{}) gr.Modifier {
function Lang (line 379) | func Lang(v interface{}) gr.Modifier {
function List (line 384) | func List(v interface{}) gr.Modifier {
function Loop (line 389) | func Loop(v interface{}) gr.Modifier {
function Low (line 394) | func Low(v interface{}) gr.Modifier {
function Manifest (line 399) | func Manifest(v interface{}) gr.Modifier {
function MarginHeight (line 404) | func MarginHeight(v interface{}) gr.Modifier {
function MarginWidth (line 409) | func MarginWidth(v interface{}) gr.Modifier {
function Max (line 414) | func Max(v interface{}) gr.Modifier {
function MaxLength (line 419) | func MaxLength(v interface{}) gr.Modifier {
function Media (line 424) | func Media(v interface{}) gr.Modifier {
function MediaGroup (line 429) | func MediaGroup(v interface{}) gr.Modifier {
function Method (line 434) | func Method(v interface{}) gr.Modifier {
function Min (line 439) | func Min(v interface{}) gr.Modifier {
function MinLength (line 444) | func MinLength(v interface{}) gr.Modifier {
function Multiple (line 449) | func Multiple(v interface{}) gr.Modifier {
function Muted (line 454) | func Muted(v interface{}) gr.Modifier {
function Name (line 459) | func Name(v interface{}) gr.Modifier {
function NoValidate (line 464) | func NoValidate(v interface{}) gr.Modifier {
function Nonce (line 469) | func Nonce(v interface{}) gr.Modifier {
function Open (line 474) | func Open(v interface{}) gr.Modifier {
function Optimum (line 479) | func Optimum(v interface{}) gr.Modifier {
function Pattern (line 484) | func Pattern(v interface{}) gr.Modifier {
function Placeholder (line 489) | func Placeholder(v interface{}) gr.Modifier {
function Poster (line 494) | func Poster(v interface{}) gr.Modifier {
function Prefix (line 499) | func Prefix(v interface{}) gr.Modifier {
function Preload (line 504) | func Preload(v interface{}) gr.Modifier {
function Profile (line 509) | func Profile(v interface{}) gr.Modifier {
function Property (line 514) | func Property(v interface{}) gr.Modifier {
function RadioGroup (line 519) | func RadioGroup(v interface{}) gr.Modifier {
function ReadOnly (line 524) | func ReadOnly(v interface{}) gr.Modifier {
function Ref (line 529) | func Ref(v interface{}) gr.Modifier {
function Rel (line 534) | func Rel(v interface{}) gr.Modifier {
function Required (line 539) | func Required(v interface{}) gr.Modifier {
function Resource (line 544) | func Resource(v interface{}) gr.Modifier {
function Results (line 549) | func Results(v interface{}) gr.Modifier {
function Reversed (line 554) | func Reversed(v interface{}) gr.Modifier {
function Role (line 559) | func Role(v interface{}) gr.Modifier {
function RowSpan (line 564) | func RowSpan(v interface{}) gr.Modifier {
function Rows (line 569) | func Rows(v interface{}) gr.Modifier {
function Sandbox (line 574) | func Sandbox(v interface{}) gr.Modifier {
function Scope (line 579) | func Scope(v interface{}) gr.Modifier {
function Scoped (line 584) | func Scoped(v interface{}) gr.Modifier {
function Scrolling (line 589) | func Scrolling(v interface{}) gr.Modifier {
function Seamless (line 594) | func Seamless(v interface{}) gr.Modifier {
function Security (line 599) | func Security(v interface{}) gr.Modifier {
function Selected (line 604) | func Selected(v interface{}) gr.Modifier {
function Shape (line 609) | func Shape(v interface{}) gr.Modifier {
function Size (line 614) | func Size(v interface{}) gr.Modifier {
function Sizes (line 619) | func Sizes(v interface{}) gr.Modifier {
function Span (line 624) | func Span(v interface{}) gr.Modifier {
function SpellCheck (line 629) | func SpellCheck(v interface{}) gr.Modifier {
function Src (line 634) | func Src(v interface{}) gr.Modifier {
function SrcDoc (line 639) | func SrcDoc(v interface{}) gr.Modifier {
function SrcLang (line 644) | func SrcLang(v interface{}) gr.Modifier {
function SrcSet (line 649) | func SrcSet(v interface{}) gr.Modifier {
function Start (line 654) | func Start(v interface{}) gr.Modifier {
function Step (line 659) | func Step(v interface{}) gr.Modifier {
function Style (line 664) | func Style(v interface{}) gr.Modifier {
function Summary (line 669) | func Summary(v interface{}) gr.Modifier {
function TabIndex (line 674) | func TabIndex(v interface{}) gr.Modifier {
function Target (line 679) | func Target(v interface{}) gr.Modifier {
function Title (line 684) | func Title(v interface{}) gr.Modifier {
function Type (line 689) | func Type(v interface{}) gr.Modifier {
function Typeof (line 694) | func Typeof(v interface{}) gr.Modifier {
function Unselectable (line 699) | func Unselectable(v interface{}) gr.Modifier {
function UseMap (line 704) | func UseMap(v interface{}) gr.Modifier {
function Value (line 709) | func Value(v interface{}) gr.Modifier {
function Vocab (line 714) | func Vocab(v interface{}) gr.Modifier {
function Width (line 719) | func Width(v interface{}) gr.Modifier {
function WMode (line 724) | func WMode(v interface{}) gr.Modifier {
function Wrap (line 729) | func Wrap(v interface{}) gr.Modifier {
FILE: component.go
function init (line 35) | func init() {
type Component (line 55) | type Component interface
type Factory (line 60) | type Factory interface
type ReactComponent (line 68) | type ReactComponent struct
method Node (line 342) | func (r *ReactComponent) Node() *js.Object {
method Render (line 347) | func (r *ReactComponent) Render(elementID string, props Props) {
method CreateElement (line 357) | func (r *ReactComponent) CreateElement(props Props, children ...Compon...
method CloneElement (line 368) | func (r *ReactComponent) CloneElement(props Props, children ...Compone...
method handleOptionsOnCreate (line 634) | func (r *ReactComponent) handleOptionsOnCreate() {
method handleOptionsOnPrepare (line 648) | func (r *ReactComponent) handleOptionsOnPrepare() {
function FromGlobal (line 92) | func FromGlobal(path ...string) *ReactComponent {
function Require (line 115) | func Require(path ...string) *ReactComponent {
type ComponentConfig (line 124) | type ComponentConfig struct
type Option (line 129) | type Option struct
function WithConfig (line 137) | func WithConfig(config ComponentConfig) Option {
function Export (line 147) | func Export(name string) Option {
function Global (line 159) | func Global(name string) Option {
function Apply (line 170) | func Apply(f func(o *js.Object) *js.Object) Option {
function NewSimpleRenderer (line 179) | func NewSimpleRenderer(c Component) Renderer {
type simpleRenderer (line 183) | type simpleRenderer struct
method Render (line 188) | func (s simpleRenderer) Render() Component {
function NewSimpleComponent (line 195) | func NewSimpleComponent(c Component, options ...Option) *ReactComponent {
type reactClass (line 199) | type reactClass struct
type delegateRenderer (line 220) | type delegateRenderer struct
method Render (line 225) | func (d delegateRenderer) Render() Component {
function NewRenderer (line 230) | func NewRenderer(renderFunc func() Component) Renderer {
function New (line 237) | func New(r Renderer, options ...Option) *ReactComponent {
function CreateIfNeeded (line 330) | func CreateIfNeeded(c Component) *Element {
function cloneOrCreateElementElementFactory (line 372) | func cloneOrCreateElementElementFactory(r *ReactComponent) func(e *Eleme...
function createElementElementFactory (line 382) | func createElementElementFactory(r *ReactComponent) func(e *Element) *js...
function cloneElement (line 390) | func cloneElement(prototype *js.Object, e *Element) *js.Object {
function createOrInvoke (line 406) | func createOrInvoke(node *js.Object, e *Element, needsCreate bool) *js.O...
function extractThisSetter (line 426) | func extractThisSetter(r Renderer) ThisSetter {
function makeComponentUpdateFunc (line 461) | func makeComponentUpdateFunc(ts ThisSetter, f func(c Cops) bool) *js.Obj...
function makeComponentUpdateVoidFunc (line 470) | func makeComponentUpdateVoidFunc(ts ThisSetter, f func(c Cops)) *js.Obje...
function makeComponentPropertyReceiverFunc (line 480) | func makeComponentPropertyReceiverFunc(ts ThisSetter, f func(c Cops)) *j...
function extractComponentUpdateArgs (line 491) | func extractComponentUpdateArgs(arguments []*js.Object) Cops {
function makeVoidFunc (line 512) | func makeVoidFunc(ts ThisSetter, f func(), assumeBlocking bool) *js.Obje...
function makeStateFunc (line 528) | func makeStateFunc(ts ThisSetter, f func() State) *js.Object {
function makeChildContextFunc (line 537) | func makeChildContextFunc(ts ThisSetter, f func() Context) (*js.Object, ...
function extractPropTypesFromTemplate (line 551) | func extractPropTypesFromTemplate(t map[string]interface{}) js.M {
type incrementer (line 570) | type incrementer struct
method next (line 574) | func (i *incrementer) next() int {
function makeRenderFunc (line 579) | func makeRenderFunc(ts ThisSetter, s string, f func() Component) *js.Obj...
function addEventListeners (line 608) | func addEventListeners(ts ThisSetter, c Component, that *This) {
function addMissingKeys (line 654) | func addMissingKeys(s string, e *Element, id *incrementer) {
FILE: el/elements.autogen.go
function Anchor (line 13) | func Anchor(mods ...gr.Modifier) *gr.Element {
function Abbreviation (line 22) | func Abbreviation(mods ...gr.Modifier) *gr.Element {
function Address (line 31) | func Address(mods ...gr.Modifier) *gr.Element {
function Area (line 40) | func Area(mods ...gr.Modifier) *gr.Element {
function Article (line 49) | func Article(mods ...gr.Modifier) *gr.Element {
function Aside (line 58) | func Aside(mods ...gr.Modifier) *gr.Element {
function Audio (line 67) | func Audio(mods ...gr.Modifier) *gr.Element {
function Bold (line 76) | func Bold(mods ...gr.Modifier) *gr.Element {
function Base (line 85) | func Base(mods ...gr.Modifier) *gr.Element {
function BidirectionalIsolation (line 94) | func BidirectionalIsolation(mods ...gr.Modifier) *gr.Element {
function BidirectionalOverride (line 103) | func BidirectionalOverride(mods ...gr.Modifier) *gr.Element {
function BlockQuote (line 112) | func BlockQuote(mods ...gr.Modifier) *gr.Element {
function Break (line 121) | func Break(mods ...gr.Modifier) *gr.Element {
function Button (line 130) | func Button(mods ...gr.Modifier) *gr.Element {
function Canvas (line 139) | func Canvas(mods ...gr.Modifier) *gr.Element {
function Caption (line 148) | func Caption(mods ...gr.Modifier) *gr.Element {
function Citation (line 157) | func Citation(mods ...gr.Modifier) *gr.Element {
function Code (line 166) | func Code(mods ...gr.Modifier) *gr.Element {
function Column (line 175) | func Column(mods ...gr.Modifier) *gr.Element {
function ColumnGroup (line 184) | func ColumnGroup(mods ...gr.Modifier) *gr.Element {
function Data (line 193) | func Data(mods ...gr.Modifier) *gr.Element {
function DataList (line 202) | func DataList(mods ...gr.Modifier) *gr.Element {
function Description (line 211) | func Description(mods ...gr.Modifier) *gr.Element {
function DeletedText (line 220) | func DeletedText(mods ...gr.Modifier) *gr.Element {
function Details (line 229) | func Details(mods ...gr.Modifier) *gr.Element {
function Definition (line 238) | func Definition(mods ...gr.Modifier) *gr.Element {
function Dialog (line 247) | func Dialog(mods ...gr.Modifier) *gr.Element {
function Div (line 256) | func Div(mods ...gr.Modifier) *gr.Element {
function DescriptionList (line 265) | func DescriptionList(mods ...gr.Modifier) *gr.Element {
function DefinitionTerm (line 274) | func DefinitionTerm(mods ...gr.Modifier) *gr.Element {
function Element (line 283) | func Element(mods ...gr.Modifier) *gr.Element {
function Emphasis (line 292) | func Emphasis(mods ...gr.Modifier) *gr.Element {
function Embed (line 301) | func Embed(mods ...gr.Modifier) *gr.Element {
function FieldSet (line 310) | func FieldSet(mods ...gr.Modifier) *gr.Element {
function FigureCaption (line 319) | func FigureCaption(mods ...gr.Modifier) *gr.Element {
function Figure (line 328) | func Figure(mods ...gr.Modifier) *gr.Element {
function Footer (line 337) | func Footer(mods ...gr.Modifier) *gr.Element {
function Form (line 346) | func Form(mods ...gr.Modifier) *gr.Element {
function Header (line 355) | func Header(mods ...gr.Modifier) *gr.Element {
function HeadingsGroup (line 364) | func HeadingsGroup(mods ...gr.Modifier) *gr.Element {
function HorizontalRule (line 373) | func HorizontalRule(mods ...gr.Modifier) *gr.Element {
function Italic (line 382) | func Italic(mods ...gr.Modifier) *gr.Element {
function InlineFrame (line 391) | func InlineFrame(mods ...gr.Modifier) *gr.Element {
function Image (line 400) | func Image(mods ...gr.Modifier) *gr.Element {
function Input (line 409) | func Input(mods ...gr.Modifier) *gr.Element {
function InsertedText (line 418) | func InsertedText(mods ...gr.Modifier) *gr.Element {
function KeyboardInput (line 427) | func KeyboardInput(mods ...gr.Modifier) *gr.Element {
function Label (line 436) | func Label(mods ...gr.Modifier) *gr.Element {
function Legend (line 445) | func Legend(mods ...gr.Modifier) *gr.Element {
function ListItem (line 454) | func ListItem(mods ...gr.Modifier) *gr.Element {
function Link (line 463) | func Link(mods ...gr.Modifier) *gr.Element {
function Main (line 472) | func Main(mods ...gr.Modifier) *gr.Element {
function Map (line 481) | func Map(mods ...gr.Modifier) *gr.Element {
function Mark (line 490) | func Mark(mods ...gr.Modifier) *gr.Element {
function Menu (line 499) | func Menu(mods ...gr.Modifier) *gr.Element {
function MenuItem (line 508) | func MenuItem(mods ...gr.Modifier) *gr.Element {
function Meta (line 517) | func Meta(mods ...gr.Modifier) *gr.Element {
function Meter (line 526) | func Meter(mods ...gr.Modifier) *gr.Element {
function Multicol (line 535) | func Multicol(mods ...gr.Modifier) *gr.Element {
function Navigation (line 544) | func Navigation(mods ...gr.Modifier) *gr.Element {
function NoFrames (line 553) | func NoFrames(mods ...gr.Modifier) *gr.Element {
function NoScript (line 562) | func NoScript(mods ...gr.Modifier) *gr.Element {
function Object (line 571) | func Object(mods ...gr.Modifier) *gr.Element {
function OrderedList (line 580) | func OrderedList(mods ...gr.Modifier) *gr.Element {
function OptionsGroup (line 589) | func OptionsGroup(mods ...gr.Modifier) *gr.Element {
function Option (line 598) | func Option(mods ...gr.Modifier) *gr.Element {
function Output (line 607) | func Output(mods ...gr.Modifier) *gr.Element {
function Paragraph (line 616) | func Paragraph(mods ...gr.Modifier) *gr.Element {
function Parameter (line 625) | func Parameter(mods ...gr.Modifier) *gr.Element {
function Picture (line 634) | func Picture(mods ...gr.Modifier) *gr.Element {
function Preformatted (line 643) | func Preformatted(mods ...gr.Modifier) *gr.Element {
function Progress (line 652) | func Progress(mods ...gr.Modifier) *gr.Element {
function Quote (line 661) | func Quote(mods ...gr.Modifier) *gr.Element {
function RubyParenthesis (line 670) | func RubyParenthesis(mods ...gr.Modifier) *gr.Element {
function RubyText (line 679) | func RubyText(mods ...gr.Modifier) *gr.Element {
function RubyTextContainer (line 688) | func RubyTextContainer(mods ...gr.Modifier) *gr.Element {
function Ruby (line 697) | func Ruby(mods ...gr.Modifier) *gr.Element {
function Strikethrough (line 706) | func Strikethrough(mods ...gr.Modifier) *gr.Element {
function Sample (line 715) | func Sample(mods ...gr.Modifier) *gr.Element {
function Script (line 724) | func Script(mods ...gr.Modifier) *gr.Element {
function Section (line 733) | func Section(mods ...gr.Modifier) *gr.Element {
function Select (line 742) | func Select(mods ...gr.Modifier) *gr.Element {
function Shadow (line 751) | func Shadow(mods ...gr.Modifier) *gr.Element {
function Small (line 760) | func Small(mods ...gr.Modifier) *gr.Element {
function Source (line 769) | func Source(mods ...gr.Modifier) *gr.Element {
function Span (line 778) | func Span(mods ...gr.Modifier) *gr.Element {
function Strong (line 787) | func Strong(mods ...gr.Modifier) *gr.Element {
function Style (line 796) | func Style(mods ...gr.Modifier) *gr.Element {
function Subscript (line 805) | func Subscript(mods ...gr.Modifier) *gr.Element {
function Summary (line 814) | func Summary(mods ...gr.Modifier) *gr.Element {
function Superscript (line 823) | func Superscript(mods ...gr.Modifier) *gr.Element {
function Table (line 832) | func Table(mods ...gr.Modifier) *gr.Element {
function TableBody (line 841) | func TableBody(mods ...gr.Modifier) *gr.Element {
function TableData (line 850) | func TableData(mods ...gr.Modifier) *gr.Element {
function Template (line 859) | func Template(mods ...gr.Modifier) *gr.Element {
function TextArea (line 868) | func TextArea(mods ...gr.Modifier) *gr.Element {
function TableFoot (line 877) | func TableFoot(mods ...gr.Modifier) *gr.Element {
function TableHeader (line 886) | func TableHeader(mods ...gr.Modifier) *gr.Element {
function TableHead (line 895) | func TableHead(mods ...gr.Modifier) *gr.Element {
function Time (line 904) | func Time(mods ...gr.Modifier) *gr.Element {
function Title (line 913) | func Title(mods ...gr.Modifier) *gr.Element {
function TableRow (line 922) | func TableRow(mods ...gr.Modifier) *gr.Element {
function Track (line 931) | func Track(mods ...gr.Modifier) *gr.Element {
function Underline (line 940) | func Underline(mods ...gr.Modifier) *gr.Element {
function UnorderedList (line 949) | func UnorderedList(mods ...gr.Modifier) *gr.Element {
function Variable (line 958) | func Variable(mods ...gr.Modifier) *gr.Element {
function Video (line 967) | func Video(mods ...gr.Modifier) *gr.Element {
function WordBreakOpportunity (line 976) | func WordBreakOpportunity(mods ...gr.Modifier) *gr.Element {
function Header1 (line 985) | func Header1(mods ...gr.Modifier) *gr.Element {
function Header2 (line 994) | func Header2(mods ...gr.Modifier) *gr.Element {
function Header3 (line 1003) | func Header3(mods ...gr.Modifier) *gr.Element {
function Header4 (line 1012) | func Header4(mods ...gr.Modifier) *gr.Element {
function Header5 (line 1021) | func Header5(mods ...gr.Modifier) *gr.Element {
function Header6 (line 1030) | func Header6(mods ...gr.Modifier) *gr.Element {
FILE: el/generate.go
function main (line 98) | func main() {
function writeElem (line 156) | func writeElem(w io.Writer, name, desc, link string) {
function capitalize (line 174) | func capitalize(s string) string {
FILE: element.go
type Modifier (line 24) | type Modifier interface
type elementFactory (line 28) | type elementFactory
type Element (line 39) | type Element struct
method Node (line 72) | func (e *Element) Node() *js.Object {
method Modify (line 80) | func (e *Element) Modify(in *Element) {
method createElement (line 96) | func (e *Element) createElement() *js.Object {
function NewElement (line 62) | func NewElement(tag string) *Element {
function NewPreparedElement (line 67) | func NewPreparedElement(o *js.Object) *Element {
type Modifiers (line 85) | type Modifiers
method Modify (line 88) | func (mods Modifiers) Modify(e *Element) {
function createElement (line 118) | func createElement(tag string, props map[string]interface{}, args []inte...
FILE: event.go
type Event (line 24) | type Event struct
method Persist (line 31) | func (e *Event) Persist() {
method Target (line 36) | func (e *Event) Target() *js.Object {
method TargetValue (line 41) | func (e *Event) TargetValue() *js.Object {
method CurrentTarget (line 46) | func (e *Event) CurrentTarget() *js.Object {
method Int (line 51) | func (e *Event) Int(key string) int {
type EventListener (line 56) | type EventListener struct
method PreventDefault (line 65) | func (l *EventListener) PreventDefault() *EventListener {
method StopPropagation (line 73) | func (l *EventListener) StopPropagation() *EventListener {
method Modify (line 91) | func (l *EventListener) Modify(element *Element) {
type Listener (line 80) | type Listener
function NewEventListener (line 84) | func NewEventListener(name string, listener func(*Event)) *EventListener {
FILE: evt/event.autogen.go
function Abort (line 13) | func Abort(listener gr.Listener) *gr.EventListener {
function AfterPrint (line 20) | func AfterPrint(listener gr.Listener) *gr.EventListener {
function AnimationEnd (line 27) | func AnimationEnd(listener gr.Listener) *gr.EventListener {
function AnimationIteration (line 34) | func AnimationIteration(listener gr.Listener) *gr.EventListener {
function AnimationStart (line 41) | func AnimationStart(listener gr.Listener) *gr.EventListener {
function AudioEnd (line 48) | func AudioEnd(listener gr.Listener) *gr.EventListener {
function AudioProcess (line 55) | func AudioProcess(listener gr.Listener) *gr.EventListener {
function AudioStart (line 62) | func AudioStart(listener gr.Listener) *gr.EventListener {
function BeforePrint (line 69) | func BeforePrint(listener gr.Listener) *gr.EventListener {
function BeforeUnload (line 76) | func BeforeUnload(listener gr.Listener) *gr.EventListener {
function BeginEvent (line 83) | func BeginEvent(listener gr.Listener) *gr.EventListener {
function Blocked (line 90) | func Blocked(listener gr.Listener) *gr.EventListener {
function Blur (line 97) | func Blur(listener gr.Listener) *gr.EventListener {
function Boundary (line 104) | func Boundary(listener gr.Listener) *gr.EventListener {
function Cached (line 111) | func Cached(listener gr.Listener) *gr.EventListener {
function CanPlay (line 118) | func CanPlay(listener gr.Listener) *gr.EventListener {
function CanPlayThrough (line 125) | func CanPlayThrough(listener gr.Listener) *gr.EventListener {
function Change (line 132) | func Change(listener gr.Listener) *gr.EventListener {
function ChargingChange (line 139) | func ChargingChange(listener gr.Listener) *gr.EventListener {
function ChargingTimeChange (line 146) | func ChargingTimeChange(listener gr.Listener) *gr.EventListener {
function Checking (line 153) | func Checking(listener gr.Listener) *gr.EventListener {
function Click (line 160) | func Click(listener gr.Listener) *gr.EventListener {
function Close (line 167) | func Close(listener gr.Listener) *gr.EventListener {
function Complete (line 174) | func Complete(listener gr.Listener) *gr.EventListener {
function CompositionEnd (line 181) | func CompositionEnd(listener gr.Listener) *gr.EventListener {
function CompositionStart (line 188) | func CompositionStart(listener gr.Listener) *gr.EventListener {
function CompositionUpdate (line 195) | func CompositionUpdate(listener gr.Listener) *gr.EventListener {
function ContextMenu (line 202) | func ContextMenu(listener gr.Listener) *gr.EventListener {
function Copy (line 209) | func Copy(listener gr.Listener) *gr.EventListener {
function Cut (line 216) | func Cut(listener gr.Listener) *gr.EventListener {
function DOMContentLoaded (line 223) | func DOMContentLoaded(listener gr.Listener) *gr.EventListener {
function DeviceLight (line 230) | func DeviceLight(listener gr.Listener) *gr.EventListener {
function DeviceMotion (line 237) | func DeviceMotion(listener gr.Listener) *gr.EventListener {
function DeviceOrientation (line 244) | func DeviceOrientation(listener gr.Listener) *gr.EventListener {
function DeviceProximity (line 251) | func DeviceProximity(listener gr.Listener) *gr.EventListener {
function DischargingTimeChange (line 258) | func DischargingTimeChange(listener gr.Listener) *gr.EventListener {
function DoubleClick (line 265) | func DoubleClick(listener gr.Listener) *gr.EventListener {
function Downloading (line 272) | func Downloading(listener gr.Listener) *gr.EventListener {
function Drag (line 279) | func Drag(listener gr.Listener) *gr.EventListener {
function DragEnd (line 286) | func DragEnd(listener gr.Listener) *gr.EventListener {
function DragEnter (line 293) | func DragEnter(listener gr.Listener) *gr.EventListener {
function DragLeave (line 300) | func DragLeave(listener gr.Listener) *gr.EventListener {
function DragOver (line 307) | func DragOver(listener gr.Listener) *gr.EventListener {
function DragStart (line 314) | func DragStart(listener gr.Listener) *gr.EventListener {
function Drop (line 321) | func Drop(listener gr.Listener) *gr.EventListener {
function DurationChange (line 328) | func DurationChange(listener gr.Listener) *gr.EventListener {
function Emptied (line 335) | func Emptied(listener gr.Listener) *gr.EventListener {
function End (line 342) | func End(listener gr.Listener) *gr.EventListener {
function EndEvent (line 349) | func EndEvent(listener gr.Listener) *gr.EventListener {
function Ended (line 356) | func Ended(listener gr.Listener) *gr.EventListener {
function Error (line 363) | func Error(listener gr.Listener) *gr.EventListener {
function Focus (line 370) | func Focus(listener gr.Listener) *gr.EventListener {
function FocusIn (line 377) | func FocusIn(listener gr.Listener) *gr.EventListener {
function FocusOut (line 384) | func FocusOut(listener gr.Listener) *gr.EventListener {
function FullScreenChange (line 391) | func FullScreenChange(listener gr.Listener) *gr.EventListener {
function FullScreenError (line 398) | func FullScreenError(listener gr.Listener) *gr.EventListener {
function GamepadConnected (line 405) | func GamepadConnected(listener gr.Listener) *gr.EventListener {
function GamepadDisconnected (line 412) | func GamepadDisconnected(listener gr.Listener) *gr.EventListener {
function GotPointerCapture (line 419) | func GotPointerCapture(listener gr.Listener) *gr.EventListener {
function HashChange (line 426) | func HashChange(listener gr.Listener) *gr.EventListener {
function Input (line 433) | func Input(listener gr.Listener) *gr.EventListener {
function Invalid (line 440) | func Invalid(listener gr.Listener) *gr.EventListener {
function KeyDown (line 447) | func KeyDown(listener gr.Listener) *gr.EventListener {
function KeyPress (line 454) | func KeyPress(listener gr.Listener) *gr.EventListener {
function KeyUp (line 461) | func KeyUp(listener gr.Listener) *gr.EventListener {
function LanguageChange (line 468) | func LanguageChange(listener gr.Listener) *gr.EventListener {
function LevelChange (line 475) | func LevelChange(listener gr.Listener) *gr.EventListener {
function Load (line 482) | func Load(listener gr.Listener) *gr.EventListener {
function LoadEnd (line 489) | func LoadEnd(listener gr.Listener) *gr.EventListener {
function LoadStart (line 496) | func LoadStart(listener gr.Listener) *gr.EventListener {
function LoadedData (line 503) | func LoadedData(listener gr.Listener) *gr.EventListener {
function LoadedMetadata (line 510) | func LoadedMetadata(listener gr.Listener) *gr.EventListener {
function LostPointerCapture (line 517) | func LostPointerCapture(listener gr.Listener) *gr.EventListener {
function Mark (line 524) | func Mark(listener gr.Listener) *gr.EventListener {
function Message (line 531) | func Message(listener gr.Listener) *gr.EventListener {
function MouseDown (line 538) | func MouseDown(listener gr.Listener) *gr.EventListener {
function MouseEnter (line 545) | func MouseEnter(listener gr.Listener) *gr.EventListener {
function MouseLeave (line 552) | func MouseLeave(listener gr.Listener) *gr.EventListener {
function MouseMove (line 559) | func MouseMove(listener gr.Listener) *gr.EventListener {
function MouseOut (line 566) | func MouseOut(listener gr.Listener) *gr.EventListener {
function MouseOver (line 573) | func MouseOver(listener gr.Listener) *gr.EventListener {
function MouseUp (line 580) | func MouseUp(listener gr.Listener) *gr.EventListener {
function NoMatch (line 587) | func NoMatch(listener gr.Listener) *gr.EventListener {
function NoUpdate (line 594) | func NoUpdate(listener gr.Listener) *gr.EventListener {
function NotificationClick (line 601) | func NotificationClick(listener gr.Listener) *gr.EventListener {
function Obsolete (line 608) | func Obsolete(listener gr.Listener) *gr.EventListener {
function Offline (line 615) | func Offline(listener gr.Listener) *gr.EventListener {
function Online (line 622) | func Online(listener gr.Listener) *gr.EventListener {
function Open (line 629) | func Open(listener gr.Listener) *gr.EventListener {
function OrientationChange (line 636) | func OrientationChange(listener gr.Listener) *gr.EventListener {
function PageHide (line 643) | func PageHide(listener gr.Listener) *gr.EventListener {
function PageShow (line 650) | func PageShow(listener gr.Listener) *gr.EventListener {
function Paste (line 657) | func Paste(listener gr.Listener) *gr.EventListener {
function Pause (line 664) | func Pause(listener gr.Listener) *gr.EventListener {
function Play (line 671) | func Play(listener gr.Listener) *gr.EventListener {
function Playing (line 678) | func Playing(listener gr.Listener) *gr.EventListener {
function PointerCancel (line 685) | func PointerCancel(listener gr.Listener) *gr.EventListener {
function PointerDown (line 692) | func PointerDown(listener gr.Listener) *gr.EventListener {
function PointerEnter (line 699) | func PointerEnter(listener gr.Listener) *gr.EventListener {
function PointerLeave (line 706) | func PointerLeave(listener gr.Listener) *gr.EventListener {
function PointerLockChange (line 713) | func PointerLockChange(listener gr.Listener) *gr.EventListener {
function PointerLockError (line 720) | func PointerLockError(listener gr.Listener) *gr.EventListener {
function PointerMove (line 727) | func PointerMove(listener gr.Listener) *gr.EventListener {
function PointerOut (line 734) | func PointerOut(listener gr.Listener) *gr.EventListener {
function PointerOver (line 741) | func PointerOver(listener gr.Listener) *gr.EventListener {
function PointerUp (line 748) | func PointerUp(listener gr.Listener) *gr.EventListener {
function PopState (line 755) | func PopState(listener gr.Listener) *gr.EventListener {
function Progress (line 762) | func Progress(listener gr.Listener) *gr.EventListener {
function Push (line 769) | func Push(listener gr.Listener) *gr.EventListener {
function PushSubscriptionChange (line 776) | func PushSubscriptionChange(listener gr.Listener) *gr.EventListener {
function RateChange (line 783) | func RateChange(listener gr.Listener) *gr.EventListener {
function ReadyStateChange (line 790) | func ReadyStateChange(listener gr.Listener) *gr.EventListener {
function RepeatEvent (line 797) | func RepeatEvent(listener gr.Listener) *gr.EventListener {
function Reset (line 804) | func Reset(listener gr.Listener) *gr.EventListener {
function Resize (line 811) | func Resize(listener gr.Listener) *gr.EventListener {
function ResourceTimingBufferFull (line 818) | func ResourceTimingBufferFull(listener gr.Listener) *gr.EventListener {
function Result (line 825) | func Result(listener gr.Listener) *gr.EventListener {
function Resume (line 832) | func Resume(listener gr.Listener) *gr.EventListener {
function SVGAbort (line 839) | func SVGAbort(listener gr.Listener) *gr.EventListener {
function SVGError (line 846) | func SVGError(listener gr.Listener) *gr.EventListener {
function SVGLoad (line 853) | func SVGLoad(listener gr.Listener) *gr.EventListener {
function SVGResize (line 860) | func SVGResize(listener gr.Listener) *gr.EventListener {
function SVGScroll (line 867) | func SVGScroll(listener gr.Listener) *gr.EventListener {
function SVGUnload (line 874) | func SVGUnload(listener gr.Listener) *gr.EventListener {
function SVGZoom (line 881) | func SVGZoom(listener gr.Listener) *gr.EventListener {
function Scroll (line 888) | func Scroll(listener gr.Listener) *gr.EventListener {
function Seeked (line 895) | func Seeked(listener gr.Listener) *gr.EventListener {
function Seeking (line 902) | func Seeking(listener gr.Listener) *gr.EventListener {
function Select (line 909) | func Select(listener gr.Listener) *gr.EventListener {
function SelectStart (line 916) | func SelectStart(listener gr.Listener) *gr.EventListener {
function SelectionChange (line 923) | func SelectionChange(listener gr.Listener) *gr.EventListener {
function Show (line 930) | func Show(listener gr.Listener) *gr.EventListener {
function SoundEnd (line 937) | func SoundEnd(listener gr.Listener) *gr.EventListener {
function SoundStart (line 944) | func SoundStart(listener gr.Listener) *gr.EventListener {
function SpeechEnd (line 951) | func SpeechEnd(listener gr.Listener) *gr.EventListener {
function SpeechStart (line 958) | func SpeechStart(listener gr.Listener) *gr.EventListener {
function Stalled (line 965) | func Stalled(listener gr.Listener) *gr.EventListener {
function Start (line 972) | func Start(listener gr.Listener) *gr.EventListener {
function Storage (line 979) | func Storage(listener gr.Listener) *gr.EventListener {
function Submit (line 986) | func Submit(listener gr.Listener) *gr.EventListener {
function Success (line 993) | func Success(listener gr.Listener) *gr.EventListener {
function Suspend (line 1000) | func Suspend(listener gr.Listener) *gr.EventListener {
function TimeUpdate (line 1007) | func TimeUpdate(listener gr.Listener) *gr.EventListener {
function Timeout (line 1014) | func Timeout(listener gr.Listener) *gr.EventListener {
function TouchCancel (line 1021) | func TouchCancel(listener gr.Listener) *gr.EventListener {
function TouchEnd (line 1028) | func TouchEnd(listener gr.Listener) *gr.EventListener {
function TouchEnter (line 1035) | func TouchEnter(listener gr.Listener) *gr.EventListener {
function TouchLeave (line 1042) | func TouchLeave(listener gr.Listener) *gr.EventListener {
function TouchMove (line 1049) | func TouchMove(listener gr.Listener) *gr.EventListener {
function TouchStart (line 1056) | func TouchStart(listener gr.Listener) *gr.EventListener {
function TransitionEnd (line 1063) | func TransitionEnd(listener gr.Listener) *gr.EventListener {
function Unload (line 1070) | func Unload(listener gr.Listener) *gr.EventListener {
function UpdateReady (line 1077) | func UpdateReady(listener gr.Listener) *gr.EventListener {
function UpgradeNeeded (line 1084) | func UpgradeNeeded(listener gr.Listener) *gr.EventListener {
function UserProximity (line 1091) | func UserProximity(listener gr.Listener) *gr.EventListener {
function VersionChange (line 1098) | func VersionChange(listener gr.Listener) *gr.EventListener {
function VisibilityChange (line 1105) | func VisibilityChange(listener gr.Listener) *gr.EventListener {
function VoicesChanged (line 1112) | func VoicesChanged(listener gr.Listener) *gr.EventListener {
function VolumeChange (line 1119) | func VolumeChange(listener gr.Listener) *gr.EventListener {
function Waiting (line 1126) | func Waiting(listener gr.Listener) *gr.EventListener {
function Wheel (line 1133) | func Wheel(listener gr.Listener) *gr.EventListener {
FILE: evt/generate.go
type Event (line 35) | type Event struct
function main (line 41) | func main() {
function capitalize (line 206) | func capitalize(s string) string {
function firstToLower (line 210) | func firstToLower(s string) string {
FILE: examples/ajax/main.go
function main (line 19) | func main() {
type gist (line 24) | type gist struct
type userGists (line 32) | type userGists struct
method Render (line 37) | func (g userGists) Render() gr.Component {
method ComponentDidMount (line 90) | func (g userGists) ComponentDidMount() {
method ComponentWillUnmount (line 115) | func (g userGists) ComponentWillUnmount() {
method ShouldComponentUpdate (line 121) | func (g userGists) ShouldComponentUpdate(this *gr.This, next gr.Cops) ...
function tableRow (line 78) | func tableRow(i interface{}) *gr.Element {
FILE: examples/basic-click-counter/main.go
function main (line 15) | func main() {
type clickCounter (line 23) | type clickCounter struct
method GetInitialState (line 28) | func (c clickCounter) GetInitialState() gr.State {
method Render (line 33) | func (c clickCounter) Render() gr.Component {
method onClick (line 47) | func (c clickCounter) onClick(event *gr.Event) {
method ShouldComponentUpdate (line 52) | func (c clickCounter) ShouldComponentUpdate(next gr.Cops) bool {
FILE: examples/basic/main.go
function main (line 15) | func main() {
type elapser (line 27) | type elapser struct
method Render (line 32) | func (e elapser) Render() gr.Component {
method ShouldComponentUpdate (line 42) | func (e elapser) ShouldComponentUpdate(this *gr.This, next gr.Cops) bo...
FILE: examples/composition/main.go
function main (line 15) | func main() {
type elapser (line 27) | type elapser struct
method Render (line 34) | func (e elapser) Render() gr.Component {
method ShouldComponentUpdate (line 46) | func (e elapser) ShouldComponentUpdate(next gr.Cops) bool {
method ComponentDidMount (line 50) | func (e elapser) ComponentDidMount() {
FILE: examples/debounce/main.go
function main (line 16) | func main() {
type mouseTracker (line 21) | type mouseTracker struct
method Render (line 26) | func (m mouseTracker) Render() gr.Component {
method GetInitialState (line 56) | func (m mouseTracker) GetInitialState() gr.State {
method ShouldComponentUpdate (line 60) | func (m mouseTracker) ShouldComponentUpdate(next gr.Cops) bool {
FILE: examples/helpers.go
function Example (line 14) | func Example(title string, body ...gr.Modifier) *gr.Element {
function Panel (line 30) | func Panel(title string, body ...gr.Modifier) *gr.Element {
function exampleListItem (line 47) | func exampleListItem(title, href, text string) gr.Modifier {
function Alert (line 68) | func Alert(classifier string, body gr.Modifier) *gr.Element {
type ClickCounter (line 80) | type ClickCounter struct
method GetInitialState (line 85) | func (c ClickCounter) GetInitialState() gr.State {
method Render (line 90) | func (c ClickCounter) Render() gr.Component {
method onClick (line 101) | func (c ClickCounter) onClick(event *gr.Event) {
method ShouldComponentUpdate (line 106) | func (c ClickCounter) ShouldComponentUpdate(
method ComponentDidMount (line 113) | func (c ClickCounter) ComponentDidMount() {
FILE: examples/interop/interop-ext-module-bundle.js
function s (line 1) | function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&re...
FILE: examples/interop/interop-ext-reverse-bundle.js
function s (line 1) | function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&re...
FILE: examples/interop/main.go
function main (line 17) | func main() {
type elapser (line 32) | type elapser struct
method Render (line 37) | func (e elapser) Render() gr.Component {
method ShouldComponentUpdate (line 50) | func (e elapser) ShouldComponentUpdate(next gr.Cops) bool {
FILE: examples/lifecycle/main.go
function main (line 16) | func main() {
type lifecycle (line 44) | type lifecycle struct
method Render (line 49) | func (l lifecycle) Render() gr.Component {
method GetInitialState (line 59) | func (l lifecycle) GetInitialState() gr.State {
method GetChildContext (line 65) | func (l lifecycle) GetChildContext() gr.Context {
method ShouldComponentUpdate (line 71) | func (l lifecycle) ShouldComponentUpdate(next gr.Cops) bool {
method ComponentWillUpdate (line 76) | func (l lifecycle) ComponentWillUpdate(next gr.Cops) {
method ComponentWillReceiveProps (line 81) | func (l lifecycle) ComponentWillReceiveProps(data gr.Cops) {
method ComponentDidUpdate (line 86) | func (l lifecycle) ComponentDidUpdate(data gr.Cops) {
method ComponentWillMount (line 91) | func (l lifecycle) ComponentWillMount() {
method ComponentDidMount (line 96) | func (l lifecycle) ComponentDidMount() {
method ComponentWillUnmount (line 101) | func (l lifecycle) ComponentWillUnmount() {
function init (line 105) | func init() {
FILE: examples/router/main.go
function main (line 33) | func main() {
type app (line 38) | type app struct
method Render (line 43) | func (a app) Render() gr.Component {
method createLinkListItem (line 60) | func (a app) createLinkListItem(path, title string) gr.Modifier {
type clickCounter (line 67) | type clickCounter struct
method GetInitialState (line 73) | func (c clickCounter) GetInitialState() gr.State {
method Render (line 81) | func (c clickCounter) Render() gr.Component {
method onClick (line 96) | func (c clickCounter) onClick(event *gr.Event) {
method ShouldComponentUpdate (line 101) | func (c clickCounter) ShouldComponentUpdate(
FILE: helpers.go
function UnmountComponentAtNode (line 39) | func UnmountComponentAtNode(elementID string) bool {
function toString (line 46) | func toString(i interface{}) string {
function toInt (line 62) | func toInt(i interface{}) int {
function objectToMap (line 84) | func objectToMap(o *js.Object) map[string]interface{} {
type HostInfo (line 104) | type HostInfo struct
function Location (line 114) | func Location() HostInfo {
FILE: lifecycle.go
type Lifecycler (line 24) | type Lifecycler interface
type Cops (line 39) | type Cops struct
type Renderer (line 46) | type Renderer interface
type StateInitializer (line 51) | type StateInitializer interface
type ChildContextProvider (line 66) | type ChildContextProvider interface
type ShouldComponentUpdate (line 72) | type ShouldComponentUpdate interface
type ComponentWillUpdate (line 78) | type ComponentWillUpdate interface
type ComponentWillReceiveProps (line 84) | type ComponentWillReceiveProps interface
type ComponentDidUpdate (line 90) | type ComponentDidUpdate interface
type ComponentWillMount (line 95) | type ComponentWillMount interface
type ComponentWillUnmount (line 100) | type ComponentWillUnmount interface
type ComponentDidMount (line 106) | type ComponentDidMount interface
FILE: modifiers.go
type textEl (line 24) | type textEl struct
method Modify (line 35) | func (s *textEl) Modify(in *Element) {
method Node (line 40) | func (s *textEl) Node() *js.Object {
function Text (line 29) | func Text(i interface{}) Modifier {
type cssClasses (line 44) | type cssClasses
method Modify (line 86) | func (m cssClasses) Modify(element *Element) {
function CSS (line 48) | func CSS(classes ...string) Modifier {
function Data (line 54) | func Data(name, val string) Modifier {
function Aria (line 60) | func Aria(name, val string) Modifier {
type prop (line 64) | type prop struct
method Modify (line 70) | func (p *prop) Modify(element *Element) {
function Prop (line 81) | func Prop(name string, value interface{}) Modifier {
type style (line 95) | type style struct
method Modify (line 111) | func (s *style) Modify(element *Element) {
type discard (line 100) | type discard
method Modify (line 103) | func (d discard) Modify(element *Element) {
function Style (line 120) | func Style(name string, value interface{}) Modifier {
type dynamicModifier (line 124) | type dynamicModifier
method Modify (line 131) | func (d dynamicModifier) Modify(element *Element) {
FILE: render.go
constant defaultFramesPerSecond (line 25) | defaultFramesPerSecond = 3
constant defaultWaitTime (line 26) | defaultWaitTime = 1000 / defaultFramesPerSecond
function RenderLoop (line 31) | func RenderLoop(render func(), interval ...time.Duration) chan struct{} {
FILE: support/support.go
function Require (line 29) | func Require(path ...string) (*js.Object, error) {
FILE: tests/component_test.go
constant exportedTestComponent (line 33) | exportedTestComponent = "GrtTest"
function TestNewSimpleRenderer (line 35) | func TestNewSimpleRenderer(t *testing.T) {
function TestNewSimpleComponent (line 41) | func TestNewSimpleComponent(t *testing.T) {
function TestCreateIfNeeded (line 49) | func TestCreateIfNeeded(t *testing.T) {
function TestNew (line 70) | func TestNew(t *testing.T) {
function TestCloneElement (line 111) | func TestCloneElement(t *testing.T) {
function TestCompositeComponents (line 130) | func TestCompositeComponents(t *testing.T) {
function TestNewWithExport (line 147) | func TestNewWithExport(t *testing.T) {
function TestNewWithGlobal (line 159) | func TestNewWithGlobal(t *testing.T) {
function TestNewWithApply (line 171) | func TestNewWithApply(t *testing.T) {
function TestComponentFromGlobal (line 185) | func TestComponentFromGlobal(t *testing.T) {
function TestRequire (line 196) | func TestRequire(t *testing.T) {
function TestForceUpdate (line 209) | func TestForceUpdate(t *testing.T) {
function TestContext (line 240) | func TestContext(t *testing.T) {
function resetComponentState (line 257) | func resetComponentState() {
function newTestCustomComponent (line 262) | func newTestCustomComponent() *testCustomComponent {
type testCustomComponent (line 266) | type testCustomComponent struct
method Node (line 270) | func (c *testCustomComponent) Node() *js.Object {
type testCompositeComponent (line 274) | type testCompositeComponent struct
method Render (line 287) | func (c *testCompositeComponent) Render() gr.Component {
function newTestCompositeComponent (line 279) | func newTestCompositeComponent() *testCompositeComponent {
function createLifecycler (line 296) | func createLifecycler() *testLifecycler {
function createLifecyclerWithColor (line 300) | func createLifecyclerWithColor(color string) gr.Factory {
type testParentWithContext (line 304) | type testParentWithContext struct
method Render (line 308) | func (l *testParentWithContext) Render() gr.Component {
method GetChildContext (line 314) | func (l *testParentWithContext) GetChildContext() gr.Context {
type testChildWithContext (line 318) | type testChildWithContext struct
method Render (line 322) | func (l *testChildWithContext) Render() gr.Component {
type testLifecycler (line 329) | type testLifecycler struct
method visited (line 335) | func (l *testLifecycler) visited(m string) {
method totalVisits (line 343) | func (l *testLifecycler) totalVisits() int {
method printVisits (line 352) | func (l *testLifecycler) printVisits() {
method visitCounter (line 365) | func (l *testLifecycler) visitCounter(m string) int {
method Render (line 372) | func (l *testLifecycler) Render() gr.Component {
method GetInitialState (line 384) | func (l *testLifecycler) GetInitialState() gr.State {
method GetChildContext (line 389) | func (l *testLifecycler) GetChildContext() gr.Context {
method ShouldComponentUpdate (line 398) | func (l *testLifecycler) ShouldComponentUpdate(next gr.Cops) bool {
method ComponentWillUpdate (line 402) | func (l *testLifecycler) ComponentWillUpdate(next gr.Cops) {
method ComponentWillReceiveProps (line 405) | func (l *testLifecycler) ComponentWillReceiveProps(data gr.Cops) {
method ComponentDidUpdate (line 408) | func (l *testLifecycler) ComponentDidUpdate(prev gr.Cops) {
method ComponentWillMount (line 411) | func (l *testLifecycler) ComponentWillMount() {
method ComponentWillUnmount (line 414) | func (l *testLifecycler) ComponentWillUnmount() {
method ComponentDidMount (line 417) | func (l *testLifecycler) ComponentDidMount() {
type testTwoButtons (line 422) | type testTwoButtons struct
method Render (line 426) | func (c *testTwoButtons) Render() gr.Component {
FILE: tests/element_test.go
function TestRenderButton (line 27) | func TestRenderButton(t *testing.T) {
function TestRenderNestedSimple (line 34) | func TestRenderNestedSimple(t *testing.T) {
function TestRenderNestedComplex (line 43) | func TestRenderNestedComplex(t *testing.T) {
function TestRenderRegularTextLast (line 64) | func TestRenderRegularTextLast(t *testing.T) {
FILE: tests/event_test.go
function TestClickableButton (line 28) | func TestClickableButton(t *testing.T) {
FILE: tests/grt/test_helpers.go
function Equal (line 17) | func Equal(t *testing.T, expected, actual interface{}) {
function NotEqual (line 25) | func NotEqual(t *testing.T, v1, v2 interface{}) {
function NotNil (line 32) | func NotNil(t *testing.T, val interface{}) {
function Fail (line 42) | func Fail(t *testing.T, args ...interface{}) {
function ShallowRenderWithContext (line 47) | func ShallowRenderWithContext(c gr.Component, ctx gr.Context) *RenderedT...
function ShallowRender (line 56) | func ShallowRender(c gr.Component) *RenderedTree {
type RenderedTree (line 72) | type RenderedTree struct
method ReRender (line 61) | func (t *RenderedTree) ReRender(props gr.Props) {
method Dive (line 66) | func (t *RenderedTree) Dive(path ...string) *RenderedTree {
method CallEventListener (line 97) | func (t *RenderedTree) CallEventListener(name string, args ...interfac...
method String (line 110) | func (t *RenderedTree) String() string {
method Sub (line 116) | func (t *RenderedTree) Sub(selector string, matchers ...Matcher) *Rend...
method This (line 140) | func (t *RenderedTree) This() *gr.This {
type Matcher (line 91) | type Matcher struct
function NewMatcher (line 102) | func NewMatcher(key, value string) Matcher {
function init (line 149) | func init() {
function isNil (line 169) | func isNil(object interface{}) bool {
FILE: tests/grt/test_helpers_test.go
function TestPlaceholder (line 7) | func TestPlaceholder(t *testing.T) {
FILE: tests/modifier_test.go
function TestRenderWithAttribute (line 28) | func TestRenderWithAttribute(t *testing.T) {
function TestDiscard (line 39) | func TestDiscard(t *testing.T) {
function TestRenderWithCSS (line 51) | func TestRenderWithCSS(t *testing.T) {
function TestRenderWithStyle (line 71) | func TestRenderWithStyle(t *testing.T) {
function TestRenderWithAria (line 89) | func TestRenderWithAria(t *testing.T) {
function TestRenderWithData (line 104) | func TestRenderWithData(t *testing.T) {
function TestRenderWithProp (line 119) | func TestRenderWithProp(t *testing.T) {
FILE: tests/this_test.go
function TestPropsFunc (line 31) | func TestPropsFunc(t *testing.T) {
function TestPropsChildren (line 63) | func TestPropsChildren(t *testing.T) {
function TestBindThis (line 79) | func TestBindThis(t *testing.T) {
function TestBindThisVariations (line 88) | func TestBindThisVariations(t *testing.T) {
type thisCompEmbed (line 123) | type thisCompEmbed struct
method Render (line 127) | func (c *thisCompEmbed) Render() gr.Component {
method ID (line 136) | func (c *thisCompEmbed) ID() string {
type thisCompNamed (line 140) | type thisCompNamed struct
method Render (line 144) | func (c *thisCompNamed) Render() gr.Component {
type thisCompChildren (line 149) | type thisCompChildren struct
method Render (line 153) | func (c *thisCompChildren) Render() gr.Component {
type testClickableButtons (line 157) | type testClickableButtons struct
method Render (line 161) | func (c *testClickableButtons) Render() gr.Component {
method createClickListener (line 183) | func (c *testClickableButtons) createClickListener(increment int) gr.L...
FILE: this.go
type This (line 29) | type This struct
method SetThis (line 34) | func (t *This) SetThis(that *js.Object) {
method Props (line 46) | func (t *This) Props() Props {
method Context (line 52) | func (t *This) Context() Context {
method Component (line 57) | func (t *This) Component(name string) Modifier {
method IsMounted (line 66) | func (t *This) IsMounted() bool {
method State (line 72) | func (t *This) State() State {
method SetState (line 109) | func (t *This) SetState(s State) {
method Refs (line 115) | func (t *This) Refs() Refs {
method ForceUpdate (line 128) | func (t *This) ForceUpdate() {
method Children (line 213) | func (t *This) Children() *Children {
type ThisSetter (line 40) | type ThisSetter interface
function NewThis (line 133) | func NewThis(that *js.Object) *This {
type Context (line 138) | type Context
type Props (line 141) | type Props
method Copy (line 151) | func (p Props) Copy() Props {
method Call (line 160) | func (p Props) Call(name string, args ...interface{}) *js.Object {
method Func (line 166) | func (p Props) Func(name string) func(args ...interface{}) *js.Object {
method Interface (line 174) | func (p Props) Interface(key string) interface{} {
method Int (line 182) | func (p Props) Int(key string) int {
method Bool (line 190) | func (p Props) Bool(key string) bool {
method String (line 198) | func (p Props) String(key string) string {
method HasChanged (line 229) | func (p Props) HasChanged(nextProps Props, keys ...string) bool {
type State (line 144) | type State
method Int (line 77) | func (s State) Int(key string) int {
method Bool (line 85) | func (s State) Bool(key string) bool {
method String (line 93) | func (s State) String(key string) string {
method Interface (line 101) | func (s State) Interface(key string) interface{} {
method HasChanged (line 236) | func (s State) HasChanged(nextState State, keys ...string) bool {
method HasChangedDeeply (line 252) | func (s State) HasChangedDeeply(nextState State, keys ...string) bool {
type Refs (line 148) | type Refs
method GetDOMNode (line 120) | func (r Refs) GetDOMNode(key string) *js.Object {
type Children (line 208) | type Children struct
method Element (line 224) | func (c *Children) Element() *Element {
function hasChanged (line 240) | func hasChanged(m1, m2 map[string]interface{}, keys ...string) bool {
Condensed preview — 64 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (9,888K chars).
[
{
"path": ".gitignore",
"chars": 300,
"preview": "# Compiled Object files, Static and Dynamic libs (Shared Objects)\n*.o\n*.a\n*.so\n\n# Folders\n_obj\n_test\n\n# Architecture spe"
},
{
"path": ".travis.yml",
"chars": 782,
"preview": "sudo: false\nlanguage: go\n\nenv:\n - SOURCE_MAP_SUPPORT=false TRAVIS_NODE_VERSION=\"5.1\" CXX=\"g++-4.8\"\n\ngo:\n - 1.8\n \ninst"
},
{
"path": "LICENSE.md",
"chars": 10412,
"preview": "Apache License\n==============\n\n_Version 2.0, January 2004_\n_<<http://www.apache.org/licenses/>>_\n\n### Terms and Co"
},
{
"path": "Makefile",
"chars": 714,
"preview": "DIRS=$(shell go list -f {{.Dir}} ./...)\n\ncheck: fmt vet lint test\n\ncyclo:\n\t@for d in $(DIRS) ; do \\\n\t\tif [ \"`gocyclo -ov"
},
{
"path": "README.md",
"chars": 2489,
"preview": "# Go React\n\n[](https://travis-ci.org/bep/gr)\n[\n**/ajax/ajax\n**/basic/basic\n**/basic-click-co"
},
{
"path": "examples/ajax/ajax.js",
"chars": 4294171,
"preview": "\"use strict\";\n(function() {\n\nError.stackTraceLimit=Infinity;var $global,$module;if(typeof window!==\"undefined\"){$global="
},
{
"path": "examples/ajax/index.html",
"chars": 471,
"preview": "<!doctype html>\n<html lang=\"en\" data-framework=\"gopherjs\">\n\n<head>\n <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn"
},
{
"path": "examples/ajax/main.go",
"chars": 2926,
"preview": "package main\n\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\n\t\"github.com/bep/gr\"\n\t\"github.com/bep/gr/attr\"\n\t\"github.com/bep/gr/"
},
{
"path": "examples/basic/basic.js",
"chars": 638514,
"preview": "\"use strict\";\n(function() {\n\nError.stackTraceLimit=Infinity;var $global,$module;if(typeof window!==\"undefined\"){$global="
},
{
"path": "examples/basic/index.html",
"chars": 471,
"preview": "<!doctype html>\n<html lang=\"en\" data-framework=\"gopherjs\">\n\t<head>\n\t\t<link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn."
},
{
"path": "examples/basic/main.go",
"chars": 963,
"preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/bep/gr\"\n\t\"github.com/bep/gr/el\"\n\t\"github.com/bep/gr/examples\"\n)\n\n// "
},
{
"path": "examples/basic-click-counter/basic-click-counter.js",
"chars": 639775,
"preview": "\"use strict\";\n(function() {\n\nError.stackTraceLimit=Infinity;var $global,$module;if(typeof window!==\"undefined\"){$global="
},
{
"path": "examples/basic-click-counter/index.html",
"chars": 482,
"preview": "<!doctype html>\n<html lang=\"en\" data-framework=\"gopherjs\">\n\t<head>\n\t\t<link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn."
},
{
"path": "examples/basic-click-counter/main.go",
"chars": 1239,
"preview": "package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/bep/gr\"\n\t\"github.com/bep/gr/el\"\n\t\"github.com/bep/gr/evt\"\n\t\"github.com/bep/gr"
},
{
"path": "examples/build.sh",
"chars": 314,
"preview": "#!/usr/bin/env bash\n\nfor D in `find . -type d -not -path '*/\\.*'`\ndo\n pushd $D\n\tgopherjs build -m\n\tpopd\ndone\n\npushd i"
},
{
"path": "examples/composition/composition.js",
"chars": 642677,
"preview": "\"use strict\";\n(function() {\n\nError.stackTraceLimit=Infinity;var $global,$module;if(typeof window!==\"undefined\"){$global="
},
{
"path": "examples/composition/index.html",
"chars": 474,
"preview": "<!doctype html>\n<html lang=\"en\" data-framework=\"gopherjs\">\n\t<head>\n\t\t<link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn."
},
{
"path": "examples/composition/main.go",
"chars": 1148,
"preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/bep/gr\"\n\t\"github.com/bep/gr/el\"\n\t\"github.com/bep/gr/examples\"\n)\n\n// "
},
{
"path": "examples/debounce/debounce.js",
"chars": 644371,
"preview": "\"use strict\";\n(function() {\n\nError.stackTraceLimit=Infinity;var $global,$module;if(typeof window!==\"undefined\"){$global="
},
{
"path": "examples/debounce/index.html",
"chars": 471,
"preview": "<!doctype html>\n<html lang=\"en\" data-framework=\"gopherjs\">\n\t<head>\n\t\t<link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn."
},
{
"path": "examples/debounce/main.go",
"chars": 1997,
"preview": "package main\n\nimport (\n\t\"time\"\n\n\t\"fmt\"\n\n\t\"github.com/bep/debounce\"\n\t\"github.com/bep/gr\"\n\t\"github.com/bep/gr/attr\"\n\t\"gith"
},
{
"path": "examples/helpers.go",
"chars": 3000,
"preview": "package examples\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/bep/gr\"\n\t\"github.com/bep/gr/attr\"\n\t\"github.com/bep/gr/el\"\n\t\"g"
},
{
"path": "examples/interop/index.html",
"chars": 758,
"preview": "<!doctype html>\n<html lang=\"en\" data-framework=\"gopherjs\">\n\t<head>\n\t\t<link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn."
},
{
"path": "examples/interop/interop-ext-global.js",
"chars": 384,
"preview": "\nvar ElapserExtGlobal = React.createClass({\n render: function () {\n var message =\n 'Global JavaScri"
},
{
"path": "examples/interop/interop-ext-module-bundle.js",
"chars": 900,
"preview": "require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return"
},
{
"path": "examples/interop/interop-ext-module.js",
"chars": 378,
"preview": " module.exports = React.createClass({\n render: function () {\n var message =\n 'Module JavaScript tim"
},
{
"path": "examples/interop/interop-ext-reverse-bundle.js",
"chars": 644274,
"preview": "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0)"
},
{
"path": "examples/interop/interop-ext-reverse.js",
"chars": 1103,
"preview": "\n// This is the one exported component from the Go side.\nvar Elapser = require('./interop').Elapser;\n\nvar start = new Da"
},
{
"path": "examples/interop/interop.js",
"chars": 642495,
"preview": "\"use strict\";\n(function() {\n\nError.stackTraceLimit=Infinity;var $global,$module;if(typeof window!==\"undefined\"){$global="
},
{
"path": "examples/interop/main.go",
"chars": 1507,
"preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/bep/gr\"\n\t\"github.com/bep/gr/el\"\n\t\"github.com/bep/gr/examples\"\n)\n\nvar"
},
{
"path": "examples/lifecycle/index.html",
"chars": 472,
"preview": "<!doctype html>\n<html lang=\"en\" data-framework=\"gopherjs\">\n\t<head>\n\t\t<link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn."
},
{
"path": "examples/lifecycle/lifecycle.js",
"chars": 664533,
"preview": "\"use strict\";\n(function() {\n\nError.stackTraceLimit=Infinity;var $global,$module;if(typeof window!==\"undefined\"){$global="
},
{
"path": "examples/lifecycle/main.go",
"chars": 2438,
"preview": "package main\n\nimport (\n\t\"time\"\n\n\t\"log\"\n\n\t\"github.com/bep/gr\"\n\t\"github.com/bep/gr/el\"\n\t\"github.com/bep/gr/examples\"\n)\n\n//"
},
{
"path": "examples/router/index.html",
"chars": 562,
"preview": "<!doctype html>\n<html lang=\"en\" data-framework=\"gopherjs\">\n\t<head>\n\t\t<link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn."
},
{
"path": "examples/router/main.go",
"chars": 2716,
"preview": "package main\n\nimport (\n\t\"fmt\"\n\n\t\"strings\"\n\n\t\"github.com/bep/gr\"\n\t\"github.com/bep/gr/attr\"\n\t\"github.com/bep/gr/el\"\n\t\"gith"
},
{
"path": "examples/router/router.js",
"chars": 694048,
"preview": "\"use strict\";\n(function() {\n\nError.stackTraceLimit=Infinity;var $global,$module;if(typeof window!==\"undefined\"){$global="
},
{
"path": "helpers.go",
"chars": 3131,
"preview": "/*\nCopyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.\n\nLicensed under the Apache Li"
},
{
"path": "lifecycle.go",
"chars": 3684,
"preview": "/*\nCopyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.\n\nLicensed under the Apache Li"
},
{
"path": "modifiers.go",
"chars": 3448,
"preview": "/*\nCopyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.\n\nLicensed under the Apache Li"
},
{
"path": "package.json",
"chars": 838,
"preview": "{\n \"name\": \"gr\",\n \"version\": \"0.0.1\",\n \"description\": \"Facebook React bindings for Go\",\n \"main\": \"index.js\",\n \"dire"
},
{
"path": "render.go",
"chars": 1385,
"preview": "/*\nCopyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.\n\nLicensed under the Apache Li"
},
{
"path": "support/support.go",
"chars": 1367,
"preview": "/*\nCopyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.\n\nLicensed under the Apache Li"
},
{
"path": "tests/component_test.go",
"chars": 10623,
"preview": "/*\nCopyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.\n\nLicensed under the Apache Li"
},
{
"path": "tests/component_tests.inc.js",
"chars": 151,
"preview": "\nglobal.Hello = React.createClass({\n render: function () {\n\t\tvar message = this.props.message\n return React.DO"
},
{
"path": "tests/doc.go",
"chars": 667,
"preview": "/*\nCopyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.\n\nLicensed under the Apache Li"
},
{
"path": "tests/element_test.go",
"chars": 1782,
"preview": "/*\nCopyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.\n\nLicensed under the Apache Li"
},
{
"path": "tests/event_test.go",
"chars": 1268,
"preview": "/*\nCopyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.\n\nLicensed under the Apache Li"
},
{
"path": "tests/grt/test_helpers.go",
"chars": 4871,
"preview": "// Package grt contains utilities used to test React components.\n// TODO(bep)\n// Move this to its own repo maybe when it"
},
{
"path": "tests/grt/test_helpers.inc.js",
"chars": 133,
"preview": "global.React = require('react');\nglobal.ReactElementToString = require('react-element-to-string')\nglobal.sd = require('s"
},
{
"path": "tests/grt/test_helpers_test.go",
"chars": 75,
"preview": "package grt\n\nimport (\n\t\"testing\"\n)\n\nfunc TestPlaceholder(t *testing.T) {\n}\n"
},
{
"path": "tests/modifier_test.go",
"chars": 3449,
"preview": "/*\nCopyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.\n\nLicensed under the Apache Li"
},
{
"path": "tests/this_test.go",
"chars": 4293,
"preview": "/*\nCopyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.\n\nLicensed under the Apache Li"
},
{
"path": "this.go",
"chars": 7137,
"preview": "/*\nCopyright 2016 Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> All rights reserved.\n\nLicensed under the Apache Li"
}
]
About this extraction
This page contains the full source code of the bep/gr GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 64 files (9.3 MB), approximately 2.4M tokens, and a symbol index with 726 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.