From cf2c56c7061b7ed40fdd3b40a352ddb9c9b7371f Mon Sep 17 00:00:00 2001
From: alexwl <alexey.a.kiryushin@gmail.com>
Date: Tue, 2 Oct 2018 13:17:04 +0300
Subject: Initial commit

---
 javascript/app/templates/components/.gitkeep       |  0
 .../app/templates/components/bottom-panel.hbs      |  9 ++++
 .../app/templates/components/expression-info.hbs   |  8 +++
 javascript/app/templates/components/file-tree.hbs  |  8 +++
 .../app/templates/components/haskell-module.hbs    | 57 ++++++++++++++++++++++
 .../app/templates/components/identifier-info.hbs   | 39 +++++++++++++++
 .../app/templates/components/identifier-name.hbs   | 12 +++++
 .../app/templates/components/infinite-list.hbs     |  3 ++
 .../app/templates/components/info-window.hbs       | 12 +++++
 .../components/input-with-autocomplete.hbs         | 19 ++++++++
 .../app/templates/components/instance-info.hbs     | 10 ++++
 .../app/templates/components/paginated-list.hbs    | 17 +++++++
 .../app/templates/components/resizable-panel.hbs   |  5 ++
 javascript/app/templates/components/text-file.hbs  |  3 ++
 .../app/templates/components/type-component.hbs    |  3 ++
 .../templates/components/type-signature-text.hbs   |  2 +
 .../app/templates/components/type-signature.hbs    | 10 ++++
 17 files changed, 217 insertions(+)
 create mode 100644 javascript/app/templates/components/.gitkeep
 create mode 100644 javascript/app/templates/components/bottom-panel.hbs
 create mode 100644 javascript/app/templates/components/expression-info.hbs
 create mode 100644 javascript/app/templates/components/file-tree.hbs
 create mode 100644 javascript/app/templates/components/haskell-module.hbs
 create mode 100644 javascript/app/templates/components/identifier-info.hbs
 create mode 100644 javascript/app/templates/components/identifier-name.hbs
 create mode 100644 javascript/app/templates/components/infinite-list.hbs
 create mode 100644 javascript/app/templates/components/info-window.hbs
 create mode 100644 javascript/app/templates/components/input-with-autocomplete.hbs
 create mode 100644 javascript/app/templates/components/instance-info.hbs
 create mode 100644 javascript/app/templates/components/paginated-list.hbs
 create mode 100644 javascript/app/templates/components/resizable-panel.hbs
 create mode 100644 javascript/app/templates/components/text-file.hbs
 create mode 100644 javascript/app/templates/components/type-component.hbs
 create mode 100644 javascript/app/templates/components/type-signature-text.hbs
 create mode 100644 javascript/app/templates/components/type-signature.hbs

(limited to 'javascript/app/templates/components')

