/*
 * Copyright (c) 2017-2023 XMLmind Software. All rights reserved.
 *
 * This file is part of the XMLmind XML Editor project.
 * For conditions of distribution and use, see the accompanying legal.txt file.
 *
 * DocBook 5.1+ assembly styles.
 */

@namespace "http://docbook.org/ns/docbook";
@namespace db5 "http://docbook.org/ns/docbook";

@import url(docbook5-config:css/docbook5.imp);

@extension "com.xmlmind.xmleditext.assembly.StyleSheetExtension";

assembly,
resources,
structure,
relationships,
transforms {
    display: block;
    collapsible: yes;
}

resources,
structure,
relationships,
transforms {
    margin-bottom: 2em;
}

assembly:before,
resources:before,
structure:before,
relationships:before,
transforms:before {
    /* Part heading styles */
    font-size: 1.2em;
    font-weight: bold;
    color: #004080;
    padding-bottom: 0.25ex;
    border-width: 1px;
    border-style: solid;
    border-color: transparent transparent #004080 transparent;
    margin-top: 1.67em;
}

assembly:before {
    display: block; /* Contains at least 1 resources */
    content: collapser(show-level-menu, yes) " Assembly";
    font-size: 1.5em;
    background-color: normal;
    margin-top: 1.33em;
}

info > title {
    font-size: 1em;
}

/* ---------------------------------------------------------------------------
   resources
 -------------------------------------------------------------------------- */

resources,
resources[grammar],
resources[transform], /*V5.2*/
resource[xml|base] {
    collapsed: yes;
}

resources:before {
    display: block; /* Contains at least 1 resource */
    content: collapser() " Resources " 
             invoke("attributeValues", grammar, xml|base);
}

description {
    display: block;
    font-size: smaller;
    padding: 0.54ex;
    background-color: #FFFFF0;
    margin-left: 4ex;
    margin-top: 0.54ex;
    margin-bottom: 0.54ex;
}

resource,
resource[grammar],
resource[transform],
resource[xml|id] {
    display: block;
    margin-left: 4ex;
    margin-top: 0.5ex;
    margin-bottom: 0.5ex;
}

resource:before {
    display: inline; /* May be empty */
    content: icon(file2, 0) " Resource " 
             invoke("attributeValues", grammar, transform, xml|id) 
             " " icon(external-link-small, navy) 
             text(decode-uri(attr(href)), font-family, monospace, color, navy);
}

/* ---------------------------------------------------------------------------
   structure
 -------------------------------------------------------------------------- */

structure,
structure[defaultformat],
structure[renderas],
structure[type],
structure[xml|id] {
    collapsed: no;
}

@property-value structure-content()
    collapser() " Structure "
    invoke("attributeValues", defaultformat, renderas, type, xml|id);

structure:before {
    display: block; /* Contains at least 1 module */
    content: structure-content();
}

structure[resourceref]:before {
    content: structure-content() 
             " " icon(left-link, navy) 
             text(attr(resourceref), font-family, monospace, color, navy)
             " " invoke("resourceDigest");
}

structure > revhistory {
    display: block;
    collapsible: yes;
    collapsed: yes;
    padding: 1ex;
    border-width: thin;
    border-style: dotted;
    border-color: gray;
    margin-top: 0;
    margin-bottom: 1em;
}

structure > revhistory:before {
    display: block;
    content: collapser() " Revisions";
    color: gray;
    margin-top: 1em;
}

/*
 * merge looks like info.
 */

merge,
merge[xml|id],
merge[xml|lang],
merge[dir],
merge[revisionflag],
merge[xreflabel] {
    display: block; 
    padding: 0.5em;
    border: 1px solid #D0FFFF;
    border-radius: 0.5em;
    background-color: #E8FFFF;
    margin-bottom: 1em;
}

@property-value merge-content()
    icon(replace, 0) " Merge "
    invoke("attributeValues", xml|id, xml|lang, dir, revisionflag, xreflabel);

merge:before {
    display: block;
    content: merge-content();
    color: #004080;
    margin-top: 1em;
}

merge[resourceref]:before {
    content: merge-content() " " icon(left-link, navy) 
             text(attr(resourceref), font-family, monospace, color, navy);
}

merge:empty,
merge[resourceref]:empty {
    color: #004080;
    padding: 0;
    border-style: none;
    background-color: normal;
    margin-top: 0.5ex;
    margin-bottom: 0.5ex;
}

