Commit e1410493 authored by Karen Konou's avatar Karen Konou

Merge branch 'dev' into 279-dev-folder-view-action-capability

parents 93c5e5da e2f0f80b
...@@ -989,7 +989,7 @@ ...@@ -989,7 +989,7 @@
"prelude", "prelude",
"unsafe-coerce" "unsafe-coerce"
], ],
"repo": "https://github.com/poorscript/purescript-dom-simple", "repo": "https://github.com/irresponsible/purescript-dom-simple",
"version": "v0.2.7" "version": "v0.2.7"
}, },
"dotenv": { "dotenv": {
...@@ -1218,7 +1218,7 @@ ...@@ -1218,7 +1218,7 @@
"nullable", "nullable",
"unsafe-coerce" "unsafe-coerce"
], ],
"repo": "https://github.com/poorscript/purescript-ffi-simple", "repo": "https://github.com/irresponsible/purescript-ffi-simple",
"version": "v0.2.10" "version": "v0.2.10"
}, },
"filterable": { "filterable": {
...@@ -1411,9 +1411,13 @@ ...@@ -1411,9 +1411,13 @@
}, },
"formula": { "formula": {
"dependencies": [ "dependencies": [
"effect",
"prelude", "prelude",
"reactix", "reactix",
"record",
"toestand", "toestand",
"tuples",
"typelevel-prelude",
"typisch" "typisch"
], ],
"repo": "https://github.com/poorscript/purescript-formula", "repo": "https://github.com/poorscript/purescript-formula",
...@@ -3812,10 +3816,9 @@ ...@@ -3812,10 +3816,9 @@
"functions", "functions",
"nullable", "nullable",
"prelude", "prelude",
"tuples",
"unsafe-coerce" "unsafe-coerce"
], ],
"repo": "https://github.com/poorscript/purescript-reactix", "repo": "https://github.com/irresponsible/purescript-reactix",
"version": "v0.4.11" "version": "v0.4.11"
}, },
"read": { "read": {
...@@ -4719,12 +4722,14 @@ ...@@ -4719,12 +4722,14 @@
"dependencies": [ "dependencies": [
"aff", "aff",
"coroutines", "coroutines",
"web-dom",
"freet", "freet",
"profunctor-lenses", "profunctor-lenses",
"react" "react",
"react-dom"
], ],
"repo": "https://github.com/paf31/purescript-thermite.git", "repo": "https://github.com/poorscript/purescript-thermite.git",
"version": "v6.3.1" "version": "hide-2020-03-04"
}, },
"thermite-dom": { "thermite-dom": {
"dependencies": [ "dependencies": [
...@@ -4746,13 +4751,13 @@ ...@@ -4746,13 +4751,13 @@
}, },
"toestand": { "toestand": {
"dependencies": [ "dependencies": [
"prelude",
"effect", "effect",
"foldable-traversable",
"reactix", "reactix",
"prelude",
"record", "record",
"tuples", "tuples",
"typelevel-prelude" "typelevel-prelude",
"typisch"
], ],
"repo": "https://github.com/poorscript/purescript-toestand", "repo": "https://github.com/poorscript/purescript-toestand",
"version": "v0.6.1" "version": "v0.6.1"
......
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [sos AT gargantext DOT org]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
...@@ -9,6 +9,8 @@ RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources ...@@ -9,6 +9,8 @@ RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources
RUN apt-get update && apt-get install -y yarn RUN apt-get update && apt-get install -y yarn
RUN curl -L https://github.com/coot/zephyr/releases/download/v0.3.2/Linux.tar.gz | tar zx -C /usr/bin --strip-components=1 zephyr/zephyr RUN curl -L https://github.com/coot/zephyr/releases/download/v0.3.2/Linux.tar.gz | tar zx -C /usr/bin --strip-components=1 zephyr/zephyr
RUN curl -L https://github.com/dhall-lang/dhall-haskell/releases/download/1.38.1/dhall-json-1.7.6-x86_64-linux.tar.bz2 | tar jx -C /usr/bin --strip-components=2 ./bin/dhall-to-json
WORKDIR /opt/app WORKDIR /opt/app
EXPOSE 5000/tcp EXPOSE 5000/tcp
CMD ["bash"] CMD ["bash"]
\ No newline at end of file
...@@ -8,8 +8,9 @@ processing, text-mining, complex networks analysis and interactive data ...@@ -8,8 +8,9 @@ processing, text-mining, complex networks analysis and interactive data
visualization to pave the way toward new kinds of interactions with your visualization to pave the way toward new kinds of interactions with your
digital corpora. digital corpora.
You will not find this software very useful without also running or being This repo deals with the frontend or client which needs
granted access to a [backend](https://gitlab.iscpif.fr/gargantext/haskell-gargantext). a backend server running or being granted access to a
[backend](https://gitlab.iscpif.fr/gargantext/haskell-gargantext).
This software is free software, developed by the CNRS Complex Systems This software is free software, developed by the CNRS Complex Systems
Institute of Paris Île-de-France (ISC-PIF) and its partners. Institute of Paris Île-de-France (ISC-PIF) and its partners.
...@@ -191,7 +192,7 @@ yarn css # for manual setup ...@@ -191,7 +192,7 @@ yarn css # for manual setup
<!-- A `purs ide` connection will be available on port 9002 while the --> <!-- A `purs ide` connection will be available on port 9002 while the -->
<!-- development server is running. --> <!-- development server is running. -->
A guide to getting set up with the IDE integration is coming soon, I hope. A guide to getting set up with the IDE integration is coming soon.
### Testing ### Testing
...@@ -236,8 +237,6 @@ yarn rebuild-set # or darn rebuild-set ...@@ -236,8 +237,6 @@ yarn rebuild-set # or darn rebuild-set
yarn rebase-set && yarn rebuild-set # or darn rebase-set && darn rebuild-set yarn rebase-set && yarn rebuild-set # or darn rebase-set && darn rebuild-set
``` ```
This will occasionally result in swearing when you go on to build.
## Theory Introduction ## Theory Introduction
Making sense of out text isn't actually that hard, but it does require Making sense of out text isn't actually that hard, but it does require
...@@ -245,21 +244,23 @@ a little background knowledge to understand. ...@@ -245,21 +244,23 @@ a little background knowledge to understand.
### N-grams ### N-grams
N-grams are at the heart of how Gargantext makes sense out of text. N-grams in contexts (of texts) are at the heart of how Gargantext makes
sense out of text.
There are two common meanings in the literature for n-gram: There are two common meanings in the literature for n-gram:
- a sequence of `n` characters - a sequence of `n` characters
- a sequence of `n` words - a sequence of `n` words
Gargantext is focused on words. Here are some example word n-grams; Gargantext is focused on words. Here are some example word n-grams
usually extracted by our Natural Language Process toolkit;
- `coffee` (unigram or 1-gram) - `coffee` (unigram or 1-gram)
- `need coffee` (bigram or 2-gram) - `black coffee` (bigram or 2-gram)
- `one coffee please` (trigram or 3-gram) - `hot black coffee` (trigram or 3-gram)
- `here is your coffee` (4-gram) - `arabica hot black coffee` (4-gram)
- `i need some more coffee` (5-gram)
N-grams are matched case insensitively and across whole words. Examples: N-grams are matched case insensitively and across whole words removing
the linked syntax if exists. Examples:
| Text | N-gram | Matches | | Text | N-gram | Matches |
|--------------|--------------|----------------------| |--------------|--------------|----------------------|
...@@ -271,20 +272,23 @@ You may read more about n-grams [on wikipedia](https://en.wikipedia.org/wiki/N-g ...@@ -271,20 +272,23 @@ You may read more about n-grams [on wikipedia](https://en.wikipedia.org/wiki/N-g
<!-- TODO: Discuss punctuation --> <!-- TODO: Discuss punctuation -->
Gargantext allows you to define n-grams interactively in your browser Gargantext allows you to define and refine n-grams interactively in your
and explore the relationships they uncover across a corpus of text. browser and explore the relationships they uncover across a corpus of
text.
Various metrics can be applied to n-grams, the most common of which is Various metrics can be applied to n-grams, the most common of which
the number of times an n-gram appears in a document. is the number of times an n-gram appears in a document (occurrences).
GarganText uses extensively the cooccurrences: times 2 n-grams appear in
same context of text.
## Glossary ## Glossary
document document
: One or more texts comprising a single logical document : One or more texts comprising a single logical document
field field
: A portion of a document, e.g. `title`, `abstract`, `body` : A portion of a document or metadata, e.g. `title`, `abstract`, `body`
corpus corpus
: A collection of documents : A collection of documents as set (with no repetition)
n-gram/ngram n-gram/ngram
: A word or words to be indexed, consisting of `n` words. : A word or words to be indexed, consisting of `n` words.
This technically includes skip-grams, but in the general case This technically includes skip-grams, but in the general case
...@@ -296,8 +300,10 @@ bigram/2-gram ...@@ -296,8 +300,10 @@ bigram/2-gram
trigram/3-gram trigram/3-gram
: A three-word n-gram, e.g. `coffee cup holder` : A three-word n-gram, e.g. `coffee cup holder`
skip-gram skip-gram
: An n-gram where the words are not all adjacent. Not yet supported. : An n-gram where the words are not all adjacent. Group 2 different
n-grams to enable such feature.
k-skip-n-gram k-skip-n-gram
: An n-gram where the words are at most distance k from each other. : An n-gram where the words are at most distance k from each other. This
feature is used for advanced research in text (not yet supported in
GarganText)
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
} }
.graph-container #controls-container { .graph-container #controls-container {
position: absolute; position: absolute;
z-index: 999; z-index: 900;
backdrop-filter: blur(4px); backdrop-filter: blur(4px);
background: rgba(255, 255, 255, 0.75); background: rgba(255, 255, 255, 0.75);
left: 0; left: 0;
...@@ -152,10 +152,10 @@ ...@@ -152,10 +152,10 @@
padding-left: 0.8rem; padding-left: 0.8rem;
} }
.graph-container .graph-row { .graph-container .graph-row {
height: 100%; height: 100vh;
} }
.graph-container .graph-row #graph-view { .graph-container .graph-row #graph-view {
height: 95%; height: 95vh;
} }
.graph-container #tree { .graph-container #tree {
position: absolute; position: absolute;
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
} }
#dafixedtop { #dafixedtop {
z-index: 999; z-index: 910;
} }
#logo-designed { #logo-designed {
...@@ -535,8 +535,20 @@ li .leaf:hover a.settings { ...@@ -535,8 +535,20 @@ li .leaf:hover a.settings {
color: black; color: black;
} }
.forest-layout-raw-tree { .forest-layout {
padding-top: 60px; background-color: #fff;
position: fixed;
top: 3.7em;
width: 15%;
z-index: 900;
}
.left-handed .forest-layout {
left: 80%;
}
.right-handed .forest-layout {
left: 2%;
} }
.code-editor .editor .code-area { .code-editor .editor .code-area {
...@@ -642,25 +654,46 @@ li .leaf:hover a.settings { ...@@ -642,25 +654,46 @@ li .leaf:hover a.settings {
list-style: decimal !important; list-style: decimal !important;
} }
#page-wrapper .cache-toggle { .cache-toggle {
cursor: pointer; cursor: pointer;
} }
#page-wrapper .side-panel {
.left-handed .side-panel {
left: 2%;
padding: 0.3em;
position: fixed;
top: 3.7em;
background-color: #fff;
width: 28%;
}
.left-handed .side-panel .header {
float: left;
}
.left-handed .side-panel .corpus-doc-view .annotated-field-wrapper .annotated-field-runs {
max-height: 200px;
overflow-y: scroll;
}
.left-handed .side-panel .corpus-doc-view .list-group .list-group-item-heading {
display: inline-block;
width: 60px;
}
.right-handed .side-panel {
left: 70%; left: 70%;
padding: 5px; padding: 0.3em;
position: fixed; position: fixed;
top: 60px; top: 3.7em;
background-color: #fff; background-color: #fff;
width: 28%; width: 28%;
} }
#page-wrapper .side-panel .header { .right-handed .side-panel .header {
float: right; float: right;
} }
#page-wrapper .side-panel .corpus-doc-view .annotated-field-wrapper .annotated-field-runs { .right-handed .side-panel .corpus-doc-view .annotated-field-wrapper .annotated-field-runs {
max-height: 200px; max-height: 200px;
overflow-y: scroll; overflow-y: scroll;
} }
#page-wrapper .side-panel .corpus-doc-view .list-group .list-group-item-heading { .right-handed .side-panel .corpus-doc-view .list-group .list-group-item-heading {
display: inline-block; display: inline-block;
width: 60px; width: 60px;
} }
......
{"version":3,"sourceRoot":"","sources":["../../src/sass/_menu.sass","../../src/sass/_context_menu.sass","../../src/sass/_graph.sass","../../src/sass/_login.sass","../../src/sass/_tree.sass","../../src/sass/_code_editor.sass","../../src/sass/_styles.sass","../../src/sass/_range_slider.sass","../../src/sass/_annotation.sass","../../src/sass/_folder_view.sass"],"names":[],"mappings":"AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;EACI;EACA;;;AAEJ;EACI;EACA;EACA;EACA;;;AAEJ;EACE;;;AAEF;AACI;EACA;;;AAEJ;AACI;EACA;;;AAGJ;AACA;EACI;;;AAEJ;EACI;EACA;EACA;EACA;;;AAEJ;EACE;EACA;;;AAEF;EACE;;;AC7CF;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AClBF;EACE;EACA;EACA;;;AAEF;AAkCE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAxCA;EAZA;EACA;EAEA;EAWE;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAEF;EACE;EACA;;AAGA;EACE;EACA;;AACN;EACE;;AACF;EACE;;AAEF;EApCA;EACA;EAEA;EAmCE;EACA;;AACF;EACE;;AACF;EACE;;AAWF;EAEE;EACA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;;AAEJ;EACE;;AAEA;EACE;;AAEJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;ACrFJ;EACE;;;AAOF;EACE;;AACA;EACE;EACA;;;AAEJ;EACE;;;AAEF;EACE;;;AAEF;EACE;;;AAEF;EACE;;;AAGF;EACE;;AAEE;EACE;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;EACA;;;AAKJ;EACE;EACA;EACA;;;AAGJ;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;;AACF;EACE;EACA;;AACA;EACE;EACA;EACA;EACA;;AACA;EACE;;AACF;EACE;EACA;EACA;EACA;;AACA;EACE;;AACN;EACE;EACA;EACA;EACA;;;AAGN;EACE;EACA;EACA;EACA;EACA;;AAGE;EACE;;;AAEN;EACE;EACA;EACA;EACA;EACA;;AAGE;EACE;;;AAEN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;;AAEJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;;AACA;EACE;EACA;;;AAGF;EACE;;;AAEJ;EACI;EACA;;;AAGF;EACE;;;AAEJ;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;;;ACvKF;EACE;;;AAGA;EACE;EACA;EACA;;AAEA;EACE;EACA;;AAGA;EACE;;AACF;EACE;;AAEJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAGN;EACE;;;AAIA;EACE;;AACA;EACE;EACA;EACA;EACA;;AACF;EACE;EACA;EACA;EACA;EACA;;AACF;EACE;;AACF;EACE;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;;AACF;EACE;;AAGN;EACE;;AACF;EACE;;AACA;EACE;EACA;;AAEE;EACE;EACA;;AACF;EACE;EACA;;AAIR;EACE;;AACF;EACE;;AACA;EACE;EACA;;AAEE;EACE;EACA;;AACF;EACE;EACA;;AACF;EACE;EACA;;AAEV;EACE;;AACF;EACE;;AAEE;EACE;;AACF;EACE;;AACN;EACE;;AAEE;EACE;;;AAGR;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EAEE;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAEF;EACE;;;AAIF;EACE;;AAEA;EACE;;;AAGN;EACE;;AACF;EACE;;AACF;EACE;;;AAEJ;EACE;;;ACpJE;EACE;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EApCR;EACA;EACA;EACA;EACA;EACA;EACA;EAlBA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AA0CM;EACE;EACA;EACA;EACA;EACA;EA5CR;EACA;EACA;EACA;EACA;EACA;EACA;EAlBA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAkDE;EACE;EACA;EACA;EACA;EACA;EACA;;AACF;EACE;EACA;EACA;;AACA;EACE;EACA;;AACF;EACE;EACA;;AACF;EACE;EACA;;AAGE;EACE;;AAEF;EACE;;;ACrFV;EACE;;AACF;EAEE;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;AAGE;EACE;EACA;;AAEF;EACE;EACA;;;AAEV;EACE;;AACA;EACE;;AACF;EACE;EACA;EACA;;;AAIA;EACE;;AACA;EACE;EACA;;AACF;EACE;;AACA;EACE;;AACJ;EACE;;;AAER;EACE;;;AAEF;EACE;;;AAEF;EACE;;;AAEF;AAGI;EACE;;AACF;EACE;;;AAEN;EACE;EACA;EACA;;;AAIA;EACE;;AACF;EACE;;;AAEJ;EACE;;AACA;EACE;;;AAEJ;EACE;EACA;;;AClFF;EACE;AACA;EACA;;AAEA;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EAEA;EAEA;;AAEA;EACE;EAEA;EACA;EACA;;;AAGN;EACE;;;ACxBJ;EACE;;AAEA;EANE;EACA;;AAQF;EAbE;EACA;;AAeF;EAhBE;EACA;;AAkBF;EAnBE;EACA;;AAqBF;EA1BE;EACA,kBANyB;;AAkC3B;EA7BE;EACA,kBAPqB;;AAsCvB;EAhCE;EACA,kBAJoB;;;AAuCtB;EApCE;EACA,kBANyB;;AA4C3B;EAvCE;EACA,kBAPqB;;AAgDvB;EA1CE;EACA,kBAJoB;;;ACRxB;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA","file":"sass.css"} {"version":3,"sourceRoot":"","sources":["../../src/sass/_menu.sass","../../src/sass/_context_menu.sass","../../src/sass/_graph.sass","../../src/sass/_login.sass","../../src/sass/_tree.sass","../../src/sass/_code_editor.sass","../../src/sass/_styles.sass","../../src/sass/_range_slider.sass","../../src/sass/_annotation.sass","../../src/sass/_folder_view.sass"],"names":[],"mappings":"AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;EACI;EACA;;;AAEJ;EACI;EACA;EACA;EACA;;;AAEJ;EACE;;;AAEF;AACI;EACA;;;AAEJ;AACI;EACA;;;AAGJ;AACA;EACI;;;AAEJ;EACI;EACA;EACA;EACA;;;AAEJ;EACE;EACA;;;AAEF;EACE;;;AC7CF;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AClBF;EACE;EACA;EACA;;;AAEF;AAkCE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAxCA;EAZA;EACA;EAEA;EAWE;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAEF;EACE;EACA;;AAGA;EACE;EACA;;AACN;EACE;;AACF;EACE;;AAEF;EApCA;EACA;EAEA;EAmCE;EACA;;AACF;EACE;;AACF;EACE;;AAWF;EAEE;EAEA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;;AAEJ;EACE;;AAEA;EACE;;AAEJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;ACtFJ;EAEE;;;AAQF;EACE;;AACA;EACE;EACA;;;AAEJ;EACE;;;AAEF;EACE;;;AAEF;EACE;;;AAEF;EACE;;;AAGF;EACE;;AAEE;EACE;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;EACA;;;AAKJ;EACE;EACA;EACA;;;AAGJ;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;;AACF;EACE;EACA;;AACA;EACE;EACA;EACA;EACA;;AACA;EACE;;AACF;EACE;EACA;EACA;EACA;;AACA;EACE;;AACN;EACE;EACA;EACA;EACA;;;AAGN;EACE;EACA;EACA;EACA;EACA;;AAGE;EACE;;;AAEN;EACE;EACA;EACA;EACA;EACA;;AAGE;EACE;;;AAEN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;;AAEJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;;AACA;EACE;EACA;;;AAGF;EACE;;;AAEJ;EACI;EACA;;;AAGF;EACE;;;AAEJ;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;;;ACzKF;EACE;;;AAGA;EACE;EACA;EACA;;AAEA;EACE;EACA;;AAGA;EACE;;AACF;EACE;;AAEJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAGN;EACE;;;AAIA;EACE;;AACA;EACE;EACA;EACA;EACA;;AACF;EACE;EACA;EACA;EACA;EACA;;AACF;EACE;;AACF;EACE;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;;AACF;EACE;;AAGN;EACE;;AACF;EACE;;AACA;EACE;EACA;;AAEE;EACE;EACA;;AACF;EACE;EACA;;AAIR;EACE;;AACF;EACE;;AACA;EACE;EACA;;AAEE;EACE;EACA;;AACF;EACE;EACA;;AACF;EACE;EACA;;AAEV;EACE;;AACF;EACE;;AAEE;EACE;;AACF;EACE;;AACN;EACE;;AAEE;EACE;;;AAGR;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EAEE;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAEF;EACE;;;AAIF;EACE;;AAEA;EACE;;;AAGN;EACE;;AACF;EACE;;AACF;EACE;;;AAEJ;EACE;EACA;EACA;EACA;EACA;;;AAEA;EACE;;;AAEF;EACE;;;AC9JA;EACE;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EApCR;EACA;EACA;EACA;EACA;EACA;EACA;EAlBA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AA0CM;EACE;EACA;EACA;EACA;EACA;EA5CR;EACA;EACA;EACA;EACA;EACA;EACA;EAlBA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAkDE;EACE;EACA;EACA;EACA;EACA;EACA;;AACF;EACE;EACA;EACA;;AACA;EACE;EACA;;AACF;EACE;EACA;;AACF;EACE;EACA;;AAGE;EACE;;AAEF;EACE;;;ACtFZ;EACE;;;AAEA;EAEE;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;AAGE;EACE;EACA;;AAEF;EACE;EACA;;;AAER;EAEE;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;AAGE;EACE;EACA;;AAEF;EACE;EACA;;;AAEV;EACE;;AACA;EACE;;AACF;EACE;EACA;EACA;;;AAIA;EACE;;AACA;EACE;EACA;;AACF;EACE;;AACA;EACE;;AACJ;EACE;;;AAER;EACE;;;AAEF;EACE;;;AAEF;EACE;;;AAEF;AAGI;EACE;;AACF;EACE;;;AAEN;EACE;EACA;EACA;;;AAIA;EACE;;AACF;EACE;;;AAEJ;EACE;;AACA;EACE;;;AAEJ;EACE;EACA;;;ACtGF;EACE;AACA;EACA;;AAEA;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EAEA;EAEA;;AAEA;EACE;EAEA;EACA;EACA;;;AAGN;EACE;;;ACxBJ;EACE;;AAEA;EANE;EACA;;AAQF;EAbE;EACA;;AAeF;EAhBE;EACA;;AAkBF;EAnBE;EACA;;AAqBF;EA1BE;EACA,kBANyB;;AAkC3B;EA7BE;EACA,kBAPqB;;AAsCvB;EAhCE;EACA,kBAJoB;;;AAuCtB;EApCE;EACA,kBANyB;;AA4C3B;EAvCE;EACA,kBAPqB;;AAgDvB;EA1CE;EACA,kBAJoB;;;ACRxB;EACE;EACA;EACA;EACA","file":"sass.css"}
\ No newline at end of file
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
<link id="bootstrap-css" href="styles/bootstrap-default.css" rel="stylesheet" /> <link id="bootstrap-css" href="styles/bootstrap-default.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="styles/highlightjs-solarized-light.css" /> <link rel="stylesheet" type="text/css" href="styles/highlightjs-solarized-light.css" />
<link href="styles/sass.css" rel="stylesheet" type="text/css" /> <link href="styles/sass.css" rel="stylesheet" type="text/css" />
<!-- <script type="text/javascript" src="/js/react-bootstrap.min.js"></script> -->
<script type="text/javascript" src="/js/react-bootstrap.js"></script>
<style> * {margin: 0; padding: 0; list-style: none;} </style> <style> * {margin: 0; padding: 0; list-style: none;} </style>
</head> </head>
<body> <body>
......
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
name = "dom-simple"; name = "dom-simple";
version = "v0.2.7"; version = "v0.2.7";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/poorscript/purescript-dom-simple"; url = "https://github.com/irresponsible/purescript-dom-simple";
rev = "v0.2.7"; rev = "v0.2.7";
sha256 = "02f1vsjk5frva3p3xpbrnj2zg4rg01l07dnvc3i6axvc5k30i282"; sha256 = "02f1vsjk5frva3p3xpbrnj2zg4rg01l07dnvc3i6axvc5k30i282";
}; };
...@@ -266,7 +266,7 @@ ...@@ -266,7 +266,7 @@
name = "ffi-simple"; name = "ffi-simple";
version = "v0.2.10"; version = "v0.2.10";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/poorscript/purescript-ffi-simple"; url = "https://github.com/irresponsible/purescript-ffi-simple";
rev = "v0.2.10"; rev = "v0.2.10";
sha256 = "14slcccmy96ml7r8rzhhqnw486qj1b385i9095fdymms78g5gnj5"; sha256 = "14slcccmy96ml7r8rzhhqnw486qj1b385i9095fdymms78g5gnj5";
}; };
...@@ -372,11 +372,11 @@ ...@@ -372,11 +372,11 @@
}; };
"generics-rep" = { "generics-rep" = {
name = "generics-rep"; name = "generics-rep";
version = "v6.1.1"; version = "v6.1.3";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/purescript/purescript-generics-rep.git"; url = "https://github.com/purescript/purescript-generics-rep.git";
rev = "v6.1.1"; rev = "v6.1.3";
sha256 = "15vchzbcvf6byks90q14lvcwb8hnxqzm2mrlxi7v1f7has4s74kn"; sha256 = "18yz3wfhh0xk1aw6scgv94mlr0hyf0q1ydhi8y3wm4zlch0lpy5i";
}; };
}; };
"globals" = { "globals" = {
...@@ -705,11 +705,11 @@ ...@@ -705,11 +705,11 @@
}; };
"proxy" = { "proxy" = {
name = "proxy"; name = "proxy";
version = "v3.0.0"; version = "v3.0.2";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/purescript/purescript-proxy.git"; url = "https://github.com/purescript/purescript-proxy.git";
rev = "v3.0.0"; rev = "v3.0.2";
sha256 = "0rqf25b1n9p5sgx7gdsxwrfv9rb3sqxgqmqpp5kdm30lfk7snz24"; sha256 = "0p941cp8qz7dqyvybm7l1dyx6hbid4azxf35clj9i0zxr4k3vb8l";
}; };
}; };
"psci-support" = { "psci-support" = {
...@@ -752,7 +752,7 @@ ...@@ -752,7 +752,7 @@
name = "reactix"; name = "reactix";
version = "v0.4.11"; version = "v0.4.11";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/poorscript/purescript-reactix"; url = "https://github.com/irresponsible/purescript-reactix";
rev = "v0.4.11"; rev = "v0.4.11";
sha256 = "1prxqww81lk32cp4mr318yanvf51kf9hz7x4n6rxdbcprj27710d"; sha256 = "1prxqww81lk32cp4mr318yanvf51kf9hz7x4n6rxdbcprj27710d";
}; };
......
{ {
"name": "Gargantext", "name": "Gargantext",
"version": "0.0.2.9.2", "version": "0.0.2.9.5",
"scripts": { "scripts": {
"generate-purs-packages-nix": "./nix/generate-purs-packages.nix", "generate-purs-packages-nix": "./nix/generate-purs-packages.nix",
"generate-psc-packages-nix": "./nix/generate-packages-json.bash", "generate-psc-packages-nix": "./nix/generate-packages-json.bash",
...@@ -9,7 +9,14 @@ ...@@ -9,7 +9,14 @@
"install-ps": "psc-package install", "install-ps": "psc-package install",
"compile": "pulp build", "compile": "pulp build",
"build": "pulp browserify -t dist/bundle.js", "build": "pulp browserify -t dist/bundle.js",
"css": "sass src/sass/sass.sass:dist/styles/sass.css && sass src/sass/bootstrap/default.sass:dist/styles/bootstrap-default.css && cp node_modules/bootstrap-dark/src/bootstrap-dark.css dist/styles/bootstrap-dark.css && sass src/sass/bootstrap/greyson.scss:dist/styles/bootstrap-greyson.css && sass src/sass/bootstrap/monotony.scss:dist/styles/bootstrap-monotony.css && sass src/sass/bootstrap/darkster.scss:dist/styles/bootstrap-darkster.css && sass src/sass/bootstrap/herbie.scss:dist/styles/bootstrap-herbie.css", "css": "sass src/sass/sass.sass:dist/styles/sass.css && yarn css-themes",
"css-themes": "yarn css-default-theme && yarn css-dark-theme && yarn css-darkster-theme && yarn css-greyson-theme && yarn css-herbie-theme && yarn css-monotony-theme",
"css-default-theme": "sass src/sass/bootstrap/default.sass:dist/styles/bootstrap-default.css",
"css-dark-theme": "cp node_modules/bootstrap-dark/src/bootstrap-dark.css dist/styles/bootstrap-dark.css",
"css-darkster-theme": "sass src/sass/bootstrap/darkster.scss:dist/styles/bootstrap-darkster.css",
"css-greyson-theme": "sass src/sass/bootstrap/greyson.scss:dist/styles/bootstrap-greyson.css",
"css-herbie-theme": "sass src/sass/bootstrap/herbie.scss:dist/styles/bootstrap-herbie.css",
"css-monotony-theme": "sass src/sass/bootstrap/monotony.scss:dist/styles/bootstrap-monotony.css",
"docs": "pulp docs -- --format html", "docs": "pulp docs -- --format html",
"repl": "pulp repl", "repl": "pulp repl",
"clean": "rm -Rf output node_modules", "clean": "rm -Rf output node_modules",
...@@ -24,9 +31,10 @@ ...@@ -24,9 +31,10 @@
"prod:pack": "parcel build index.html -d prod --public-url . --no-source-maps" "prod:pack": "parcel build index.html -d prod --public-url . --no-source-maps"
}, },
"dependencies": { "dependencies": {
"@popperjs/core": "^2.9.2",
"aes-js": "^3.1.1", "aes-js": "^3.1.1",
"base-x": "^3.0.2", "base-x": "^3.0.2",
"bootstrap": "4.4.1", "bootstrap": "^4.6.0",
"bootstrap-dark": "^1.0.3", "bootstrap-dark": "^1.0.3",
"create-react-class": "^15.6.3", "create-react-class": "^15.6.3",
"echarts": "^4.1.0", "echarts": "^4.1.0",
...@@ -37,6 +45,7 @@ ...@@ -37,6 +45,7 @@
"pullstate": "^1.20.6", "pullstate": "^1.20.6",
"react": "^16.10", "react": "^16.10",
"react-awesome-popover": "^6.1.1", "react-awesome-popover": "^6.1.1",
"react-bootstrap": "^1.5.2",
"react-dom": "^16.10", "react-dom": "^16.10",
"react-tooltip": "^4.2.8", "react-tooltip": "^4.2.8",
"secp256k1": "^3.3.0", "secp256k1": "^3.3.0",
......
...@@ -80,6 +80,11 @@ let additions = ...@@ -80,6 +80,11 @@ let additions =
, repo = "https://github.com/nwolverson/purescript-dom-filereader" , repo = "https://github.com/nwolverson/purescript-dom-filereader"
, version = "v5.0.0" , version = "v5.0.0"
} }
, formula =
{ dependencies = [ "effect", "prelude", "reactix", "record", "toestand", "tuples", "typelevel-prelude", "typisch" ]
, repo = "https://github.com/poorscript/purescript-formula"
, version = "v0.2.1"
}
, markdown = , markdown =
{ dependencies = [ "precise" ] { dependencies = [ "precise" ]
, repo = "https://github.com/poorscript/purescript-markdown" , repo = "https://github.com/poorscript/purescript-markdown"
...@@ -107,7 +112,17 @@ let additions = ...@@ -107,7 +112,17 @@ let additions =
, "unsafe-coerce" , "unsafe-coerce"
] ]
, repo = "https://github.com/irresponsible/purescript-reactix" , repo = "https://github.com/irresponsible/purescript-reactix"
, version = "v0.4.6" , version = "v0.4.11"
}
, toestand =
{ dependencies = [ "effect", "reactix", "prelude", "record", "tuples", "typelevel-prelude", "typisch" ]
, repo = "https://github.com/poorscript/purescript-toestand"
, version = "v0.6.1"
}
, typisch =
{ dependencies = [ "prelude" ]
, repo = "https://github.com/poorscript/purescript-typisch"
, version = "v0.2.1"
} }
, tuples-native = , tuples-native =
{ dependencies = { dependencies =
......
...@@ -10,14 +10,13 @@ import Data.Either (Either(..)) ...@@ -10,14 +10,13 @@ import Data.Either (Either(..))
import Data.Map as Map import Data.Map as Map
import Data.Maybe (Maybe(..), maybe, fromMaybe) import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Effect (Effect) import Effect (Effect)
import Reactix as R
import Toestand as T
import Web.Storage.Storage as WSS
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils as GU import Gargantext.Utils as GU
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2 import Gargantext.Utils.Toestand as T2
import Reactix as R
import Toestand as T
import Web.Storage.Storage as WSS
localStorageKey :: String localStorageKey :: String
localStorageKey = "garg-async-tasks" localStorageKey = "garg-async-tasks"
...@@ -56,8 +55,8 @@ removeTaskFromList ts (GT.AsyncTaskWithType { task: GT.AsyncTask { id: id' } }) ...@@ -56,8 +55,8 @@ removeTaskFromList ts (GT.AsyncTaskWithType { task: GT.AsyncTask { id: id' } })
A.filter (\(GT.AsyncTaskWithType { task: GT.AsyncTask { id: id'' } }) -> id' /= id'') ts A.filter (\(GT.AsyncTaskWithType { task: GT.AsyncTask { id: id'' } }) -> id' /= id'') ts
type ReductorProps = ( type ReductorProps = (
reloadForest :: T.Box T2.Reload reloadForest :: T2.ReloadS
, reloadRoot :: T.Box T2.Reload , reloadRoot :: T2.ReloadS
, storage :: Storage , storage :: Storage
) )
...@@ -73,3 +72,26 @@ remove :: GT.NodeID -> GT.AsyncTaskWithType -> T.Box Storage -> Effect Unit ...@@ -73,3 +72,26 @@ remove :: GT.NodeID -> GT.AsyncTaskWithType -> T.Box Storage -> Effect Unit
remove id task storage = T.modify_ newStorage storage remove id task storage = T.modify_ newStorage storage
where where
newStorage s = Map.alter (maybe Nothing $ (\ts -> Just $ removeTaskFromList ts task)) id s newStorage s = Map.alter (maybe Nothing $ (\ts -> Just $ removeTaskFromList ts task)) id s
-- When a task is finished: which tasks cause forest or app reload
asyncTaskTriggersAppReload :: GT.AsyncTaskType -> Boolean
asyncTaskTriggersAppReload _ = false
asyncTaskTTriggersAppReload :: GT.AsyncTaskWithType -> Boolean
asyncTaskTTriggersAppReload (GT.AsyncTaskWithType { typ }) = asyncTaskTriggersAppReload typ
asyncTaskTriggersMainPageReload :: GT.AsyncTaskType -> Boolean
asyncTaskTriggersMainPageReload GT.UpdateNgramsCharts = true
asyncTaskTriggersMainPageReload _ = false
asyncTaskTTriggersMainPageReload :: GT.AsyncTaskWithType -> Boolean
asyncTaskTTriggersMainPageReload (GT.AsyncTaskWithType { typ }) = asyncTaskTriggersMainPageReload typ
asyncTaskTriggersTreeReload :: GT.AsyncTaskType -> Boolean
asyncTaskTriggersTreeReload GT.Form = true
asyncTaskTriggersTreeReload GT.UploadFile = true
asyncTaskTriggersTreeReload _ = false
asyncTaskTTriggersTreeReload :: GT.AsyncTaskWithType -> Boolean
asyncTaskTTriggersTreeReload (GT.AsyncTaskWithType { typ }) = asyncTaskTriggersTreeReload typ
...@@ -12,27 +12,27 @@ ...@@ -12,27 +12,27 @@
module Gargantext.Components.Annotation.AnnotatedField where module Gargantext.Components.Annotation.AnnotatedField where
import Data.Array as A import Data.Array as A
import Data.List ( List(..), (:), length ) import Data.List (List(..), (:))
import Data.Maybe ( Maybe(..), maybe ) import Data.Maybe ( Maybe(..), maybe )
import Data.String.Common ( joinWith ) import Data.String.Common ( joinWith )
import Data.Tuple (Tuple(..), snd) import Data.Tuple (Tuple(..), snd)
import Data.Tuple.Nested ( (/\) ) import Data.Tuple.Nested ( (/\) )
-- import DOM.Simple.Console (log2)
import DOM.Simple.Event as DE import DOM.Simple.Event as DE
import Effect (Effect) import Effect (Effect)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as HTML import Reactix.DOM.HTML as HTML
import Reactix.SyntheticEvent as E import Reactix.SyntheticEvent as E
import Record as Record
import Toestand as T import Toestand as T
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Components.Annotation.Menu ( annotationMenu, AnnotationMenu, MenuType(..) ) import Gargantext.Components.Annotation.Menu ( annotationMenuWrapper, AnnotationMenu, MenuType(..) )
import Gargantext.Components.Annotation.Utils ( termBootstrapClass, termClass ) import Gargantext.Components.Annotation.Utils (termClass)
import Gargantext.Components.NgramsTable.Core (NgramsTable, NgramsTerm, findNgramTermList, highlightNgrams, normNgram) import Gargantext.Components.NgramsTable.Core (NgramsTable, NgramsTerm, findNgramTermList, highlightNgrams, normNgram)
import Gargantext.Types (CTabNgramType(..), TermList)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Selection as Sel import Gargantext.Utils.Selection as Sel
import Gargantext.Types (CTabNgramType(..), TermList)
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.Annotation.AnnotatedField" here = R2.here "Gargantext.Components.Annotation.AnnotatedField"
...@@ -49,25 +49,37 @@ type MouseEvent = E.SyntheticEvent DE.MouseEvent ...@@ -49,25 +49,37 @@ type MouseEvent = E.SyntheticEvent DE.MouseEvent
-- defaultProps = { ngrams: NgramsTable Map.empty, text: Nothing, setTermList: \_ _ _ -> pure unit } -- defaultProps = { ngrams: NgramsTable Map.empty, text: Nothing, setTermList: \_ _ _ -> pure unit }
annotatedField :: R2.Component Props annotatedField :: R2.Component Props
annotatedField = R.createElement annotatedFieldComponent annotatedField = R.createElement annotatedFieldCpt
annotatedFieldCpt :: R.Component Props
annotatedFieldComponent :: R.Component Props annotatedFieldCpt = here.component "annotatedField" cpt where
annotatedFieldComponent = here.component "annotatedField" cpt cpt props _ = do
where menuRef <- R.useRef (Nothing :: Maybe (Record AnnotationMenu))
cpt { ngrams, setTermList, text: fieldText } _ = do
redrawMenu <- T.useBox false redrawMenu <- T.useBox false
redrawMenu' <- T.useLive T.unequal redrawMenu
menuRef <- R.useRef (Nothing :: Maybe AnnotationMenu) pure $ annotatedFieldInner (Record.merge { menuRef, redrawMenu } props)
type InnerProps =
(
menuRef :: R.Ref (Maybe (Record AnnotationMenu))
, redrawMenu :: T.Box Boolean
| Props
)
annotatedFieldInner :: R2.Leaf InnerProps
annotatedFieldInner p = R.createElement annotatedFieldInnerCpt p []
annotatedFieldInnerCpt :: R.Component InnerProps
annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where
cpt { menuRef, ngrams, redrawMenu, setTermList, text: fieldText } _ = do
redrawMenu' <- T.useLive T.unequal redrawMenu
let wrapperProps = { className: "annotated-field-wrapper" } -- menu <- T.useBox (Nothing :: Maybe (Record AnnotationMenu))
wrap (text /\ list) = { list let wrap (text /\ list) = { list
, onSelect: onAnnotationSelect { menuRef, ngrams, redrawMenu, setTermList } , onSelect: onAnnotationSelect { menuRef, ngrams, redrawMenu, setTermList }
, text } , text }
pure $ HTML.div wrapperProps pure $ HTML.div { className: "annotated-field-wrapper" }
[ maybe (HTML.div {} []) annotationMenu $ R.readRef menuRef [ annotationMenuWrapper { menuRef }
, HTML.div { className: "annotated-field-runs" } , HTML.div { className: "annotated-field-runs" }
((\p -> annotateRun p []) <$> wrap <$> compile ngrams fieldText) ((\p -> annotateRun p []) <$> wrap <$> compile ngrams fieldText)
] ]
...@@ -77,7 +89,7 @@ compile ngrams = maybe [] (highlightNgrams CTabTerms ngrams) ...@@ -77,7 +89,7 @@ compile ngrams = maybe [] (highlightNgrams CTabTerms ngrams)
-- Runs -- Runs
onAnnotationSelect :: forall e. DE.IsMouseEvent e => { menuRef :: R.Ref (Maybe AnnotationMenu) onAnnotationSelect :: forall e. DE.IsMouseEvent e => { menuRef :: R.Ref (Maybe (Record AnnotationMenu))
, ngrams :: NgramsTable , ngrams :: NgramsTable
, redrawMenu :: T.Box Boolean , redrawMenu :: T.Box Boolean
, setTermList :: NgramsTerm -> Maybe TermList -> TermList -> Effect Unit } , setTermList :: NgramsTerm -> Maybe TermList -> TermList -> Effect Unit }
...@@ -109,7 +121,7 @@ onAnnotationSelect { menuRef, ngrams, redrawMenu, setTermList } (Just (Tuple ngr ...@@ -109,7 +121,7 @@ onAnnotationSelect { menuRef, ngrams, redrawMenu, setTermList } (Just (Tuple ngr
-- showMenu :: forall p e. DE.IsMouseEvent e => { event :: E.SyntheticEvent e | p } -> Effect Unit -- showMenu :: forall p e. DE.IsMouseEvent e => { event :: E.SyntheticEvent e | p } -> Effect Unit
showMenu :: forall e. DE.IsMouseEvent e => { event :: E.SyntheticEvent e showMenu :: forall e. DE.IsMouseEvent e => { event :: E.SyntheticEvent e
, getList :: NgramsTerm -> Maybe TermList , getList :: NgramsTerm -> Maybe TermList
, menuRef :: R.Ref (Maybe AnnotationMenu) , menuRef :: R.Ref (Maybe (Record AnnotationMenu))
, menuType :: MenuType , menuType :: MenuType
, ngram :: NgramsTerm , ngram :: NgramsTerm
, redrawMenu :: T.Box Boolean , redrawMenu :: T.Box Boolean
...@@ -126,11 +138,12 @@ showMenu { event, getList, menuRef, menuType, ngram, redrawMenu, setTermList } = ...@@ -126,11 +138,12 @@ showMenu { event, getList, menuRef, menuType, ngram, redrawMenu, setTermList } =
hideMenu { menuRef, redrawMenu } hideMenu { menuRef, redrawMenu }
E.preventDefault event E.preventDefault event
--range <- Sel.getRange sel 0 --range <- Sel.getRange sel 0
--log2 "[showMenu] selection range" $ Sel.rangeToTuple range --here.log2 "selection range" $ Sel.rangeToTuple range
let menu = Just let menu = Just
{ list { list
, onClose: hideMenu { menuRef, redrawMenu }
, menuType , menuType
, onClose: hideMenu { menuRef, redrawMenu }
, redrawMenu
, setList , setList
, x , x
, y } , y }
...@@ -148,26 +161,19 @@ type Run = ...@@ -148,26 +161,19 @@ type Run =
) )
annotateRun :: R2.Component Run annotateRun :: R2.Component Run
annotateRun = R.createElement annotatedRunComponent annotateRun = R.createElement annotatedRunCpt
annotatedRunCpt :: R.Component Run
annotatedRunComponent :: R.Component Run annotatedRunCpt = here.component "annotatedRun" cpt
annotatedRunComponent = R.staticComponent "AnnotatedRun" cpt
where where
cpt { list: Nil, onSelect, text } _ = cpt { list, onSelect, text } _ = do
HTML.span { on: { mouseUp: onSelect Nothing } } [ HTML.text text ]
cpt { list: lst@((ngram /\ list) : otherLists), onSelect, text } _ = let el = case list of
HTML.span { className Nil -> HTML.span { on: { mouseUp: onSelect Nothing } } [ HTML.text text ]
, on: { click: onSelect (Just (ngram /\ list)) } } [ HTML.text text ] lst@(( ngram /\ list' ) : otherLists) ->
where let bgClasses = joinWith " " $ A.fromFoldable $ termClass <<< snd <$> lst
bgClasses = joinWith " " $ A.fromFoldable $ termClass <<< snd <$> lst
-- className = "annotation-run bg-" <> termBootstrapClass list
className = "annotation-run " <> bgClasses className = "annotation-run " <> bgClasses
-- cb = onSelect text list in
-- elt = HTML.span { className
-- case list of , on: { click: onSelect (Just (ngram /\ list')) } } [ HTML.text text ]
-- Nothing -> HTML.span { on: { mouseUp: cb } }
-- Just l -> HTML.span { -- className: "annotation-run bg-" <> termBootstrapClass l pure $ el
-- className: "annotation-run " <> termClass l
-- , on: { click: cb }
-- }
...@@ -2,13 +2,17 @@ ...@@ -2,13 +2,17 @@
module Gargantext.Components.Annotation.Menu where module Gargantext.Components.Annotation.Menu where
import Prelude (Unit, pure, ($), (<>), (==))
import Data.Array as A import Data.Array as A
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Effect (Effect) import Effect (Effect)
import Effect.Uncurried (mkEffectFn1) import Effect.Uncurried (mkEffectFn1)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as HTML import Reactix.DOM.HTML as HTML
import Toestand as T
import Gargantext.Prelude
import Gargantext.Types (TermList(..), termListName) import Gargantext.Types (TermList(..), termListName)
import Gargantext.Components.Annotation.Utils (termBootstrapClass) import Gargantext.Components.Annotation.Utils (termBootstrapClass)
...@@ -20,6 +24,9 @@ here :: R2.Here ...@@ -20,6 +24,9 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Annotation.Menu" here = R2.here "Gargantext.Components.Annotation.Menu"
data MenuType = NewNgram | SetTermListItem data MenuType = NewNgram | SetTermListItem
derive instance genericMenuType :: Generic MenuType _
instance eqMenuType :: Eq MenuType where
eq = genericEq
type Props = type Props =
( list :: Maybe TermList ( list :: Maybe TermList
...@@ -27,32 +34,65 @@ type Props = ...@@ -27,32 +34,65 @@ type Props =
, setList :: TermList -> Effect Unit -- not a state hook setter , setList :: TermList -> Effect Unit -- not a state hook setter
) )
type AnnotationMenu = { type AnnotationMenu = (
x :: Number onClose :: Effect Unit
, redrawMenu :: T.Box Boolean
, x :: Number
, y :: Number , y :: Number
, onClose :: Effect Unit
| Props | Props
} )
type AnnotationMenuWrapper =
(
menuRef :: R.Ref (Maybe (Record AnnotationMenu))
)
eqAnnotationMenu :: Record AnnotationMenu -> Record AnnotationMenu -> Boolean
eqAnnotationMenu new old = new.list == old.list &&
new.menuType == old.menuType &&
new.x == old.x &&
new.y == old.y
eqAnnotationMenuWrapper :: { new :: Maybe (Record AnnotationMenu)
, old :: Maybe (Record AnnotationMenu) } -> Effect Boolean
eqAnnotationMenuWrapper { new: Nothing, old: Nothing } = pure $ true
eqAnnotationMenuWrapper { new: Nothing, old: Just _ } = pure $ false
eqAnnotationMenuWrapper { new: Just _, old: Nothing } = pure $ false
eqAnnotationMenuWrapper { new: Just n, old: Just o } = pure $ eqAnnotationMenu n o
annotationMenuWrapper :: R2.Leaf AnnotationMenuWrapper
annotationMenuWrapper p = R.createElement annotationMenuWrapperCpt p []
annotationMenuWrapperCpt :: R.Component AnnotationMenuWrapper
annotationMenuWrapperCpt = here.component "annotationMenuWrapper" cpt where
cpt { menuRef } _ = do
case R.readRef menuRef of
Nothing -> pure $ HTML.div {} []
Just menu -> pure $ annotationMenu menu
-- | An Annotation Menu is parameterised by a Maybe Termlist of the -- | An Annotation Menu is parameterised by a Maybe Termlist of the
-- | TermList the currently selected text belongs to -- | TermList the currently selected text belongs to
annotationMenu :: AnnotationMenu -> R.Element annotationMenu :: R2.Leaf AnnotationMenu
annotationMenu {x, y, list, menuType, onClose, setList} = annotationMenu p = R.createElement annotationMenuCpt p []
CM.contextMenu {x, y, onClose} [ annotationMenuCpt :: R.Component AnnotationMenu
R.createElement annotationMenuCpt {list, menuType, setList} [] annotationMenuCpt = here.component "annotationMenu" cpt where
cpt { x, y, list, menuType, onClose, redrawMenu, setList } _ = do
redrawMenu' <- T.useLive T.unequal redrawMenu
pure $ CM.contextMenu {x, y, onClose} [
annotationMenuInner { list, menuType, setList }
] ]
annotationMenuCpt :: R.Component Props annotationMenuInner :: R2.Leaf Props
annotationMenuCpt = here.component "annotationMenu" cpt annotationMenuInner p = R.createElement annotationMenuInnerCpt p []
where annotationMenuInnerCpt :: R.Component Props
cpt props _ = pure $ R.fragment $ children props annotationMenuInnerCpt = here.component "annotationMenuInner" cpt where
children props = A.mapMaybe (addToList props) [ MapTerm, CandidateTerm, StopTerm ] cpt props _ = pure $ R.fragment $ A.mapMaybe (addToList props) [ MapTerm, CandidateTerm, StopTerm ]
-- | Given the TermList to render the item for zand the Maybe TermList the item may belong to, possibly render the menuItem -- | Given the TermList to render the item for zand the Maybe TermList the item may belong to, possibly render the menuItem
addToList :: Record Props -> TermList -> Maybe R.Element addToList :: Record Props -> TermList -> Maybe R.Element
addToList {list: Just t'} t addToList {list: Just t'} t
| t == t' = Nothing | t == t' = Nothing
addToList {menuType, setList} t = Just $ CM.contextMenuItem [ link ] addToList {menuType, setList} t = Just $ CM.contextMenuItem {} [ link ]
where where
link = HTML.a { on: { click }, className: className } [ HTML.text (label menuType) ] link = HTML.a { on: { click }, className: className } [ HTML.text (label menuType) ]
label NewNgram = "Add to " <> termListName t label NewNgram = "Add to " <> termListName t
......
module Gargantext.Components.App (app) where module Gargantext.Components.App (app) where
import Reactix as R
import Toestand as T
import Gargantext.Prelude import Gargantext.Prelude
import Data.Maybe (Maybe(..))
import Gargantext.AsyncTasks as GAT import Gargantext.AsyncTasks as GAT
import Gargantext.Components.App.Data (emptyApp) import Gargantext.Components.App.Data (emptyApp)
import Gargantext.Components.Router (router) import Gargantext.Components.Router (router)
...@@ -10,8 +11,6 @@ import Gargantext.Hooks (useHashRouter) ...@@ -10,8 +11,6 @@ import Gargantext.Hooks (useHashRouter)
import Gargantext.Router as Router import Gargantext.Router as Router
import Gargantext.Sessions as Sessions import Gargantext.Sessions as Sessions
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R
import Toestand as T
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.App" here = R2.here "Gargantext.Components.App"
......
This diff is collapsed.
...@@ -4,7 +4,6 @@ module Gargantext.Components.ContextMenu.ContextMenu where ...@@ -4,7 +4,6 @@ module Gargantext.Components.ContextMenu.ContextMenu where
import Data.Maybe ( Maybe(..) ) import Data.Maybe ( Maybe(..) )
import Data.Nullable ( Nullable, null, toMaybe ) import Data.Nullable ( Nullable, null, toMaybe )
import Data.Tuple.Nested ( (/\) )
import Data.Traversable ( traverse_ ) import Data.Traversable ( traverse_ )
import DOM.Simple as DOM import DOM.Simple as DOM
import DOM.Simple.Event as DE import DOM.Simple.Event as DE
...@@ -34,14 +33,14 @@ type Props t = ( ...@@ -34,14 +33,14 @@ type Props t = (
contextMenu :: forall t. R2.Component (Props t) contextMenu :: forall t. R2.Component (Props t)
contextMenu = R.createElement contextMenuCpt contextMenu = R.createElement contextMenuCpt
contextMenuCpt :: forall t. R.Component (Props t) contextMenuCpt :: forall t. R.Component (Props t)
contextMenuCpt = here.component "contextMenu" cpt contextMenuCpt = here.component "contextMenu" cpt
where where
cpt menu@{ x, y, onClose } children = do cpt menu@{ onClose, x, y } children = do
host <- R2.getPortalHost host <- R2.getPortalHost
root <- R.useRef null root <- R.useRef null
rect <- T.useBox Nothing -- NOTE: Just some dummy width/height here, it should be set properly in the effect function later
rect <- T.useBox $ Just $ R2.domRectFromRect { x, y, width: 100.0, height: 100.0 }
rect' <- T.useLive T.unequal rect rect' <- T.useLive T.unequal rect
R.useLayoutEffect1 (R.readRef root) $ do R.useLayoutEffect1 (R.readRef root) $ do
...@@ -49,7 +48,7 @@ contextMenuCpt = here.component "contextMenu" cpt ...@@ -49,7 +48,7 @@ contextMenuCpt = here.component "contextMenu" cpt
(\r -> T.write_ (Just (Element.boundingRect r)) rect) (\r -> T.write_ (Just (Element.boundingRect r)) rect)
(toMaybe $ R.readRef root) (toMaybe $ R.readRef root)
pure $ pure unit pure $ pure unit
R.useLayoutEffect2 root rect (contextMenuEffect onClose root) R.useLayoutEffect2 (R.readRef root) rect' (contextMenuEffect onClose root)
let cs = [ let cs = [
HTML.div { className: "popover-content" } HTML.div { className: "popover-content" }
[ HTML.div { className: "card" } [ HTML.div { className: "card" }
...@@ -64,13 +63,13 @@ contextMenuCpt = here.component "contextMenu" cpt ...@@ -64,13 +63,13 @@ contextMenuCpt = here.component "contextMenu" cpt
, key: "context-menu" , key: "context-menu"
, className: "context-menu" , className: "context-menu"
, style: position menu rect , style: position menu rect
, data: {toggle: "popover", placement: "right"} , data: { placement: "right", toggle: "popover" }
} }
elems ref _ _ = HTML.div elems ref menu Nothing = HTML.div
{ ref { ref
, key: "context-menu" , key: "context-menu"
, className: "context-menu" , className: "context-menu"
, data: {toggle: "popover", placement: "right"} , data: { placement: "right", toggle: "popover" }
} }
contextMenuEffect contextMenuEffect
...@@ -92,8 +91,10 @@ contextMenuEffect onClose rootRef = ...@@ -92,8 +91,10 @@ contextMenuEffect onClose rootRef =
documentClickHandler :: Effect Unit -> DOM.Element -> Callback DE.MouseEvent documentClickHandler :: Effect Unit -> DOM.Element -> Callback DE.MouseEvent
documentClickHandler onClose menu = documentClickHandler onClose menu =
R2.named "hideMenuOnClickOutside" $ callback $ \e -> R2.named "hideMenuOnClickOutside" $ callback $ \e -> do
when (Element.contains menu (DE.target e)) onClose when (R2.mouseClickInElement e menu) $ do
here.log "mouse in element"
onClose
documentScrollHandler :: Effect Unit -> Callback DE.MouseEvent documentScrollHandler :: Effect Unit -> Callback DE.MouseEvent
documentScrollHandler onClose = documentScrollHandler onClose =
...@@ -108,9 +109,8 @@ position mouse {width: menuWidth, height: menuHeight} = {left, top} ...@@ -108,9 +109,8 @@ position mouse {width: menuWidth, height: menuHeight} = {left, top}
screenWidth = window .. "innerWidth" screenWidth = window .. "innerWidth"
screenHeight = window .. "innerHeight" screenHeight = window .. "innerHeight"
contextMenuItem :: Array R.Element -> R.Element contextMenuItem :: R2.Component ()
contextMenuItem = R.createElement contextMenuItemCpt {} contextMenuItem = R.createElement contextMenuItemCpt
contextMenuItemCpt :: R.Component () contextMenuItemCpt :: R.Component ()
contextMenuItemCpt = here.component "contextMenuItem" cpt contextMenuItemCpt = here.component "contextMenuItem" cpt
where where
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -49,7 +49,6 @@ linkNodeType _ = GT.Error ...@@ -49,7 +49,6 @@ linkNodeType _ = GT.Error
linkNode :: R2.Component SubTreeParamsIn linkNode :: R2.Component SubTreeParamsIn
linkNode = R.createElement linkNodeCpt linkNode = R.createElement linkNodeCpt
linkNodeCpt :: R.Component SubTreeParamsIn linkNodeCpt :: R.Component SubTreeParamsIn
linkNodeCpt = here.component "linkNode" cpt linkNodeCpt = here.component "linkNode" cpt
where where
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
function _debugger(a) {
debugger;
}
exports._debugger = _debugger;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment