mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
jso: add Popover API Wrappers (#934)
This commit is contained in:
parent
92666e8cf0
commit
98cd2efc0f
|
@ -16,8 +16,9 @@
|
|||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.popover.PopoverInvokerElement;
|
||||
|
||||
public abstract class HTMLButtonElement extends HTMLElement {
|
||||
public abstract class HTMLButtonElement extends HTMLElement implements PopoverInvokerElement {
|
||||
public static final String TYPE_BUTTON = "button";
|
||||
|
||||
public static final String TYPE_RESET = "reset";
|
||||
|
|
|
@ -29,9 +29,10 @@ import org.teavm.jso.dom.types.DOMTokenList;
|
|||
import org.teavm.jso.dom.xml.Element;
|
||||
import org.teavm.jso.dom.xml.Node;
|
||||
import org.teavm.jso.dom.xml.NodeList;
|
||||
import org.teavm.jso.popover.ToggleEventTarget;
|
||||
|
||||
public abstract class HTMLElement implements Element, ElementCSSInlineStyle, EventTarget, FocusEventTarget,
|
||||
MouseEventTarget, WheelEventTarget, KeyboardEventTarget, LoadEventTarget, TouchEventTarget {
|
||||
MouseEventTarget, WheelEventTarget, KeyboardEventTarget, LoadEventTarget, TouchEventTarget, ToggleEventTarget {
|
||||
@Override
|
||||
public abstract NodeList<? extends HTMLElement> getElementsByTagName(String name);
|
||||
|
||||
|
@ -158,6 +159,20 @@ public abstract class HTMLElement implements Element, ElementCSSInlineStyle, Eve
|
|||
@JSProperty
|
||||
public abstract DOMTokenList getClassList();
|
||||
|
||||
@JSProperty
|
||||
public abstract String getPopover();
|
||||
|
||||
@JSProperty
|
||||
public abstract void setPopover(String popover);
|
||||
|
||||
public abstract void hidePopover();
|
||||
|
||||
public abstract void showPopover();
|
||||
|
||||
public abstract boolean togglePopover();
|
||||
|
||||
public abstract boolean togglePopover(boolean force);
|
||||
|
||||
public final HTMLElement withAttr(String name, String value) {
|
||||
setAttribute(name, value);
|
||||
return this;
|
||||
|
|
|
@ -17,8 +17,9 @@ package org.teavm.jso.dom.html;
|
|||
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.file.FileList;
|
||||
import org.teavm.jso.popover.PopoverInvokerElement;
|
||||
|
||||
public abstract class HTMLInputElement extends HTMLElement {
|
||||
public abstract class HTMLInputElement extends HTMLElement implements PopoverInvokerElement {
|
||||
@JSProperty
|
||||
public abstract boolean isChecked();
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 2024 lasse-cs.
|
||||
*
|
||||
* 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 org.teavm.jso.popover;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.dom.html.HTMLElement;
|
||||
|
||||
public interface PopoverInvokerElement {
|
||||
|
||||
String HIDE = "hide";
|
||||
|
||||
String SHOW = "show";
|
||||
|
||||
String TOGGLE = "toggle";
|
||||
|
||||
@JSProperty
|
||||
String getPopoverTargetAction();
|
||||
|
||||
@JSProperty
|
||||
void setPopoverTargetAction(String action);
|
||||
|
||||
@JSProperty
|
||||
HTMLElement getPopoverTargetElement();
|
||||
|
||||
@JSProperty
|
||||
void setPopoverTargetElement(HTMLElement popoverTarget);
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright 2024 lasse-cs.
|
||||
*
|
||||
* 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 org.teavm.jso.popover;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.dom.events.Event;
|
||||
|
||||
public interface ToggleEvent extends Event {
|
||||
|
||||
String OPEN = "open";
|
||||
String CLOSED = "closed";
|
||||
|
||||
@JSProperty
|
||||
String getOldState();
|
||||
|
||||
@JSProperty
|
||||
String getNewState();
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright 2024 lasse-cs.
|
||||
*
|
||||
* 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 org.teavm.jso.popover;
|
||||
|
||||
import org.teavm.jso.dom.events.EventListener;
|
||||
import org.teavm.jso.dom.events.EventTarget;
|
||||
import org.teavm.jso.dom.events.Registration;
|
||||
|
||||
public interface ToggleEventTarget extends EventTarget {
|
||||
|
||||
default Registration onBeforeToggle(EventListener<ToggleEvent> listener) {
|
||||
return onEvent("beforetoggle", listener);
|
||||
}
|
||||
|
||||
default Registration onToggle(EventListener<ToggleEvent> listener) {
|
||||
return onEvent("toggle", listener);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user