Support
Support Status
Short version: ApricityUI tries to move toward the Web, but it is not a browser.
The best mental model is not "if a webpage can do it, ApricityUI can too", but "ApricityUI supports a practical subset that keeps becoming more Web-like".
If you write against full browser expectations, you will probably hit rough edges.
Remember This First
The default layout model is not browser document flow. It is closer to flex, and it is generally safer to think in terms of a vertical main axis by default.
So if you are used to dropping a div into a browser page and letting it stack naturally, do not rely on that here. Write layout intentionally.
Registered Tags
These are the most commonly used tags:
bodydivspanpreimgainputtextareaselectoptionsprite
Minecraft-specific tags:
containerslotrecipetranslation
There is also a group of tags that do not have browser-level built-in logic, but global.css already provides reasonable default styles for them:
ph1toh6smallbstrongiemmarksubsupcodekbdhrblockquote
CSS Selectors
These common selectors are practically supported:
- Tag selectors
.class#id[attr][attr=value]:first-child:last-child:nth-child():hover:active:focus:empty:checked- Descendant selector via space
- Child selector
> - Multiple selectors
,
That is enough for most regular interfaces.
CSS Properties
Common layout properties are already usable:
.panel {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 180px;
height: 96px;
padding: 8px;
margin: 4px;
position: relative;
top: 4px;
left: 4px;
}
Common and relatively reliable groups include:
- Layout:
displayflex-*grid-template-*grid-rowgrid-column - Size:
widthheightmin/max-* - Box model:
margin*padding*border*border-radiusborder-image - Positioning:
positiontoprightbottomleftz-index - Background:
background-* - Text:
colorfont-sizefont-familyfont-weightfont-styleline-heighttext-stroke - Visual:
opacitybox-shadowtransformclip-pathfilterbackdrop-filter - Interaction:
cursorpointer-eventsvisibilityuser-select - Animation:
transitionanimation@keyframes - Fonts:
@font-face - Variables:
--*
If you use an unsupported property, the usual outcome is not an error. It simply does nothing.
So when debugging styles, do not assume the property is implemented just because the syntax is correct.
What global.css Gives You
The built-in global.css already provides some foundation:
- Basic styling for common text tags such as
p,h1-h6,blockquote,code,kbd, andpre - Basic styling for form tags such as
inputandselect - Default structural styling for
container,slot, andrecipe - A set of slot-related CSS variables
So you are not starting from a blank sheet, but you also should not treat it like a full browser UA stylesheet.
Slot-Related Variables
These variables are useful in slot and container scenarios:
--aui-slot-size--aui-slot-render-bg--aui-slot-render-item--aui-slot-icon-scale--aui-slot-padding--aui-slot-z--aui-slot-interactive--aui-slot-cycle--aui-slot-cycle-interval--aui-container-columns
If you are building container UI, these are worth memorizing.
How Far JS Support Goes
Without KubeJS, HTML and CSS still work, but scripting and devtools are significantly reduced.
With KubeJS installed, the commonly useful interfaces include:
let title = document.querySelector(".title")
let items = document.querySelectorAll("slot")
let badge = document.createElement("div")
badge.innerText = "Hello"
badge.setAttribute("class", "badge")
document.body.append(badge)
badge.addEventListener("mousedown", e => {
badge.setAttribute("data-state", "active")
})
window.setTimeout(() => {
badge.remove()
}, 1000)
Reliable interfaces include:
document.querySelector()document.querySelectorAll()document.createElement()element.append()element.prepend()element.remove()element.getAttribute()element.setAttribute()element.removeAttribute()element.innerTextelement.valueaddEventListener()window.setTimeout()window.setInterval()window.localStorage
Do not treat it like a complete browser:
- Do not expect a full BOM
- Do not expect
fetch - Do not expect many modern Web APIs
There are also in-world window interfaces on the client KJS side:
ApricityUI.createInWorldDocument()ApricityUI.createWorldWindow()ApricityUI.createFollowFacingWorldWindow()ApricityUI.removeWorldWindow()ApricityUI.clearWorldWindows()
These are very convenient for client-side visualization scripts.
Unified Java Entry Points
If you are developing a mod and do not want to remember separate APIs for Document, networking, and WorldWindow, you can now mostly go through ApricityUI directly.
Common ones include:
ApricityUI.createDocument()ApricityUI.createInWorldDocument()ApricityUI.removeDocument()ApricityUI.openScreen()ApricityUI.closeScreen()ApricityUI.bind()ApricityUI.createWorldWindow()ApricityUI.createFollowFacingWorldWindow()ApricityUI.removeWorldWindow()ApricityUI.clearWorldWindows()
That helps keep the JS-side and Java-side documentation aligned.
Current Semantics Of A Few Special Tags
Only the essentials here. For full details, see the dedicated sections.
slotis unified into one tag. Inside containers it defaults tobound, outside containers it defaults tovirtual.- Virtual items should now come from
innerText; old attribute-based forms are no longer recommended. recipenow uses<recipe type="..."></recipe>, with the recipe id read frominnerText, notrecipe-id.translationusesinnerTextas the translation key.spriteuses thesrc + steps + duration + directionstyle of parameters. Do not force old image-slicing workflows into it.
Common Interfaces For Most Interactions
Element
let panel = document.createElement("div")
panel.setAttribute("class", "panel")
panel.innerText = "example"
document.body.append(panel)
panel.prepend(document.createElement("span"))
let cls = panel.getAttribute("class")
panel.removeAttribute("class")
panel.remove()
Document
let el = document.querySelector(".panel")
let all = document.querySelectorAll("div")
let node = document.createElement("span")
document.body.append(node)
Window
window.localStorage.localStorage.putString("theme", "dark")
window.setTimeout(() => {
// later
}, 500)
window.setInterval(() => {
// repeat
}, 1000)