test(ui): a component with no stylesheet reads the theme's :root variables
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
077b38e684
commit
ae61e99e06
10 changed files with 36 additions and 1 deletions
15
examples/library/ui_theme.ludic
Normal file
15
examples/library/ui_theme.ludic
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# ui_theme.ludic — a component with no stylesheet of its own still reads the theme's :root variables,
|
||||
# inherited from the screen that uses it, in its style="..." declarations.
|
||||
import "ludic.ui"
|
||||
import "ui_theme_parts/Bare.ludic"
|
||||
import "ui_theme_parts/Shell.ludic"
|
||||
program UiTheme {
|
||||
numbers float
|
||||
entry {
|
||||
ui_backend(new UiBackend)
|
||||
let root: UiNode = ui_nodes("Shell", null)
|
||||
ui_place(root, 0.0, 0.0, 400.0, 400.0)
|
||||
let bare = root.children[0].children[0]
|
||||
print(`accent {ui_hex(bare.children[0].fg)} gap {int(bare.gap)}`)
|
||||
}
|
||||
}
|
||||
3
examples/library/ui_theme_parts/Bare.ludic
Normal file
3
examples/library/ui_theme_parts/Bare.ludic
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Bare.ludic - a component with no stylesheet: it reads the theme's variables from where it is used
|
||||
component Bare {
|
||||
}
|
||||
4
examples/library/ui_theme_parts/Bare.xml
Normal file
4
examples/library/ui_theme_parts/Bare.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<div style="gap: var(--gap)">
|
||||
<p style="color: var(--accent)">hot</p>
|
||||
<p>plain</p>
|
||||
</div>
|
||||
2
examples/library/ui_theme_parts/Shell.lss
Normal file
2
examples/library/ui_theme_parts/Shell.lss
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
@import "theme.lss";
|
||||
.shell { width: 300px }
|
||||
3
examples/library/ui_theme_parts/Shell.ludic
Normal file
3
examples/library/ui_theme_parts/Shell.ludic
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Shell.ludic - a screen whose sheet imports the theme, around a component with no sheet of its own
|
||||
component Shell {
|
||||
}
|
||||
3
examples/library/ui_theme_parts/Shell.xml
Normal file
3
examples/library/ui_theme_parts/Shell.xml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<div class="shell">
|
||||
<Bare/>
|
||||
</div>
|
||||
1
examples/library/ui_theme_parts/theme.lss
Normal file
1
examples/library/ui_theme_parts/theme.lss
Normal file
|
|
@ -0,0 +1 @@
|
|||
:root { --accent: #ff0000; --gap: 7px }
|
||||
Loading…
Add table
Add a link
Reference in a new issue