| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
use std::collections::HashMap; |
| 28 |
use std::fmt::Write as _; |
| 29 |
|
| 30 |
use makeover_layout as layout; |
| 31 |
|
| 32 |
|
| 33 |
use makeover_layout::Intent as _; |
| 34 |
use makeover_webview::figure::figure_html; |
| 35 |
use makeover_webview::form::{Filling, Markup, Value, escape, field_html}; |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
use makeover_webview::{Emit, class, option_class}; |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
use makeover_webview::list::{ |
| 47 |
Cell as Emitted, cell_part_class, cells_html, column_classes, part_class, |
| 48 |
}; |
| 49 |
use makeover_webview::meter::meter_html; |
| 50 |
use makeover_webview::placeholder::placeholder_html; |
| 51 |
use quasi_router::screen::{Act, Cell, Cells, Destination, Field, Node, Row, Slot, Tag}; |
| 52 |
use quasi_router::{Action, Method, Params}; |
| 53 |
|
| 54 |
|
| 55 |
fn class_attr(names: &[&str], opts: &Emit, out: &mut String) { |
| 56 |
out.push_str(" class=\""); |
| 57 |
for (i, name) in names.iter().enumerate() { |
| 58 |
if i > 0 { |
| 59 |
out.push(' '); |
| 60 |
} |
| 61 |
out.push_str(&escape(&class(name, opts))); |
| 62 |
} |
| 63 |
out.push('"'); |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
fn tone_attr(tone: layout::Tone, out: &mut String) { |
| 80 |
if matches!(tone, layout::Tone::Neutral) { |
| 81 |
return; |
| 82 |
} |
| 83 |
out.push_str(" data-tone=\""); |
| 84 |
out.push_str(tone.token()); |
| 85 |
out.push('"'); |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
fn refill(field: &Field) -> Value<'_> { |
| 101 |
if field.kind == layout::FieldKind::Secret { |
| 102 |
return Value::Absent; |
| 103 |
} |
| 104 |
match field.value.as_deref() { |
| 105 |
None => Value::Absent, |
| 106 |
Some(_) if field.kind == layout::FieldKind::Checkbox => Value::On(true), |
| 107 |
Some(value) => Value::Text(value), |
| 108 |
} |
| 109 |
} |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
fn field_group_html(field: &Field, morphs: bool, opts: &Emit, out: &mut String) { |
| 124 |
let filling = Filling::of(refill(field)); |
| 125 |
let writes = field.changes.as_ref(); |
| 126 |
|
| 127 |
if let Some(action) = writes { |
| 128 |
out.push_str("<div"); |
| 129 |
class_attr(&["field-writes"], opts, out); |
| 130 |
action_attrs(action, Fires::ChangeInside, None, morphs, None, out); |
| 131 |
out.push('>'); |
| 132 |
} |
| 133 |
|
| 134 |
field.with_layout(|borrowed| { |
| 135 |
out.push_str(&field_html(&borrowed, &filling, opts)); |
| 136 |
}); |
| 137 |
|
| 138 |
if writes.is_some() { |
| 139 |
out.push_str("</div>"); |
| 140 |
} |
| 141 |
} |
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
fn rich_html(source: &str) -> String { |
| 158 |
docengine::render_strict(source) |
| 159 |
} |
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
fn json_string(text: &str, out: &mut String) { |
| 169 |
out.push('"'); |
| 170 |
for ch in text.chars() { |
| 171 |
match ch { |
| 172 |
'"' => out.push_str("\\\""), |
| 173 |
'\\' => out.push_str("\\\\"), |
| 174 |
'\n' => out.push_str("\\n"), |
| 175 |
'\r' => out.push_str("\\r"), |
| 176 |
'\t' => out.push_str("\\t"), |
| 177 |
c if (c as u32) < 0x20 => { |
| 178 |
let _ = write!(out, "\\u{:04x}", c as u32); |
| 179 |
} |
| 180 |
c => out.push(c), |
| 181 |
} |
| 182 |
} |
| 183 |
out.push('"'); |
| 184 |
} |
| 185 |
|
| 186 |
|
| 187 |
fn json_object(params: &Params) -> String { |
| 188 |
let mut json = String::from("{"); |
| 189 |
for (i, (name, value)) in params.iter().enumerate() { |
| 190 |
if i > 0 { |
| 191 |
json.push(','); |
| 192 |
} |
| 193 |
json_string(name, &mut json); |
| 194 |
json.push(':'); |
| 195 |
json_string(value, &mut json); |
| 196 |
} |
| 197 |
json.push('}'); |
| 198 |
json |
| 199 |
} |
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
#[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 207 |
pub(crate) enum Fires<'a> { |
| 208 |
|
| 209 |
Click, |
| 210 |
|
| 211 |
|
| 212 |
Change, |
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
ChangeInside, |
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
Key(&'a str), |
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
ClickBeside, |
| 237 |
} |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
pub(crate) fn action_attrs( |
| 261 |
action: &Action, |
| 262 |
fires: Fires, |
| 263 |
confirm: Option<&str>, |
| 264 |
morphs: bool, |
| 265 |
gathers: Option<&str>, |
| 266 |
out: &mut String, |
| 267 |
) { |
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
if let Destination::External(url) = &action.destination { |
| 273 |
out.push_str(" href=\""); |
| 274 |
out.push_str(&escape(url)); |
| 275 |
out.push_str("\" target=\"_blank\" rel=\"noopener noreferrer\""); |
| 276 |
return; |
| 277 |
} |
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
if let Destination::Route(path) = &action.destination |
| 286 |
&& !action.method.mutates() |
| 287 |
{ |
| 288 |
out.push_str(" href=\""); |
| 289 |
out.push_str(&escape(&quasi_http::route_url(path, &action.carried))); |
| 290 |
out.push('"'); |
| 291 |
} |
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
if let Some(selector) = gathers { |
| 302 |
out.push_str(" hx-include=\""); |
| 303 |
out.push_str(&escape(selector)); |
| 304 |
out.push('"'); |
| 305 |
} |
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
if let Some(region) = &action.replaces { |
| 311 |
out.push_str(" hx-target=\"#"); |
| 312 |
out.push_str(&escape(region)); |
| 313 |
out.push('"'); |
| 314 |
} |
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
if let Some(filename) = &action.saves { |
| 324 |
if is_link(action) { |
| 325 |
out.push_str(" download=\""); |
| 326 |
} else { |
| 327 |
out.push_str(" data-saves=\""); |
| 328 |
} |
| 329 |
out.push_str(&escape(filename)); |
| 330 |
out.push('"'); |
| 331 |
} |
| 332 |
|
| 333 |
let verb = match action.method { |
| 334 |
Method::Get => " hx-get=\"", |
| 335 |
Method::Post => " hx-post=\"", |
| 336 |
Method::Delete => " hx-delete=\"", |
| 337 |
Method::Put => " hx-put=\"", |
| 338 |
}; |
| 339 |
out.push_str(verb); |
| 340 |
out.push_str(&escape(&quasi_http::route_url( |
| 341 |
action.destination.as_str(), |
| 342 |
&action.carried, |
| 343 |
))); |
| 344 |
out.push('"'); |
| 345 |
|
| 346 |
if !action.params.is_empty() { |
| 347 |
out.push_str(" hx-vals=\""); |
| 348 |
out.push_str(&escape(&json_object(&action.params))); |
| 349 |
out.push('"'); |
| 350 |
} |
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
match fires { |
| 355 |
Fires::Click => {} |
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
Fires::ClickBeside => out.push_str(concat!( |
| 360 |
" hx-trigger=\"click[!event.target.closest(", |
| 361 |
"'[data-act]')]\"" |
| 362 |
)), |
| 363 |
Fires::Change => out.push_str(" hx-trigger=\"change\""), |
| 364 |
Fires::Key(filter) => { |
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
out.push_str(" hx-trigger=\"keydown["); |
| 369 |
out.push_str(&escape(filter)); |
| 370 |
out.push_str("] from:body\""); |
| 371 |
} |
| 372 |
Fires::ChangeInside => { |
| 373 |
out.push_str(" hx-trigger=\"change\""); |
| 374 |
out.push_str(" hx-include=\"find input, find select, find textarea\""); |
| 375 |
} |
| 376 |
} |
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
if let Some(prompt) = confirm { |
| 383 |
out.push_str(" hx-confirm=\""); |
| 384 |
out.push_str(&escape(prompt)); |
| 385 |
out.push('"'); |
| 386 |
} |
| 387 |
|
| 388 |
if morphs { |
| 389 |
|
| 390 |
|
| 391 |
out.push_str(" hx-swap=\"morph\""); |
| 392 |
} |
| 393 |
} |
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
const fn is_link(action: &Action) -> bool { |
| 405 |
action.destination.is_external() || !action.method.mutates() |
| 406 |
} |
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
const fn control_tag(action: &Action) -> (&'static str, &'static str) { |
| 420 |
if is_link(action) { |
| 421 |
("<a", "</a>") |
| 422 |
} else { |
| 423 |
("<button type=\"button\"", "</button>") |
| 424 |
} |
| 425 |
} |
| 426 |
|
| 427 |
|
| 428 |
pub(crate) fn act_html(act: &Act, morphs: bool, opts: &Emit, out: &mut String) { |
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
let gathered = class("row-select", opts); |
| 436 |
let gathers = act.over.as_ref().map(|_| format!(".{gathered}")); |
| 437 |
let gathers = gathers.as_deref(); |
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
let (open, close) = control_tag(&act.action); |
| 445 |
out.push_str(open); |
| 446 |
class_attr(&["button"], opts, out); |
| 447 |
tone_attr(act.tone, out); |
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
out.push_str(" data-act"); |
| 453 |
|
| 454 |
match act.state { |
| 455 |
Some(layout::State::Disabled) => { |
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
if is_link(&act.action) { |
| 466 |
out.push_str(" aria-disabled=\"true\""); |
| 467 |
} else { |
| 468 |
out.push_str(" disabled"); |
| 469 |
} |
| 470 |
} |
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
_ => action_attrs( |
| 480 |
&act.action, |
| 481 |
Fires::Click, |
| 482 |
act.confirm.as_deref(), |
| 483 |
morphs, |
| 484 |
gathers, |
| 485 |
out, |
| 486 |
), |
| 487 |
} |
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
if let Some(key) = &act.key { |
| 494 |
out.push_str(" accesskey=\""); |
| 495 |
out.push_str(&escape(key)); |
| 496 |
out.push('"'); |
| 497 |
} |
| 498 |
|
| 499 |
out.push('>'); |
| 500 |
out.push_str(&escape(&act.label)); |
| 501 |
out.push_str(close); |
| 502 |
} |
| 503 |
|
| 504 |
|
| 505 |
fn row_html(row: &Row, morphs: bool, opts: &Emit, out: &mut String) { |
| 506 |
let mut classes = vec!["row"]; |
| 507 |
if row.current { |
| 508 |
classes.push("row-current"); |
| 509 |
} |
| 510 |
if row.selected == Some(true) { |
| 511 |
classes.push("row-selected"); |
| 512 |
} |
| 513 |
|
| 514 |
out.push_str("<li"); |
| 515 |
class_attr(&classes, opts, out); |
| 516 |
if row.current { |
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
out.push_str(" aria-current=\"true\""); |
| 521 |
} |
| 522 |
out.push('>'); |
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
if let Some(ticked) = row.selected { |
| 529 |
out.push_str("<input type=\"checkbox\""); |
| 530 |
class_attr(&["row-select"], opts, out); |
| 531 |
if ticked { |
| 532 |
out.push_str(" checked"); |
| 533 |
} |
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
if let Some(value) = &row.value { |
| 543 |
out.push_str(" name=\""); |
| 544 |
out.push_str(&escape(quasi_router::Node::TICKED)); |
| 545 |
out.push_str("\" value=\""); |
| 546 |
out.push_str(&escape(value)); |
| 547 |
out.push('"'); |
| 548 |
} |
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
if let Some(action) = &row.toggle { |
| 555 |
action_attrs(action, Fires::Change, None, morphs, None, out); |
| 556 |
} |
| 557 |
out.push_str(" aria-label=\"Select\">"); |
| 558 |
} |
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
let mut rest = row.parts.as_slice(); |
| 570 |
while let Some(head) = rest.first() { |
| 571 |
let role = head.role; |
| 572 |
let taken = rest.iter().take_while(|part| part.role == role).count(); |
| 573 |
let (group, tail) = rest.split_at(taken); |
| 574 |
row_part_html(row, role, group, morphs, opts, out); |
| 575 |
rest = tail; |
| 576 |
} |
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
if !row.menu.is_empty() { |
| 583 |
out.push_str("<div"); |
| 584 |
class_attr(&["row-menu"], opts, out); |
| 585 |
|
| 586 |
|
| 587 |
out.push_str(" data-menu=\"row\" hidden>"); |
| 588 |
for act in &row.menu { |
| 589 |
act_html(act, morphs, opts, out); |
| 590 |
} |
| 591 |
out.push_str("</div>"); |
| 592 |
} |
| 593 |
|
| 594 |
out.push_str("</li>"); |
| 595 |
} |
| 596 |
|
| 597 |
|
| 598 |
fn row_part_html( |
| 599 |
row: &Row, |
| 600 |
role: layout::RowPart, |
| 601 |
group: &[quasi_router::Part], |
| 602 |
morphs: bool, |
| 603 |
opts: &Emit, |
| 604 |
out: &mut String, |
| 605 |
) { |
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
let activates = role == layout::RowPart::Primary && row.activate.is_some(); |
| 612 |
|
| 613 |
let close = if let (true, Some(action)) = (activates, row.activate.as_ref()) { |
| 614 |
let (open, close) = control_tag(action); |
| 615 |
out.push_str(open); |
| 616 |
class_attr(&["row-activate"], opts, out); |
| 617 |
action_attrs(action, Fires::Click, None, morphs, None, out); |
| 618 |
out.push('>'); |
| 619 |
close |
| 620 |
} else { |
| 621 |
out.push_str("<span"); |
| 622 |
class_attr(&[part_class(role)], opts, out); |
| 623 |
out.push('>'); |
| 624 |
"</span>" |
| 625 |
}; |
| 626 |
|
| 627 |
for part in group { |
| 628 |
row_inline_html(&part.node, morphs, opts, out); |
| 629 |
} |
| 630 |
|
| 631 |
out.push_str(close); |
| 632 |
} |
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
|
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
fn row_inline_html(node: &Node, morphs: bool, opts: &Emit, out: &mut String) { |
| 654 |
match node { |
| 655 |
Node::Text { text, .. } => out.push_str(&escape(text)), |
| 656 |
Node::Rich { source } => out.push_str(&docengine::render_phrase(source)), |
| 657 |
Node::Token(tag) => tag_html(tag, morphs, opts, out), |
| 658 |
Node::Act(act) => act_html(act, morphs, opts, out), |
| 659 |
Node::Meter(meter) => out.push_str(&meter_html(&meter.as_layout(), opts)), |
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
other => node_html(other, morphs, opts, &HashMap::new(), out), |
| 668 |
} |
| 669 |
} |
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
|
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
fn cell_run_html(cell: &Cell, morphs: bool, opts: &Emit) -> String { |
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
if let [Node::Text { text, .. }] = cell.parts.as_slice() { |
| 692 |
return escape(text); |
| 693 |
} |
| 694 |
|
| 695 |
let mut out = String::new(); |
| 696 |
let mut rest = cell.parts.as_slice(); |
| 697 |
while let Some((head, tail)) = rest.split_first() { |
| 698 |
match head { |
| 699 |
Node::Text { text, .. } => { |
| 700 |
out.push_str("<span"); |
| 701 |
class_attr(&[cell_part_class(layout::CellPart::Value)], opts, &mut out); |
| 702 |
out.push('>'); |
| 703 |
out.push_str(&escape(text)); |
| 704 |
out.push_str("</span>"); |
| 705 |
rest = tail; |
| 706 |
} |
| 707 |
|
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
Node::Link { text, action } => { |
| 716 |
let (open, close) = control_tag(action); |
| 717 |
out.push_str(open); |
| 718 |
class_attr(&[cell_part_class(layout::CellPart::Link)], opts, &mut out); |
| 719 |
out.push_str(" data-act"); |
| 720 |
action_attrs(action, Fires::Click, None, morphs, None, &mut out); |
| 721 |
out.push('>'); |
| 722 |
out.push_str(&escape(text)); |
| 723 |
out.push_str(close); |
| 724 |
rest = tail; |
| 725 |
} |
| 726 |
Node::Token(_) => { |
| 727 |
let run = rest.iter().take_while(|p| matches!(p, Node::Token(_))); |
| 728 |
out.push_str("<span"); |
| 729 |
class_attr(&[cell_part_class(layout::CellPart::Tokens)], opts, &mut out); |
| 730 |
out.push('>'); |
| 731 |
let mut taken = 0; |
| 732 |
for part in run { |
| 733 |
if let Node::Token(tag) = part { |
| 734 |
tag_html(tag, morphs, opts, &mut out); |
| 735 |
} |
| 736 |
taken += 1; |
| 737 |
} |
| 738 |
out.push_str("</span>"); |
| 739 |
rest = &rest[taken..]; |
| 740 |
} |
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
Node::Act(_) => { |
| 746 |
let run = rest.iter().take_while(|p| matches!(p, Node::Act(_))); |
| 747 |
out.push_str("<span"); |
| 748 |
class_attr( |
| 749 |
&[cell_part_class(layout::CellPart::Actions)], |
| 750 |
opts, |
| 751 |
&mut out, |
| 752 |
); |
| 753 |
out.push('>'); |
| 754 |
let mut taken = 0; |
| 755 |
for part in run { |
| 756 |
if let Node::Act(act) = part { |
| 757 |
act_html(act, morphs, opts, &mut out); |
| 758 |
} |
| 759 |
taken += 1; |
| 760 |
} |
| 761 |
out.push_str("</span>"); |
| 762 |
rest = &rest[taken..]; |
| 763 |
} |
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
other => { |
| 769 |
|
| 770 |
|
| 771 |
node_html(other, morphs, opts, &HashMap::new(), &mut out); |
| 772 |
rest = tail; |
| 773 |
} |
| 774 |
} |
| 775 |
} |
| 776 |
out |
| 777 |
} |
| 778 |
|
| 779 |
|
| 780 |
fn cells_row_html( |
| 781 |
cells: &Cells, |
| 782 |
columns: &[quasi_router::screen::Column], |
| 783 |
morphs: bool, |
| 784 |
opts: &Emit, |
| 785 |
out: &mut String, |
| 786 |
) { |
| 787 |
let mut classes = vec!["table-row"]; |
| 788 |
if cells.current { |
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
classes.push("table-row-current"); |
| 793 |
} |
| 794 |
|
| 795 |
out.push_str("<div role=\"row\""); |
| 796 |
class_attr(&classes, opts, out); |
| 797 |
if cells.current { |
| 798 |
out.push_str(" aria-current=\"true\""); |
| 799 |
} |
| 800 |
if let Some(action) = &cells.activate { |
| 801 |
|
| 802 |
|
| 803 |
|
| 804 |
|
| 805 |
let carries_control = cells.values.iter().any(Cell::carries_control); |
| 806 |
let fires = if carries_control { |
| 807 |
Fires::ClickBeside |
| 808 |
} else { |
| 809 |
Fires::Click |
| 810 |
}; |
| 811 |
action_attrs(action, fires, None, morphs, None, out); |
| 812 |
} |
| 813 |
out.push('>'); |
| 814 |
|
| 815 |
|
| 816 |
|
| 817 |
|
| 818 |
|
| 819 |
|
| 820 |
let filled: Vec<String> = cells |
| 821 |
.values |
| 822 |
.iter() |
| 823 |
.map(|cell| cell_run_html(cell, morphs, opts)) |
| 824 |
.collect(); |
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
let parts: Vec<Option<layout::CellPart>> = cells |
| 832 |
.values |
| 833 |
.iter() |
| 834 |
.map(|cell| { |
| 835 |
matches!(cell.parts.as_slice(), [Node::Text { .. }]).then_some(layout::CellPart::Value) |
| 836 |
}) |
| 837 |
.collect(); |
| 838 |
let borrowed: Vec<layout::Column<'_>> = columns |
| 839 |
.iter() |
| 840 |
.map(quasi_router::screen::Column::as_layout) |
| 841 |
.collect(); |
| 842 |
let cells: Vec<Emitted<'_>> = borrowed |
| 843 |
.iter() |
| 844 |
.zip(filled.iter()) |
| 845 |
.zip(parts) |
| 846 |
.map(|((column, value), part)| Emitted { |
| 847 |
column: column.name, |
| 848 |
part, |
| 849 |
content: Markup(value), |
| 850 |
}) |
| 851 |
.collect(); |
| 852 |
out.push_str(&cells_html(&borrowed, &cells, opts)); |
| 853 |
|
| 854 |
out.push_str("</div>"); |
| 855 |
} |
| 856 |
|
| 857 |
|
| 858 |
pub(crate) fn node_html( |
| 859 |
node: &Node, |
| 860 |
morphs: bool, |
| 861 |
opts: &Emit, |
| 862 |
fills: &HashMap<String, String>, |
| 863 |
out: &mut String, |
| 864 |
) { |
| 865 |
match node { |
| 866 |
Node::Heading { level, text } => { |
| 867 |
let tag = match level { |
| 868 |
layout::Heading::Page => "h1", |
| 869 |
layout::Heading::Section => "h2", |
| 870 |
layout::Heading::Subsection => "h3", |
| 871 |
}; |
| 872 |
let _ = write!(out, "<{tag}"); |
| 873 |
class_attr(&["heading"], opts, out); |
| 874 |
out.push('>'); |
| 875 |
out.push_str(&escape(text)); |
| 876 |
let _ = write!(out, "</{tag}>"); |
| 877 |
} |
| 878 |
|
| 879 |
Node::Text { text, tone } => { |
| 880 |
out.push_str("<p"); |
| 881 |
class_attr(&["text"], opts, out); |
| 882 |
tone_attr(*tone, out); |
| 883 |
out.push('>'); |
| 884 |
out.push_str(&escape(text)); |
| 885 |
out.push_str("</p>"); |
| 886 |
} |
| 887 |
|
| 888 |
Node::StandIn { |
| 889 |
state, |
| 890 |
message, |
| 891 |
act, |
| 892 |
} => { |
| 893 |
|
| 894 |
|
| 895 |
|
| 896 |
|
| 897 |
let mut way_out = String::new(); |
| 898 |
if let Some(act) = act { |
| 899 |
act_html(act, morphs, opts, &mut way_out); |
| 900 |
} |
| 901 |
out.push_str(&placeholder_html( |
| 902 |
*state, |
| 903 |
message, |
| 904 |
(!way_out.is_empty()).then_some(Markup(way_out.as_str())), |
| 905 |
opts, |
| 906 |
)); |
| 907 |
} |
| 908 |
|
| 909 |
Node::Rich { source } => { |
| 910 |
out.push_str("<div"); |
| 911 |
class_attr(&["rich"], opts, out); |
| 912 |
out.push('>'); |
| 913 |
out.push_str(&rich_html(source)); |
| 914 |
out.push_str("</div>"); |
| 915 |
} |
| 916 |
|
| 917 |
Node::Act(act) => act_html(act, morphs, opts, out), |
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
|
| 922 |
Node::Link { text, action } => { |
| 923 |
let (open, close) = control_tag(action); |
| 924 |
out.push_str(open); |
| 925 |
class_attr(&["link"], opts, out); |
| 926 |
out.push_str(" data-act"); |
| 927 |
action_attrs(action, Fires::Click, None, morphs, None, out); |
| 928 |
out.push('>'); |
| 929 |
out.push_str(&escape(text)); |
| 930 |
out.push_str(close); |
| 931 |
} |
| 932 |
|
| 933 |
Node::Token(tag) => tag_html(tag, morphs, opts, out), |
| 934 |
|
| 935 |
|
| 936 |
|
| 937 |
Node::Figure(figure) => { |
| 938 |
out.push_str(&figure_html(&figure.as_layout(), opts)); |
| 939 |
} |
| 940 |
|
| 941 |
Node::Notice { kind, tone, text } => { |
| 942 |
out.push_str("<div"); |
| 943 |
class_attr( |
| 944 |
&[match kind { |
| 945 |
layout::Notice::Toast => "toast", |
| 946 |
layout::Notice::Banner => "banner", |
| 947 |
}], |
| 948 |
opts, |
| 949 |
out, |
| 950 |
); |
| 951 |
tone_attr(*tone, out); |
| 952 |
|
| 953 |
|
| 954 |
|
| 955 |
let assertive = matches!(tone, layout::Tone::Danger | layout::Tone::Warning); |
| 956 |
if assertive { |
| 957 |
out.push_str(" role=\"alert\""); |
| 958 |
} else { |
| 959 |
out.push_str(" role=\"status\" aria-live=\"polite\""); |
| 960 |
} |
| 961 |
out.push('>'); |
| 962 |
out.push_str(&escape(text)); |
| 963 |
out.push_str("</div>"); |
| 964 |
} |
| 965 |
|
| 966 |
Node::Field(field) => field_group_html(field, morphs, opts, out), |
| 967 |
|
| 968 |
Node::Form { |
| 969 |
action, |
| 970 |
submit, |
| 971 |
fields, |
| 972 |
} => { |
| 973 |
out.push_str("<form"); |
| 974 |
class_attr(&["form"], opts, out); |
| 975 |
action_attrs(action, Fires::Click, None, morphs, None, out); |
| 976 |
out.push('>'); |
| 977 |
for field in fields { |
| 978 |
field_group_html(field, morphs, opts, out); |
| 979 |
} |
| 980 |
out.push_str("<button type=\"submit\""); |
| 981 |
class_attr(&["button", "act-submit"], opts, out); |
| 982 |
out.push('>'); |
| 983 |
out.push_str(&escape(submit)); |
| 984 |
out.push_str("</button></form>"); |
| 985 |
} |
| 986 |
|
| 987 |
Node::List { rows, more } => { |
| 988 |
out.push_str("<ul"); |
| 989 |
class_attr(&["list"], opts, out); |
| 990 |
out.push('>'); |
| 991 |
for row in rows { |
| 992 |
row_html(row, morphs, opts, out); |
| 993 |
} |
| 994 |
out.push_str("</ul>"); |
| 995 |
|
| 996 |
|
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
if let Some(rest) = more { |
| 1001 |
out.push_str("<div"); |
| 1002 |
class_attr(&["rest"], opts, out); |
| 1003 |
out.push('>'); |
| 1004 |
|
| 1005 |
let (open, close) = control_tag(&rest.action); |
| 1006 |
out.push_str(open); |
| 1007 |
class_attr(&["button", "rest-more"], opts, out); |
| 1008 |
action_attrs(&rest.action, Fires::Click, None, morphs, None, out); |
| 1009 |
out.push('>'); |
| 1010 |
match rest.remaining { |
| 1011 |
Some(n) => { |
| 1012 |
out.push_str("Show more ("); |
| 1013 |
out.push_str(&n.to_string()); |
| 1014 |
out.push_str(" remaining)"); |
| 1015 |
} |
| 1016 |
None => out.push_str("Show more"), |
| 1017 |
} |
| 1018 |
out.push_str(close); |
| 1019 |
out.push_str("</div>"); |
| 1020 |
} |
| 1021 |
} |
| 1022 |
|
| 1023 |
Node::Table { columns, rows } => { |
| 1024 |
let borrowed: Vec<layout::Column<'_>> = columns |
| 1025 |
.iter() |
| 1026 |
.map(quasi_router::screen::Column::as_layout) |
| 1027 |
.collect(); |
| 1028 |
|
| 1029 |
|
| 1030 |
|
| 1031 |
|
| 1032 |
|
| 1033 |
|
| 1034 |
|
| 1035 |
|
| 1036 |
|
| 1037 |
out.push_str("<div role=\"table\""); |
| 1038 |
class_attr(&["table"], opts, out); |
| 1039 |
out.push('>'); |
| 1040 |
|
| 1041 |
out.push_str("<div role=\"row\""); |
| 1042 |
class_attr(&["table-head"], opts, out); |
| 1043 |
out.push('>'); |
| 1044 |
for (column, described) in borrowed.iter().zip(columns) { |
| 1045 |
out.push_str("<span role=\"columnheader\""); |
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
|
| 1050 |
|
| 1051 |
out.push_str(" class=\""); |
| 1052 |
out.push_str(&escape(&class("table-heading", opts))); |
| 1053 |
out.push(' '); |
| 1054 |
out.push_str(&escape(&column_classes(column, opts))); |
| 1055 |
out.push('"'); |
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
if let Some(sort) = column.sorted { |
| 1060 |
out.push_str(" aria-sort=\""); |
| 1061 |
out.push_str(sort.as_str()); |
| 1062 |
out.push('"'); |
| 1063 |
} |
| 1064 |
if column.sortable { |
| 1065 |
out.push_str(" data-sortable"); |
| 1066 |
} |
| 1067 |
out.push('>'); |
| 1068 |
match &described.reorder { |
| 1069 |
|
| 1070 |
|
| 1071 |
|
| 1072 |
|
| 1073 |
Some(action) => { |
| 1074 |
let (open, close) = control_tag(action); |
| 1075 |
out.push_str(open); |
| 1076 |
class_attr(&["table-sort"], opts, out); |
| 1077 |
action_attrs(action, Fires::Click, None, morphs, None, out); |
| 1078 |
out.push('>'); |
| 1079 |
out.push_str(&escape(column.name)); |
| 1080 |
out.push_str(close); |
| 1081 |
} |
| 1082 |
None => out.push_str(&escape(column.name)), |
| 1083 |
} |
| 1084 |
out.push_str("</span>"); |
| 1085 |
} |
| 1086 |
out.push_str("</div>"); |
| 1087 |
|
| 1088 |
for cells in rows { |
| 1089 |
cells_row_html(cells, columns, morphs, opts, out); |
| 1090 |
} |
| 1091 |
out.push_str("</div>"); |
| 1092 |
} |
| 1093 |
|
| 1094 |
Node::Select { |
| 1095 |
kind, |
| 1096 |
options, |
| 1097 |
chosen, |
| 1098 |
action, |
| 1099 |
} => select_html( |
| 1100 |
*kind, |
| 1101 |
options, |
| 1102 |
chosen.as_deref(), |
| 1103 |
action.as_ref(), |
| 1104 |
morphs, |
| 1105 |
opts, |
| 1106 |
out, |
| 1107 |
), |
| 1108 |
|
| 1109 |
|
| 1110 |
|
| 1111 |
|
| 1112 |
|
| 1113 |
Node::Meter(meter) => out.push_str(&meter_html(&meter.as_layout(), opts)), |
| 1114 |
|
| 1115 |
|
| 1116 |
|
| 1117 |
|
| 1118 |
|
| 1119 |
Node::Stats { figures } => { |
| 1120 |
out.push_str("<div"); |
| 1121 |
class_attr(&["figures"], opts, out); |
| 1122 |
out.push('>'); |
| 1123 |
for (figure, action) in figures { |
| 1124 |
match action { |
| 1125 |
Some(action) => { |
| 1126 |
let (open, close) = control_tag(action); |
| 1127 |
out.push_str(open); |
| 1128 |
class_attr(&["figure-act"], opts, out); |
| 1129 |
action_attrs(action, Fires::Click, None, morphs, None, out); |
| 1130 |
out.push('>'); |
| 1131 |
out.push_str(&figure_html(&figure.as_layout(), opts)); |
| 1132 |
out.push_str(close); |
| 1133 |
} |
| 1134 |
None => out.push_str(&figure_html(&figure.as_layout(), opts)), |
| 1135 |
} |
| 1136 |
} |
| 1137 |
out.push_str("</div>"); |
| 1138 |
} |
| 1139 |
|
| 1140 |
Node::Region(slot) => slot_html(slot, morphs, opts, fills, out), |
| 1141 |
} |
| 1142 |
} |
| 1143 |
|
| 1144 |
|
| 1145 |
|
| 1146 |
|
| 1147 |
|
| 1148 |
|
| 1149 |
fn tag_html(tag: &Tag, morphs: bool, opts: &Emit, out: &mut String) { |
| 1150 |
let Tag { |
| 1151 |
kind, |
| 1152 |
label, |
| 1153 |
tone, |
| 1154 |
latched, |
| 1155 |
action, |
| 1156 |
} = tag; |
| 1157 |
let (kind, tone, latched) = (*kind, *tone, *latched); |
| 1158 |
let action = action.as_ref(); |
| 1159 |
|
| 1160 |
let mut classes = vec![match kind { |
| 1161 |
layout::Token::Badge => "badge", |
| 1162 |
layout::Token::Chip { .. } => "chip", |
| 1163 |
}]; |
| 1164 |
|
| 1165 |
|
| 1166 |
|
| 1167 |
|
| 1168 |
if latched { |
| 1169 |
classes.push("latched"); |
| 1170 |
} |
| 1171 |
|
| 1172 |
|
| 1173 |
|
| 1174 |
|
| 1175 |
let interactive = kind.interactive() && action.is_some(); |
| 1176 |
let close = if interactive { |
| 1177 |
|
| 1178 |
|
| 1179 |
|
| 1180 |
let (open, close) = action.map_or(("<span", "</span>"), control_tag); |
| 1181 |
out.push_str(open); |
| 1182 |
close |
| 1183 |
} else { |
| 1184 |
out.push_str("<span"); |
| 1185 |
"</span>" |
| 1186 |
}; |
| 1187 |
class_attr(&classes, opts, out); |
| 1188 |
tone_attr(tone, out); |
| 1189 |
|
| 1190 |
if interactive { |
| 1191 |
|
| 1192 |
|
| 1193 |
|
| 1194 |
|
| 1195 |
out.push_str(" data-act"); |
| 1196 |
if latched { |
| 1197 |
|
| 1198 |
|
| 1199 |
|
| 1200 |
|
| 1201 |
|
| 1202 |
|
| 1203 |
if action.is_some_and(is_link) { |
| 1204 |
out.push_str(" aria-current=\"true\""); |
| 1205 |
} else { |
| 1206 |
out.push_str(" aria-pressed=\"true\""); |
| 1207 |
} |
| 1208 |
} |
| 1209 |
if let Some(action) = action { |
| 1210 |
action_attrs(action, Fires::Click, None, morphs, None, out); |
| 1211 |
} |
| 1212 |
} |
| 1213 |
|
| 1214 |
out.push('>'); |
| 1215 |
out.push_str(&escape(label)); |
| 1216 |
if matches!(kind, layout::Token::Chip { removable: true }) { |
| 1217 |
out.push_str("<span"); |
| 1218 |
class_attr(&["chip-remove"], opts, out); |
| 1219 |
out.push_str(" aria-hidden=\"true\"></span>"); |
| 1220 |
} |
| 1221 |
out.push_str(close); |
| 1222 |
} |
| 1223 |
|
| 1224 |
|
| 1225 |
|
| 1226 |
|
| 1227 |
|
| 1228 |
|
| 1229 |
|
| 1230 |
|
| 1231 |
|
| 1232 |
|
| 1233 |
|
| 1234 |
|
| 1235 |
|
| 1236 |
|
| 1237 |
|
| 1238 |
|
| 1239 |
|
| 1240 |
|
| 1241 |
|
| 1242 |
fn select_html( |
| 1243 |
kind: layout::Selector, |
| 1244 |
options: &[(quasi_router::screen::Choice, Option<Action>)], |
| 1245 |
chosen: Option<&str>, |
| 1246 |
action: Option<&Action>, |
| 1247 |
morphs: bool, |
| 1248 |
opts: &Emit, |
| 1249 |
out: &mut String, |
| 1250 |
) { |
| 1251 |
out.push_str("<div"); |
| 1252 |
class_attr(&["selector"], opts, out); |
| 1253 |
out.push_str(" data-selector=\""); |
| 1254 |
out.push_str(option_class(kind)); |
| 1255 |
out.push('"'); |
| 1256 |
|
| 1257 |
|
| 1258 |
if matches!(kind, layout::Selector::Tabs) { |
| 1259 |
out.push_str(" role=\"tablist\""); |
| 1260 |
} else { |
| 1261 |
out.push_str(" role=\"group\""); |
| 1262 |
} |
| 1263 |
out.push('>'); |
| 1264 |
|
| 1265 |
for (option, own) in options { |
| 1266 |
let picked = chosen.is_some_and(|value| value == option.value); |
| 1267 |
|
| 1268 |
let mut classes = vec![option_class(kind)]; |
| 1269 |
if picked { |
| 1270 |
classes.push("chosen"); |
| 1271 |
} |
| 1272 |
|
| 1273 |
|
| 1274 |
|
| 1275 |
|
| 1276 |
|
| 1277 |
let (open, close) = own |
| 1278 |
.as_ref() |
| 1279 |
.map_or(("<button type=\"button\"", "</button>"), |action| { |
| 1280 |
control_tag(action) |
| 1281 |
}); |
| 1282 |
out.push_str(open); |
| 1283 |
class_attr(&classes, opts, out); |
| 1284 |
if matches!(kind, layout::Selector::Tabs) { |
| 1285 |
out.push_str(" role=\"tab\" aria-selected=\""); |
| 1286 |
out.push_str(if picked { "true\"" } else { "false\"" }); |
| 1287 |
} else if picked { |
| 1288 |
out.push_str(" aria-pressed=\"true\""); |
| 1289 |
} |
| 1290 |
|
| 1291 |
|
| 1292 |
|
| 1293 |
|
| 1294 |
|
| 1295 |
if let Some(own) = own { |
| 1296 |
action_attrs(own, Fires::Click, None, morphs, None, out); |
| 1297 |
} else if let Some(action) = action { |
| 1298 |
|
| 1299 |
|
| 1300 |
|
| 1301 |
let carrying = action.clone().with(Node::SELECTED, option.value.clone()); |
| 1302 |
action_attrs(&carrying, Fires::Click, None, morphs, None, out); |
| 1303 |
} |
| 1304 |
|
| 1305 |
out.push('>'); |
| 1306 |
out.push_str(&escape(&option.label)); |
| 1307 |
out.push_str(close); |
| 1308 |
} |
| 1309 |
|
| 1310 |
out.push_str("</div>"); |
| 1311 |
} |
| 1312 |
|
| 1313 |
|
| 1314 |
|
| 1315 |
|
| 1316 |
|
| 1317 |
|
| 1318 |
|
| 1319 |
|
| 1320 |
|
| 1321 |
|
| 1322 |
|
| 1323 |
|
| 1324 |
|
| 1325 |
|
| 1326 |
|
| 1327 |
|
| 1328 |
|
| 1329 |
|
| 1330 |
|
| 1331 |
|
| 1332 |
|
| 1333 |
|
| 1334 |
pub(crate) fn oob_html( |
| 1335 |
region: &str, |
| 1336 |
node: &Node, |
| 1337 |
morphs: bool, |
| 1338 |
opts: &Emit, |
| 1339 |
fills: &HashMap<String, String>, |
| 1340 |
out: &mut String, |
| 1341 |
) { |
| 1342 |
out.push_str("<div hx-swap-oob=\"innerHTML:#"); |
| 1343 |
|
| 1344 |
|
| 1345 |
|
| 1346 |
out.push_str(&escape(region)); |
| 1347 |
out.push_str("\">"); |
| 1348 |
node_html(node, morphs, opts, fills, out); |
| 1349 |
out.push_str("</div>"); |
| 1350 |
} |
| 1351 |
|
| 1352 |
|
| 1353 |
pub(crate) fn slot_html( |
| 1354 |
slot: &Slot, |
| 1355 |
morphs: bool, |
| 1356 |
opts: &Emit, |
| 1357 |
fills: &HashMap<String, String>, |
| 1358 |
out: &mut String, |
| 1359 |
) { |
| 1360 |
let kind = match &slot.kind { |
| 1361 |
quasi_router::RegionKind::Band => "band", |
| 1362 |
quasi_router::RegionKind::Sidebar => "sidebar", |
| 1363 |
quasi_router::RegionKind::Pane => "pane", |
| 1364 |
quasi_router::RegionKind::Split => "split", |
| 1365 |
quasi_router::RegionKind::TabGroup => "tabgroup", |
| 1366 |
quasi_router::RegionKind::Modal => "modal", |
| 1367 |
quasi_router::RegionKind::Bespoke { .. } => "bespoke", |
| 1368 |
}; |
| 1369 |
|
| 1370 |
out.push_str("<div id=\""); |
| 1371 |
|
| 1372 |
|
| 1373 |
|
| 1374 |
out.push_str(&escape(&slot.id)); |
| 1375 |
out.push('"'); |
| 1376 |
class_attr(&["region", kind], opts, out); |
| 1377 |
|
| 1378 |
if let quasi_router::RegionKind::Bespoke { name } = &slot.kind { |
| 1379 |
|
| 1380 |
|
| 1381 |
out.push_str(" data-bespoke=\""); |
| 1382 |
out.push_str(&escape(name)); |
| 1383 |
out.push('"'); |
| 1384 |
} |
| 1385 |
|
| 1386 |
if matches!(slot.readiness, layout::Readiness::Pending) { |
| 1387 |
out.push_str(" aria-busy=\"true\""); |
| 1388 |
} |
| 1389 |
|
| 1390 |
if matches!(slot.kind, quasi_router::RegionKind::Modal) { |
| 1391 |
|
| 1392 |
|
| 1393 |
out.push_str(" role=\"dialog\" aria-modal=\"true\""); |
| 1394 |
} |
| 1395 |
|
| 1396 |
out.push('>'); |
| 1397 |
for node in &slot.body { |
| 1398 |
node_html(node, morphs, opts, fills, out); |
| 1399 |
} |
| 1400 |
|
| 1401 |
|
| 1402 |
|
| 1403 |
|
| 1404 |
|
| 1405 |
|
| 1406 |
|
| 1407 |
|
| 1408 |
if matches!(slot.kind, quasi_router::RegionKind::Bespoke { .. }) |
| 1409 |
&& let Some(fill) = fills.get(&slot.id) |
| 1410 |
{ |
| 1411 |
out.push_str(fill); |
| 1412 |
} |
| 1413 |
|
| 1414 |
out.push_str("</div>"); |
| 1415 |
} |
| 1416 |
|