| 46 |
46 |
|
Cell,
|
| 47 |
47 |
|
/// One node member: its body says what it is told afterwards.
|
| 48 |
48 |
|
Node,
|
|
49 |
+ |
/// One picture: its body sets on the `Image`, and it emits nothing.
|
|
50 |
+ |
Image,
|
| 49 |
51 |
|
}
|
| 50 |
52 |
|
|
| 51 |
53 |
|
pub fn declaration(declaration: &Declaration) -> Result<TokenStream> {
|
| 541 |
543 |
|
quote!(.act(#held)),
|
| 542 |
544 |
|
))
|
| 543 |
545 |
|
}
|
|
546 |
+ |
// A row's parts are placed by role rather than ranked by priority,
|
|
547 |
+ |
// which is the other thing `beside` means and the container is what
|
|
548 |
+ |
// says which. embeds' button strip is the site: a thumbnail and a title
|
|
549 |
+ |
// in `Primary`, the buy control in `Actions`, the price a setting
|
|
550 |
+ |
// between them.
|
|
551 |
+ |
(Container::Row, Emission::Beside { priority, inner }) => Ok((
|
|
552 |
+ |
node(inner)?,
|
|
553 |
+ |
quote!(.part(::quasi_router::layout::RowPart::#priority, #held)),
|
|
554 |
+ |
)),
|
| 544 |
555 |
|
(Container::Row, other) => Err(syn::Error::new(
|
| 545 |
556 |
|
emission_span(other),
|
| 546 |
|
- |
"a row holds controls and says what opening it does: write \
|
| 547 |
|
- |
`act <label> to <action>;`, `include <shape>;` or `activate to <action>;`",
|
|
557 |
+ |
"a row holds controls, places its parts and says what opening it does: write \
|
|
558 |
+ |
`act <label> to <action>;`, `include <shape>;`, `beside <part> <emission>` \
|
|
559 |
+ |
or `activate to <action>;`",
|
|
560 |
+ |
)),
|
|
561 |
+ |
(Container::Image, other) => Err(syn::Error::new(
|
|
562 |
+ |
emission_span(other),
|
|
563 |
+ |
"a picture holds nothing: its body says how it sits in its box",
|
| 548 |
564 |
|
)),
|
| 549 |
565 |
|
(Container::Run, Emission::Beside { priority, inner }) => Ok((
|
| 550 |
566 |
|
node(inner)?,
|
| 701 |
717 |
|
/// One emission as a `Node` value.
|
| 702 |
718 |
|
fn node(emission: &Emission) -> Result<TokenStream> {
|
| 703 |
719 |
|
match emission {
|
|
720 |
+ |
Emission::Simple { member, args, body } if member == "picture" => {
|
|
721 |
+ |
// The one member whose body does not set on a `Node`. `Node::Image`
|
|
722 |
+ |
// holds an `Image`, and `fit`, `lazy`, `caption` and `intrinsic`
|
|
723 |
+ |
// are that type's builders, so the body accretes onto the picture
|
|
724 |
+ |
// and the variant goes on afterwards. embeds' cover is the site: a
|
|
725 |
+ |
// 40-pixel thumbnail whose art is any shape, which is `Fit::Cover`
|
|
726 |
+ |
// and is unsayable without a body.
|
|
727 |
+ |
let args = args.iter().map(self::arg).collect::<Result<Vec<_>>>()?;
|
|
728 |
+ |
let picture = accrete(
|
|
729 |
+ |
body,
|
|
730 |
+ |
Container::Image,
|
|
731 |
+ |
"e!(::quasi_router::Image::new(#(#args),*)),
|
|
732 |
+ |
)?;
|
|
733 |
+ |
Ok(quote!(::quasi_router::Node::Image(#picture)))
|
|
734 |
+ |
}
|
| 704 |
735 |
|
Emission::Simple { member, args, body } => {
|
| 705 |
736 |
|
let args = args.iter().map(self::arg).collect::<Result<Vec<_>>>()?;
|
| 706 |
737 |
|
accrete(
|