diff --git a/javascript/app/templates/components/.gitkeep b/javascript/app/templates/components/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/javascript/app/templates/components/bottom-panel.hbs b/javascript/app/templates/components/bottom-panel.hbs
new file mode 100644
index 0000000..26b1919
--- /dev/null
+++ b/javascript/app/templates/components/bottom-panel.hbs
@@ -0,0 +1,9 @@
+<div class="bottom-panel-header">
+    <span class="bottom-panel-header-content">{{yield "header"}}</span>
+    <span class="bottom-panel-header-options">
+        <a href="#" {{action "close"}}>Close</a>
+    </span>
+</div>
+<div class="bottom-panel-content">
+    {{yield "body"}}
+</div>
diff --git a/javascript/app/templates/components/expression-info.hbs b/javascript/app/templates/components/expression-info.hbs
new file mode 100644
index 0000000..509fb24
--- /dev/null
+++ b/javascript/app/templates/components/expression-info.hbs
@@ -0,0 +1,8 @@
+<div class="expressions">
+    {{#each expressions as |expression|}}
+        <div class="expression">
+            <span class="source-code">{{expression.sourceCode}}</span>
+            <br/>:: {{type-signature type=expression.info.exprType identifiers=identifiers currentLineNumber=currentLineNumber}}
+        </div>
+    {{/each}}
+</div>
diff --git a/javascript/app/templates/components/file-tree.hbs b/javascript/app/templates/components/file-tree.hbs
new file mode 100644
index 0000000..b5e38ef
--- /dev/null
+++ b/javascript/app/templates/components/file-tree.hbs
@@ -0,0 +1,8 @@
+<div class="file-tree-header">
+    <div class="input-group">
+        {{input class="form-control" value=query placeholder="Filename"}}<a class="hide-file-tree" href="#" {{action "hide"}}>Hide</a>
+    </div>
+</div>
+<div class="file-tree-content">
+    <div class="file-tree"></div>
+</div>
diff --git a/javascript/app/templates/components/haskell-module.hbs b/javascript/app/templates/components/haskell-module.hbs
new file mode 100644
index 0000000..77b9df7
--- /dev/null
+++ b/javascript/app/templates/components/haskell-module.hbs
@@ -0,0 +1,57 @@
+<div class="source-code-container"></div>
+{{#if declarations}}
+    <div class="declarations">
+        <div class="declarations-header">            
+            <div class="input-group">
+                {{input class="form-control" value=query placeholder="Identifier"}}<a class="hide-declarations" href="#" {{action "toggleShowDeclarations"}}>{{showDeclarationsLabel}}</a>
+            </div>
+        </div>
+        {{#if showDeclarations}}
+            <div id="declarations-content" class="declarations-content">                
+                <ul>                    
+                    {{#infinite-list containerElementId="declarations-content" elements=filteredDeclarations perPage=30 as |declaration|}}
+                        <li class="declaration">
+                            <div class="declaration">
+                                <a {{action "goToLine" declaration.lineNumber}} href="#"><span class="source-code-font">{{declaration.name}}{{#if declaration.declType}} :: {{type-signature-text components=declaration.declType.components}}{{/if}}</span>
+                                </a><span>{{#unless declaration.isExported}}<i>(not exported)</i>{{/unless}}</span>
+                            </div>
+                        </li>
+                    {{/infinite-list}}
+                </ul>
+            </div>
+        {{/if}}
+    </div>
+{{/if}}
+{{#info-window
+   targetElement=selectedIdentifier
+   isHoveredOverIdentifier=isHoveredOverIdentifier
+   hasSelectedExpression=hasSelectedExpression
+   containerElementId="right-panel" as |section|}}
+    {{#if (eq section "header")}}
+        {{#if hasSelectedExpression}}
+            <div>Selected expressions</div>
+        {{else}}
+            {{identifier-name
+              identifierInfo=identifierInfo
+              identifierOccurrence=identifierOccurrence
+              identifierElement=selectedIdentifier
+              currentPackageId=packageId
+              isBinder=identifierOccurrence.isBinder
+              currentLineNumber=currentLineNumber
+              findReferences=findReferences}}
+        {{/if}}
+    {{else}}
+        {{#unless hasSelectedExpression}}
+            {{identifier-info
+              identifierInfo=identifierInfo
+              identifierOccurrence=identifierOccurrence
+              identifiers=identifiers
+              currentLineNumber=currentLineNumber}}
+    {{else}}
+            {{expression-info
+              expressions=expressions
+              identifiers=identifiers
+              currentLineNumber=currentLineNumber}}
+        {{/unless}}
+    {{/if}}
+{{/info-window}}
diff --git a/javascript/app/templates/components/identifier-info.hbs b/javascript/app/templates/components/identifier-info.hbs
new file mode 100644
index 0000000..7146a2e
--- /dev/null
+++ b/javascript/app/templates/components/identifier-info.hbs
@@ -0,0 +1,39 @@
+{{#if (or identifierInfo identifierOccurrence.idOccType)}}
+    <div class="identifier-info">
+        {{#if identifierInfo}}
+            {{#if isNaughtyRecSel}}
+                <i>This record selector can never be called because its type mentions a type variable that isn't in the result type of the constructor</i>
+            {{else}}
+                {{type-signature
+                  type=identifierInfo.idType
+                  identifiers=identifiers
+                  currentLineNumber=currentLineNumber}}
+            {{/if}}
+        {{/if}}
+        {{#if (and identifierInfo identifierOccurrence identifierOccurrence.idOccType)}}
+            <div style="height:10px"></div>
+        {{/if}}
+        {{#if (and identifierOccurrence identifierOccurrence.idOccType)}}
+            {{type-signature
+              type=identifierOccurrence.idOccType
+              identifiers=identifiers
+              currentLineNumber=currentLineNumber}}
+        {{/if}}
+        <div class="documentation">
+            {{{identifierInfo.doc}}}
+            {{{downloadedDocumentation}}}
+        </div>
+        {{#if identifierOccurrence.instanceResolution}}
+            <div style="height:10px"></div>
+        {{/if}}
+        <div>
+            {{#if identifierOccurrence.instanceResolution}}
+                {{instance-info
+                  instance=identifierOccurrence.instanceResolution
+                  identifiers=identifiers
+                  nestedLevel=0
+                  currentLineNumber=currentLineNumber}}
+            {{/if}}
+        </div>
+    </div>
+{{/if}}
diff --git a/javascript/app/templates/components/identifier-name.hbs b/javascript/app/templates/components/identifier-name.hbs
new file mode 100644
index 0000000..ca16e23
--- /dev/null
+++ b/javascript/app/templates/components/identifier-name.hbs
@@ -0,0 +1,12 @@
+<div>
+    <span class="source-code-font break-word identifier-menu-item" style={{style}}>{{#if identifierInfo.demangledOccName}}{{identifierInfo.demangledOccName}}{{else}}{{name}}{{/if}}</span>
+    {{#unless isBinder}}
+        {{#if location}}
+            <span class="identifier-menu-item">{{location}}</span>            
+            <span class="link identifier-menu-item" onmouseup={{action "goToDefinition"}}>Go to definition</span>
+        {{/if}}
+    {{/unless}}
+    {{#if isExternalIdentifier}}
+        <span class="link identifier-menu-item" onmouseup={{action "findReferences" identifierInfo currentPackageId}}>Find references</span>
+    {{/if}}
+</div>
diff --git a/javascript/app/templates/components/infinite-list.hbs b/javascript/app/templates/components/infinite-list.hbs
new file mode 100644
index 0000000..ab103d4
--- /dev/null
+++ b/javascript/app/templates/components/infinite-list.hbs
@@ -0,0 +1,3 @@
+{{#each renderedElements as |element|}}
+    {{yield element}}
+{{/each}}
diff --git a/javascript/app/templates/components/info-window.hbs b/javascript/app/templates/components/info-window.hbs
new file mode 100644
index 0000000..003e2c5
--- /dev/null
+++ b/javascript/app/templates/components/info-window.hbs
@@ -0,0 +1,12 @@
+<div class="info-window">
+    <div class="info-window-header">
+        <div class="info-window-options">
+            <a href="#" {{action "pin"}}>{{#if isPinned}}Unpin{{else}}Pin{{/if}}</a>
+            <a href="#" {{action "close"}}>Close</a>
+        </div>
+        {{yield "header"}}
+    </div>
+    <div class="info-window-content">
+        {{yield "body"}}
+    </div>
+</div>
diff --git a/javascript/app/templates/components/input-with-autocomplete.hbs b/javascript/app/templates/components/input-with-autocomplete.hbs
new file mode 100644
index 0000000..eb0100d
--- /dev/null
+++ b/javascript/app/templates/components/input-with-autocomplete.hbs
@@ -0,0 +1,19 @@
+<div class="input-group">
+    {{input class="form-control search-input" value=query placeholder=placeholder}}
+    <div class="autocomplete-container">
+        {{# if items}}
+            <ul class="autocomplete-items">
+                {{#each items as |item index|}}
+                    <li class="{{if (eq index highlightedItemIndex) "highlighted"}}" onclick={{action "goToDefinition" item}}>
+                        <div class="autocomplete-item">
+                            {{yield item}}
+                        </div>
+                    </li>
+                {{/each}}
+            </ul>
+        {{/if}}
+    </div>
+    <div class="input-group-append">
+        <button id="search-input" class="btn btn-outline-secondary" {{action "onSubmit" query}}>Search</button>
+    </div>
+</div>
diff --git a/javascript/app/templates/components/instance-info.hbs b/javascript/app/templates/components/instance-info.hbs
new file mode 100644
index 0000000..b5c2fdf
--- /dev/null
+++ b/javascript/app/templates/components/instance-info.hbs
@@ -0,0 +1,10 @@
+{{#if instance}}
+    <div style={{style}}>
+        <span class="source-code-font">
+            instance {{type-signature type=instance.instanceType identifiers=identifiers currentLineNumber=currentLineNumber noExpand=true}}</span>
+        (<span class="link" onclick={{action "goToDefinition"}}>Go to definition</span>)
+        {{#each instance.instances as |inst|}}
+            {{instance-info instance=inst identifiers=identifiers nestedLevel=nextNestedLevel currentLineNumber=currentLineNumber}}
+        {{/each}}
+    </div>
+{{/if}}
diff --git a/javascript/app/templates/components/paginated-list.hbs b/javascript/app/templates/components/paginated-list.hbs
new file mode 100644
index 0000000..2ae9813
--- /dev/null
+++ b/javascript/app/templates/components/paginated-list.hbs
@@ -0,0 +1,17 @@
+<div class="paginated-list-header">   
+    <span>Found {{total}}</span>
+    {{#if (or next prev)}}
+        &nbsp;
+        &nbsp;
+        <span>
+            {{#if first}}<button class="btn btn-outline-secondary btn-sm" {{action "update" first.href}}>&lt;&lt;</button>{{/if}}
+            {{#if prev}}<button button class="btn btn-outline-secondary btn-sm" {{action "update" prev.href}}>&lt;</button>{{/if}}
+            {{firstItemOnPage}} - {{lastItemOnPage}}
+            {{#if next}}<button button class="btn btn-outline-secondary btn-sm" {{action "update" next.href}}>&gt;</button>{{/if}}
+            {{#if last}}<button button class="btn btn-outline-secondary btn-sm" {{action "update" last.href}}>&gt;&gt;</button>{{/if}}
+        </span>
+    {{/if}}    
+</div>
+<div class="paginated-list-content">
+    {{yield items}}    
+</div>
diff --git a/javascript/app/templates/components/resizable-panel.hbs b/javascript/app/templates/components/resizable-panel.hbs
new file mode 100644
index 0000000..0fd3aa7
--- /dev/null
+++ b/javascript/app/templates/components/resizable-panel.hbs
@@ -0,0 +1,5 @@
+<div class="absolute-container">{{yield (action "hide")}}
+    <div onclick={{action "hide"}} class="show-left-panel-button">
+        {{{hideButtonLabel}}}
+    </div>
+</div>
diff --git a/javascript/app/templates/components/text-file.hbs b/javascript/app/templates/components/text-file.hbs
new file mode 100644
index 0000000..6a50453
--- /dev/null
+++ b/javascript/app/templates/components/text-file.hbs
@@ -0,0 +1,3 @@
+<div class="source-code-container">
+{{{html}}}
+</div>
diff --git a/javascript/app/templates/components/type-component.hbs b/javascript/app/templates/components/type-component.hbs
new file mode 100644
index 0000000..775324e
--- /dev/null
+++ b/javascript/app/templates/components/type-component.hbs
@@ -0,0 +1,3 @@
+{{#if (and expanded identifierInfo)}}({{/if}}
+<span class="source-code {{linkClass}}" onmouseup={{action "onmouseup"}}>{{occName}}</span>
+{{#if (and expanded identifierInfo)}} :: {{type-signature type=identifierInfo.idType identifiers=identifiers noExpand=true}}){{/if}}
diff --git a/javascript/app/templates/components/type-signature-text.hbs b/javascript/app/templates/components/type-signature-text.hbs
new file mode 100644
index 0000000..505a466
--- /dev/null
+++ b/javascript/app/templates/components/type-signature-text.hbs
@@ -0,0 +1,2 @@
+{{!-- No newlines to get rid of spaces between spans --}}
+{{#each components as |typeComponent|}}{{#if (eq typeComponent.tag "Text")}}{{typeComponent.contents}}{{else}}{{typeComponent.name}}{{/if}}{{/each}}
diff --git a/javascript/app/templates/components/type-signature.hbs b/javascript/app/templates/components/type-signature.hbs
new file mode 100644
index 0000000..249f1b8
--- /dev/null
+++ b/javascript/app/templates/components/type-signature.hbs
@@ -0,0 +1,10 @@
+{{!-- No newlines to get rid of spaces between spans --}}
+{{#each components as |typeComponent|}}{{#if (eq typeComponent.tag "Text")}}<span class="source-code">{{typeComponent.contents}}</span>{{else}}{{type-component occName=typeComponent.name internalId=typeComponent.internalId identifiers=identifiers currentLineNumber=currentLineNumber}}{{/if}}{{/each}}
+{{#unless noExpand}}
+    {{#if type.componentsExpanded}}
+        <div style="margin-top:5px">
+            <button class="btn btn-outline-secondary btn-sm" {{action "toggleExpandTypeSynonyms"}}>{{expandTypeSynonymsLabel}}
+            </button>
+        </div>
+    {{/if}}
+{{/unless}}
-- 
cgit v1.2.3