merge:empty {
    content: merge-content();
}

merge[resourceref]:empty {
    content: merge-content() " " icon(left-link, navy) 
             text(attr(resourceref), font-family, monospace, color, navy);
}

merge:empty:before,
merge[resourceref]:empty:before {
    content: "";
}

module > info,
module > merge,
module > merge[resourceref],
module > merge:before,
module > merge[resourceref]:before {
    margin-left: 4ex;
}

merge > * {
    display: block;
    text-align: left; /* Reset paragraph styles */
    font: normal normal 1em sans-serif;
    color: black;
    margin-left: 18ex;
    margin-right: 0;
    margin-top: 1em;
    margin-bottom: 1em;
}

merge > *:first-child { /* nicer */
    margin-top: 0;
    margin-bottom: 0;
}

merge > *:before {
    display: marker; 
    content: element-label();
    font: normal normal small sans-serif;
    color: #004080;
}

merge > *:after {
    content: "";
}

merge > title {
    font-weight: bold;
    color: #004080;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    margin-bottom: 1em;
}

merge > title:before {
    content: "";
}

/*
 * module
 */

module,
module[chunk],
module[contentonly],
module[omittitles],
module[renderas],
module[xml|id] {
    display: block;
    collapsible: yes;
    not-collapsible-head: 1;
    margin-left: 4ex;
    margin-top: 0.5ex;
    margin-bottom: 0.5ex;
}

@property-value module-content()
    collapser(hide-when-disabled, yes) 
    " Module "
    invoke("attributeValues", chunk, contentonly, omittitles, renderas, xml|id);


module:before {
    display: inline; /* May be empty */
    content: module-content();
}

module[resourceref]:before {
    content: module-content()
             " " icon(left-link, navy) 
             text(attr(resourceref), font-family, monospace, color, navy)
             " " invoke("resourceDigest");
}

/*
 * filterin, filterout, output
 */

filterin,
filterout,
output {
    display: block;
    margin-top: 0.5ex;
    margin-bottom: 0.5ex;
}

module > filterin,
module > filterout,
module > output {
    margin-left: 4ex;
}

filterin {
    content: icon(plus, 0) " Filter in " invoke("attributeValues");
    color: #208020;
}

filterout {
    content: icon(minus, 0) " Filter out " invoke("attributeValues");
    color: #802020;
}

output {
    content: icon(right-arrow, 0) " Output " invoke("attributeValues");
    color: #802080;
}

/* ---------------------------------------------------------------------------
   relationships
 -------------------------------------------------------------------------- */

relationships,
relationships[type] {
    collapsed: yes;
}

relationships:before {
    display: block; /* Contains at least 1 instance or relationship */
    content: collapser() " Relationships "
             invoke("attributeValues", type);
}

relationship,
relationship[type] {
    display: block;
    collapsible: yes;
    margin-left: 4ex;
    margin-bottom: 0.5ex;
}

relationship:before {
    display: block; /* Contains at least 1 instance */
    content: collapser() " Relationship "
             invoke("attributeValues", type);
    margin-top: 0.5ex;
    margin-left: 4ex;
}

association {
    display: block;
    font-size: smaller;
    padding: 0.54ex;
    background-color: #F0F8FF;
    margin-left: 4ex;
    margin-top: 0.54ex;
    margin-bottom: 0.54ex;
}

instance,
instance[linking] {
    display: block;
    content: icon(left-link, navy) 
             text(attr(linkend), font-family, monospace, color, navy)
             " " invoke("attributeValues", linking);
    margin-left: 4ex;
}

/* ---------------------------------------------------------------------------
   transforms
 -------------------------------------------------------------------------- */

transforms,
transforms[xml|base] {
    collapsed: yes;
}

transforms:before {
    display: block; /* Contains at least 1 transform */
    content: collapser() " Transforms "
             invoke("attributeValues", xml|base);
    margin: 0;
}

transform,
transform[grammar],
transform[name] {
    display: block;
    content: icon(cog, 0) " Transform " 
             invoke("attributeValues", grammar, name) 
             " " icon(external-link-small, navy)
             text(decode-uri(attr(href)), font-family, monospace, color, navy);
    margin-left: 4ex;
    margin-top: 0.5ex;
    margin-bottom: 0.5ex;
}
