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

[ps 0.15] this monstrocity is alive

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