-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hack Ginevra: Support <source> and <video>
- Loading branch information
Showing
7 changed files
with
194 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
package dev.nipafx.ginevra.html; | ||
|
||
record Source(String path) implements Src { } | ||
public record Source(Src src, String type) implements HtmlElement { | ||
|
||
public Source() { | ||
this(Src.none(), null); | ||
} | ||
|
||
public Source src(Src src) { | ||
return new Source(src, this.type); | ||
} | ||
|
||
public Source type(String type) { | ||
return new Source(this.src, type); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
ginevra/src/main/java/dev/nipafx/ginevra/html/Video.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
package dev.nipafx.ginevra.html; | ||
|
||
import java.util.List; | ||
|
||
public record Video( | ||
Id id, Classes classes, Src src, Integer height, Integer width, Src poster, Preload preload, | ||
Boolean autoplay, Boolean loop, Boolean muted, Boolean playinline, | ||
Boolean controls, Boolean disablepictureinpicture, Boolean disableremoteplayback, | ||
List<? extends Element> children) implements HtmlElement { | ||
|
||
public Video() { | ||
this( | ||
Id.none(), Classes.none(), Src.none(), null, null, null, null, | ||
null, null, null, null, null, null, null, List.of()); | ||
} | ||
|
||
public Video id(Id id) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video classes(Classes classes) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video src(Src src) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video height(Integer height) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video width(Integer width) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video poster(Src poster) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video preload(Preload preload) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video autoplay(Boolean autoplay) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video loop(Boolean loop) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video muted(Boolean muted) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video playinline(Boolean playinline) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video controls(Boolean controls) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video disablepictureinpicture(Boolean disablepictureinpicture) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video disableremoteplayback(Boolean disableremoteplayback) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video children(List<? extends Element> children) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, children); | ||
} | ||
|
||
public Video children(Element... children) { | ||
return new Video( | ||
id, classes, src, height, width, poster, preload, | ||
autoplay, loop, muted, playinline, controls, disablepictureinpicture, disableremoteplayback, List.of(children)); | ||
} | ||
|
||
public enum Preload { | ||
NONE, METADATA, AUTO; | ||
|
||
@Override | ||
public String toString() { | ||
return switch (this) { | ||
case NONE -> "none"; | ||
case METADATA -> "metadata"; | ||
case AUTO -> "auto"; | ||
}; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters