119 Commits
Author SHA1 Message Date
Liu 5b18848ef9 fix(ui): size flex lines by content in fixed-size containers
- subtract the line content height, not the container text sizehint, when
  distributing cross-axis free space
- center icons correctly in text-based flex containers such as empty-media
- pin the empty-media icon to a 16px box
2026-11-22 20:11:23 +08:00
Liu 747a222fcc feat(styles): follow the accent in focus rings and app fills
- generate focus box-shadow overrides from the accent primary color
- add the fill-primary class for app-level primary fills
- use it for the doc-viewer payout progress bar
2026-11-22 20:11:20 +08:00
Liu dc0ab38546 feat(styles): add switchable accent color themes
- generate an override stylesheet for each preset from style-nova
- add the ui_theme_* API, custom colors and single-slot loading
- persist the choice and add the navbar color picker
- keep badge variants, tooltip arrows and swatches consistent
2026-11-21 23:26:31 +08:00
Liu 64ea750885 feat(css): allow unloading style rules by source
- track rules by the source name passed to the loader
- add css_remove_style_rules() and ui_unload_css_string()
- refresh computed styles after removal and cover it with a test
2026-11-21 22:23:12 +08:00
Liu 7449e6fb4a feat(pandagl): add quiet font loading for optional fonts
pd_font_try_load_file() reports failures at debug level so platform probes, test candidates and CSS @font-face no longer spam errors for missing system fonts. pd_font_load_file() and XML font resources still report errors, and initialization warns once when no usable default font exists.
2026-11-19 23:37:21 +08:00
Liu 464eed1402 build: centralize package versions and standardize on C11
versions.json is now the single source of truth; scripts/sync-versions.mjs keeps xmake descriptors, tracked version headers and package.json in sync. Sub-library versions are aligned with the published 1.0.0 packages. C11 is set at the project level, and _GNU_SOURCE is defined on POSIX so strict C11 still exposes clock_gettime, strdup and recursive pthread mutexes.
2026-11-19 22:03:59 +08:00
Liu 0e0bf7b179 fix(ui): image listener removal should free list nodes
list_unlink() leaves the node allocated. Use list_delete_node() when removing listeners, and destroy listener nodes when the image source is destroyed.
2026-11-19 22:03:59 +08:00
Liu ac011085ec fix(ui): event initialization should clear uninitialized mouse data
Synthetic click events only set target/type/data, leaving mouse coordinates uninitialized. Zero the event before assigning fields so hit testing does not read undefined values.
2026-11-19 22:03:59 +08:00
Liu ee6fc1956d fix(ui): debug log should not keep an unused style pointer
cs is only read by UI_DEBUG_MSG, and debug logging compiles the message away in release builds. Reference child->computed_style directly in the log arguments so GCC does not warn about an unused local.
2026-11-19 01:19:58 +08:00
Liu 18b74cc9f1 fix(ui): make fit-content width and tooltip reveal deterministic
Initialize the fit-content width during CSS cascade instead of leaving a
stack-garbage value, and apply tooltip visibility in the reveal frame so the
behavior no longer depends on an extra layout pass.
2026-11-16 00:03:50 +08:00
Liu 86662849bd fix(ui): serialize image loading and start the loader after init
lcui_ui_init created the loader thread before ui_init() had created the image cache, list and mutex, so the thread could enter ui_load_images with uninitialized state (libpng reader crash in the background-style suite). Start the thread after ui_init and guard all image loader entry points with a mutex shared by the loader and UI threads.
2026-11-16 00:03:50 +08:00
Liu 6f3348cb07 fix(ui): refresh canvas box when overflow styles change
Box shadow and text decoration overflow grow the canvas box without changing the layout size, so ui_widget_update_box_size was skipped and the canvas box stayed stale. Recompute it after every style update.
2026-11-16 00:03:50 +08:00
Liu 093a6a1e35 feat: add explicit window lifecycle and per-window event routing
- add the window API and lifecycle design specs
- lcui_init no longer creates a window; settings loading is explicit
- add lcui_window_* create/bind/geometry/state/show/close api
- replace display modes with window options and quit-on-last-window
- add per-window event scopes and window-based pointer/keyboard routing
- keep pending updates for widgets appended during a frame
- migrate examples, tests, previews and internals docs
- remove default-scope focus and mouseover getters
2026-11-16 00:03:50 +08:00
Liu 855855263b feat(css): add align-self support for flex items
- register align-self and resolve auto against the container align-items
- apply per-item alignment to measuring, cross-axis layout and static positions
- align item media icons with the first title line
2026-11-14 00:31:15 +08:00
Liu cbf051e061 fix(ui): refresh status styles only for matched selectors
- skip style refreshes when no :hover/:active/:focus selector matches
- detect self and descendant status selectors separately before refresh
- preserve API text content across CSS content overrides and restore it on exit
- cover unmatched, matched and text-content status changes in integration tests
2026-11-13 22:18:29 +08:00
Liu 1f46778893 fix(ui): stabilize layout measurement and style refresh
- restore intrinsic sizes before measuring flex and block children
- resolve percentage widths against indefinite parents as auto
- reflow parents when child content changes and refresh background geometry
- ignore hidden flex items in gap insertion and use spec static positions
- keep text paint size in sync with the current capture scale
2026-11-13 21:56:39 +08:00
Liu a23c16f5c5 feat(widgets): add input group widget 2026-11-08 00:20:36 +08:00
Liu 20b3221cfd fix(ui): stabilize flex layout and add layout contract tests
- merge own sizehint with child layout extent; keep sizehint callable
- support cross-axis auto margins and flex-basis content/percentage
- fix space-evenly gap, canvas destroy, breadcrumb intrinsic width and dynamic text intrinsic refresh
- add flex contract, sizehint, empty layout and field layout suites
- move empty/field scenarios to theme-independent test fixtures
- document layout coverage and known gaps
2026-11-08 00:20:31 +08:00
Liu 22c883b79e fix(ui): wrap and stabilize flex column text layout
Persist parent width constraint (source + generation) and wrap text at it; six-pass flex layout with <=1 reflow per child; fit-content clamp for centered auto-width children; re-derive centered column cross width from constraint on standalone reflow; fixed-cross flex containers ignore child size hint. Record row main-axis allocation as a persisted constraint so a flex:1 child keeps its width across standalone reflow. Measure/layout phase split, measurement cache invalidation test, and sizehint capability flag so zero-size results are not mistaken for missing sizehints. Add layout engine rules doc and integration tests (wrap, empty, empty-basic, field-checkbox remount, empty media icon).
2026-11-08 00:20:27 +08:00
Liu 47014c5dbb feat(widgets): add popover widget 2026-10-28 23:40:31 +08:00
Liu f760db2176 fix(ui): ui_widget_render should re-anchor offscreen captures in logical units 2026-10-18 15:42:22 +08:00
Liu 7154337944 feat(widgets): add button variants, sizes and themed styles with docs 2026-10-17 21:16:51 +08:00
Liu 708611a727 feat(ui-server): sync system cursor with hovered widget style
Expose ui_get_mouseover() and, at the end of ui_server_update(), resolve
the first non-auto cursor up the hover ancestor chain (emulating CSS
inheritance), then apply it to the owning window. Runs after style
recomputation so :hover and dynamic changes take effect in the same
frame; resets to auto when the hovered widget is destroyed.
2026-10-17 21:16:47 +08:00
Liu 251bf2fa54 feat(ui): propagate inherited CSS values to dependent children 2026-10-17 21:16:45 +08:00
Liu 916aac4850 feat(ui): render text underlines with offset and thickness control 2026-10-17 21:16:42 +08:00
Liu 53ef6ac477 fix(ui): destroy temporary string style values 2026-10-17 21:16:39 +08:00
Liu 4801465d93 fix(ui): calculate widget offsets without duplicate padding 2026-10-17 21:16:37 +08:00
Liu d7c5e848a6 refactor(ui): clarify event listener context parameters 2026-10-17 21:16:37 +08:00
Liu 8cb5bd7c32 fix(ui): percentage flex items should wrap within intrinsic size 2026-10-17 21:16:36 +08:00
Liu 3c6a592e98 fix(ui): incorporate children intrinsic width into cross size calculation 2026-10-17 21:16:35 +08:00
Liu b5e6bbf1c3 test(ui): add choice card reflow stability test and document event handler signature 2026-10-17 21:16:35 +08:00
Liu 3801fdc10f refactor(yutil): rename public APIs and migrate timer to ptk
- charset module renamed to encoding (decode/encode kept)
- time: get_time_ms → y_gettime, sleep_ms → y_sleep
- time: delete get_time_us, get_time_delta, sleep_s
- string: strdup2 → y_strdup, wcsdup2 → y_wcsdup
- string: strtolower → y_strlower, strtrim → y_strtrim
- string: wcstrim → y_wcstrim, strhash → y_strhash
- string: strreplace → y_strreplace, strsplit → y_strsplit
- string: delete wcsreplace, cmdsplit
- math: delete y_iround, y_pow2
- timer module migrated from yutil to ptk as internal timer_scheduler
- WinMain simplified to use __argc/__argv instead of cmdsplit

BREAKING CHANGE: all renamed yutil public APIs require downstream
  to update function names. Deleted APIs require code changes:
  - get_time_us: use y_gettime() for ms timestamps
  - get_time_delta: use y_gettime() - start instead
  - sleep_s: use y_sleep(ms) with millisecond argument
  - wcsreplace: no replacement, had zero callers
  - cmdsplit: WinMain now uses __argc/__argv from CRT
  - timer_list_*: migrated to ptk timer_scheduler_*;
    ptk_reset_timer still available for external use
2026-08-05 22:42:26 +08:00
Liu 6cd01b468e chore: update copyright comment 2026-08-05 22:42:22 +08:00
Liu 7f9f52b904 chore: update copyright and email 2026-08-05 22:42:16 +08:00
Liu f54cd12539 feat(css): add gap, row-gap and column-gap support
Add the CSS gap shorthand and its row-gap/column-gap longhands for flex
containers.

- Register row-gap/column-gap as longhand properties and gap as a
  shorthand accepting [ normal | <length-percentage> ]{1,2}.
- Add css_gap_t (CSS_GAP_INHERIT/SET/NORMAL) and corresponding
  type/unit/value fields on css_computed_style_t.
- Implement cascade logic in lib/css/src/properties/gap.c, resolving
  normal to zero and rejecting auto.
