| 48 |
48 |
|
Node,
|
| 49 |
49 |
|
/// One picture: its body sets on the `Image`, and it emits nothing.
|
| 50 |
50 |
|
Image,
|
|
51 |
+ |
/// One canvas: its body sets on the `Canvas` and draws inside its scope.
|
|
52 |
+ |
Canvas,
|
| 51 |
53 |
|
}
|
| 52 |
54 |
|
|
| 53 |
55 |
|
pub fn declaration(declaration: &Declaration) -> Result<TokenStream> {
|
| 525 |
527 |
|
(Container::Screen, Emission::Region { name, kind, body }) => {
|
| 526 |
528 |
|
Ok((slot(name, kind, body)?, quote!(.with(#held))))
|
| 527 |
529 |
|
}
|
|
530 |
+ |
// A region another shape built. `custom_page`'s three screens carry the
|
|
531 |
+ |
// same platform strip top and bottom, and every link in it is per
|
|
532 |
+ |
// request, so the band is a shape rather than `Chrome`. A table already
|
|
533 |
+ |
// takes a row this way and a row a control; this is a document taking a
|
|
534 |
+ |
// region.
|
|
535 |
+ |
(Container::Screen, Emission::Include(supplier)) => {
|
|
536 |
+ |
let supplier = hole(supplier)?;
|
|
537 |
+ |
Ok((
|
|
538 |
+ |
quote!(::std::convert::Into::into(#supplier)),
|
|
539 |
+ |
quote!(.with(#held)),
|
|
540 |
+ |
))
|
|
541 |
+ |
}
|
| 528 |
542 |
|
(Container::Screen, other) => Err(syn::Error::new(
|
| 529 |
543 |
|
emission_span(other),
|
| 530 |
|
- |
"a document holds regions: write `region <name> as <kind> { .. }`",
|
|
544 |
+ |
"a document holds regions: write `region <name> as <kind> { .. }` \
|
|
545 |
+ |
or `include <shape>;`",
|
| 531 |
546 |
|
)),
|
| 532 |
547 |
|
(Container::Cells | Container::Cell | Container::Row, Emission::Activate(action)) => {
|
| 533 |
548 |
|
Ok((self::action(action)?, quote!(.activate(#held))))
|
| 562 |
577 |
|
emission_span(other),
|
| 563 |
578 |
|
"a picture holds nothing: its body says how it sits in its box",
|
| 564 |
579 |
|
)),
|
|
580 |
+ |
// Inside the scope and after the markup, which is the only place a
|
|
581 |
+ |
// canvas can hold anything: the markup is opaque, so nothing is
|
|
582 |
+ |
// injected into the middle of it.
|
|
583 |
+ |
(Container::Canvas, other) => Ok((node(other)?, quote!(.with(#held)))),
|
| 565 |
584 |
|
(Container::Run, Emission::Beside { priority, inner }) => Ok((
|
| 566 |
585 |
|
node(inner)?,
|
| 567 |
586 |
|
quote!(.beside(#held, ::quasi_router::layout::Priority::#priority)),
|
| 732 |
751 |
|
)?;
|
| 733 |
752 |
|
Ok(quote!(::quasi_router::Node::Image(#picture)))
|
| 734 |
753 |
|
}
|
|
754 |
+ |
Emission::Simple { member, args, body } if member == "canvas" => {
|
|
755 |
+ |
// The second member whose body does not set on a `Node`, and for
|
|
756 |
+ |
// `picture`'s reason: `Node::Canvas` holds a `Canvas`, and
|
|
757 |
+ |
// `classed`, `identified` and the nodes drawn in the scope are that
|
|
758 |
+ |
// type's. `custom_page` is the site -- a creator's markup under the
|
|
759 |
+ |
// scope `css_sanitizer` rewrote every one of their rules for.
|
|
760 |
+ |
//
|
|
761 |
+ |
// One argument always, because `Canvas::new("")` is
|
|
762 |
+ |
// `Canvas::default()`: an item page has no creator markup and the
|
|
763 |
+ |
// scope is still what carries the stylesheet.
|
|
764 |
+ |
let args = args.iter().map(self::arg).collect::<Result<Vec<_>>>()?;
|
|
765 |
+ |
let canvas = accrete(
|
|
766 |
+ |
body,
|
|
767 |
+ |
Container::Canvas,
|
|
768 |
+ |
"e!(::quasi_router::screen::Canvas::new(#(#args),*)),
|
|
769 |
+ |
)?;
|
|
770 |
+ |
Ok(quote!(::quasi_router::Node::Canvas(::std::boxed::Box::new(#canvas))))
|
|
771 |
+ |
}
|
| 735 |
772 |
|
Emission::Simple { member, args, body } => {
|
| 736 |
773 |
|
let args = args.iter().map(self::arg).collect::<Result<Vec<_>>>()?;
|
| 737 |
774 |
|
accrete(
|