Commit 5686b05c authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[ps 0.15] this monstrocity is alive

parent bc02d207
This diff is collapsed.
<!doctype> <!doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
......
<!doctype> <!doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
......
...@@ -3,11 +3,10 @@ ...@@ -3,11 +3,10 @@
import import
( (
pkgs.fetchFromGitHub { pkgs.fetchFromGitHub {
#owner = "justinwoo"; owner = "justinwoo";
owner = "cgenie";
repo = "easy-purescript-nix"; repo = "easy-purescript-nix";
rev = "0d34a62a0bc531baa5350dc305fe56317f706be2"; rev = "master";
sha256 = "0brdkkp60l3ggirab0zvhd7q11vk906gaxml7kmbg6gy029j7l5v"; sha256 = "03g9xq451dmrkq8kiz989wnl8k0lmj60ajflz44bhp7cm08hf3bw";
} }
) { ) {
inherit pkgs; inherit pkgs;
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
pkgs.fetchFromGitHub { pkgs.fetchFromGitHub {
owner = "justinwoo"; owner = "justinwoo";
repo = "psc-package-nix"; repo = "psc-package-nix";
rev = "0f1f001e2ea17ad461871a1873050f6aef5f1284"; rev = "e00fdaf2a2628b6b056db12ff4a3069aa04cb536";
sha256 = "0gbwcvw8rvxhlg9p6avd0812y263jzim1sra5frbdi0s6q0ngsgi"; sha256 = "0p2cblmpma7s058r5nfwzpvdsi98qhh5isvc47052wjbmfinh8db";
} }
...@@ -36,14 +36,17 @@ ...@@ -36,14 +36,17 @@
"bootstrap": "^4.6.0", "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",
"d3": "^7.0.0", "crypto": "^1.0.1",
"d3": "^7.6.1",
"echarts": "^5.1.2", "echarts": "^5.1.2",
"echarts-for-react": "^3.0.1", "echarts-for-react": "^3.0.1",
"esbuild": "^0.15.7",
"graphql": "^15.6.1", "graphql": "^15.6.1",
"graphql-ws": "^5.5.0", "graphql-ws": "^5.5.0",
"highlightjs": "^9.16.2", "highlightjs": "^9.16.2",
"immer": "^9.0.5", "immer": "^9.0.5",
"isomorphic-unfetch": "^3.1.0", "isomorphic-unfetch": "^3.1.0",
"markdown-it": "^13.0.1",
"prop-types": "^15.6.2", "prop-types": "^15.6.2",
"pullstate": "^1.20.6", "pullstate": "^1.20.6",
"react": "^17.0.2", "react": "^17.0.2",
...@@ -52,7 +55,7 @@ ...@@ -52,7 +55,7 @@
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-tooltip": "^4.2.8", "react-tooltip": "^4.2.8",
"secp256k1": "^4.0.2", "secp256k1": "^4.0.2",
"sigma": "https://github.com/garganscript/sigma.js#garg" "sigma": "https://github.com/garganscript/sigma.js#main"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.15.0", "@babel/core": "^7.15.0",
...@@ -63,6 +66,7 @@ ...@@ -63,6 +66,7 @@
"react-testing-library": "^8.0.1", "react-testing-library": "^8.0.1",
"sass": "^1.35.2", "sass": "^1.35.2",
"serve": "^12.0.0", "serve": "^12.0.0",
"spago": "^0.20.9",
"ssl-serve": "^6.5.8", "ssl-serve": "^6.5.8",
"taiko": "latest", "taiko": "latest",
"vscode-languageserver": "^7.0.0", "vscode-languageserver": "^7.0.0",
......
This diff is collapsed.
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
"globals", "globals",
"integers", "integers",
"js-timers", "js-timers",
"markdown-smolder",
"math", "math",
"maybe", "maybe",
"milkis", "milkis",
...@@ -38,7 +37,6 @@ ...@@ -38,7 +37,6 @@
"simple-json", "simple-json",
"simple-json-generics", "simple-json-generics",
"simplecrypto", "simplecrypto",
"smolder",
"spec-discovery", "spec-discovery",
"spec-quickcheck", "spec-quickcheck",
"string-parsers", "string-parsers",
......
...@@ -15,6 +15,7 @@ to generate this file without the comments in this block. ...@@ -15,6 +15,7 @@ to generate this file without the comments in this block.
[ "aff" [ "aff"
, "aff-promise" , "aff-promise"
, "affjax" , "affjax"
, "affjax-web"
, "argonaut" , "argonaut"
, "argonaut-codecs" , "argonaut-codecs"
, "argonaut-core" , "argonaut-core"
...@@ -41,14 +42,14 @@ to generate this file without the comments in this block. ...@@ -41,14 +42,14 @@ to generate this file without the comments in this block.
, "form-urlencoded" , "form-urlencoded"
, "formula" , "formula"
, "functions" , "functions"
, "globals"
, "graphql-client" , "graphql-client"
, "http-methods" , "http-methods"
, "integers" , "integers"
, "js-timers" , "js-timers"
, "lists" , "lists"
, "markdown" -- , "markdown"
, "markdown-smolder" , "markdown-it"
--, "markdown-smolder"
, "maybe" , "maybe"
, "media-types" , "media-types"
, "milkis" , "milkis"
...@@ -74,7 +75,7 @@ to generate this file without the comments in this block. ...@@ -74,7 +75,7 @@ to generate this file without the comments in this block.
, "simple-json" , "simple-json"
, "simple-json-generics" , "simple-json-generics"
, "simplecrypto" , "simplecrypto"
, "smolder" -- , "smolder"
, "strings" , "strings"
, "strings-extra" , "strings-extra"
, "stringutils" , "stringutils"
......
'use strict'; 'use strict';
exports._show = show;
exports._hide = hide;
/** /**
* @function show * @function show
* @param {Window} window * @param {Window} window
* @param {string} querySelector * @param {string} querySelector
* @unpure {Object} window.$ * @unpure {Object} window.$
*/ */
function show(window, querySelector) { export function _show(window, querySelector) {
window.$(querySelector).modal('show'); window.$(querySelector).modal('show');
} }
/** /**
...@@ -17,7 +15,7 @@ function show(window, querySelector) { ...@@ -17,7 +15,7 @@ function show(window, querySelector) {
* @param {string} querySelector * @param {string} querySelector
* @unpure {Object} window.$ * @unpure {Object} window.$
*/ */
function hide(window, querySelector) { export function _hide(window, querySelector) {
window.$(querySelector).modal('hide'); window.$(querySelector).modal('hide');
// @XXX Bootstrap not removing some modal elements on "hide" method // @XXX Bootstrap not removing some modal elements on "hide" method
// @https://stackoverflow.com/questions/50168312/bootstrap-4-close-modal-backdrop-doesnt-disappear // @https://stackoverflow.com/questions/50168312/bootstrap-4-close-modal-backdrop-doesnt-disappear
......
'use strict'; 'use strict';
const reactTooltip = require('react-tooltip'); import Tooltip from 'react-tooltip';
console.log('Tooltip', Tooltip);
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
window.ReactTooltip = reactTooltip; window.ReactTooltip = Tooltip;
} }
exports.reactTooltipCpt = reactTooltip; export { Tooltip as reactTooltipCpt };
...@@ -7,7 +7,6 @@ module Gargantext.Components.Bootstrap.Tooltip ...@@ -7,7 +7,6 @@ module Gargantext.Components.Bootstrap.Tooltip
import Gargantext.Prelude import Gargantext.Prelude
import ConvertableOptions as CO import ConvertableOptions as CO
import Data.Symbol (SProxy(..))
import Data.UUID as UUID import Data.UUID as UUID
import Gargantext.Components.Bootstrap.Types (TooltipEffect(..), TooltipPosition(..), Variant(..)) import Gargantext.Components.Bootstrap.Types (TooltipEffect(..), TooltipPosition(..), Variant(..))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -15,6 +14,7 @@ import Reactix as R ...@@ -15,6 +14,7 @@ import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Record as Record import Record as Record
import Record.Extra as RX import Record.Extra as RX
import Type.Proxy (Proxy(..))
foreign import reactTooltipCpt :: R.Component Props foreign import reactTooltipCpt :: R.Component Props
...@@ -61,20 +61,20 @@ tooltip props = R.rawCreateElement reactTooltipCpt props'' ...@@ -61,20 +61,20 @@ tooltip props = R.rawCreateElement reactTooltipCpt props''
props' = CO.defaults options props props' = CO.defaults options props
props'' = props' props'' = props'
# Record.set # Record.set
(SProxy :: SProxy "effect") (Proxy :: Proxy "effect")
(show props'.effect) (show props'.effect)
>>> Record.set >>> Record.set
(SProxy :: SProxy "variant") (Proxy :: Proxy "variant")
(show props'.variant) (show props'.variant)
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "variant") (Proxy :: Proxy "variant")
(SProxy :: SProxy "type") (Proxy :: Proxy "type")
>>> Record.set >>> Record.set
(SProxy :: SProxy "position") (Proxy :: Proxy "position")
(show props'.position) (show props'.position)
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "position") (Proxy :: Proxy "position")
(SProxy :: SProxy "place") (Proxy :: Proxy "place")
------------------------------------------------------------- -------------------------------------------------------------
......
...@@ -139,7 +139,8 @@ carousselCpt = here.component "caroussel" cpt ...@@ -139,7 +139,8 @@ carousselCpt = here.component "caroussel" cpt
onClick c = \_-> do onClick c = \_-> do
setLocalCategories $ Map.insert r._id c setLocalCategories $ Map.insert r._id c
launchAff_ $ do launchAff_ $ do
putCategories session nodeId $ CategoryQuery {nodeIds: [r._id], category: c} _ <- putCategories session nodeId $ CategoryQuery {nodeIds: [r._id], category: c}
pure unit
icon :: Category -> Boolean -> String icon :: Category -> Boolean -> String
icon cat b = btn b $ "fa fa-" <> (color $ size b $ icon' cat b) icon cat b = btn b $ "fa fa-" <> (color $ size b $ icon' cat b)
......
...@@ -40,7 +40,7 @@ magenta :: Color ...@@ -40,7 +40,7 @@ magenta :: Color
magenta = stringColor "magenta" magenta = stringColor "magenta"
violet :: Color violet :: Color
violet = cssColor CSS.violet violet = stringColor "violet"
black :: Color black :: Color
black = stringColor "black" black = stringColor "black"
......
"use strict"; "use strict";
var ReactEcharts = require("echarts-for-react"); import * as ReactEcharts from "echarts-for-react";
exports.eChartsClass = ReactEcharts.default; let eChartsClass = ReactEcharts.default;
export { eChartsClass };
/** /**
* @XXX "echarts-for-react" unsuitable to proper PureScript implementation * @XXX "echarts-for-react" unsuitable to proper PureScript implementation
...@@ -11,7 +12,7 @@ exports.eChartsClass = ReactEcharts.default; ...@@ -11,7 +12,7 @@ exports.eChartsClass = ReactEcharts.default;
* @param {function} fn * @param {function} fn
* @returns * @returns
*/ */
exports.listenerFn1 = function(fn) { export function listenerFn1(fn) {
return function() { return function() {
var args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
fn(args[0])() fn(args[0])()
...@@ -24,7 +25,7 @@ exports.listenerFn1 = function(fn) { ...@@ -24,7 +25,7 @@ exports.listenerFn1 = function(fn) {
* @param {object} opts * @param {object} opts
* @returns * @returns
*/ */
exports.dispatchAction = function(eChartsInstance) { export function dispatchAction(eChartsInstance) {
return function(opts) { return function(opts) {
return function() { return function() {
eChartsInstance.dispatchAction(opts); eChartsInstance.dispatchAction(opts);
......
...@@ -54,7 +54,7 @@ chartWith options = ...@@ -54,7 +54,7 @@ chartWith options =
refListener (Options { onInit }) = case onInit of refListener (Options { onInit }) = case onInit of
Nothing -> pure unit Nothing -> pure unit
Just fn -> listenerFn1 (_ # fn # execOnInit) Just fn -> listenerFn1 (execOnInit fn)
execOnInit fn = toMaybe >>> case _ of execOnInit fn = toMaybe >>> case _ of
Nothing -> pure unit Nothing -> pure unit
......
...@@ -4,7 +4,6 @@ import Data.Array (foldl) ...@@ -4,7 +4,6 @@ import Data.Array (foldl)
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Data.Symbol (SProxy(..))
import Gargantext.Components.Charts.Options.Data (DataD1, DataD2) import Gargantext.Components.Charts.Options.Data (DataD1, DataD2)
import Gargantext.Components.Charts.Options.Font (ItemStyle, Tooltip) import Gargantext.Components.Charts.Options.Font (ItemStyle, Tooltip)
import Gargantext.Components.Charts.Options.Legend (SelectedMode) import Gargantext.Components.Charts.Options.Legend (SelectedMode)
...@@ -13,6 +12,7 @@ import Prelude (class Eq, class Show, bind, map, pure, show, ($), (+), (<<<), (< ...@@ -13,6 +12,7 @@ import Prelude (class Eq, class Show, bind, map, pure, show, ($), (+), (<<<), (<
import Record as Record import Record as Record
import Record.Unsafe (unsafeSet) import Record.Unsafe (unsafeSet)
import Simple.JSON as JSON import Simple.JSON as JSON
import Type.Proxy (Proxy(..))
import Unsafe.Coerce (unsafeCoerce) import Unsafe.Coerce (unsafeCoerce)
...@@ -213,8 +213,8 @@ treeLeaf :: String -> Int -> TreeNode ...@@ -213,8 +213,8 @@ treeLeaf :: String -> Int -> TreeNode
treeLeaf n v = TreeNode { name : n, value : v, children : []} treeLeaf n v = TreeNode { name : n, value : v, children : []}
nameP = SProxy :: SProxy "name" nameP = Proxy :: Proxy "name"
labelP = SProxy :: SProxy "label" labelP = Proxy :: Proxy "label"
-- | TODO -- | TODO
......
...@@ -11,12 +11,13 @@ import Data.String.Utils (endsWith) ...@@ -11,12 +11,13 @@ import Data.String.Utils (endsWith)
import DOM.Simple.Types (Element) import DOM.Simple.Types (Element)
import Effect (Effect) import Effect (Effect)
import FFI.Simple ((.=)) import FFI.Simple ((.=))
import MarkdownIt (renderString)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Text.Markdown.SlamDown.Parser (parseMd) -- import Text.Markdown.SlamDown.Parser (parseMd)
import Text.Markdown.SlamDown.Smolder as MD -- import Text.Markdown.SlamDown.Smolder as MD
import Text.Markdown.SlamDown.Syntax (SlamDownP) -- import Text.Markdown.SlamDown.Syntax (SlamDownP)
import Text.Smolder.Renderer.String as Smolder -- import Text.Smolder.Renderer.String as Smolder
import Toestand as T import Toestand as T
import Gargantext.Prelude import Gargantext.Prelude
...@@ -58,16 +59,18 @@ codeNlFix :: CodeType -> Code -> Code ...@@ -58,16 +59,18 @@ codeNlFix :: CodeType -> Code -> Code
codeNlFix _ "" = " " codeNlFix _ "" = " "
codeNlFix _ c = if endsWith "\n" c then (c <> " ") else c codeNlFix _ c = if endsWith "\n" c then (c <> " ") else c
render :: CodeType -> Code -> Either Error Html render :: CodeType -> Code -> Effect (Either Error Html)
render Haskell code = Right $ renderHaskell $ codeNlFix Haskell code render Haskell code = pure $ Right $ renderHaskell $ codeNlFix Haskell code
render Python code = Right $ renderPython $ codeNlFix Python code render Python code = pure $ Right $ renderPython $ codeNlFix Python code
render JSON code = result render JSON code = pure result
where where
parsedE = jsonParser code parsedE = jsonParser code
result = case parsedE of result = case parsedE of
Left err -> Left err Left err -> Left err
Right parsed -> Right $ R2.stringify parsed 2 Right parsed -> Right $ R2.stringify parsed 2
render Markdown code = Right $ renderMd $ codeNlFix Markdown code render Markdown code = do
r <- renderMd $ codeNlFix Markdown code
pure $ Right r
previewPostProcess :: CodeType -> Element -> Effect Unit previewPostProcess :: CodeType -> Element -> Effect Unit
previewPostProcess Haskell htmlEl = do previewPostProcess Haskell htmlEl = do
...@@ -83,13 +86,14 @@ previewPostProcess Markdown _ = pure unit ...@@ -83,13 +86,14 @@ previewPostProcess Markdown _ = pure unit
-- TODO Replace with markdown-it? -- TODO Replace with markdown-it?
-- https://pursuit.purescript.org/packages/purescript-markdown-it -- https://pursuit.purescript.org/packages/purescript-markdown-it
renderMd' :: forall e. MD.ToMarkupOptions e -> String -> String -- renderMd' :: forall e. MD.ToMarkupOptions e -> String -> String
renderMd' options input = -- renderMd' options input =
either identity (MD.toMarkup' options >>> Smolder.render) -- either identity (MD.toMarkup' options >>> Smolder.render)
(parseMd input :: Either String (SlamDownP String)) -- (parseMd input :: Either String (SlamDownP String))
renderMd :: String -> String renderMd :: String -> Effect String
renderMd = renderMd' MD.defaultToMarkupOptions renderMd = renderString
--renderMd = renderMd' MD.defaultToMarkupOptions
renderHaskell :: String -> String renderHaskell :: String -> String
renderHaskell s = s renderHaskell s = s
...@@ -189,7 +193,8 @@ renderHtml code codeType htmlElRef error = ...@@ -189,7 +193,8 @@ renderHtml code codeType htmlElRef error =
case (toMaybe $ R.readRef htmlElRef) of case (toMaybe $ R.readRef htmlElRef) of
Nothing -> pure unit Nothing -> pure unit
Just htmlEl -> do Just htmlEl -> do
case render codeType code of r <- render codeType code
case r of
Left err -> do Left err -> do
T.write_ (Just err) error T.write_ (Just err) error
Right rendered -> do Right rendered -> do
......
...@@ -17,7 +17,6 @@ import Data.Ord.Down (Down(..)) ...@@ -17,7 +17,6 @@ import Data.Ord.Down (Down(..))
import Data.Set (Set) import Data.Set (Set)
import Data.Set as Set import Data.Set as Set
import Data.String as Str import Data.String as Str
import Data.Symbol (SProxy(..))
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect (Effect) import Effect (Effect)
...@@ -56,6 +55,7 @@ import Reactix.DOM.HTML as H ...@@ -56,6 +55,7 @@ import Reactix.DOM.HTML as H
import Record.Extra as RX import Record.Extra as RX
import Simple.JSON as JSON import Simple.JSON as JSON
import Toestand as T import Toestand as T
import Type.Proxy (Proxy(..))
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.DocsTable" here = R2.here "Gargantext.Components.DocsTable"
...@@ -100,8 +100,8 @@ type PageLayoutProps = ...@@ -100,8 +100,8 @@ type PageLayoutProps =
| CommonProps | CommonProps
) )
_documentIdsDeleted = prop (SProxy :: SProxy "documentIdsDeleted") _documentIdsDeleted = prop (Proxy :: Proxy "documentIdsDeleted")
_localCategories = prop (SProxy :: SProxy "localCategories") _localCategories = prop (Proxy :: Proxy "localCategories")
docViewLayout :: Record LayoutProps -> R.Element docViewLayout :: Record LayoutProps -> R.Element
docViewLayout props = R.createElement docViewLayoutCpt props [] docViewLayout props = R.createElement docViewLayoutCpt props []
...@@ -270,7 +270,7 @@ scanDocumentCreationProgress boxes session nodeId currentTask cbk = do ...@@ -270,7 +270,7 @@ scanDocumentCreationProgress boxes session nodeId currentTask cbk = do
, GT.IsKilled , GT.IsKilled
, GT.IsFailure , GT.IsFailure
] ]
hasEndingStatus s = any (_ # s # eq) endingStatusList hasEndingStatus s = any (eq s) endingStatusList
if (hasEndingStatus status) if (hasEndingStatus status)
then then
......
...@@ -147,7 +147,9 @@ docViewCpt = here.component "docView" cpt ...@@ -147,7 +147,9 @@ docViewCpt = here.component "docView" cpt
performDeletions :: Session -> Int -> T.Box Deletions -> Deletions -> Effect Unit performDeletions :: Session -> Int -> T.Box Deletions -> Deletions -> Effect Unit
performDeletions session nodeId deletions deletions' = do performDeletions session nodeId deletions deletions' = do
launchAff_ $ deleteDocuments session nodeId (DeleteDocumentQuery q) launchAff_ $ do
_ <- deleteDocuments session nodeId (DeleteDocumentQuery q)
pure unit
T.modify_ del deletions T.modify_ del deletions
where where
q = { documents: Set.toUnfoldable deletions'.pending } q = { documents: Set.toUnfoldable deletions'.pending }
...@@ -155,7 +157,9 @@ performDeletions session nodeId deletions deletions' = do ...@@ -155,7 +157,9 @@ performDeletions session nodeId deletions deletions' = do
markCategory :: Session -> NodeID -> Category -> Array NodeID -> Effect Unit markCategory :: Session -> NodeID -> Category -> Array NodeID -> Effect Unit
markCategory session nodeId category nids = markCategory session nodeId category nids =
void $ launchAff_ $ putCategories session nodeId (CategoryQuery q) void $ launchAff_ $ do
_ <- putCategories session nodeId (CategoryQuery q)
pure unit
where -- TODO add array of delete rows here where -- TODO add array of delete rows here
q = {nodeIds: nids, category: favCategory category} q = {nodeIds: nids, category: favCategory category}
......
exports.nodeUserRegexp = /(@{1}.*).gargantext.org$/; export const nodeUserRegexp = /(@{1}.*).gargantext.org$/;
...@@ -9,7 +9,6 @@ import Data.Array.NonEmpty as NArray ...@@ -9,7 +9,6 @@ import Data.Array.NonEmpty as NArray
import Data.Foldable (intercalate) import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.String.Regex as Regex import Data.String.Regex as Regex
import Data.Symbol (SProxy(..))
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff, launchAff) import Effect.Aff (Aff, launchAff)
...@@ -44,6 +43,7 @@ import Reactix as R ...@@ -44,6 +43,7 @@ import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Record as Record import Record as Record
import Toestand as T import Toestand as T
import Type.Proxy (Proxy(..))
-- (?) never been able to properly declare PureScript Regex... -- (?) never been able to properly declare PureScript Regex...
foreign import nodeUserRegexp :: Regex.Regex foreign import nodeUserRegexp :: Regex.Regex
...@@ -544,7 +544,7 @@ nodeActionsCpt :: R.Component NodeActionsProps ...@@ -544,7 +544,7 @@ nodeActionsCpt :: R.Component NodeActionsProps
nodeActionsCpt = here.component "nodeActions" cpt where nodeActionsCpt = here.component "nodeActions" cpt where
cpt props _ = pure (child props.nodeType) cpt props _ = pure (child props.nodeType)
where where
nodeActionsP = SProxy :: SProxy "nodeType" nodeActionsP = Proxy :: Proxy "nodeType"
childProps = Record.delete nodeActionsP props childProps = Record.delete nodeActionsP props
......
...@@ -5,11 +5,12 @@ module Gargantext.Components.GraphExplorer.Sidebar ...@@ -5,11 +5,12 @@ module Gargantext.Components.GraphExplorer.Sidebar
import Gargantext.Prelude import Gargantext.Prelude
import Control.Parallel (parTraverse) import Control.Parallel (parTraverse)
import Data.Array (last, mapWithIndex) import Data.Array (last)
import Data.Array as A import Data.Array as A
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Foldable (intercalate) import Data.Foldable (intercalate)
import Data.Foldable as F import Data.Foldable as F
import Data.FunctorWithIndex (mapWithIndex)
import Data.Int (fromString) import Data.Int (fromString)
import Data.Map as Map import Data.Map as Map
import Data.Maybe (Maybe(..), fromJust) import Data.Maybe (Maybe(..), fromJust)
......
...@@ -5,7 +5,8 @@ module Gargantext.Components.GraphExplorer.Toolbar.SlideButton ...@@ -5,7 +5,8 @@ module Gargantext.Components.GraphExplorer.Toolbar.SlideButton
, mouseSelectorSizeButton , mouseSelectorSizeButton
) where ) where
import Global (readFloat) import Data.Maybe (Maybe(..))
import Data.Number as DN
import Prelude import Prelude
import Effect (Effect) import Effect (Effect)
import Reactix as R import Reactix as R
...@@ -29,7 +30,6 @@ type Props = ...@@ -29,7 +30,6 @@ type Props =
sizeButton :: Record Props -> R.Element sizeButton :: Record Props -> R.Element
sizeButton props = R.createElement sizeButtonCpt props [] sizeButton props = R.createElement sizeButtonCpt props []
sizeButtonCpt :: R.Component Props sizeButtonCpt :: R.Component Props
sizeButtonCpt = here.component "sizeButton" cpt where sizeButtonCpt = here.component "sizeButton" cpt where
cpt { state, caption, min, max, onChange } _ = do cpt { state, caption, min, max, onChange } _ = do
...@@ -67,15 +67,18 @@ labelSizeButton sigmaRef state = ...@@ -67,15 +67,18 @@ labelSizeButton sigmaRef state =
, max: 30.0 , max: 30.0
, onChange: \e -> do , onChange: \e -> do
let sigma = R.readRef sigmaRef let sigma = R.readRef sigmaRef
let newValue = readFloat $ R.unsafeEventValue e let newValue' = DN.fromString $ R.unsafeEventValue e
Sigmax.dependOnSigma sigma "[labelSizeButton] sigma: Nothing" $ \s -> do case newValue' of
Sigma.setSettings s { Nothing -> pure unit
defaultLabelSize: newValue Just newValue ->
, drawLabels: true Sigmax.dependOnSigma sigma "[labelSizeButton] sigma: Nothing" $ \s -> do
, maxNodeSize: newValue / 2.5 Sigma.setSettings s {
--, labelSizeRatio: newValue / 2.5 defaultLabelSize: newValue
} , drawLabels: true
T.write_ newValue state , maxNodeSize: newValue / 2.5
--, labelSizeRatio: newValue / 2.5
}
T.write_ newValue state
} }
mouseSelectorSizeButton :: R.Ref Sigmax.Sigma -> T.Box Number -> R.Element mouseSelectorSizeButton :: R.Ref Sigmax.Sigma -> T.Box Number -> R.Element
...@@ -87,10 +90,13 @@ mouseSelectorSizeButton sigmaRef state = ...@@ -87,10 +90,13 @@ mouseSelectorSizeButton sigmaRef state =
, max: 50.0 , max: 50.0
, onChange: \e -> do , onChange: \e -> do
let sigma = R.readRef sigmaRef let sigma = R.readRef sigmaRef
let newValue = readFloat $ R.unsafeEventValue e let newValue' = DN.fromString $ R.unsafeEventValue e
Sigmax.dependOnSigma sigma "[mouseSelectorSizeButton] sigma: Nothing" $ \s -> do case newValue' of
Sigma.setSettings s { Nothing -> pure unit
mouseSelectorSize: newValue Just newValue ->
} Sigmax.dependOnSigma sigma "[mouseSelectorSizeButton] sigma: Nothing" $ \s -> do
T.write_ newValue state Sigma.setSettings s {
} mouseSelectorSize: newValue
}
T.write_ newValue state
}
...@@ -9,10 +9,10 @@ import Data.Maybe (Maybe(..), fromJust) ...@@ -9,10 +9,10 @@ import Data.Maybe (Maybe(..), fromJust)
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Data.Ord.Generic (genericCompare) import Data.Ord.Generic (genericCompare)
import Data.Show.Generic (genericShow) import Data.Show.Generic (genericShow)
import Data.Symbol (SProxy(..))
import Partial.Unsafe (unsafePartial) import Partial.Unsafe (unsafePartial)
import Record as Record import Record as Record
import Simple.JSON as JSON import Simple.JSON as JSON
import Type.Proxy (Proxy(..))
type GraphId = Int type GraphId = Int
...@@ -27,18 +27,18 @@ newtype Node = Node { ...@@ -27,18 +27,18 @@ newtype Node = Node {
, y :: Number , y :: Number
} }
x_coordP = SProxy :: SProxy "x_coord" x_coordP = Proxy :: Proxy "x_coord"
xP = SProxy :: SProxy "x" xP = Proxy :: Proxy "x"
y_coordP = SProxy :: SProxy "y_coord" y_coordP = Proxy :: Proxy "y_coord"
yP = SProxy :: SProxy "y" yP = Proxy :: Proxy "y"
clustDefaultP = SProxy :: SProxy "clustDefault" clustDefaultP = Proxy :: Proxy "clustDefault"
clust_defaultP = SProxy :: SProxy "clust_default" clust_defaultP = Proxy :: Proxy "clust_default"
cameraP = SProxy :: SProxy "camera" cameraP = Proxy :: Proxy "camera"
mCameraP = SProxy :: SProxy "mCamera" mCameraP = Proxy :: Proxy "mCamera"
idP = SProxy :: SProxy "id" idP = Proxy :: Proxy "id"
id_P = SProxy :: SProxy "id_" id_P = Proxy :: Proxy "id_"
typeP = SProxy :: SProxy "type" typeP = Proxy :: Proxy "type"
type_P = SProxy :: SProxy "type_" type_P = Proxy :: Proxy "type_"
derive instance Generic Node _ derive instance Generic Node _
derive instance Newtype Node _ derive instance Newtype Node _
......
...@@ -4,7 +4,7 @@ module Gargantext.Components.GraphQL.AffjaxSimpleJSONClient ...@@ -4,7 +4,7 @@ module Gargantext.Components.GraphQL.AffjaxSimpleJSONClient
import Prelude import Prelude
import Affjax (Error(..), Response, URL, defaultRequest, printError, request) import Affjax.Web (Error(..), Response, URL, defaultRequest, printError, request)
import Affjax.RequestBody as RequestBody import Affjax.RequestBody as RequestBody
import Affjax.RequestHeader (RequestHeader(..)) import Affjax.RequestHeader (RequestHeader(..))
import Affjax.ResponseFormat as ResponseFormat import Affjax.ResponseFormat as ResponseFormat
...@@ -21,18 +21,18 @@ import Simple.JSON as JSON ...@@ -21,18 +21,18 @@ import Simple.JSON as JSON
data AffjaxClient data AffjaxClient
= AffjaxClient URL (Array RequestHeader) = AffjaxClient URL (Array RequestHeader)
-- --
-- instance queryClient :: QueryClient AffjaxClient Unit Unit where -- instance queryClient :: QueryClient AffjaxClient Unit Unit where
-- clientQuery _ (AffjaxClient url headers) name q vars = throwLeft =<< convertJsonResponse =<< queryPostForeign "query" url headers name q vars -- clientQuery _ (AffjaxClient url headers) name q vars = throwLeft =<< convertJsonResponse =<< queryPostForeign "query" url headers name q vars
-- clientMutation _ (AffjaxClient url headers) name q vars = throwLeft =<< convertJsonResponse =<< queryPostForeign "mutation" url headers name q vars -- clientMutation _ (AffjaxClient url headers) name q vars = throwLeft =<< convertJsonResponse =<< queryPostForeign "mutation" url headers name q vars
-- defQueryOpts = const unit -- defQueryOpts = const unit
-- defMutationOpts = const unit -- defMutationOpts = const unit
-- --
-- throwLeft :: forall r body. Either Error { body :: body | r } -> Aff body -- throwLeft :: forall r body. Either Error { body :: body | r } -> Aff body
-- throwLeft = case _ of -- throwLeft = case _ of
-- Left err -> throwError $ error $ printError err -- Left err -> throwError $ error $ printError err
-- Right { body } -> pure body -- Right { body } -> pure body
-- --
-- queryPostForeign :: -- queryPostForeign ::
-- forall d. -- forall d.
-- JSON.WriteForeign d => -- JSON.WriteForeign d =>
...@@ -57,13 +57,13 @@ data AffjaxClient ...@@ -57,13 +57,13 @@ data AffjaxClient
-- } -- }
-- , headers = headers <> [ ContentType applicationJSON ] -- , headers = headers <> [ ContentType applicationJSON ]
-- } -- }
-- --
-- convertJsonResponse :: Either Error (Response String) -> Aff (Either Error (Response Json)) -- convertJsonResponse :: Either Error (Response String) -> Aff (Either Error (Response Json))
-- convertJsonResponse (Left err) = pure $ Left err -- convertJsonResponse (Left err) = pure $ Left err
-- convertJsonResponse (Right res@{ body }) = pure $ case JSON.readJSON body of -- convertJsonResponse (Right res@{ body }) = pure $ case JSON.readJSON body of
-- Left err -> Left $ ResponseBodyError (DLN.head err) (res { body = unsafeToForeign body }) -- Left err -> Left $ ResponseBodyError (DLN.head err) (res { body = unsafeToForeign body })
-- Right body' -> Right $ res { body = toJSON body' } -- Right body' -> Right $ res { body = toJSON body' }
-- --
-- foreign import toJSON :: forall d. JSON.ReadForeign d => d -> Json -- foreign import toJSON :: forall d. JSON.ReadForeign d => d -> Json
-- --
-- --
module Gargantext.Components.Login.Form where module Gargantext.Components.Login.Form where
import Prelude (Unit, bind, discard, not, notEq, pure, show, ($), (&&), (*>), (<>)) import Prelude (Unit, bind, discard, not, notEq, pure, show, unit, ($), (&&), (*>), (<>))
import Data.Either (Either(..)) import Data.Either (Either(..))
import DOM.Simple.Event as DE import DOM.Simple.Event as DE
import Effect (Effect) import Effect (Effect)
...@@ -107,13 +107,14 @@ submitForm { backend, sessions, visible } cell e = do ...@@ -107,13 +107,14 @@ submitForm { backend, sessions, visible } cell e = do
state <- T.read cell state <- T.read cell
launchAff_ $ do launchAff_ $ do
res <- postAuthRequest backend (req state) res <- postAuthRequest backend (req state)
case res of _ <- case res of
Left message -> liftEffect $ T.write (state { error = message }) cell Left message -> liftEffect $ T.write (state { error = message }) cell
Right sess -> Right sess ->
liftEffect $ liftEffect $
Sessions.change (Sessions.Login sess) sessions Sessions.change (Sessions.Login sess) sessions
*> T.write false visible *> T.write false visible
*> T.write (state { error = "" }) cell *> T.write (state { error = "" }) cell
pure unit
where where
req { username, password } = AuthRequest { username, password } req { username, password } = AuthRequest { username, password }
......
...@@ -10,7 +10,6 @@ import Data.Generic.Rep (class Generic) ...@@ -10,7 +10,6 @@ import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..), maybe, fromMaybe) import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Data.Sequence as Seq import Data.Sequence as Seq
import Data.Symbol (SProxy(..))
import Effect.Aff (launchAff_) import Effect.Aff (launchAff_)
import Gargantext.Components.NgramsTable.Loader (clearCache) import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types as CT import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types as CT
...@@ -30,6 +29,7 @@ import Reactix.DOM.HTML as H ...@@ -30,6 +29,7 @@ import Reactix.DOM.HTML as H
import Record as Record import Record as Record
import Simple.JSON as JSON import Simple.JSON as JSON
import Toestand as T import Toestand as T
import Type.Proxy (Proxy(..))
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Annuaire" here = R2.here "Gargantext.Components.Nodes.Annuaire"
...@@ -150,7 +150,7 @@ pageLayoutCpt = here.component "pageLayout" cpt ...@@ -150,7 +150,7 @@ pageLayoutCpt = here.component "pageLayout" cpt
where where
errorHandler = logRESTError here "[pageLayout]" errorHandler = logRESTError here "[pageLayout]"
type PageProps = type PageProps =
( frontends :: Frontends ( frontends :: Frontends
, pagePath :: T.Box PagePath , pagePath :: T.Box PagePath
-- , info :: AnnuaireInfo -- , info :: AnnuaireInfo
...@@ -263,10 +263,10 @@ instance JSON.ReadForeign AnnuaireInfo where ...@@ -263,10 +263,10 @@ instance JSON.ReadForeign AnnuaireInfo where
inst <- JSON.readImpl f inst <- JSON.readImpl f
pure $ AnnuaireInfo $ Record.rename user_idP userIdP $ Record.rename parent_idP parentIdP inst pure $ AnnuaireInfo $ Record.rename user_idP userIdP $ Record.rename parent_idP parentIdP inst
where where
user_idP = SProxy :: SProxy "user_id" user_idP = Proxy :: Proxy "user_id"
userIdP = SProxy :: SProxy "userId" userIdP = Proxy :: Proxy "userId"
parent_idP = SProxy :: SProxy "parent_id" parent_idP = Proxy :: Proxy "parent_id"
parentIdP = SProxy :: SProxy "parentId" parentIdP = Proxy :: Proxy "parentId"
--newtype AnnuaireTable = AnnuaireTable { annuaireTable :: Array (Maybe Contact)} --newtype AnnuaireTable = AnnuaireTable { annuaireTable :: Array (Maybe Contact)}
...@@ -292,4 +292,3 @@ loadPage session {nodeId, params: { offset, limit }} = ...@@ -292,4 +292,3 @@ loadPage session {nodeId, params: { offset, limit }} =
getAnnuaireInfo :: Session -> Int -> AffRESTError AnnuaireInfo getAnnuaireInfo :: Session -> Int -> AffRESTError AnnuaireInfo
getAnnuaireInfo session id = get session (NodeAPI Node (Just id) "") getAnnuaireInfo session id = get session (NodeAPI Node (Just id) "")
...@@ -7,9 +7,9 @@ import Data.Lens (Lens', lens) ...@@ -7,9 +7,9 @@ import Data.Lens (Lens', lens)
import Data.Maybe (Maybe(..), fromMaybe) import Data.Maybe (Maybe(..), fromMaybe)
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Data.String as S import Data.String as S
import Data.Symbol (SProxy(..))
import Record as Record import Record as Record
import Simple.JSON as JSON import Simple.JSON as JSON
import Type.Proxy (Proxy(..))
import Gargantext.Prelude (class Eq, bind, pure, ($)) import Gargantext.Prelude (class Eq, bind, pure, ($))
...@@ -32,7 +32,7 @@ instance JSON.ReadForeign NodeContact where ...@@ -32,7 +32,7 @@ instance JSON.ReadForeign NodeContact where
readImpl f = do readImpl f = do
inst <- JSON.readImpl f inst <- JSON.readImpl f
pure $ NodeContact $ Record.rename parent_idP parentIdP $ Record.rename user_idP userIdP inst pure $ NodeContact $ Record.rename parent_idP parentIdP $ Record.rename user_idP userIdP inst
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
newtype Contact' = newtype Contact' =
...@@ -347,8 +347,8 @@ _phone = lens getter setter ...@@ -347,8 +347,8 @@ _phone = lens getter setter
where where
getter (ContactTouch {phone}) = fromMaybe "" phone getter (ContactTouch {phone}) = fromMaybe "" phone
setter (ContactTouch ct) val = ContactTouch $ ct { phone = Just val } setter (ContactTouch ct) val = ContactTouch $ ct { phone = Just val }
user_idP = SProxy :: SProxy "user_id" user_idP = Proxy :: Proxy "user_id"
userIdP = SProxy :: SProxy "userId" userIdP = Proxy :: Proxy "userId"
parent_idP = SProxy :: SProxy "parent_id" parent_idP = Proxy :: Proxy "parent_id"
parentIdP = SProxy :: SProxy "parentId" parentIdP = Proxy :: Proxy "parentId"
...@@ -4,6 +4,7 @@ import Data.Array as A ...@@ -4,6 +4,7 @@ import Data.Array as A
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Eq.Generic (genericEq) import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.FunctorWithIndex (mapWithIndex)
import Data.List as List import Data.List as List
import Data.Maybe (Maybe(..), fromMaybe) import Data.Maybe (Maybe(..), fromMaybe)
import Data.Show.Generic (genericShow) import Data.Show.Generic (genericShow)
...@@ -156,7 +157,7 @@ fieldsCodeEditorCpt = here.component "fieldsCodeEditorCpt" cpt ...@@ -156,7 +157,7 @@ fieldsCodeEditorCpt = here.component "fieldsCodeEditorCpt" cpt
List.modifyAt idx (\{ ftField: Field f } -> { idx, ftField: Field $ f { name = newName } }) fs) fields List.modifyAt idx (\{ ftField: Field f } -> { idx, ftField: Field $ f { name = newName } }) fs) fields
recomputeIndices :: FTFieldsWithIndex -> FTFieldsWithIndex recomputeIndices :: FTFieldsWithIndex -> FTFieldsWithIndex
recomputeIndices (FTFieldsWithIndex lst) = FTFieldsWithIndex $ List.mapWithIndex (\idx -> \{ ftField } -> { idx, ftField }) lst recomputeIndices (FTFieldsWithIndex lst) = FTFieldsWithIndex $ mapWithIndex (\idx -> \{ ftField } -> { idx, ftField }) lst
hash :: FTFieldWithIndex -> Hash hash :: FTFieldWithIndex -> Hash
hash { idx, ftField } = Crypto.hash $ "--idx--" <> (show idx) <> "--field--" <> (show ftField) hash { idx, ftField } = Crypto.hash $ "--idx--" <> (show idx) <> "--field--" <> (show ftField)
......
module Gargantext.Components.Nodes.Corpus.Code where module Gargantext.Components.Nodes.Corpus.Code where
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.FunctorWithIndex (mapWithIndex)
import Data.List as List import Data.List as List
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Effect (Effect) import Effect (Effect)
...@@ -59,7 +60,7 @@ corpusCodeView props = R.createElement corpusCodeViewCpt props [] ...@@ -59,7 +60,7 @@ corpusCodeView props = R.createElement corpusCodeViewCpt props []
corpusCodeViewCpt :: R.Component ViewProps corpusCodeViewCpt :: R.Component ViewProps
corpusCodeViewCpt = here.component "corpusCodeView" cpt where corpusCodeViewCpt = here.component "corpusCodeView" cpt where
cpt {corpus: (NodePoly {hyperdata: Hyperdata {fields: FTFieldList fields}}), nodeId, reload, session, boxes} _ = do cpt {corpus: (NodePoly {hyperdata: Hyperdata {fields: FTFieldList fields}}), nodeId, reload, session, boxes} _ = do
let fieldsWithIndex = FTFieldsWithIndex $ List.mapWithIndex (\idx -> \ftField -> { idx, ftField }) fields let fieldsWithIndex = FTFieldsWithIndex $ mapWithIndex (\idx -> \ftField -> { idx, ftField }) fields
fieldsS <- T.useBox fieldsWithIndex fieldsS <- T.useBox fieldsWithIndex
fields' <- T.useLive T.unequal fieldsS fields' <- T.useLive T.unequal fieldsS
fieldsRef <- R.useRef fields fieldsRef <- R.useRef fields
......
...@@ -2,6 +2,7 @@ module Gargantext.Components.Nodes.Corpus.Dashboard where ...@@ -2,6 +2,7 @@ module Gargantext.Components.Nodes.Corpus.Dashboard where
import Data.Array as A import Data.Array as A
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.FunctorWithIndex (mapWithIndex)
import Data.List as List import Data.List as List
import Data.Maybe (Maybe(..), fromMaybe) import Data.Maybe (Maybe(..), fromMaybe)
import Effect (Effect) import Effect (Effect)
...@@ -129,7 +130,7 @@ dashboardLayoutLoadedCpt = here.component "dashboardLayoutLoaded" cpt ...@@ -129,7 +130,7 @@ dashboardLayoutLoadedCpt = here.component "dashboardLayoutLoaded" cpt
where where
onClickAddChart _ = onChange { charts: A.cons P.CDocsHistogram charts onClickAddChart _ = onChange { charts: A.cons P.CDocsHistogram charts
, fields } , fields }
chartsEls = A.mapWithIndex chartIdx charts chartsEls = mapWithIndex chartIdx charts
chartIdx idx chart = chartIdx idx chart =
renderChart { boxes renderChart { boxes
, chart , chart
...@@ -158,7 +159,7 @@ dashboardCodeEditorCpt :: R.Component CodeEditorProps ...@@ -158,7 +159,7 @@ dashboardCodeEditorCpt :: R.Component CodeEditorProps
dashboardCodeEditorCpt = here.component "dashboardCodeEditor" cpt dashboardCodeEditorCpt = here.component "dashboardCodeEditor" cpt
where where
cpt { fields: FTFieldList fields, nodeId, onChange, session } _ = do cpt { fields: FTFieldList fields, nodeId, onChange, session } _ = do
let fieldsWithIndex = FTFieldsWithIndex $ List.mapWithIndex (\idx -> \ftField -> { idx, ftField }) fields let fieldsWithIndex = FTFieldsWithIndex $ mapWithIndex (\idx -> \ftField -> { idx, ftField }) fields
fieldsS <- T.useBox fieldsWithIndex fieldsS <- T.useBox fieldsWithIndex
fields' <- T.useLive T.unequal fieldsS fields' <- T.useLive T.unequal fieldsS
fieldsRef <- R.useRef fields' fieldsRef <- R.useRef fields'
......
...@@ -15,7 +15,6 @@ import Data.Generic.Rep (class Generic) ...@@ -15,7 +15,6 @@ import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Data.Show.Generic (genericShow) import Data.Show.Generic (genericShow)
import Data.Symbol (SProxy(..))
import Gargantext.Components.PhyloExplorer.JSON (PhyloJSON) import Gargantext.Components.PhyloExplorer.JSON (PhyloJSON)
import Gargantext.Components.PhyloExplorer.Types (PhyloSet, parseToPhyloSet) import Gargantext.Components.PhyloExplorer.Types (PhyloSet, parseToPhyloSet)
import Gargantext.Config.REST (AffRESTError) import Gargantext.Config.REST (AffRESTError)
...@@ -28,6 +27,7 @@ import Gargantext.Types as GT ...@@ -28,6 +27,7 @@ import Gargantext.Types as GT
import Record as Record import Record as Record
import Simple.JSON as JSON import Simple.JSON as JSON
import Simple.JSON.Generics as JSONG import Simple.JSON.Generics as JSONG
import Type.Proxy (Proxy(..))
get :: S.Session -> NodeID -> AffRESTError (PhyloSet) get :: S.Session -> NodeID -> AffRESTError (PhyloSet)
...@@ -57,23 +57,23 @@ instance JSON.WriteForeign UpdateData where ...@@ -57,23 +57,23 @@ instance JSON.WriteForeign UpdateData where
where where
rename rename
= Record.rename = Record.rename
(SProxy :: SProxy "proximity") (Proxy :: Proxy "proximity")
(SProxy :: SProxy "_sc_phyloProximity") (Proxy :: Proxy "_sc_phyloProximity")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "synchrony") (Proxy :: Proxy "synchrony")
(SProxy :: SProxy "_sc_phyloSynchrony") (Proxy :: Proxy "_sc_phyloSynchrony")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "quality") (Proxy :: Proxy "quality")
(SProxy :: SProxy "_sc_phyloQuality") (Proxy :: Proxy "_sc_phyloQuality")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "timeUnit") (Proxy :: Proxy "timeUnit")
(SProxy :: SProxy "_sc_timeUnit") (Proxy :: Proxy "_sc_timeUnit")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "clique") (Proxy :: Proxy "clique")
(SProxy :: SProxy "_sc_clique") (Proxy :: Proxy "_sc_clique")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "exportFilter") (Proxy :: Proxy "exportFilter")
(SProxy :: SProxy "_sc_exportFilter") (Proxy :: Proxy "_sc_exportFilter")
data TimeUnit data TimeUnit
= Epoch TimeUnitCriteria = Epoch TimeUnitCriteria
...@@ -96,68 +96,68 @@ instance JSON.WriteForeign TimeUnit where ...@@ -96,68 +96,68 @@ instance JSON.WriteForeign TimeUnit where
where where
parseEpoch parseEpoch
= Record.rename = Record.rename
(SProxy :: SProxy "period") (Proxy :: Proxy "period")
(SProxy :: SProxy "_epoch_period") (Proxy :: Proxy "_epoch_period")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "step") (Proxy :: Proxy "step")
(SProxy :: SProxy "_epoch_step") (Proxy :: Proxy "_epoch_step")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "matchingFrame") (Proxy :: Proxy "matchingFrame")
(SProxy :: SProxy "_epoch_matchingFrame") (Proxy :: Proxy "_epoch_matchingFrame")
>>> Record.insert >>> Record.insert
(SProxy :: SProxy "tag") (Proxy :: Proxy "tag")
"Epoch" "Epoch"
parseYear parseYear
= Record.rename = Record.rename
(SProxy :: SProxy "period") (Proxy :: Proxy "period")
(SProxy :: SProxy "_year_period") (Proxy :: Proxy "_year_period")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "step") (Proxy :: Proxy "step")
(SProxy :: SProxy "_year_step") (Proxy :: Proxy "_year_step")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "matchingFrame") (Proxy :: Proxy "matchingFrame")
(SProxy :: SProxy "_year_matchingFrame") (Proxy :: Proxy "_year_matchingFrame")
>>> Record.insert >>> Record.insert
(SProxy :: SProxy "tag") (Proxy :: Proxy "tag")
"Year" "Year"
parseMonth parseMonth
= Record.rename = Record.rename
(SProxy :: SProxy "period") (Proxy :: Proxy "period")
(SProxy :: SProxy "_month_period") (Proxy :: Proxy "_month_period")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "step") (Proxy :: Proxy "step")
(SProxy :: SProxy "_month_step") (Proxy :: Proxy "_month_step")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "matchingFrame") (Proxy :: Proxy "matchingFrame")
(SProxy :: SProxy "_month_matchingFrame") (Proxy :: Proxy "_month_matchingFrame")
>>> Record.insert >>> Record.insert
(SProxy :: SProxy "tag") (Proxy :: Proxy "tag")
"Month" "Month"
parseWeek parseWeek
= Record.rename = Record.rename
(SProxy :: SProxy "period") (Proxy :: Proxy "period")
(SProxy :: SProxy "_week_period") (Proxy :: Proxy "_week_period")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "step") (Proxy :: Proxy "step")
(SProxy :: SProxy "_week_step") (Proxy :: Proxy "_week_step")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "matchingFrame") (Proxy :: Proxy "matchingFrame")
(SProxy :: SProxy "_week_matchingFrame") (Proxy :: Proxy "_week_matchingFrame")
>>> Record.insert >>> Record.insert
(SProxy :: SProxy "tag") (Proxy :: Proxy "tag")
"Week" "Week"
parseDay parseDay
= Record.rename = Record.rename
(SProxy :: SProxy "period") (Proxy :: Proxy "period")
(SProxy :: SProxy "_day_period") (Proxy :: Proxy "_day_period")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "step") (Proxy :: Proxy "step")
(SProxy :: SProxy "_day_step") (Proxy :: Proxy "_day_step")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "matchingFrame") (Proxy :: Proxy "matchingFrame")
(SProxy :: SProxy "_day_matchingFrame") (Proxy :: Proxy "_day_matchingFrame")
>>> Record.insert >>> Record.insert
(SProxy :: SProxy "tag") (Proxy :: Proxy "tag")
"Day" "Day"
...@@ -217,27 +217,27 @@ instance JSON.WriteForeign Clique where ...@@ -217,27 +217,27 @@ instance JSON.WriteForeign Clique where
where where
parseFIS parseFIS
= Record.insert = Record.insert
(SProxy :: SProxy "tag") (Proxy :: Proxy "tag")
"Fis" "Fis"
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "support") (Proxy :: Proxy "support")
(SProxy :: SProxy "_fis_support") (Proxy :: Proxy "_fis_support")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "size") (Proxy :: Proxy "size")
(SProxy :: SProxy "_fis_size") (Proxy :: Proxy "_fis_size")
parseMaxClique parseMaxClique
= Record.insert = Record.insert
(SProxy :: SProxy "tag") (Proxy :: Proxy "tag")
"MaxClique" "MaxClique"
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "size") (Proxy :: Proxy "size")
(SProxy :: SProxy "_mcl_size") (Proxy :: Proxy "_mcl_size")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "threshold") (Proxy :: Proxy "threshold")
(SProxy :: SProxy "_mcl_threshold") (Proxy :: Proxy "_mcl_threshold")
>>> Record.rename >>> Record.rename
(SProxy :: SProxy "filter") (Proxy :: Proxy "filter")
(SProxy :: SProxy "_mcl_filter") (Proxy :: Proxy "_mcl_filter")
data ReflexiveClique data ReflexiveClique
......
...@@ -4,35 +4,35 @@ ...@@ -4,35 +4,35 @@
/// FIELDS /// FIELDS
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
var EXTRACTED_TERMS_EVENT = 'extracted_terms_event'; const EXTRACTED_TERMS_EVENT = 'extracted_terms_event';
var EXTRACTED_COUNT_EVENT = 'extracted_count_event'; const EXTRACTED_COUNT_EVENT = 'extracted_count_event';
var SELECTED_TERM_EVENT = 'selected_term_event'; const SELECTED_TERM_EVENT = 'selected_term_event';
var SELECTED_BRANCH_EVENT = 'selected_branch_event'; const SELECTED_BRANCH_EVENT = 'selected_branch_event';
var SELECTED_SOURCE_EVENT = 'selected_source_event'; const SELECTED_SOURCE_EVENT = 'selected_source_event';
var DISPLAY_VIEW_EVENT = 'display_view_event'; const DISPLAY_VIEW_EVENT = 'display_view_event';
var ISO_LINE_DOM_QUERY = '.phylo-isoline'; const ISO_LINE_DOM_QUERY = '.phylo-isoline';
var LEFT_COLUMN_DOM_QUERY = '.phylo-grid__blueprint__left'; const LEFT_COLUMN_DOM_QUERY = '.phylo-grid__blueprint__left';
var CENTER_COLUMN_DOM_QUERY = '.phylo-grid__blueprint__center'; const CENTER_COLUMN_DOM_QUERY = '.phylo-grid__blueprint__center';
var SCAPE_DOM_QUERY = '.phylo-grid__content__scape'; const SCAPE_DOM_QUERY = '.phylo-grid__content__scape';
// (?) Global thread dependencies: // (?) Global thread dependencies:
// * d3 <Object> (main D3 proxy)) // * d3 <Object> (main D3 proxy))
// * window <Window> (cf. below function signature for window uses) // * window <Window> (cf. below function signature for window uses)
// * document <HTMLDocument> // * document <HTMLDocument>
var memoTickText = {}; // <Object> of <Int> => <TickText> let memoTickText = {}; // <Object> of <Int> => <TickText>
/// <TickText> :: /// <TickText> ::
/// <Int> bId /// <Int> bId
/// <Float> limit /// <Float> limit
/// <String>text /// <String>text
var panel = undefined; // <Object> instanceof d3.selection let panel = undefined; // <Object> instanceof d3.selection
var svg = undefined; // <Object> instanceof d3.selection let svg = undefined; // <Object> instanceof d3.selection
var label = undefined; // <Object> instanceof d3.selection let label = undefined; // <Object> instanceof d3.selection
var zoom = undefined; // <Function> see https://github.com/d3/d3-zoom#zoom let zoom = undefined; // <Function> see https://github.com/d3/d3-zoom#zoom
var xScale0 = undefined; // <Function> see https://github.com/d3/d3-scale#_continuous let xScale0 = undefined; // <Function> see https://github.com/d3/d3-scale#_continuous
var yScale0 = undefined; // <Function> see https://github.com/d3/d3-scale#_continuous let yScale0 = undefined; // <Function> see https://github.com/d3/d3-scale#_continuous
var subscribers = {}; // <Object> dictionary for pubsub pattern let subscribers = {}; // <Object> dictionary for pubsub pattern
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// HELPERS /// HELPERS
...@@ -2279,26 +2279,29 @@ function addEmergenceLabels(k, emergences, branchByGroup, fontScale, opacityScal ...@@ -2279,26 +2279,29 @@ function addEmergenceLabels(k, emergences, branchByGroup, fontScale, opacityScal
/// EXPORTS /// EXPORTS
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
exports._extractedTermsEvent = EXTRACTED_TERMS_EVENT; export const _extractedTermsEvent = EXTRACTED_TERMS_EVENT;
exports._extractedCountEvent = EXTRACTED_COUNT_EVENT; export const _extractedCountEvent = EXTRACTED_COUNT_EVENT;
exports._selectedTermEvent = SELECTED_TERM_EVENT; export const _selectedTermEvent = SELECTED_TERM_EVENT;
exports._selectedBranchEvent = SELECTED_BRANCH_EVENT; export const _selectedBranchEvent = SELECTED_BRANCH_EVENT;
exports._selectedSourceEvent = SELECTED_SOURCE_EVENT; export const _selectedSourceEvent = SELECTED_SOURCE_EVENT;
exports._displayViewEvent = DISPLAY_VIEW_EVENT; export const _displayViewEvent = DISPLAY_VIEW_EVENT;
exports._drawPhylo = drawPhylo; let pubsubPublish = pubsub.publish;
exports._drawWordCloud = drawWordCloud; let pubsubSubscribe = pubsub.subscribe;
exports._showLabel = showLabel; let pubsubUnsubscribe = pubsub.unsubscribe;
exports._termClick = termClick;
exports._resetView = resetView; export { drawPhylo as _drawPhylo,
exports._showLabel = showLabel; drawWordCloud as _drawWordCloud,
exports._showHeading = showHeading; showLabel as _showLabel,
exports._showLanding = showLanding; termClick as _termClick,
exports._exportViz = exportViz; resetView as _resetView,
exports._doubleClick = doubleClick; showHeading as _showHeading,
exports._highlightGroups = highlightGroups; showLanding as _showLanding,
exports._initPath = initPath; exportViz as _exportViz,
doubleClick as _doubleClick,
exports._publish = pubsub.publish; highlightGroups as _highlightGroups,
exports._subscribe = pubsub.subscribe; initPath as _initPath,
exports._unsubscribe = pubsub.unsubscribe;
pubsubPublish as _publish,
pubsubSubscribe as _subscribe,
pubsubUnsubscribe as _unsubscribe };
...@@ -4,8 +4,9 @@ module Gargantext.Components.PhyloExplorer.SelectionTab ...@@ -4,8 +4,9 @@ module Gargantext.Components.PhyloExplorer.SelectionTab
import Gargantext.Prelude import Gargantext.Prelude
import Data.Array (length, mapWithIndex, null) import Data.Array (length, null)
import Data.Foldable (intercalate) import Data.Foldable (intercalate)
import Data.FunctorWithIndex (mapWithIndex)
import Data.Int (ceil) import Data.Int (ceil)
import Data.Maybe (Maybe(..), isJust) import Data.Maybe (Maybe(..), isJust)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @param {string} year * @param {string} year
* @returns {Date} * @returns {Date}
*/ */
function yearToDate(year) { export function yearToDate(year) {
var d = new Date(); var d = new Date();
d.setYear(parseInt(year)); d.setYear(parseInt(year));
...@@ -18,7 +18,7 @@ function yearToDate(year) { ...@@ -18,7 +18,7 @@ function yearToDate(year) {
* @param {string} str * @param {string} str
* @returns {Date} * @returns {Date}
*/ */
function stringToDate(str) { export function stringToDate(str) {
var arr = (str.replace('"','')).split('-'); var arr = (str.replace('"','')).split('-');
var d = new Date(); var d = new Date();
...@@ -34,7 +34,7 @@ function stringToDate(str) { ...@@ -34,7 +34,7 @@ function stringToDate(str) {
* @param {string} str * @param {string} str
* @returns {Date} * @returns {Date}
*/ */
function utcStringToDate(str) { export function utcStringToDate(str) {
var arr = ((str.replace('"','')).replace(' UTC','')).split(/[\s-:]+/); var arr = ((str.replace('"','')).replace(' UTC','')).split(/[\s-:]+/);
var d = new Date(); var d = new Date();
...@@ -45,7 +45,3 @@ function utcStringToDate(str) { ...@@ -45,7 +45,3 @@ function utcStringToDate(str) {
return d; return d;
} }
exports.yearToDate = yearToDate;
exports.stringToDate = stringToDate;
exports.utcStringToDate = utcStringToDate;
...@@ -20,6 +20,7 @@ import Gargantext.Prelude ...@@ -20,6 +20,7 @@ import Gargantext.Prelude
import Data.Array as Array import Data.Array as Array
import Data.Date as Date import Data.Date as Date
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.FunctorWithIndex (mapWithIndex)
import Data.Int as Int import Data.Int as Int
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
...@@ -379,7 +380,7 @@ parseSources ...@@ -379,7 +380,7 @@ parseSources
-- sorting purpose only -- sorting purpose only
sortSources :: Array String -> Array Source sortSources :: Array String -> Array Source
sortSources sortSources
= Array.mapWithIndex setSource = mapWithIndex setSource
>>> Array.sortWith getLabel >>> Array.sortWith getLabel
where where
......
...@@ -11,6 +11,7 @@ import Data.Eq.Generic (genericEq) ...@@ -11,6 +11,7 @@ import Data.Eq.Generic (genericEq)
import Data.Int (fromNumber) import Data.Int (fromNumber)
import Data.Maybe (Maybe(..), fromMaybe) import Data.Maybe (Maybe(..), fromMaybe)
import Data.Number as DN import Data.Number as DN
import Data.Number.Format as DNF
import Data.Nullable (Nullable, null) import Data.Nullable (Nullable, null)
import Data.Traversable (traverse_) import Data.Traversable (traverse_)
import DOM.Simple as DOM import DOM.Simple as DOM
...@@ -18,7 +19,6 @@ import DOM.Simple.Document (document) ...@@ -18,7 +19,6 @@ import DOM.Simple.Document (document)
import DOM.Simple.Event as Event import DOM.Simple.Event as Event
import DOM.Simple.EventListener as EL import DOM.Simple.EventListener as EL
import DOM.Simple (DOMRect) import DOM.Simple (DOMRect)
import Global (toFixed)
import Effect (Effect) import Effect (Effect)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
...@@ -169,8 +169,9 @@ renderScaleSel ref props (Range.Closed {min, max}) = ...@@ -169,8 +169,9 @@ renderScaleSel ref props (Range.Closed {min, max}) =
style = {left: computeLeft, width: computeWidth} style = {left: computeLeft, width: computeWidth}
percOffsetMin = Range.normalise props.bounds min percOffsetMin = Range.normalise props.bounds min
percOffsetMax = Range.normalise props.bounds max percOffsetMax = Range.normalise props.bounds max
computeLeft = (show $ 100.0 * percOffsetMin) <> "%" computeLeft = formatter $ 100.0 * percOffsetMin
computeWidth = (show $ 100.0 * (percOffsetMax - percOffsetMin)) <> "%" computeWidth = formatter $ 100.0 * (percOffsetMax - percOffsetMin)
formatter n = (DNF.toStringWith (DNF.fixed 0) n) <> "%"
renderKnob :: Knob -> R.Ref (Nullable DOM.Element) -> Range.NumberRange -> Bounds -> T.Box (Maybe Knob) -> Int -> R.Element renderKnob :: Knob -> R.Ref (Nullable DOM.Element) -> Range.NumberRange -> Bounds -> T.Box (Maybe Knob) -> Int -> R.Element
...@@ -178,12 +179,10 @@ renderKnob knob ref (Range.Closed value) bounds set precision = ...@@ -178,12 +179,10 @@ renderKnob knob ref (Range.Closed value) bounds set precision =
H.div { ref, tabIndex, className, aria, on: { mouseDown: onMouseDown }, style } [ H.div { ref, tabIndex, className, aria, on: { mouseDown: onMouseDown }, style } [
H.div { className: "range-slider__placeholder" } H.div { className: "range-slider__placeholder" }
[ [
H.text $ text $ toFixed precision val H.text $ DNF.toStringWith (DNF.precision precision) val
] ]
] ]
where where
text (Just num) = num
text Nothing = "error"
tabIndex = 0 tabIndex = 0
className = "range-slider__knob" className = "range-slider__knob"
aria = { label: labelPrefix knob <> "value: " <> show val } aria = { label: labelPrefix knob <> "value: " <> show val }
......
...@@ -134,7 +134,7 @@ mainPageCpt = here.component "mainPage" cpt where ...@@ -134,7 +134,7 @@ mainPageCpt = here.component "mainPage" cpt where
-> (Unit -> Effect Unit) -> (Unit -> Effect Unit)
deleteTile tile listBox = const do deleteTile tile listBox = const do
list <- T.read listBox list <- T.read listBox
newList <- pure $ filter (_ # tile.id # findTile # not) list newList <- pure $ filter (not $ findTile $ tile.id) list
T.write_ newList listBox T.write_ newList listBox
let hasHorizontalTiles = not $ eq 0 $ length tileAxisXList let hasHorizontalTiles = not $ eq 0 $ length tileAxisXList
......
module Gargantext.Config.REST where module Gargantext.Config.REST where
import Affjax (Error(..), defaultRequest, request) import Affjax.Web (Error(..), defaultRequest, request)
import Affjax as Affjax import Affjax as Affjax
import Affjax.RequestBody (formData, formURLEncoded, string) import Affjax.RequestBody (formData, formURLEncoded, string)
import Affjax.RequestHeader as ARH import Affjax.RequestHeader as ARH
......
...@@ -188,7 +188,7 @@ highlightNgrams ntype table@(NgramsTable {ngrams_repo_elements: elts}) input0 = ...@@ -188,7 +188,7 @@ highlightNgrams ntype table@(NgramsTable {ngrams_repo_elements: elts}) input0 =
--applyNgramsTablePatchToSingleTerm :: NgramsTerm -> NgramsTablePatch -> Set NgramsTerm -> Set NgramsTerm --applyNgramsTablePatchToSingleTerm :: NgramsTerm -> NgramsTablePatch -> Set NgramsTerm -> Set NgramsTerm
--applyNgramsTablePatchToSingleTerm ngram patch s = --applyNgramsTablePatchToSingleTerm ngram patch s =
-- applyNgramsTablePatch patch $ -- applyNgramsTablePatch patch $
patchSetFromMap :: forall a. Ord a => Map a Boolean -> PatchSet a patchSetFromMap :: forall a. Ord a => Map a Boolean -> PatchSet a
patchSetFromMap m = PatchSet { rem: Map.keys (Map.filter not m) patchSetFromMap m = PatchSet { rem: Map.keys (Map.filter not m)
......
...@@ -23,7 +23,6 @@ import Data.Show.Generic (genericShow) ...@@ -23,7 +23,6 @@ import Data.Show.Generic (genericShow)
import Data.Set (Set) import Data.Set (Set)
import Data.Set as Set import Data.Set as Set
import Data.String.Regex (Regex, regex, replace) as R import Data.String.Regex (Regex, regex, replace) as R
import Data.Symbol (SProxy(..))
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff) import Effect.Aff (Aff)
...@@ -36,6 +35,7 @@ import Gargantext.Sessions (Session) ...@@ -36,6 +35,7 @@ import Gargantext.Sessions (Session)
import Gargantext.Types as GT import Gargantext.Types as GT
import Simple.JSON as JSON import Simple.JSON as JSON
import Reactix as R import Reactix as R
import Type.Proxy (Proxy(..))
type Endo a = a -> a type Endo a = a -> a
...@@ -276,28 +276,28 @@ instance JSON.WriteForeign NgramsElement where ...@@ -276,28 +276,28 @@ instance JSON.WriteForeign NgramsElement where
JSON.writeImpl $ ne { children = Set.toUnfoldable ne.children :: Array _ } JSON.writeImpl $ ne { children = Set.toUnfoldable ne.children :: Array _ }
_parent :: forall parent row. Lens' { parent :: parent | row } parent _parent :: forall parent row. Lens' { parent :: parent | row } parent
_parent = prop (SProxy :: SProxy "parent") _parent = prop (Proxy :: Proxy "parent")
_root :: forall root row. Lens' { root :: root | row } root _root :: forall root row. Lens' { root :: root | row } root
_root = prop (SProxy :: SProxy "root") _root = prop (Proxy :: Proxy "root")
_ngrams :: forall row. Lens' { ngrams :: NgramsTerm | row } NgramsTerm _ngrams :: forall row. Lens' { ngrams :: NgramsTerm | row } NgramsTerm
_ngrams = prop (SProxy :: SProxy "ngrams") _ngrams = prop (Proxy :: Proxy "ngrams")
_children :: forall row. Lens' { children :: Set NgramsTerm | row } (Set NgramsTerm) _children :: forall row. Lens' { children :: Set NgramsTerm | row } (Set NgramsTerm)
_children = prop (SProxy :: SProxy "children") _children = prop (Proxy :: Proxy "children")
_occurrences :: forall row. Lens' { occurrences :: Int | row } Int _occurrences :: forall row. Lens' { occurrences :: Int | row } Int
_occurrences = prop (SProxy :: SProxy "occurrences") _occurrences = prop (Proxy :: Proxy "occurrences")
_list :: forall a row. Lens' { list :: a | row } a _list :: forall a row. Lens' { list :: a | row } a
_list = prop (SProxy :: SProxy "list") _list = prop (Proxy :: Proxy "list")
_ngrams_repo_elements :: forall a row. Lens' { ngrams_repo_elements :: a | row } a _ngrams_repo_elements :: forall a row. Lens' { ngrams_repo_elements :: a | row } a
_ngrams_repo_elements = prop (SProxy :: SProxy "ngrams_repo_elements") _ngrams_repo_elements = prop (Proxy :: Proxy "ngrams_repo_elements")
_ngrams_scores :: forall a row. Lens' { ngrams_scores :: a | row } a _ngrams_scores :: forall a row. Lens' { ngrams_scores :: a | row } a
_ngrams_scores = prop (SProxy :: SProxy "ngrams_scores") _ngrams_scores = prop (Proxy :: Proxy "ngrams_scores")
_NgramsElement :: Iso' NgramsElement { _NgramsElement :: Iso' NgramsElement {
children :: Set NgramsTerm children :: Set NgramsTerm
......
This diff is collapsed.
...@@ -96,8 +96,8 @@ useFormValidation = do ...@@ -96,8 +96,8 @@ useFormValidation = do
result /\ resultBox <- R2.useBox' (V (Right mempty) :: VForm) result /\ resultBox <- R2.useBox' (V (Right mempty) :: VForm)
memoHasError <- R.useMemo1 result $ const $ hasError result memoHasError <- R.useMemo1 result $ const $ hasError result
memoHasError' <- R.useMemo1 result $ const $ (_ # result # hasError') memoHasError' <- R.useMemo1 result $ const $ hasError' result
memoHasError_ <- R.useMemo1 result $ const $ (_ # result # hasError_) memoHasError_ <- R.useMemo1 result $ const $ hasError_ result
pure pure
{ tryCount { tryCount
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
* @link https://gist.github.com/gregseth/5582254 [2] * @link https://gist.github.com/gregseth/5582254 [2]
* @type {RegExp} * @type {RegExp}
*/ */
exports.emailPattern = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/; export const emailPattern = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;
/** /**
* Date Pattern * Date Pattern
* @link https://www.regextester.com/96683 * @link https://www.regextester.com/96683
* @type {RegExp} * @type {RegExp}
*/ */
exports.datePattern = /([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))/ export const datePattern = /([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))/;
...@@ -72,7 +72,7 @@ changeTileRoute tileAxisXList tileAxisYList tile newRoute = do ...@@ -72,7 +72,7 @@ changeTileRoute tileAxisXList tileAxisYList tile newRoute = do
findTile id tile' = eq id $ get (Proxy :: Proxy "id") tile' findTile id tile' = eq id $ get (Proxy :: Proxy "id") tile'
hasTile :: Array (Record Tile) -> UUID -> Maybe Int hasTile :: Array (Record Tile) -> UUID -> Maybe Int
hasTile list id = findIndex (_ # id # findTile) list hasTile list id = findIndex (findTile id) list
updateTile :: Int -> AppRoute -> Array (Record Tile) -> Array (Record Tile) updateTile :: Int -> AppRoute -> Array (Record Tile) -> Array (Record Tile)
updateTile index route list = modifyAtIndices updateTile index route list = modifyAtIndices
......
'use strict'; 'use strict';
exports._add = add;
exports._remove = remove;
/** /**
* @function add * @function add
* @param {Window} window * @param {Window} window
...@@ -10,7 +8,7 @@ exports._remove = remove; ...@@ -10,7 +8,7 @@ exports._remove = remove;
* @param {String} targetQuery * @param {String} targetQuery
* @param {String} type * @param {String} type
*/ */
function add(window, document, sourceQuery, targetQuery, type) { export function _add(window, document, sourceQuery, targetQuery, type) {
var source = document.querySelector(sourceQuery); var source = document.querySelector(sourceQuery);
var target = document.querySelector(targetQuery); var target = document.querySelector(targetQuery);
...@@ -49,7 +47,7 @@ function add(window, document, sourceQuery, targetQuery, type) { ...@@ -49,7 +47,7 @@ function add(window, document, sourceQuery, targetQuery, type) {
* @param {Document} document * @param {Document} document
* @param {String} sourceQuery * @param {String} sourceQuery
*/ */
function remove(document, sourceQuery) { export function _remove(document, sourceQuery) {
var source = document.querySelector(sourceQuery); var source = document.querySelector(sourceQuery);
console.log(sourceQuery) console.log(sourceQuery)
source.removeEventListener('mousedown'); source.removeEventListener('mousedown');
......
...@@ -28,21 +28,17 @@ try { ...@@ -28,21 +28,17 @@ try {
var wheelOpt = supportsPassive ? { passive: false } : false; var wheelOpt = supportsPassive ? { passive: false } : false;
var wheelEvent = 'onwheel' in document.createElement('div') ? 'wheel' : 'mousewheel'; var wheelEvent = 'onwheel' in document.createElement('div') ? 'wheel' : 'mousewheel';
// call this to Disable export function disableScroll() {
function disableScroll() { // call this to Disable
window.addEventListener('DOMMouseScroll', preventDefault, false); // older FF window.addEventListener('DOMMouseScroll', preventDefault, false); // older FF
window.addEventListener(wheelEvent, preventDefault, wheelOpt); // modern desktop window.addEventListener(wheelEvent, preventDefault, wheelOpt); // modern desktop
window.addEventListener('touchmove', preventDefault, wheelOpt); // mobile window.addEventListener('touchmove', preventDefault, wheelOpt); // mobile
window.addEventListener('keydown', preventDefaultForScrollKeys, false); window.addEventListener('keydown', preventDefaultForScrollKeys, false);
} }
export function enableScroll() {
// call this to Enable // call this to Enable
function enableScroll() {
window.removeEventListener('DOMMouseScroll', preventDefault, false); window.removeEventListener('DOMMouseScroll', preventDefault, false);
window.removeEventListener(wheelEvent, preventDefault, wheelOpt); window.removeEventListener(wheelEvent, preventDefault, wheelOpt);
window.removeEventListener('touchmove', preventDefault, wheelOpt); window.removeEventListener('touchmove', preventDefault, wheelOpt);
window.removeEventListener('keydown', preventDefaultForScrollKeys, false); window.removeEventListener('keydown', preventDefaultForScrollKeys, false);
} }
exports.disableScroll = disableScroll;
exports.enableScroll = enableScroll;
'use strict'; 'use strict';
const sigma = require('sigma/src/garg.js').sigma; //import { sigma } from 'sigma/src/garg.js';
import sigma from 'sigma';
console.log('imported sigma', sigma);
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
window.sigma = sigma; window.sigma = sigma;
} }
const CustomShapes = require('sigma/plugins/garg.js').init(sigma, window).customShapes; /*import('sigma/plugins/garg.js').then((module) => {
require('sigma/src/utils/sigma.utils.js').init(sigma); let CustomShapes = module.init(sigma, window).customShapes;
CustomShapes.init();
});
*/
//import('sigma/src/utils/sigma.utils.js').then((module) => { module.init(sigma) });
// Black circle around a node // Black circle around a node
/*
(function() { (function() {
var originalDef = sigma.canvas.nodes.def; let originalDef = sigma.canvas.nodes.def;
sigma.canvas.nodes.def = (node, context, settings) => { sigma.canvas.nodes.def = (node, context, settings) => {
var prefix = settings('prefix') || ''; let prefix = settings('prefix') || '';
originalDef(node, context, settings); originalDef(node, context, settings);
...@@ -32,7 +40,9 @@ require('sigma/src/utils/sigma.utils.js').init(sigma); ...@@ -32,7 +40,9 @@ require('sigma/src/utils/sigma.utils.js').init(sigma);
context.stroke(); context.stroke();
} }
})() })()
*/
/*
sigma.canvas.nodes.selected = (node, context, settings) => { sigma.canvas.nodes.selected = (node, context, settings) => {
// hack // hack
// We need to temporarily set node.type to 'def'. This is for 2 reasons // We need to temporarily set node.type to 'def'. This is for 2 reasons
...@@ -43,16 +53,18 @@ sigma.canvas.nodes.selected = (node, context, settings) => { ...@@ -43,16 +53,18 @@ sigma.canvas.nodes.selected = (node, context, settings) => {
sigma.canvas.hovers.def(node, context, settings); sigma.canvas.hovers.def(node, context, settings);
node.type = 'selected'; node.type = 'selected';
//console.log('hovers, settings:', settings); //console.log('hovers, settings:', settings);
}; };
*/
CustomShapes.init(); //CustomShapes.init();
let sigmaMouseSelector = (sigma, options) => { /*
let sigmaMouseSelector = function(sigma, options) {
sigma.plugins = sigma.plugins || {}; sigma.plugins = sigma.plugins || {};
sigma.plugins.mouseSelector = (s, renderer) => { sigma.plugins.mouseSelector = (s, renderer) => {
var _self = this; let _self = this;
var _offset = null; let _offset = null;
const _s = s; const _s = s;
const _renderer = renderer; const _renderer = renderer;
const _container = _renderer.container; const _container = _renderer.container;
...@@ -169,6 +181,7 @@ let sigmaMouseSelector = (sigma, options) => { ...@@ -169,6 +181,7 @@ let sigmaMouseSelector = (sigma, options) => {
} }
sigmaMouseSelector(sigma); sigmaMouseSelector(sigma);
*/
function _sigma(left, right, opts) { function _sigma(left, right, opts) {
try { try {
...@@ -178,14 +191,14 @@ function _sigma(left, right, opts) { ...@@ -178,14 +191,14 @@ function _sigma(left, right, opts) {
} }
} }
function addRenderer(left, right, sigma, renderer) { function _addRenderer(left, right, sigma, renderer) {
try { try {
return right(sigma.addRenderer(renderer)); return right(sigma.addRenderer(renderer));
} catch(e) { } catch(e) {
return left(e); return left(e);
} }
} }
function bindMouseSelectorPlugin(left, right, sig) { function _bindMouseSelectorPlugin(left, right, sig) {
try { try {
return right(sigma.plugins.mouseSelector(sig, sig.renderers[0])); return right(sigma.plugins.mouseSelector(sig, sig.renderers[0]));
} catch(e) { } catch(e) {
...@@ -193,9 +206,9 @@ function bindMouseSelectorPlugin(left, right, sig) { ...@@ -193,9 +206,9 @@ function bindMouseSelectorPlugin(left, right, sig) {
return left(e); return left(e);
} }
} }
function bind(sigma, event, handler) { sigma.bind(event, handler); } function _bind(sigma, event, handler) { sigma.bind(event, handler); }
function takeScreenshot(sigma) { function _takeScreenshot(sigma) {
let c = sigma.renderers[0].container; let c = sigma.renderers[0].container;
let edges = c.getElementsByClassName('sigma-edges')[0]; let edges = c.getElementsByClassName('sigma-edges')[0];
let scene = c.getElementsByClassName('sigma-scene')[0]; let scene = c.getElementsByClassName('sigma-scene')[0];
...@@ -209,26 +222,26 @@ function takeScreenshot(sigma) { ...@@ -209,26 +222,26 @@ function takeScreenshot(sigma) {
return edges.toDataURL('image/png'); return edges.toDataURL('image/png');
} }
function getEdges(sigma) { function _getEdges(sigma) {
return sigma.graph.edges(); return sigma.graph.edges();
} }
function getNodes(sigma) { function _getNodes(sigma) {
return sigma.graph.nodes(); return sigma.graph.nodes();
} }
function proxySetSettings(window, sigma, settings) { function _proxySetSettings(window, sigma, settings) {
var id = sigma.id; var id = sigma.id;
window.sigma.instances(id).settings(settings); window.sigma.instances(id).settings(settings);
window.sigma.instances(id).refresh(); window.sigma.instances(id).refresh();
} }
exports._sigma = _sigma; export { _sigma,
exports._addRenderer = addRenderer; _addRenderer,
exports._bindMouseSelectorPlugin = bindMouseSelectorPlugin; _bindMouseSelectorPlugin,
exports._bind = bind; _bind,
exports._takeScreenshot = takeScreenshot; _takeScreenshot,
exports._getEdges = getEdges; _getEdges,
exports._getNodes = getNodes; _getNodes,
exports._proxySetSettings = proxySetSettings; _proxySetSettings };
'use strict'; 'use strict';
exports.goToImpl = function(cam) {
export function goToImpl(cam) {
return function(props) { return function(props) {
return cam.goTo(props); return cam.goTo(props);
}; };
......
...@@ -78,6 +78,6 @@ main stateBox = do ...@@ -78,6 +78,6 @@ main stateBox = do
pure pure
{ state { state
, stateBox , stateBox
, setStateKey : (_ # stateBox # setter) , setStateKey : setter stateBox -- (_ # stateBox # setter)
, bindStateKey: (_ # stateBox # binder $ state) , bindStateKey: binder stateBox state -- (_ # stateBox # binder $ state)
} }
'use strict'; 'use strict';
const pkg = require('../../package.json'); import pkg from '../../package.json';
exports.version = pkg.version; let version = pkg.version
export { version };
'use strict'; 'use strict';
exports._wordRegex = /[a-z]+/gi;
export _wordRegex = /[a-z]+/gi;
This diff is collapsed.
...@@ -128,5 +128,5 @@ textEllipsisBreak :: Int -> String -> String ...@@ -128,5 +128,5 @@ textEllipsisBreak :: Int -> String -> String
textEllipsisBreak len n = textEllipsisBreak len n =
if S.length n < len then n if S.length n < len then n
else case (slice 0 len n) of else case (slice 0 len n) of
Nothing -> "???" "" -> "???"
Just s -> s <> "…" s -> s <> "…"
This diff is collapsed.
function _push(a, i) { export function _push(a, i) {
a.push(i); a.push(i);
} }
exports._push = _push;
...@@ -36,4 +36,4 @@ min xs = foldr reducer (A.head xs) xs ...@@ -36,4 +36,4 @@ min xs = foldr reducer (A.head xs) xs
range :: Int -> Int -> Int -> Array Int range :: Int -> Int -> Int -> Array Int
range start end step = map (\i -> start + i*step) $ A.range 0 end' range start end step = map (\i -> start + i*step) $ A.range 0 end'
where where
end' = DI.round $ DI.floor $ (DI.toNumber $ end - start) / (DI.toNumber step) end' = DI.floor $ (DI.toNumber $ end - start) / (DI.toNumber step)
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// https://stackoverflow.com/a/9458996 // https://stackoverflow.com/a/9458996
// This is because base64-codec/Data.Base64.encodeBase64 was too slow // This is because base64-codec/Data.Base64.encodeBase64 was too slow
exports.arrayBufferToBase64Impl = function(buffer) { export function arrayBufferToBase64Impl(buffer) {
var binary = ''; var binary = '';
var bytes = new Uint8Array( buffer ); var bytes = new Uint8Array( buffer );
var len = bytes.byteLength; var len = bytes.byteLength;
......
"use strict"; "use strict";
exports.createDropdown = function(iid) { export function createDropdown(iid) {
var el = document.getElementById(iid); var el = document.getElementById(iid);
if (!window.Dropdown) return; if (!window.Dropdown) return;
......
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.
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