- Apply gaps in ui_flexbox_layout: main-axis gap participates in line
  size, wrap detection, justify-content space and per-item positioning;
  cross-axis gap participates in cross-size accumulation and line
  positioning. The last item/line never gets a trailing gap. Percentage
  gaps resolve against the container content-box on the corresponding
  axis.
- Cover gap parsing/cascading in lib/css/tests (single/two values,
  axis-only, normal, percentage) and add a flex layout integration test
  exercising column-gap, row-gap, wrapped two-value gap and normal.
2026-08-05 22:41:30 +08:00
CopilotandLiu 01a0d11be3 refactor(ui): consolidate flexbox row/column axis logic
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Liu <lc-soft@live.cn>
2026-08-05 22:41:27 +08:00
Liu 3f49931cb6 fix(ui): avoid mbstowcs assertion in ui_print_tree on Windows
The %ls format in logger_error went through UCRT's wide-to-multibyte path, which triggered a debug assertion in mbstowcs.cpp under non-UTF-8 locales and also produced unreadable output when the console code page was GBK.

Switch the tree drawing to UTF-8 byte literals so the log path stays purely narrow, and temporarily set the console output code page to CP_UTF8 around the dump so the box-drawing characters render correctly.
2026-08-05 22:41:24 +08:00
Liu 3a867040d1 build(xmake): fix package name, target naming and example install
- Remove per-lib set_project() calls that overrode the global lcui
  project name; xmake show now correctly reports the project as lcui.
- Move per-lib set_version() into the corresponding target() block so
  each sub-library keeps an independent version usable for standalone
  packaging.
- Add set_default(false) and set_group(examples) to all pandagl
  examples so they are no longer picked up by xmake package.
- Rename targets to use dashes for consistency:
    pandagl_cairo_example  -> pandagl-cairo-example
    preview_block_layout   -> preview-block-layout
    preview_flex_layout    -> preview-flex-layout
    preview_scrollbar      -> preview-scrollbar
    preview_widget_opacity -> preview-widget-opacity
- Bump yutil submodule to drop its set_project() call as well.
2026-08-05 22:41:23 +08:00
Liu d64fe6202b refactor(pandagl): rename font API to align with typeface/glyph concepts
The previous naming conflated multiple levels of the font model:
pd_font_t actually owned a single typeface resource (FT_Face), while
pd_font_bitmap_t represented a per-glyph bitmap. The pd_font_library_*
prefix was redundant under the pd_font_ namespace and resulted in
verbose call sites (up to 34 chars).

Type renames
- pd_font_t          -> pd_font_face_t
- pd_font_bitmap_t   -> pd_glyph_bitmap_t
- font_engine_t      -> pd_font_engine_t
- struct tags updated to match the typedef names.

API renames (grouped by sub-object)
- Face lifecycle:    pd_font_create/destroy -> pd_font_face_create/destroy
- Face registry:     pd_font_library_add_font     -> pd_font_register
                     pd_font_library_get_font     -> pd_font_get
                     pd_font_library_get_font_id  -> pd_font_get_id
                     pd_font_library_query        -> pd_font_query
                     pd_font_library_load_file    -> pd_font_load_file
                     pd_font_library_get_font_path-> pd_font_find_path
                     pd_font_library_get_default_font -> pd_font_get_default
                     pd_font_library_set_default_font -> pd_font_set_default
                     pd_font_library_set_font_family_alias
                                                  -> pd_font_family_set_alias
                     pd_font_library_update_font_weight
                                                  -> pd_font_replace_weight
                     pd_font_library_update_font_style
                                                  -> pd_font_replace_style
- Parsing helpers:   pd_font_library_detect_weight -> pd_font_parse_weight
                     pd_font_library_detect_style  -> pd_font_parse_style
- Glyph rendering:   pd_font_library_render_bitmap -> pd_font_render_glyph
                     pd_canvas_mix_font_bitmap     -> pd_canvas_mix_glyph_bitmap
                     pd_font_bitmap_init/destroy   -> pd_glyph_bitmap_init/destroy
- Glyph cache:       pd_font_library_add_bitmap    -> pd_font_cache_add_bitmap
                     pd_font_library_get_bitmap    -> pd_font_cache_get_bitmap

pd_font_library_init/destroy are kept as the module lifecycle entry
points, matching the FT_Init_FreeType / FT_Done_FreeType convention.

All call sites in lib/pandagl, lib/ui, lib/ui-xml, src/, tests/ and
examples/ are updated accordingly.
2026-08-05 22:41:19 +08:00
Liu e873c47216 refactor(ui): change image event listener return types to bool 2026-03-31 21:20:28 +08:00
Liu ded5f84022 fix(ui): memory leak and division by zero error 2026-03-31 21:20:28 +08:00
Liu c4895a3efb fix(ui): cannot set css shorthand property 2026-03-31 21:20:28 +08:00
Liu 06a958eda4 fix(ui): clear implicit conversion warnings 2025-08-16 11:22:29 +08:00
Liu 1de2dfd62c fix: delay refresh window to use the latest size of widget 2025-04-16 00:16:38 +08:00
Liu 9510e2c2ef style: format code and delete unused files 2025-01-06 23:14:33 +08:00
Liu 940a0fc33a chore: update copyright 2025-01-05 23:29:56 +08:00
Liu 4ad7d8a4fb feat: font alias 2025-01-05 23:08:45 +08:00
Liu 24f3192b9a refactor: update LCUI's dependencies on ui-widgets and ui-router 2024-12-29 23:37:24 +08:00
Liu cfa605110e style: add BOM header 2024-12-23 00:02:48 +08:00
Liu 6851e9aef3 refactor: change type naming style 2024-12-22 23:14:13 +08:00