view-template.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /*jshint esversion: 6 */
  2. var operatorTemplate = `
  3. <style type='text/css'>
  4. .documentation { font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 12px; line-height: 1.5; margin: 0; }
  5. .documentation h1 { font-weight: 600; font-size: 14px; line-height: 1.25; border-bottom: 1px solid #eaecef; padding-bottom: 0.3em; margin-top: 0; margin-bottom: 16px; }
  6. .documentation h2 { font-weight: 600; font-size: 12px; line-height: 1.25; margin-bottom: 16px; border-bottom: 1px solid #eaecef; }
  7. .documentation h3 { font-weight: 600; font-size: 12px; line-height: 1.25; }
  8. .documentation p { margin-top: 2px; margin-bottom: 2px; }
  9. .documentation a { color: #237; }
  10. .documentation code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 10px; background-color: rgba(27, 31, 35, 0.05); padding: 0.2em 0.4em; margin: 0; border-radius: 3px }
  11. .documentation pre { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11px; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgba(27, 31, 35, 0.05); border-radius: 3px; }
  12. .documentation pre code { font-size: 11px; padding: 16px; line-height: 1.45; background-color: transparent; padding: 0; border-radius: 0; }
  13. .documentation tt { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-weight: 600; font-size: 85%; background-color: rgba(27, 31, 35, 0.05); border-radius: 3px; padding: 0.2em 0.4em; margin: 0; }
  14. .documentation dl dt { font-size: 12px; font-weight: 600; padding: 0; margin-top: 16px; }
  15. .documentation dd { padding: 0 16px; margin-left: 0; margin-bottom: 16px; }
  16. .documentation ul { margin-top: 6px; margin-bottom: 6px; padding-left: 20px; }
  17. .documentation li { }
  18. </style>
  19. <div id='documentation' class='documentation'>
  20. <h1>{{{name}}}</h1>
  21. {{#if summary}}
  22. <p>{{{summary}}}</p>
  23. {{/if}}
  24. {{#if description}}
  25. <p>{{{description}}}</p>
  26. {{/if}}
  27. {{#if attributes}}
  28. <h2>Attributes</h2>
  29. <dl>
  30. {{#attributes}}
  31. <dt>{{{name}}}{{#if type}}: <tt>{{{type}}}</tt>{{/if}}</dt>
  32. <dd>{{{description}}}</dd>
  33. {{/attributes}}
  34. </dl>
  35. {{/if}}
  36. {{#if inputs}}
  37. <h2>Inputs{{#if inputs_range}} ({{{inputs_range}}}){{/if}}</h2>
  38. <dl>
  39. {{/if}}
  40. {{#inputs}}
  41. <dt>{{{name}}}{{#if type}}: <tt>{{{type}}}</tt>{{/if}} {{#if option}}({{{option}}}){{/if}}</dt>
  42. <dd>{{{description}}}</dd>
  43. {{/inputs}}
  44. </dl>
  45. {{#if outputs.length}}
  46. <h2>Outputs{{#if outputs_range}} ({{{outputs_range}}}){{/if}}</h2>
  47. <dl>
  48. {{/if}}
  49. {{#outputs}}
  50. <dt>{{{name}}}{{#if type}}: <tt>{{{type}}}</tt>{{/if}} {{#if option}}({{{option}}}){{/if}}</dt>
  51. <dd>{{{description}}}</dd>
  52. {{/outputs}}
  53. </dl>
  54. {{#if type_constraints}}
  55. <h2>Type Constraints</h2>
  56. <dl>
  57. {{#type_constraints}}
  58. <dt>{{{type_param_str}}}: {{#allowed_type_strs}}<tt>{{this}}</tt>{{#unless @last}}, {{/unless}}{{/allowed_type_strs}}</dt>
  59. <dd>{{{description}}}</dd>
  60. {{/type_constraints}}
  61. </dl>
  62. {{/if}}
  63. {{#if examples}}
  64. <h2>Examples</h2>
  65. {{#examples}}
  66. <h3>{{{summary}}}</h3>
  67. <pre>{{{code}}}</pre>
  68. {{/examples}}
  69. {{/if}}
  70. {{#if references}}
  71. <h2>References</h2>
  72. <ul>
  73. {{#references}}
  74. <li>{{{description}}}</li>
  75. {{/references}}
  76. </ul>
  77. {{/if}}
  78. {{#if domain}}{{#if since_version}}{{#if support_level}}
  79. <h2>Support</h2>
  80. <dl>
  81. In domain <tt>{{{domain}}}</tt> since version <tt>{{{since_version}}}</tt> at support level <tt>{{{support_level}}}</tt>.
  82. </dl>
  83. {{/if}}{{/if}}{{/if}}
  84. </div>
  85. `;
  86. var summaryTemplate = `
  87. <style type='text/css'>
  88. .summary { font-family: 'Open Sans', --apple-system, "Helvetica Neue", Helvetica, Arial, sans-serf; font-size: 12px; line-height: 1.5; overflow: hidden; margin: auto; }
  89. .summary h1 { font-family: inherit; font-weight: 600; font-size: 12px; margin: 0; color: #333; letter-spacing: 0.5px; padding: 10px 0px 0px 0px; margin: 10px 0px 0px 0px; -webkit-user-select: none; -moz-user-select: none; user-select: none; }
  90. .summary .section { color: #777; margin-top: 10px; margin-bottom: 10px; padding: 10px; overflow-y: auto; position: relative; border: 1px solid none; border-radius: 10px; border: 1px solid #ccc; }
  91. .summary .section .property { margin: 2px 0 2px 0; overflow: hidden; width: 100% !important; }
  92. .summary .section .property .name { float: left; clear: left; width: 80px; min-width: 80px; font-weight: 600; }
  93. .summary .section .property .value { overflow: hidden; }
  94. .summary .section .property .value b { font-weight: 600; }
  95. .summary .section .property .value input { font-family: inherit; font-size: inherit; color: inherit; background-color: inherit; width: 100%; margin: 0; padding: 0; border: 0; outline: none; text-overflow: ellipsis; }
  96. .summary .section .property .value code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 10px; background-color: rgba(27, 31, 35, 0.05); padding: 0.2em 0.4em; margin: 0; border-radius: 3px; background-color: #d6d6d6; }
  97. </style>
  98. <div class='summary'>
  99. <div class='section'>
  100. {{#properties}}
  101. <div class='property'>
  102. <div class='name'>{{name}}</div>
  103. <div class='value'>{{value}}</div>
  104. </div>
  105. {{/properties}}
  106. </div>
  107. <h1>GRAPHS</h1>
  108. {{#graphs}}
  109. <div class='section'>
  110. {{#if name}}
  111. <div class='property'>
  112. <div class='name'>Name</div>
  113. <div class='value'><input type='text' value='{{name}}' readonly='true'/></div>
  114. </div>
  115. {{/if}}
  116. {{#if version}}
  117. <div class='property'>
  118. <div class='name'>Version</div>
  119. <div class='value'>{{version}}</div>
  120. </div>
  121. {{/if}}
  122. {{#if type}}
  123. <div class='property'>
  124. <div class='name'>Type</div>
  125. <div class='value'>{{type}}</div>
  126. </div>
  127. {{/if}}
  128. {{#if tags}}
  129. <div class='property'>
  130. <div class='name'>Tags</div>
  131. <div class='value'>{{tags}}</div>
  132. </div>
  133. {{/if}}
  134. {{#if description}}
  135. <div class='property'>
  136. <div class='name'>Description</div>
  137. <div class='value'>{{description}}</div>
  138. </div>
  139. {{/if}}
  140. <div class='property'>
  141. {{#if inputs}}
  142. <div class='name'>Inputs</div>
  143. <div class='value'>
  144. {{#inputs}}
  145. <b>{{name}}</b>{{#if type}}: <code>{{type}}</code>{{/if}}<br>
  146. {{#if description}}<div style='margin-left: 20px'>{{description}}</div>{{/if}}
  147. {{/inputs}}
  148. </div>
  149. </div>
  150. {{/if}}
  151. {{#if outputs}}
  152. <div class='property'>
  153. <div class='name'>Outputs</div>
  154. <div class='value'>
  155. {{#outputs}}
  156. <b>{{name}}</b>{{#if type}}: <code>{{type}}</code>{{/if}}<br>
  157. {{#if description}}<div style='margin-left: 20px'>{{description}}</div>{{/if}}
  158. {{/outputs}}
  159. </div>
  160. </div>
  161. {{/if}}
  162. <div class='property'>
  163. <div class='value'>
  164. <button style='float: right; width: 80px; margin: 2px 0 0 0;' onclick='javascript:updateActiveGraph("{{{name}}}");'>View</button>
  165. </div>
  166. </div>
  167. {{/graphs}}
  168. </div>
  169. `;