Skip to content

Commit 77dbc6a

Browse files
feat: impl flex-shrink in js and fix layout
1 parent 8ea326a commit 77dbc6a

File tree

9 files changed

+14
-4
lines changed

9 files changed

+14
-4
lines changed

dependencies/breeze-ui.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package("breeze-glfw")
55

66
package("breeze-ui")
77
add_urls("https://github.com/std-microblock/breeze-ui.git")
8-
add_versions("2025.12.08+1", "4c552d6efa34bfdc3a29c40936c39f122210f0dd")
8+
add_versions("2025.12.08+4", "b6f3d435609392c8f62022e6f4f05c93a7be1969")
99
add_deps("breeze-glfw", "nanovg", "glad", "nanosvg")
1010
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
1111

src/shell/script/binding_qjs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ template<> struct js_bind<mb_shell::js::breeze_ui::js_flex_layout_widget> {
104104
.property<&mb_shell::js::breeze_ui::js_flex_layout_widget::get_padding_top, &mb_shell::js::breeze_ui::js_flex_layout_widget::set_padding_top>("padding_top")
105105
.property<&mb_shell::js::breeze_ui::js_flex_layout_widget::get_padding_bottom, &mb_shell::js::breeze_ui::js_flex_layout_widget::set_padding_bottom>("padding_bottom")
106106
.property<&mb_shell::js::breeze_ui::js_flex_layout_widget::get_flex_grow, &mb_shell::js::breeze_ui::js_flex_layout_widget::set_flex_grow>("flex_grow")
107+
.property<&mb_shell::js::breeze_ui::js_flex_layout_widget::get_flex_shrink, &mb_shell::js::breeze_ui::js_flex_layout_widget::set_flex_shrink>("flex_shrink")
107108
.property<&mb_shell::js::breeze_ui::js_flex_layout_widget::get_max_height, &mb_shell::js::breeze_ui::js_flex_layout_widget::set_max_height>("max_height")
108109
.property<&mb_shell::js::breeze_ui::js_flex_layout_widget::get_enable_scrolling, &mb_shell::js::breeze_ui::js_flex_layout_widget::set_enable_scrolling>("enable_scrolling")
109110
.property<&mb_shell::js::breeze_ui::js_flex_layout_widget::get_enable_child_clipping, &mb_shell::js::breeze_ui::js_flex_layout_widget::set_enable_child_clipping>("enable_child_clipping")
@@ -138,6 +139,8 @@ template<> struct js_bind<mb_shell::js::breeze_ui::js_flex_layout_widget> {
138139
.fun<&mb_shell::js::breeze_ui::js_flex_layout_widget::set_padding_bottom>("set_padding_bottom")
139140
.fun<&mb_shell::js::breeze_ui::js_flex_layout_widget::get_flex_grow>("get_flex_grow")
140141
.fun<&mb_shell::js::breeze_ui::js_flex_layout_widget::set_flex_grow>("set_flex_grow")
142+
.fun<&mb_shell::js::breeze_ui::js_flex_layout_widget::get_flex_shrink>("get_flex_shrink")
143+
.fun<&mb_shell::js::breeze_ui::js_flex_layout_widget::set_flex_shrink>("set_flex_shrink")
141144
.fun<&mb_shell::js::breeze_ui::js_flex_layout_widget::get_max_height>("get_max_height")
142145
.fun<&mb_shell::js::breeze_ui::js_flex_layout_widget::set_max_height>("set_max_height")
143146
.fun<&mb_shell::js::breeze_ui::js_flex_layout_widget::get_enable_scrolling>("get_enable_scrolling")

src/shell/script/binding_types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ export class js_flex_layout_widget extends js_widget {
7979
set padding_bottom(value: number);
8080
get flex_grow(): number;
8181
set flex_grow(value: number);
82+
get flex_shrink(): number;
83+
set flex_shrink(value: number);
8284
get max_height(): number;
8385
set max_height(value: number);
8486
get enable_scrolling(): boolean;

src/shell/script/binding_types_breeze_ui.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ IMPL_SIMPLE_PROP(breeze_ui::js_flex_layout_widget, widget_js_base,
473473
crop_overflow, bool)
474474
IMPL_SIMPLE_PROP(breeze_ui::js_flex_layout_widget, widget_js_base, flex_grow,
475475
float)
476+
IMPL_SIMPLE_PROP(breeze_ui::js_flex_layout_widget, widget_js_base, flex_shrink,
477+
float)
476478

477479
std::string breeze_ui::js_flex_layout_widget::get_justify_content() const {
478480
auto widget = std::dynamic_pointer_cast<ui::flex_widget>($widget);

src/shell/script/binding_types_breeze_ui.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ struct breeze_ui {
8484
DEFINE_PROP(float, padding_top)
8585
DEFINE_PROP(float, padding_bottom)
8686
DEFINE_PROP(float, flex_grow)
87+
DEFINE_PROP(float, flex_shrink)
8788
DEFINE_PROP(float, max_height)
8889
DEFINE_PROP(bool, enable_scrolling)
8990
DEFINE_PROP(bool, enable_child_clipping)

src/shell/script/script.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/shell/script/ts/src/config_page/PluginStore.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ const PluginStore = memo(() => {
7171
installed ? (have_update ? '#FFA500' : '#2979FF') : (shell.breeze.is_light_theme() ? '#C0C0C0aa' : '#505050aa')
7272
} />
7373
<flex gap={10} padding={10} borderRadius={8}
74-
flexGrow={1} horizontal >
74+
flexGrow={1} horizontal>
7575
<flex gap={10} alignItems="stretch" flexGrow={1}>
7676
<Text fontSize={18}>{plugin.name}</Text>
7777
<Text>{plugin.description}</Text>
7878
</flex>
79-
<flex gap={10} alignItems="center">
79+
<flex gap={10} alignItems="center" flexShrink={0}>
8080
<Button onClick={() => installPlugin(plugin)}>
8181
<Text>{installingPlugins.has(plugin.name) ? t("安装中...") : (installed ? (have_update ? `更新 (${local_version} -> ${plugin.version})` : '已安装') : '安装')}</Text>
8282
</Button>

src/shell/script/ts/src/jsx.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ declare module 'react' {
3434
autoSize?: boolean;
3535
gap?: number;
3636
flexGrow?: number;
37+
flexShrink?: number;
3738
maxHeight?: number;
3839
enableScrolling?: boolean;
3940
enableChildClipping?: boolean;

src/shell/script/ts/src/react/renderer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ const componentMap = {
138138
alignItems: getSetFactory('align_items'),
139139
gap: getSetFactory('gap'),
140140
flexGrow: getSetFactory('flex_grow'),
141+
flexShrink: getSetFactory('flex_shrink'),
141142
maxHeight: getSetFactory('max_height'),
142143
enableScrolling: getSetFactory('enable_scrolling'),
143144
enableChildClipping: getSetFactory('enable_child_clipping'),

0 commit comments

Comments
 (0)