Skip to content

Commit 6b7a60f

Browse files
author
Mike Solomon
committed
Initial commit
0 parents  commit 6b7a60f

File tree

9 files changed

+245
-0
lines changed

9 files changed

+245
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# purescript-web-events.py
2+
3+
A polyfill of web-dom to purescript-python
4+
5+
Note that this is an error-only library, as there are no web events in python. It is meant to allow projects to build that rely on this dependency, but it should never be called from python code.

packages.dhall

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{-
2+
Welcome to your new Dhall package-set!
3+
4+
Below are instructions for how to edit this file for most use
5+
cases, so that you don't need to know Dhall to use it.
6+
7+
## Warning: Don't Move This Top-Level Comment!
8+
9+
Due to how `dhall format` currently works, this comment's
10+
instructions cannot appear near corresponding sections below
11+
because `dhall format` will delete the comment. However,
12+
it will not delete a top-level comment like this one.
13+
14+
## Use Cases
15+
16+
Most will want to do one or both of these options:
17+
1. Override/Patch a package's dependency
18+
2. Add a package not already in the default package set
19+
20+
This file will continue to work whether you use one or both options.
21+
Instructions for each option are explained below.
22+
23+
### Overriding/Patching a package
24+
25+
Purpose:
26+
- Change a package's dependency to a newer/older release than the
27+
default package set's release
28+
- Use your own modified version of some dependency that may
29+
include new API, changed API, removed API by
30+
using your custom git repo of the library rather than
31+
the package set's repo
32+
33+
Syntax:
34+
Replace the overrides' "{=}" (an empty record) with the following idea
35+
The "//" or "⫽" means "merge these two records and
36+
when they have the same value, use the one on the right:"
37+
-------------------------------
38+
let overrides =
39+
{ packageName =
40+
upstream.packageName // { updateEntity1 = "new value", updateEntity2 = "new value" }
41+
, packageName =
42+
upstream.packageName // { version = "v4.0.0" }
43+
, packageName =
44+
upstream.packageName // { repo = "https://www.example.com/path/to/new/repo.git" }
45+
}
46+
-------------------------------
47+
48+
Example:
49+
-------------------------------
50+
let overrides =
51+
{ halogen =
52+
upstream.halogen // { version = "master" }
53+
, halogen-vdom =
54+
upstream.halogen-vdom // { version = "v4.0.0" }
55+
}
56+
-------------------------------
57+
58+
### Additions
59+
60+
Purpose:
61+
- Add packages that aren't already included in the default package set
62+
63+
Syntax:
64+
Replace the additions' "{=}" (an empty record) with the following idea:
65+
-------------------------------
66+
let additions =
67+
{ package-name =
68+
{ dependencies =
69+
[ "dependency1"
70+
, "dependency2"
71+
]
72+
, repo =
73+
"https://example.com/path/to/git/repo.git"
74+
, version =
75+
"tag ('v4.0.0') or branch ('master')"
76+
}
77+
, package-name =
78+
{ dependencies =
79+
[ "dependency1"
80+
, "dependency2"
81+
]
82+
, repo =
83+
"https://example.com/path/to/git/repo.git"
84+
, version =
85+
"tag ('v4.0.0') or branch ('master')"
86+
}
87+
, etc.
88+
}
89+
-------------------------------
90+
91+
Example:
92+
-------------------------------
93+
let additions =
94+
{ benchotron =
95+
{ dependencies =
96+
[ "arrays"
97+
, "exists"
98+
, "profunctor"
99+
, "strings"
100+
, "quickcheck"
101+
, "lcg"
102+
, "transformers"
103+
, "foldable-traversable"
104+
, "exceptions"
105+
, "node-fs"
106+
, "node-buffer"
107+
, "node-readline"
108+
, "datetime"
109+
, "now"
110+
]
111+
, repo =
112+
"https://github.com/hdgarrood/purescript-benchotron.git"
113+
, version =
114+
"v7.0.0"
115+
}
116+
}
117+
-------------------------------
118+
-}
119+
120+
121+
let upstream =
122+
https://github.com/purescript/package-sets/releases/download/psc-0.13.8/packages.dhall sha256:0e95ec11604dc8afc1b129c4d405dcc17290ce56d7d0665a0ff15617e32bbf03
123+
124+
let overrides = {=}
125+
126+
let additions = {=}
127+
128+
in upstream // overrides // additions

pure-py.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"corefn-dir": "output",
3+
"data-format": "Compressed",
4+
"entry-module": "Main",
5+
"index-mirror": "affexpr",
6+
"pspy-blueprint": "pspy-blueprint"
7+
}

python-ffi/Web/Event/Event.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
def bubbles(e):
2+
return False
3+
4+
5+
def cancelable(e):
6+
return False
7+
8+
9+
def _currentTarget(e):
10+
return None
11+
12+
13+
def defaultPrevented(e):
14+
def _1():
15+
return False
16+
17+
return _1
18+
19+
20+
def eventPhaseIndex(e):
21+
return 0
22+
23+
24+
def _target(e):
25+
return None
26+
27+
28+
def timeStamp(e):
29+
return 0
30+
31+
32+
def type_(e):
33+
return ""
34+
35+
36+
def preventDefault(e):
37+
def _1():
38+
return True
39+
40+
return _1
41+
42+
43+
def stopImmediatePropagation(e):
44+
def _1():
45+
return True
46+
47+
return _1
48+
49+
50+
def stopPropagation(e):
51+
def _1():
52+
return True
53+
54+
return _1
55+

python-ffi/Web/Event/EventTarget.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
eventListener = lambda f: lambda: lambda e: f(None)()
2+
3+
addEventListener = lambda t: lambda l: lambda u: lambda tg: lambda: True
4+
5+
removeEventListener = lambda t: lambda l: lambda u: lambda tg: lambda: True
6+
7+
dispatchEvent = lambda e: lambda t: lambda: True

python-ffi/Web/Internal/FFI.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def _unsafeReadProtoTagged(nothing, just, name, value):
2+
return nothing
3+

requirements.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
appdirs==1.4.4
2+
astroid==2.4.2
3+
attrs==19.3.0
4+
black==19.10b0
5+
bytecode==0.11.0
6+
certifi==2020.6.20
7+
chardet==3.0.4
8+
click==7.1.2
9+
gitdb==4.0.5
10+
GitPython==3.1.3
11+
idna==2.10
12+
isort==4.3.21
13+
lazy-object-proxy==1.4.3
14+
mccabe==0.6.1
15+
painless-import-extension==0.2.2
16+
pathspec==0.8.0
17+
pspy-executable==0.8.8
18+
purescripto==0.8.8
19+
pylint==2.5.3
20+
pysexpr==0.6
21+
regex==2020.6.8
22+
requests==2.24.0
23+
six==1.15.0
24+
smmap==3.0.4
25+
toml==0.10.1
26+
typed-ast==1.4.1
27+
urllib3==1.25.9
28+
wisepy2==1.1.1
29+
wrapt==1.12.1

spago.dhall

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{-
2+
Welcome to a Spago project!
3+
You can edit this file as you like.
4+
-}
5+
{ name = "purescript-aff"
6+
, dependencies = [ "foreign", "console", "effect", "psci-support" ]
7+
, packages = ./packages.dhall
8+
, sources = [ "src/**/*.purs"]
9+
, backend = "pspy"
10+
}

src/Main.purs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module Main where

0 commit comments

Comments
 (0)