some cleanup

This commit is contained in:
udo
2026-04-28 12:10:07 +00:00
parent 223cf4c6e1
commit cd445f3c9b
224 changed files with 1558 additions and 38907 deletions
@@ -2,11 +2,11 @@
COMPONENT(Request& context)
{
String title = first(context.call["title"].to_string(), "Sign in with OAuth");
String subtitle = first(context.call["subtitle"].to_string(), "Choose your preferred authentication method");
String callback_url = first(context.call["callback_url"].to_string(), starter_link("auth/callback", context));
String title = first(context.props["title"].to_string(), "Sign in with OAuth");
String subtitle = first(context.props["subtitle"].to_string(), "Choose your preferred authentication method");
String callback_url = first(context.props["callback_url"].to_string(), starter_link("auth/callback", context));
DTree services = context.call["services"];
DTree services = context.props["services"];
if(services.get_type_name() != "array" || services["google"]["name"].to_string() == "")
{
services["google"]["name"] = "Google";
@@ -41,7 +41,7 @@ COMPONENT(Request& context)
<label><?= subtitle ?></label>
</div>
<? services.each([&](DTree service, String service_key) {
String client_id = context.call[service_key + "_client_id"].to_string();
String client_id = context.props[service_key + "_client_id"].to_string();
String handler_name = ascii_safe_name(service_key);
String service_name = service["name"].to_string();
String scope = service["scope"].to_string();
@@ -76,8 +76,8 @@ DTree data_format_value(DTree value, DTree row, DTree column)
COMPONENT:SUMMARY_METRICS(Request& context)
{
String title = context.call["title"].to_string();
String subtitle = context.call["subtitle"].to_string();
String title = context.props["title"].to_string();
String subtitle = context.props["subtitle"].to_string();
<>
<div class="dashboard-panel">
@@ -88,7 +88,7 @@ COMPONENT:SUMMARY_METRICS(Request& context)
</div>
<? } ?>
<div class="dashboard-stat-grid">
<? context.call["items"].each([&](DTree item, String key) {
<? context.props["items"].each([&](DTree item, String key) {
String tone = first(item["tone"].to_string(), "info");
String href = item["href"].to_string();
String tag = href != "" ? "a" : "div";
@@ -108,16 +108,16 @@ COMPONENT:TIMESERIES_CHART(Request& context)
starter_register_js("js/u-format.js", context);
starter_register_js("js/u-timeseries-chart.js", context);
String chart_id = first(context.call["id"].to_string(), "ts-chart-" + std::to_string((u64)time()));
String chart_id = first(context.props["id"].to_string(), "ts-chart-" + std::to_string((u64)time()));
String canvas_id = chart_id + "-canvas";
String title = context.call["title"].to_string();
String subtitle = context.call["subtitle"].to_string();
s32 height = std::max(180, (s32)int_val(first(context.call["height"].to_string(), "320")));
String x_axis_label = first(context.call["x_axis_label"].to_string(), "Time");
String y_axis_left_label = first(context.call["y_axis_left_label"].to_string(), "Value");
String y_axis_right_label = context.call["y_axis_right_label"].to_string();
String y_axis_left_format = first(context.call["y_axis_left_format"].to_string(), "number");
String y_axis_right_format = first(context.call["y_axis_right_format"].to_string(), "number");
String title = context.props["title"].to_string();
String subtitle = context.props["subtitle"].to_string();
s32 height = std::max(180, (s32)int_val(first(context.props["height"].to_string(), "320")));
String x_axis_label = first(context.props["x_axis_label"].to_string(), "Time");
String y_axis_left_label = first(context.props["y_axis_left_label"].to_string(), "Value");
String y_axis_right_label = context.props["y_axis_right_label"].to_string();
String y_axis_left_format = first(context.props["y_axis_left_format"].to_string(), "number");
String y_axis_right_format = first(context.props["y_axis_right_format"].to_string(), "number");
<>
<div class="dashboard-panel">
@@ -139,7 +139,7 @@ COMPONENT:TIMESERIES_CHART(Request& context)
yAxisLeftFormat: <?: json_encode(y_axis_left_format) ?>,
yAxisRightFormat: <?: json_encode(y_axis_right_format) ?>
});
chart.setData(<?: json_encode(context.call["series"]) ?>, <?: json_encode(context.call["x_labels"]) ?>);
chart.setData(<?: json_encode(context.props["series"]) ?>, <?: json_encode(context.props["x_labels"]) ?>);
window[<?: json_encode("chart_" + chart_id) ?>] = chart;
}());
</script>
@@ -151,17 +151,17 @@ COMPONENT:SORTABLE_TABLE(Request& context)
starter_register_js("js/u-format.js", context);
starter_register_js("js/u-sortable-table.js", context);
String table_id = first(context.call["id"].to_string(), "sortable-table-" + std::to_string((u64)time()));
String title = context.call["title"].to_string();
String subtitle = context.call["subtitle"].to_string();
String empty_label = first(context.call["empty_label"].to_string(), "No data available");
String table_id = first(context.props["id"].to_string(), "sortable-table-" + std::to_string((u64)time()));
String title = context.props["title"].to_string();
String subtitle = context.props["subtitle"].to_string();
String empty_label = first(context.props["empty_label"].to_string(), "No data available");
DTree init_options;
init_options["storageKey"] = first(context.call["storage_key"].to_string(), "starter.sort." + table_id);
if(context.call["sort"]["column"].to_string() != "")
init_options["storageKey"] = first(context.props["storage_key"].to_string(), "starter.sort." + table_id);
if(context.props["sort"]["column"].to_string() != "")
{
init_options["initialSort"]["column"] = context.call["sort"]["column"];
init_options["initialSort"]["direction"] = first(context.call["sort"]["direction"].to_string(), "asc");
init_options["initialSort"]["column"] = context.props["sort"]["column"];
init_options["initialSort"]["direction"] = first(context.props["sort"]["direction"].to_string(), "asc");
}
<>
@@ -176,7 +176,7 @@ COMPONENT:SORTABLE_TABLE(Request& context)
<table id="<?= table_id ?>" class="u-sortable-table">
<thead>
<tr>
<? context.call["columns"].each([&](DTree column, String key) {
<? context.props["columns"].each([&](DTree column, String key) {
String align = first(column["align"].to_string(), "left");
bool sortable = column["sortable"].to_string() == "" || column["sortable"].to_string() == "1";
?><th scope="col" class="align-<?= align ?>"<?= sortable ? "" : " data-sortable=\"false\"" ?>><?= first(column["label"].to_string(), column["key"].to_string(), "Column") ?></th><?
@@ -184,14 +184,14 @@ COMPONENT:SORTABLE_TABLE(Request& context)
</tr>
</thead>
<tbody>
<? if(context.call["rows"].get_type_name() != "array" || context.call["rows"]["0"].get_type_name() != "array") { ?>
<tr data-empty-row="1"><td colspan="<?= context.call["columns"]._map.size() == 0 ? "1" : std::to_string(context.call["columns"]._map.size()) ?>" class="muted"><?= empty_label ?></td></tr>
<? if(context.props["rows"].get_type_name() != "array" || context.props["rows"]["0"].get_type_name() != "array") { ?>
<tr data-empty-row="1"><td colspan="<?= context.props["columns"]._map.size() == 0 ? "1" : std::to_string(context.props["columns"]._map.size()) ?>" class="muted"><?= empty_label ?></td></tr>
<? } ?>
<? context.call["rows"].each([&](DTree row, String key) {
<? context.props["rows"].each([&](DTree row, String key) {
if(row.get_type_name() != "array")
return;
?><tr><?
context.call["columns"].each([&](DTree column, String ckey) {
context.props["columns"].each([&](DTree column, String ckey) {
String col_key = column["key"].to_string();
DTree formatted = data_format_value(row[col_key], row, column);
?><td class="align-<?= first(column["align"].to_string(), "left") ?>" data-sort-value="<?= formatted["sort"].to_string() ?>"><?= formatted["display"].to_string() ?></td><?
@@ -213,21 +213,21 @@ COMPONENT:SORTABLE_TABLE(Request& context)
COMPONENT:DATA_TABLE(Request& context)
{
String table_id = first(context.call["id"].to_string(), "data-grid-" + std::to_string((u64)time()));
String table_id = first(context.props["id"].to_string(), "data-grid-" + std::to_string((u64)time()));
starter_register_js("js/ag-grid/ag-grid-community.min.js", context);
starter_register_css("js/ag-grid/ag-grid.css", context);
starter_register_css("js/ag-grid/ag-theme-alpine.css", context);
DTree columns = context.call["columns"];
DTree columns = context.props["columns"];
if(columns.get_type_name() != "array")
columns.set_array();
bool has_explicit_columns = columns.is_list() &&
columns._map.size() > 0 &&
columns._map.find("0") != columns._map.end() &&
columns["0"]["field"].to_string() != "";
if(!has_explicit_columns && context.call["items"]["0"].get_type_name() == "array")
if(!has_explicit_columns && context.props["items"]["0"].get_type_name() == "array")
{
context.call["items"]["0"].each([&](DTree value, String key) {
context.props["items"]["0"].each([&](DTree value, String key) {
DTree col;
col["field"] = key;
col["headerName"] = key;
@@ -248,7 +248,7 @@ COMPONENT:DATA_TABLE(Request& context)
columns = normalized_columns;
}
DTree row_data = context.call["items"];
DTree row_data = context.props["items"];
if(row_data.get_type_name() != "array")
row_data.set_array();
if(!row_data.is_list())
@@ -264,7 +264,7 @@ COMPONENT:DATA_TABLE(Request& context)
DTree grid_options;
grid_options["pagination"].set_bool(true);
grid_options["paginationPageSize"] = first(context.call["options"]["paginationPageSize"].to_string(), "20");
grid_options["paginationPageSize"] = first(context.props["options"]["paginationPageSize"].to_string(), "20");
grid_options["paginationPageSizeSelector"].set_bool(false);
grid_options["suppressMenuHide"].set_bool(true);
grid_options["animateRows"].set_bool(true);
@@ -275,7 +275,7 @@ COMPONENT:DATA_TABLE(Request& context)
<div class="ag-grid-container" style="margin: 1rem 0;">
<div class="ag-grid-toolbar" style="display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem;padding:0.75rem;background:var(--surface-elevated);border:1px solid var(--border);border-radius:0.5rem 0.5rem 0 0;border-bottom:none;">
<div style="display:flex;gap:1rem;align-items:center;flex:1;">
<span style="color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;"><?= std::to_string(context.call["items"]._map.size()) ?> rows</span>
<span style="color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;"><?= std::to_string(context.props["items"]._map.size()) ?> rows</span>
<input type="text" id="<?= table_id ?>-search" placeholder="Search all columns..." style="padding:0.5rem 0.75rem;border:1px solid var(--border);border-radius:0.375rem;background:var(--surface);color:var(--text-primary);font-size:0.875rem;width:250px;" />
</div>
<div style="display:flex;gap:0.5rem;">
@@ -283,7 +283,7 @@ COMPONENT:DATA_TABLE(Request& context)
<button id="<?= table_id ?>-clear-filters" class="btn btn-outline">Clear Filters</button>
</div>
</div>
<div id="<?= table_id ?>" class="ag-theme-alpine-dark" style="height: <?= first(context.call["height"].to_string(), "400px") ?>; width: 100%; border: 1px solid var(--border); border-radius: 0 0 0.5rem 0.5rem; overflow: hidden;"></div>
<div id="<?= table_id ?>" class="ag-theme-alpine-dark" style="height: <?= first(context.props["height"].to_string(), "400px") ?>; width: 100%; border: 1px solid var(--border); border-radius: 0 0 0.5rem 0.5rem; overflow: hidden;"></div>
</div>
<script>
(function () {
@@ -44,10 +44,10 @@ void marketing_default_features(DTree& features)
COMPONENT:HERO_SECTION(Request& context)
{
String title = first(context.call["title"].to_string(), "Welcome to the Present");
String subtitle = first(context.call["subtitle"].to_string(), "Experience no-quite-modern web development with our cutting-edge framework");
String cta_text = first(context.call["cta_text"].to_string(), "Get Started");
String cta_link = first(context.call["cta_link"].to_string(), "#");
String title = first(context.props["title"].to_string(), "Welcome to the Present");
String subtitle = first(context.props["subtitle"].to_string(), "Experience no-quite-modern web development with our cutting-edge framework");
String cta_text = first(context.props["cta_text"].to_string(), "Get Started");
String cta_link = first(context.props["cta_link"].to_string(), "#");
<>
<div class="hero-section">
@@ -194,7 +194,7 @@ COMPONENT:HERO_SECTION(Request& context)
COMPONENT:FEATURES_GRID(Request& context)
{
DTree features = context.call["features"];
DTree features = context.props["features"];
marketing_default_features(features);
<>
@@ -288,7 +288,7 @@ COMPONENT:FEATURES_GRID(Request& context)
COMPONENT:STATS_SECTION(Request& context)
{
DTree stats = context.call["stats"];
DTree stats = context.props["stats"];
if(stats.get_type_name() != "array" || stats["0"]["label"].to_string() == "")
{
DTree item;
@@ -364,7 +364,7 @@ COMPONENT:STATS_SECTION(Request& context)
COMPONENT:BRANDS_SHOWCASE(Request& context)
{
DTree logos = context.call["logos"];
DTree logos = context.props["logos"];
if(logos.get_type_name() != "array" || logos["0"]["name"].to_string() == "")
{
DTree item;
@@ -376,7 +376,7 @@ COMPONENT:BRANDS_SHOWCASE(Request& context)
item.clear();
}
}
String title = first(context.call["title"].to_string(), "Trusted by Leading Companies");
String title = first(context.props["title"].to_string(), "Trusted by Leading Companies");
<>
<div class="brands-section">
@@ -410,7 +410,7 @@ COMPONENT:BRANDS_SHOWCASE(Request& context)
COMPONENT:TESTIMONIALS(Request& context)
{
DTree testimonials = context.call["testimonials"];
DTree testimonials = context.props["testimonials"];
if(testimonials.get_type_name() != "array" || testimonials["0"]["name"].to_string() == "")
{
DTree item;
@@ -473,7 +473,7 @@ COMPONENT:TESTIMONIALS(Request& context)
COMPONENT:PRICING_TABLE(Request& context)
{
DTree plans = context.call["plans"];
DTree plans = context.props["plans"];
if(plans.get_type_name() != "array" || plans["0"]["name"].to_string() == "")
{
DTree plan;
@@ -546,12 +546,12 @@ COMPONENT:PRICING_TABLE(Request& context)
COMPONENT:CTA_SECTION(Request& context)
{
String title = first(context.call["title"].to_string(), "Ready to Get Started?");
String subtitle = first(context.call["subtitle"].to_string(), "Join thousands of developers building amazing applications with our framework.");
String cta_text = first(context.call["cta_text"].to_string(), "Start Building Now");
String cta_link = first(context.call["cta_link"].to_string(), "#");
String secondary_text = first(context.call["secondary_text"].to_string(), "View Documentation");
String secondary_link = first(context.call["secondary_link"].to_string(), "#");
String title = first(context.props["title"].to_string(), "Ready to Get Started?");
String subtitle = first(context.props["subtitle"].to_string(), "Join thousands of developers building amazing applications with our framework.");
String cta_text = first(context.props["cta_text"].to_string(), "Start Building Now");
String cta_link = first(context.props["cta_link"].to_string(), "#");
String secondary_text = first(context.props["secondary_text"].to_string(), "View Documentation");
String secondary_link = first(context.props["secondary_link"].to_string(), "#");
<>
<div class="cta-section">
@@ -5,11 +5,11 @@ COMPONENT(Request& context)
starter_register_js("components/gauges/common.js", context);
starter_register_css("themes/common/css/gauges.css", context);
String gauge_id = first(context.call["id"].to_string(), "arcgauge-" + std::to_string((u64)time()));
String title = context.call["title"].to_string();
String subtitle = context.call["subtitle"].to_string();
String style = context.call["style"].to_string();
DTree scale = context.call["scale"];
String gauge_id = first(context.props["id"].to_string(), "arcgauge-" + std::to_string((u64)time()));
String title = context.props["title"].to_string();
String subtitle = context.props["subtitle"].to_string();
String style = context.props["style"].to_string();
DTree scale = context.props["scale"];
<>
<div class="arcgauge-set" id="<?= gauge_attr_id(gauge_id) ?>" style="<?= style ?>">
@@ -20,7 +20,7 @@ COMPONENT(Request& context)
</div>
<? } ?>
<div class="arcgauge-grid">
<? context.call["items"].each([&](DTree item, String item_id_raw) {
<? context.props["items"].each([&](DTree item, String item_id_raw) {
DTree merged = scale;
item.each([&](DTree value, String key) { merged[key] = value; });
String item_id = gauge_attr_id(item_id_raw);
@@ -62,7 +62,7 @@ COMPONENT(Request& context)
}); ?>
</div>
</div>
<? if(context.call["listen"].to_string() != "") { ?>
<? if(context.props["listen"].to_string() != "") { ?>
<script>
window.ArcgaugeComponents = window.ArcgaugeComponents || {
start_listen : function(prop) {
@@ -84,7 +84,7 @@ COMPONENT(Request& context)
});
}
};
ArcgaugeComponents.start_listen(<?: json_encode(context.call, '\'') ?>);
ArcgaugeComponents.start_listen(<?: json_encode(context.props, '\'') ?>);
</script>
<? } ?>
</>
@@ -5,15 +5,15 @@ COMPONENT(Request& context)
starter_register_js("components/gauges/common.js", context);
starter_register_css("themes/common/css/gauges.css", context);
String gauge_id = first(context.call["id"].to_string(), "needlegauge-" + std::to_string((u64)time()));
String style = context.call["style"].to_string();
String title = context.call["title"].to_string();
String subtitle = context.call["subtitle"].to_string();
f64 size = float_val(first(context.call["size"].to_string(), "200"));
DTree scale = context.call["scale"];
String gauge_id = first(context.props["id"].to_string(), "needlegauge-" + std::to_string((u64)time()));
String style = context.props["style"].to_string();
String title = context.props["title"].to_string();
String subtitle = context.props["subtitle"].to_string();
f64 size = float_val(first(context.props["size"].to_string(), "200"));
DTree scale = context.props["scale"];
f64 scale_angle_start = float_val(first(scale["angle_start"].to_string(), std::to_string(-gauge_pi())));
f64 scale_angle_end = float_val(first(scale["angle_end"].to_string(), "0"));
f64 img_height = float_val(first(context.call["img_height"].to_string(), std::to_string(size * std::max(cos(scale_angle_start), cos(scale_angle_end)))));
f64 img_height = float_val(first(context.props["img_height"].to_string(), std::to_string(size * std::max(cos(scale_angle_start), cos(scale_angle_end)))));
<>
<section class="gauge-set needlegauge-set" id="<?= gauge_attr_id(gauge_id) ?>" style="<?= style ?>">
@@ -24,7 +24,7 @@ COMPONENT(Request& context)
</div>
<? } ?>
<div class="needlegauge-grid">
<? context.call["items"].each([&](DTree item, String item_id_raw) {
<? context.props["items"].each([&](DTree item, String item_id_raw) {
DTree merged = scale;
item.each([&](DTree value, String key) { merged[key] = value; });
String item_id = gauge_attr_id(item_id_raw);
@@ -117,7 +117,7 @@ COMPONENT(Request& context)
}); ?>
</div>
</section>
<? if(context.call["listen"].to_string() != "") { ?>
<? if(context.props["listen"].to_string() != "") { ?>
<script>
window.NeedlegaugeComponents = window.NeedlegaugeComponents || {
start_listen : function(prop) {
@@ -137,7 +137,7 @@ COMPONENT(Request& context)
});
}
};
NeedlegaugeComponents.start_listen(<?: json_encode(context.call, '\'') ?>);
NeedlegaugeComponents.start_listen(<?: json_encode(context.props, '\'') ?>);
</script>
<? } ?>
</>
@@ -5,18 +5,18 @@ COMPONENT(Request& context)
starter_register_js("components/gauges/common.js", context);
starter_register_css("themes/common/css/gauges.css", context);
String gauge_id = first(context.call["id"].to_string(), "progressbar-" + std::to_string((u64)time()));
String style = context.call["style"].to_string();
String item_style = context.call["item-style"].to_string();
String label_style = context.call["label-style"].to_string();
String value_style = context.call["value-style"].to_string();
String bar_style = context.call["bar-style"].to_string();
String title = context.call["title"].to_string();
String subtitle = context.call["subtitle"].to_string();
String layout = first(context.call["layout"].to_string(), "horizontal");
String bar_color_default = context.call["bar-color"].to_string();
DTree scale = context.call["scale"];
DTree markers = context.call["markers"];
String gauge_id = first(context.props["id"].to_string(), "progressbar-" + std::to_string((u64)time()));
String style = context.props["style"].to_string();
String item_style = context.props["item-style"].to_string();
String label_style = context.props["label-style"].to_string();
String value_style = context.props["value-style"].to_string();
String bar_style = context.props["bar-style"].to_string();
String title = context.props["title"].to_string();
String subtitle = context.props["subtitle"].to_string();
String layout = first(context.props["layout"].to_string(), "horizontal");
String bar_color_default = context.props["bar-color"].to_string();
DTree scale = context.props["scale"];
DTree markers = context.props["markers"];
StringList default_palette;
default_palette.push_back("var(--success, #10b981)");
@@ -35,7 +35,7 @@ COMPONENT(Request& context)
<? } ?>
<? if(layout == "horizontal") { ?>
<div class="progressbar-grid progressbar-grid-horizontal">
<? context.call["items"].each([&](DTree bar, String bar_id) {
<? context.props["items"].each([&](DTree bar, String bar_id) {
DTree merged = scale;
bar.each([&](DTree item, String key) { merged[key] = item; });
String item_id = gauge_attr_id(bar_id);
@@ -86,8 +86,8 @@ COMPONENT(Request& context)
}); ?>
</div>
<? } else { ?>
<div class="progressbar-grid progressbar-grid-vertical" style="--progressbar-height: <?= first(context.call["height"].to_string(), "240") ?>px;">
<? context.call["items"].each([&](DTree bar, String bar_id) {
<div class="progressbar-grid progressbar-grid-vertical" style="--progressbar-height: <?= first(context.props["height"].to_string(), "240") ?>px;">
<? context.props["items"].each([&](DTree bar, String bar_id) {
DTree merged = scale;
bar.each([&](DTree item, String key) { merged[key] = item; });
String item_id = gauge_attr_id(bar_id);
@@ -137,7 +137,7 @@ COMPONENT(Request& context)
</div>
<? } ?>
</section>
<? if(context.call["listen"].to_string() != "") { ?>
<? if(context.props["listen"].to_string() != "") { ?>
<script>
window.ProgressbarComponents = window.ProgressbarComponents || {
start_listen : function(prop) {
@@ -161,7 +161,7 @@ COMPONENT(Request& context)
});
}
};
ProgressbarComponents.start_listen(<?: json_encode(context.call, '\'') ?>);
ProgressbarComponents.start_listen(<?: json_encode(context.props, '\'') ?>);
</script>
<? } ?>
</>
@@ -7,9 +7,9 @@ COMPONENT(Request& context)
DTree user = users.current();
bool signed_in = user["email"].to_string() != "";
String theme_key = context.cfg.get_by_path("theme/key").to_string();
String wrapper_class = first(context.call["wrapper_class"].to_string(), theme_key == "localfirst" ? "admin-account-card" : "nav-account nav-menu");
String links_class = first(context.call["links_wrapper_class"].to_string(), theme_key == "localfirst" ? "admin-account-links" : "");
String name_class = first(context.call["name_class"].to_string(), theme_key == "localfirst" ? "admin-account-name" : "account-name");
String wrapper_class = first(context.props["wrapper_class"].to_string(), theme_key == "localfirst" ? "admin-account-card" : "nav-account nav-menu");
String links_class = first(context.props["links_wrapper_class"].to_string(), theme_key == "localfirst" ? "admin-account-links" : "");
String name_class = first(context.props["name_class"].to_string(), theme_key == "localfirst" ? "admin-account-name" : "account-name");
<>
<div class="<?= wrapper_class ?>">
@@ -8,7 +8,7 @@ COMPONENT(Request& context)
return;
String text = first(context.cfg.get_by_path("theme/footer_text").to_string(), context.cfg.get_by_path("site/name").to_string());
String inner_class = first(context.call["inner_class"].to_string(), context.cfg.get_by_path("theme/key").to_string() == "portal-light" ? "footer-inner" : "");
String inner_class = first(context.props["inner_class"].to_string(), context.cfg.get_by_path("theme/key").to_string() == "portal-light" ? "footer-inner" : "");
<>
<footer>
@@ -6,7 +6,7 @@ COMPONENT(Request& context)
if(starter_page_embed_mode(context))
return;
String cookie_value = context.call["cookie_consent"].to_string();
String cookie_value = context.props["cookie_consent"].to_string();
bool cookie_consent = !(cookie_value == "0" || cookie_value == "false" || cookie_value == "FALSE" || cookie_value == "no" || cookie_value == "NO");
<>
@@ -3,18 +3,18 @@
COMPONENT(Request& context)
{
starter_boot(context);
if(context.call["main_html"].to_string() != "")
context.var["starter"]["fragments"]["main"] = context.call["main_html"];
if(context.call["json"].get_type_name() == "array")
context.var["starter"]["json"] = context.call["json"];
if(context.call["page_type"].to_string() != "")
context.var["starter"]["page_type"] = context.call["page_type"];
if(context.call["embed_mode"].to_string() != "")
context.var["starter"]["embed_mode"] = context.call["embed_mode"];
if(context.props["main_html"].to_string() != "")
context.var["starter"]["fragments"]["main"] = context.props["main_html"];
if(context.props["json"].get_type_name() == "array")
context.var["starter"]["json"] = context.props["json"];
if(context.props["page_type"].to_string() != "")
context.var["starter"]["page_type"] = context.props["page_type"];
if(context.props["embed_mode"].to_string() != "")
context.var["starter"]["embed_mode"] = context.props["embed_mode"];
starter_render_page(context);
}
COMPONENT:HEAD(Request& context)
{
print(component("head", context.call, context));
print(component("head", context.props, context));
}
@@ -3,17 +3,17 @@
COMPONENT(Request& context)
{
starter_boot(context);
String nav_class = context.call["nav_class"].to_string();
String nav_class = context.props["nav_class"].to_string();
if(nav_class == "" && (context.cfg.get_by_path("theme/key").to_string() == "portal-dark" || context.cfg.get_by_path("theme/key").to_string() == "dark" || context.cfg.get_by_path("theme/key").to_string() == "retro-gaming"))
nav_class = "nav-shell";
DTree account_props;
if(context.call["account_wrapper_class"].to_string() != "")
account_props["wrapper_class"] = context.call["account_wrapper_class"];
if(context.call["links_wrapper_class"].to_string() != "")
account_props["links_wrapper_class"] = context.call["links_wrapper_class"];
if(context.call["name_class"].to_string() != "")
account_props["name_class"] = context.call["name_class"];
if(context.props["account_wrapper_class"].to_string() != "")
account_props["wrapper_class"] = context.props["account_wrapper_class"];
if(context.props["links_wrapper_class"].to_string() != "")
account_props["links_wrapper_class"] = context.props["links_wrapper_class"];
if(context.props["name_class"].to_string() != "")
account_props["name_class"] = context.props["name_class"];
<>
<nav<?: nav_class != "" ? " class=\"" + html_escape(nav_class) + "\"" : "" ?>>
@@ -4,14 +4,14 @@ COMPONENT:APP_FRAME(Request& context)
{
starter_register_css("themes/common/css/workspace.css", context);
starter_register_js("js/u-workspace-shell.js", context);
String id = context.call["id"].to_string();
String overlay_id = context.call["overlay_id"].to_string();
String class_name = context.call["class"].to_string();
String id = context.props["id"].to_string();
String overlay_id = context.props["overlay_id"].to_string();
String class_name = context.props["class"].to_string();
<>
<div<?: id != "" ? " id=\"" + html_escape(id) + "\"" : "" ?> class="ws-app<?= class_name != "" ? " " + html_escape(class_name) : "" ?>">
<?: context.call["sidebar_html"].to_string() ?>
<?: context.props["sidebar_html"].to_string() ?>
<div<?: overlay_id != "" ? " id=\"" + html_escape(overlay_id) + "\"" : "" ?> class="ws-sidebar-overlay"></div>
<main class="ws-main"><?: context.call["main_html"].to_string() ?></main>
<main class="ws-main"><?: context.props["main_html"].to_string() ?></main>
</div>
</>
}
@@ -19,11 +19,11 @@ COMPONENT:APP_FRAME(Request& context)
COMPONENT:EMPTY_STATE(Request& context)
{
<>
<div class="ws-empty-state<?= context.call["class"].to_string() != "" ? " " + html_escape(context.call["class"].to_string()) : "" ?>">
<div class="ws-empty-icon"><i class="<?= first(context.call["icon_class"].to_string(), "fas fa-layer-group") ?>"></i></div>
<h2><?= context.call["title"].to_string() ?></h2>
<p><?= context.call["text"].to_string() ?></p>
<?: context.call["action_html"].to_string() ?>
<div class="ws-empty-state<?= context.props["class"].to_string() != "" ? " " + html_escape(context.props["class"].to_string()) : "" ?>">
<div class="ws-empty-icon"><i class="<?= first(context.props["icon_class"].to_string(), "fas fa-layer-group") ?>"></i></div>
<h2><?= context.props["title"].to_string() ?></h2>
<p><?= context.props["text"].to_string() ?></p>
<?: context.props["action_html"].to_string() ?>
</div>
</>
}
@@ -31,18 +31,18 @@ COMPONENT:EMPTY_STATE(Request& context)
COMPONENT:LIST_STATE(Request& context)
{
<>
<div class="ws-list-state<?= context.call["class"].to_string() != "" ? " " + html_escape(context.call["class"].to_string()) : "" ?>"><? if(context.call["icon_class"].to_string() != "") { ?><i class="<?= context.call["icon_class"].to_string() ?>"></i><? } ?><span><?= context.call["text"].to_string() ?></span></div>
<div class="ws-list-state<?= context.props["class"].to_string() != "" ? " " + html_escape(context.props["class"].to_string()) : "" ?>"><? if(context.props["icon_class"].to_string() != "") { ?><i class="<?= context.props["icon_class"].to_string() ?>"></i><? } ?><span><?= context.props["text"].to_string() ?></span></div>
</>
}
COMPONENT:MOBILE_BAR(Request& context)
{
<>
<div class="ws-mobile-bar<?= context.call["class"].to_string() != "" ? " " + html_escape(context.call["class"].to_string()) : "" ?>">
<button<?: context.call["button_id"].to_string() != "" ? " id=\"" + html_escape(context.call["button_id"].to_string()) + "\"" : "" ?> class="ws-mobile-toggle" title="Toggle sidebar" type="button">
<i class="<?= first(context.call["icon_class"].to_string(), "fas fa-bars") ?>"></i>
<div class="ws-mobile-bar<?= context.props["class"].to_string() != "" ? " " + html_escape(context.props["class"].to_string()) : "" ?>">
<button<?: context.props["button_id"].to_string() != "" ? " id=\"" + html_escape(context.props["button_id"].to_string()) + "\"" : "" ?> class="ws-mobile-toggle" title="Toggle sidebar" type="button">
<i class="<?= first(context.props["icon_class"].to_string(), "fas fa-bars") ?>"></i>
</button>
<span class="ws-mobile-title"><?= context.call["title"].to_string() ?></span>
<span class="ws-mobile-title"><?= context.props["title"].to_string() ?></span>
</div>
</>
}
@@ -50,12 +50,12 @@ COMPONENT:MOBILE_BAR(Request& context)
COMPONENT:PANEL_HEADER(Request& context)
{
<>
<div class="ws-panel-header<?= context.call["class"].to_string() != "" ? " " + html_escape(context.call["class"].to_string()) : "" ?>">
<div class="ws-panel-header<?= context.props["class"].to_string() != "" ? " " + html_escape(context.props["class"].to_string()) : "" ?>">
<div class="ws-panel-title-group">
<h2><?= context.call["title"].to_string() ?></h2>
<? if(context.call["subtitle"].to_string() != "") { ?><p class="ws-subtitle"><?= context.call["subtitle"].to_string() ?></p><? } ?>
<h2><?= context.props["title"].to_string() ?></h2>
<? if(context.props["subtitle"].to_string() != "") { ?><p class="ws-subtitle"><?= context.props["subtitle"].to_string() ?></p><? } ?>
</div>
<? if(context.call["actions_html"].to_string() != "") { ?><div class="ws-header-actions"><?: context.call["actions_html"].to_string() ?></div><? } ?>
<? if(context.props["actions_html"].to_string() != "") { ?><div class="ws-header-actions"><?: context.props["actions_html"].to_string() ?></div><? } ?>
</div>
</>
}
@@ -63,9 +63,9 @@ COMPONENT:PANEL_HEADER(Request& context)
COMPONENT:PANEL(Request& context)
{
<>
<section<?: context.call["id"].to_string() != "" ? " id=\"" + html_escape(context.call["id"].to_string()) + "\"" : "" ?> class="ws-panel<?= context.call["class"].to_string() != "" ? " " + html_escape(context.call["class"].to_string()) : "" ?>">
<?: context.call["header_html"].to_string() ?>
<?: context.call["body_html"].to_string() ?>
<section<?: context.props["id"].to_string() != "" ? " id=\"" + html_escape(context.props["id"].to_string()) + "\"" : "" ?> class="ws-panel<?= context.props["class"].to_string() != "" ? " " + html_escape(context.props["class"].to_string()) : "" ?>">
<?: context.props["header_html"].to_string() ?>
<?: context.props["body_html"].to_string() ?>
</section>
</>
}
@@ -73,9 +73,9 @@ COMPONENT:PANEL(Request& context)
COMPONENT:SECTION_HEAD(Request& context)
{
<>
<div class="ws-section-head<?= context.call["class"].to_string() != "" ? " " + html_escape(context.call["class"].to_string()) : "" ?>">
<h3><?= context.call["title"].to_string() ?></h3>
<? if(context.call["actions_html"].to_string() != "") { ?><div class="ws-header-actions"><?: context.call["actions_html"].to_string() ?></div><? } ?>
<div class="ws-section-head<?= context.props["class"].to_string() != "" ? " " + html_escape(context.props["class"].to_string()) : "" ?>">
<h3><?= context.props["title"].to_string() ?></h3>
<? if(context.props["actions_html"].to_string() != "") { ?><div class="ws-header-actions"><?: context.props["actions_html"].to_string() ?></div><? } ?>
</div>
</>
}
@@ -83,9 +83,9 @@ COMPONENT:SECTION_HEAD(Request& context)
COMPONENT:SECTION(Request& context)
{
<>
<section<?: context.call["id"].to_string() != "" ? " id=\"" + html_escape(context.call["id"].to_string()) + "\"" : "" ?> class="ws-section<?= context.call["class"].to_string() != "" ? " " + html_escape(context.call["class"].to_string()) : "" ?>">
<?: context.call["header_html"].to_string() ?>
<?: context.call["body_html"].to_string() ?>
<section<?: context.props["id"].to_string() != "" ? " id=\"" + html_escape(context.props["id"].to_string()) + "\"" : "" ?> class="ws-section<?= context.props["class"].to_string() != "" ? " " + html_escape(context.props["class"].to_string()) : "" ?>">
<?: context.props["header_html"].to_string() ?>
<?: context.props["body_html"].to_string() ?>
</section>
</>
}
@@ -93,9 +93,9 @@ COMPONENT:SECTION(Request& context)
COMPONENT:SIDEBAR_SHELL(Request& context)
{
<>
<aside<?: context.call["id"].to_string() != "" ? " id=\"" + html_escape(context.call["id"].to_string()) + "\"" : "" ?> class="ws-sidebar<?= context.call["class"].to_string() != "" ? " " + html_escape(context.call["class"].to_string()) : "" ?>">
<?: context.call["top_html"].to_string() ?>
<?: context.call["body_html"].to_string() ?>
<aside<?: context.props["id"].to_string() != "" ? " id=\"" + html_escape(context.props["id"].to_string()) + "\"" : "" ?> class="ws-sidebar<?= context.props["class"].to_string() != "" ? " " + html_escape(context.props["class"].to_string()) : "" ?>">
<?: context.props["top_html"].to_string() ?>
<?: context.props["body_html"].to_string() ?>
</aside>
</>
}
@@ -103,11 +103,11 @@ COMPONENT:SIDEBAR_SHELL(Request& context)
COMPONENT:SIDEBAR_TOOLBAR(Request& context)
{
<>
<div class="ws-sidebar-top<?= context.call["class"].to_string() != "" ? " " + html_escape(context.call["class"].to_string()) : "" ?>">
<?: context.call["action_html"].to_string() ?>
<div class="ws-sidebar-top<?= context.props["class"].to_string() != "" ? " " + html_escape(context.props["class"].to_string()) : "" ?>">
<?: context.props["action_html"].to_string() ?>
<div class="ws-search-wrap">
<i class="fas fa-search ws-search-icon"></i>
<input type="search"<?: context.call["search_input_id"].to_string() != "" ? " id=\"" + html_escape(context.call["search_input_id"].to_string()) + "\"" : "" ?> name="<?= first(context.call["search_input_name"].to_string(), "search") ?>" class="ws-search-input" placeholder="<?= first(context.call["search_placeholder"].to_string(), "Search...") ?>" autocomplete="off">
<input type="search"<?: context.props["search_input_id"].to_string() != "" ? " id=\"" + html_escape(context.props["search_input_id"].to_string()) + "\"" : "" ?> name="<?= first(context.props["search_input_name"].to_string(), "search") ?>" class="ws-search-input" placeholder="<?= first(context.props["search_placeholder"].to_string(), "Search...") ?>" autocomplete="off">
</div>
</div>
</>
@@ -115,8 +115,8 @@ COMPONENT:SIDEBAR_TOOLBAR(Request& context)
COMPONENT:STATUS_PILL(Request& context)
{
String variant = to_lower(first(context.call["variant"].to_string(), "neutral"));
String variant = to_lower(first(context.props["variant"].to_string(), "neutral"));
<>
<span class="ws-status-pill ws-status-pill-<?= variant ?><?= context.call["class"].to_string() != "" ? " " + html_escape(context.call["class"].to_string()) : "" ?>"><?= first(context.call["label"].to_string(), context.call["text"].to_string()) ?></span>
<span class="ws-status-pill ws-status-pill-<?= variant ?><?= context.props["class"].to_string() != "" ? " " + html_escape(context.props["class"].to_string()) : "" ?>"><?= first(context.props["label"].to_string(), context.props["text"].to_string()) ?></span>
</>
}
+3 -3
View File
@@ -206,7 +206,7 @@ String app_html_class(Request& context)
String app_page_main_html(Request& context)
{
String main_html = context.call["main_html"].to_string();
String main_html = context.props["main_html"].to_string();
if(main_html == "")
main_html = context.var["app"]["fragments"]["main"].to_string();
return(main_html);
@@ -236,9 +236,9 @@ bool app_request_embed_mode(Request& context)
bool app_page_embed_mode(Request& context)
{
String embed_value = context.call["embed_mode"].to_string();
String embed_value = context.props["embed_mode"].to_string();
if(embed_value != "")
return(app_bool_value(context.call["embed_mode"]));
return(app_bool_value(context.props["embed_mode"]));
return(app_request_embed_mode(context));
}
@@ -5,8 +5,8 @@ COMPONENT(Request& context)
starter_boot(context);
context.header["Content-Type"] = "application/json";
context.header["Cache-Control"] = "no-cache, no-store, must-revalidate";
if(context.call["json"].get_type_name() == "array")
print(json_encode(context.call["json"]));
if(context.props["json"].get_type_name() == "array")
print(json_encode(context.props["json"]));
else if(context.var["starter"]["json"].get_type_name() == "array")
print(json_encode(context.var["starter"]["json"]));
else
+1 -1
View File
@@ -20,7 +20,7 @@ RENDER(Request& context)
</div>
<pre class="code-block"><code>COMPONENT:HERO_SECTION(Request&amp; context)
{
String title = first(context.call["title"].to_string(), "Welcome");
String title = first(context.props["title"].to_string(), "Welcome");
&lt;&gt;
&lt;div class="hero-section"&gt;...&lt;/div&gt;
&lt;/&gt;