feat(ui): ludic.ui grows toward HTML, CSS and React (Phase 0.U1-U4)
- Natives: ui_native(tag, measure, draw) makes an element the program draws itself; ui_fire runs its on-<event> with event.value. input, select and textarea have simple defaults. - React: - keyed <each>, <let>, <provide> context through components, <fragment>; - named slots, default props on <component>; - on-mount / on-unmount; - inline text inside text elements. - CSS: - custom properties and var(); - position relative/absolute/fixed with insets and z-index; - em/rem/vw/vh and @media; - wrapping text and ellipsis, overflow; - + and ~ combinators, :nth-child(an+b), :checked, :active. - Developing: errors with file:line, ui_errors(), ui_reload() keeping state, and an inspector-style ui_dump. - view fields infer the type of a literal or a named function's result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
66a2bc2214
commit
637d07400e
39 changed files with 42012 additions and 40795 deletions
|
|
@ -11,6 +11,8 @@ export property UiFile {
|
|||
imp: []UiFile = null
|
||||
own: []UiRule = null
|
||||
sheet: UiSheet = null
|
||||
src: string = "" # the text it was read from
|
||||
disk: bool = false # read from a file (ui_reload looks again), or handed over as text
|
||||
}
|
||||
var lib_files: []UiFile = new []UiFile
|
||||
var lib_screen_names: []string = new []string
|
||||
|
|
@ -26,8 +28,10 @@ function lib_file(path: string) -> UiFile {
|
|||
ui_err(`{path}: cannot read it`)
|
||||
return null
|
||||
}
|
||||
if lss_is(path) { return lss_file(src, path) }
|
||||
return lib_read(src, path)
|
||||
var f: UiFile = null
|
||||
if lss_is(path) { f = lss_file(src, path) } else { f = lib_read(src, path) }
|
||||
f.disk = true
|
||||
return f
|
||||
}
|
||||
# a file's text, as if read from `path` (its imports are found beside it)
|
||||
export function ui_load_text(src: string, path: string) -> void {
|
||||
|
|
@ -35,6 +39,8 @@ export function ui_load_text(src: string, path: string) -> void {
|
|||
}
|
||||
function lib_read(src: string, path: string) -> UiFile {
|
||||
let f = lib_new(path)
|
||||
f.src = src
|
||||
tp_lines(src)
|
||||
let root = tpl_read(Xml.parse(src), path)
|
||||
var tops = root.kids
|
||||
if root.tag != "ui" { tops = [root] }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue