Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move Svg to Halogen.Svg, update to halogen v5 #18

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d6d96ca
Add CSS font-size property
kettlebell Jul 21, 2018
c177a85
Delete trailing whitespace.
epost May 15, 2019
606386a
Update dependencies
rskew Jul 22, 2019
7e63e23
Add marker
rskew Jul 22, 2019
c95ec85
Keyed elements
rskew Jul 30, 2019
769cf5a
Types for marker attributes
rskew Aug 18, 2019
12ff09c
Fix warnings
rskew Aug 23, 2019
7423cf2
Emacs temp files in .gitignore
rskew Aug 23, 2019
d71b1fc
stroke-linecap
rskew Aug 23, 2019
746285f
Updated to Halogen V5.
Nov 1, 2019
f1858f8
Updated bower.json.
StephenWakely Nov 3, 2019
fda7480
Merge branch 'rskew/master'
srghma Jul 31, 2020
2830daf
Merge branch 'FungusHumungus/master'
srghma Jul 31, 2020
cad5b73
feat: update npm packages, use spago, remove psc-package.json, update…
srghma Jul 31, 2020
685263f
feat: remove spago and purescript from npm deps, these deps cannot be…
srghma Jul 31, 2020
90744e3
feat: rename Svg to Halogen.Svg, fix examples
srghma Jul 31, 2020
d83756d
feat: remove yarn.lock
srghma Jul 31, 2020
4a62d74
refactor: styling of rows
srghma Jul 31, 2020
3f50d56
fix(#13): circle should be a Node, not a Leaf
srghma Jul 31, 2020
32728b3
refactor: dont use $ for consistency
srghma Jul 31, 2020
4f5a4ea
feat: all Nodes should have a node_ variant
srghma Jul 31, 2020
f626e76
feat: defs should be a Node, add additional attrs to CoreAttributes a…
srghma Jul 31, 2020
b15e1d3
feat: move Indexed to DOM.Svg.Indexed
srghma Jul 31, 2020
ed28634
fix: tests
srghma Jul 31, 2020
08a5bd3
fix: warnings
srghma Jul 31, 2020
33efe55
refactor: Keyed -> reorder functions
srghma Aug 1, 2020
32ddfd9
feat: Svg to SVG -> rename
srghma Aug 1, 2020
528caac
feat: add XLINK
srghma Aug 1, 2020
28fa1cd
feat: add classes func, change String to more type safe ClassName fro…
srghma Aug 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
/output/
/.psci*
package-lock.json
yarn.lock
.psc-package
*.swp
/.psc-ide-port
/.spago/
/examples/circle/dist/app.js
*.log
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
language: node_js
dist: trusty
sudo: required
node_js: 8

node_js: stable

install:
- npm install -g psc-package pulp purescript@">=0.12 <0.13"
- npm install -g purescript spago
- npm install

script:
- pulp --version
- npm test
- npm run -s test
- npm run -s examples:circle:bundle-app
8 changes: 4 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"output"
],
"dependencies": {
"purescript-strings": "^3.3.1",
"purescript-halogen": "^3.0.1",
"purescript-dom-indexed": "^5.0.0"
"purescript-strings": "^4.0.1",
"purescript-halogen": "^5.0.0-rc.7",
"purescript-dom-indexed": "^7.0.0"
},
"devDependencies": {
"purescript-psci-support": "^3.0.0"
"purescript-psci-support": "^4.0.0"
},
"repository": {
"type": "git",
Expand Down
8 changes: 0 additions & 8 deletions examples/circle/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions examples/circle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This is a minimal example to show (and test) SVG usage.
From the current directory:

> npm install
> npm run build
> npm run examples:circle:bundle-app

The code will be build as `./dist/app.js`, runnable by opening
`./dist/index.html`.
7 changes: 0 additions & 7 deletions examples/circle/bower.json

This file was deleted.

1 change: 0 additions & 1 deletion examples/circle/package.json

This file was deleted.

8 changes: 0 additions & 8 deletions examples/circle/psc-package.json

This file was deleted.

9 changes: 9 additions & 0 deletions examples/circle/spago.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{-
Welcome to a Spago project!
You can edit this file as you like.
-}
{ name = "halogen-svg-example"
, dependencies = (../../spago.dhall).dependencies
, packages = (../../spago.dhall).packages
, sources = (../../spago.dhall).sources # ["examples/circle/**/*.purs"]
}
39 changes: 22 additions & 17 deletions examples/circle/src/Main.purs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Main where

import Prelude
import Data.Const (Const)
import Data.Maybe (Maybe(..))

import Effect (Effect)
Expand All @@ -11,39 +12,43 @@ import Halogen.HTML.Events as HE
import Halogen.Aff (awaitBody, runHalogenAff)
import Halogen.VDom.Driver (runUI)

import Svg.Elements as SE
import Svg.Attributes as SA
import Halogen.SVG.Elements as SE
import Halogen.SVG.Attributes as SA

data Query a = ToggleState a
data Action = ToggleState

type State = { on :: Boolean }

initialState :: forall t . t -> State
initialState = const { on: false }

ui :: forall g. H.Component HTML Query Unit Void g
ui = H.component { initialState, render, eval, receiver: const Nothing }
ui :: forall g. H.Component HTML (Const Void) Unit Void g
ui = H.mkComponent { initialState
, render
, eval: H.mkEval H.defaultEval
{ handleAction = handleAction }
}
where
render :: State -> H.ComponentHTML Query
render :: State -> H.ComponentHTML Action () g
render state =
SE.svg [SA.viewBox x y w h]
[ SE.circle
[ SA.r (if state.on then w/6.0 else w/3.0)
, SA.fill $ Just (SA.RGB 0 0 100)
, HE.onClick (HE.input_ ToggleState)
SE.svg
[ SA.viewBox x y w h ]
[ SE.circle
[ SA.r (if state.on then w/6.0 else w/3.0)
, SA.fill $ Just (SA.RGB 0 0 100)
, HE.onClick (const $ Just ToggleState)
]
[]
]
]

where
h = 150.0
w = 150.0
x = -(w / 2.0)
y = -(h / 2.0)

eval :: Query ~> H.ComponentDSL State Query Void g
eval (ToggleState next) = do
_ <- H.modify (\state -> state { on = not state.on })
pure next
handleAction :: Action -> H.HalogenM State Action () Void g Unit
handleAction ToggleState =
H.modify_ (\state -> state { on = not state.on })

main :: Effect Unit
main = runHalogenAff do
Expand Down
16 changes: 6 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{
"private": true,
"scripts": {
"postinstall": "psc-package install",
"build": "pulp --psc-package browserify --optimise --to dist/app.js",
"watch": "pulp --psc-package -w browserify --to dist/app.js",
"test": "pulp --psc-package test"
},
"dependencies": {
"virtual-dom": "^2.1.1"
"postinstall": "spago install",
"build": "spago build --purs-args '--strict'",
"test": "spago test --purs-args '--strict'",
"examples:circle:build": "spago --config examples/circle/spago.dhall build",
"examples:circle:bundle-app": "spago --config examples/circle/spago.dhall bundle-app --to examples/circle/dist/app.js"
},
"devDependencies": {
"pulp": "^12.0.1",
"psc-package": "^0.3.1",
"purescript": "^0.12.0"
"purescript-psa": "^0.7.3"
}
}
128 changes: 128 additions & 0 deletions packages.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{-
Welcome to your new Dhall package-set!

Below are instructions for how to edit this file for most use
cases, so that you don't need to know Dhall to use it.

## Warning: Don't Move This Top-Level Comment!

Due to how `dhall format` currently works, this comment's
instructions cannot appear near corresponding sections below
because `dhall format` will delete the comment. However,
it will not delete a top-level comment like this one.

## Use Cases

Most will want to do one or both of these options:
1. Override/Patch a package's dependency
2. Add a package not already in the default package set

This file will continue to work whether you use one or both options.
Instructions for each option are explained below.

### Overriding/Patching a package

Purpose:
- Change a package's dependency to a newer/older release than the
default package set's release
- Use your own modified version of some dependency that may
include new API, changed API, removed API by
using your custom git repo of the library rather than
the package set's repo

Syntax:
Replace the overrides' "{=}" (an empty record) with the following idea
The "//" or "⫽" means "merge these two records and
when they have the same value, use the one on the right:"
-------------------------------
let override =
{ packageName =
upstream.packageName // { updateEntity1 = "new value", updateEntity2 = "new value" }
, packageName =
upstream.packageName // { version = "v4.0.0" }
, packageName =
upstream.packageName // { repo = "https://www.example.com/path/to/new/repo.git" }
}
-------------------------------

Example:
-------------------------------
let overrides =
{ halogen =
upstream.halogen // { version = "master" }
, halogen-vdom =
upstream.halogen-vdom // { version = "v4.0.0" }
}
-------------------------------

### Additions

Purpose:
- Add packages that aren't already included in the default package set

Syntax:
Replace the additions' "{=}" (an empty record) with the following idea:
-------------------------------
let additions =
{ package-name =
{ dependencies =
[ "dependency1"
, "dependency2"
]
, repo =
"https://example.com/path/to/git/repo.git"
, version =
"tag ('v4.0.0') or branch ('master')"
}
, package-name =
{ dependencies =
[ "dependency1"
, "dependency2"
]
, repo =
"https://example.com/path/to/git/repo.git"
, version =
"tag ('v4.0.0') or branch ('master')"
}
, etc.
}
-------------------------------

Example:
-------------------------------
let additions =
{ benchotron =
{ dependencies =
[ "arrays"
, "exists"
, "profunctor"
, "strings"
, "quickcheck"
, "lcg"
, "transformers"
, "foldable-traversable"
, "exceptions"
, "node-fs"
, "node-buffer"
, "node-readline"
, "datetime"
, "now"
]
, repo =
"https://github.com/hdgarrood/purescript-benchotron.git"
, version =
"v7.0.0"
}
}
-------------------------------
-}


let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20200724/packages.dhall sha256:bb941d30820a49345a0e88937094d2b9983d939c9fd3a46969b85ce44953d7d9

let overrides = {=}

let additions = {=}

in upstream // overrides // additions
8 changes: 0 additions & 8 deletions psc-package.json

This file was deleted.

20 changes: 20 additions & 0 deletions spago.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{-
Welcome to a Spago project!
You can edit this file as you like.
-}
{ name =
"halogen-svg"
, dependencies =
[ "console"
, "effect"
, "halogen"
, "prelude"
, "psci-support"
, "strings"
, "web-uievents"
]
, packages =
./packages.dhall
, sources =
[ "src/**/*.purs", "test/**/*.purs" ]
}
Loading