Skip to content

Commit

Permalink
Update for PureScript 0.15 (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashoneyman authored Apr 28, 2022
1 parent ebab812 commit e663002
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 85 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ jobs:
- uses: actions/checkout@v2

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "unstable"

- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: "12"
node-version: "14"

- name: Install dependencies
run: |
Expand Down
39 changes: 14 additions & 25 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
{
"name": "purescript-halogen-vdom",
"homepage": "https://github.com/purescript-halogen/purescript-halogen-vdom",
"authors": [
"Nathan Faubion <[email protected]>"
],
"authors": ["Nathan Faubion <[email protected]>"],
"description": "An extensible virtial-dom library for PureScript",
"keywords": [
"purescript",
"halogen",
"virtual-dom"
],
"keywords": ["purescript", "halogen", "virtual-dom"],
"repository": {
"type": "git",
"url": "https://github.com/purescript-halogen/purescript-halogen-vdom.git"
},
"license": "Apache-2.0",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"output"
],
"ignore": ["**/.*", "node_modules", "bower_components", "output"],
"dependencies": {
"purescript-prelude": "^5.0.0",
"purescript-effect": "^3.0.0",
"purescript-tuples": "^6.0.0",
"purescript-web-html": "^3.0.0",
"purescript-foreign-object": "^3.0.0",
"purescript-maybe": "^5.0.0",
"purescript-unsafe-coerce": "^5.0.0",
"purescript-bifunctors": "^5.0.0",
"purescript-refs": "^5.0.0",
"purescript-foreign": "^6.0.0"
"purescript-prelude": "^6.0.0",
"purescript-effect": "^4.0.0",
"purescript-tuples": "^7.0.0",
"purescript-web-html": "^4.0.0",
"purescript-foreign-object": "^4.0.0",
"purescript-maybe": "^6.0.0",
"purescript-unsafe-coerce": "^6.0.0",
"purescript-bifunctors": "^6.0.0",
"purescript-refs": "^6.0.0",
"purescript-foreign": "^7.0.0"
},
"devDependencies": {
"purescript-exists": "^5.0.0"
"purescript-exists": "^6.0.0"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"build": "pulp build -- --censor-lib --strict"
},
"devDependencies": {
"pulp": "^15.0.0",
"pulp": "^16.0.0-0",
"purescript-psa": "^0.8.2",
"rimraf": "^3.0.2"
}
Expand Down
94 changes: 47 additions & 47 deletions src/Halogen/VDom/Util.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
"use strict";

exports.unsafeGetAny = function (key, obj) {
export function unsafeGetAny(key, obj) {
return obj[key];
};
}

exports.unsafeHasAny = function (key, obj) {
export function unsafeHasAny(key, obj) {
return obj.hasOwnProperty(key);
};
}

exports.unsafeSetAny = function (key, val, obj) {
export function unsafeSetAny(key, val, obj) {
obj[key] = val;
};
}

exports.unsafeDeleteAny = function (key, obj) {
export function unsafeDeleteAny(key, obj) {
delete obj[key];
};
}

exports.forE = function (a, f) {
export function forE(a, f) {
var b = [];
for (var i = 0; i < a.length; i++) {
b.push(f(i, a[i]));
}
return b;
};
}

exports.forEachE = function (a, f) {
export function forEachE(a, f) {
for (var i = 0; i < a.length; i++) {
f(a[i]);
}
};
}

exports.forInE = function (o, f) {
export function forInE(o, f) {
var ks = Object.keys(o);
for (var i = 0; i < ks.length; i++) {
var k = ks[i];
f(k, o[k]);
}
};
}

exports.replicateE = function (n, f) {
export function replicateE(n, f) {
for (var i = 0; i < n; i++) {
f();
}
};
}

exports.diffWithIxE = function (a1, a2, f1, f2, f3) {
export function diffWithIxE(a1, a2, f1, f2, f3) {
var a3 = [];
var l1 = a1.length;
var l2 = a2.length;
Expand All @@ -64,19 +64,19 @@ exports.diffWithIxE = function (a1, a2, f1, f2, f3) {
i++;
}
return a3;
};
}

exports.strMapWithIxE = function (as, fk, f) {
export function strMapWithIxE(as, fk, f) {
var o = {};
for (var i = 0; i < as.length; i++) {
var a = as[i];
var k = fk(a);
o[k] = f(k, i, a);
}
return o;
};
}

exports.diffWithKeyAndIxE = function (o1, as, fk, f1, f2, f3) {
export function diffWithKeyAndIxE(o1, as, fk, f1, f2, f3) {
var o2 = {};
for (var i = 0; i < as.length; i++) {
var a = as[i];
Expand All @@ -94,75 +94,75 @@ exports.diffWithKeyAndIxE = function (o1, as, fk, f1, f2, f3) {
f2(k, o1[k]);
}
return o2;
};
}

exports.refEq = function (a, b) {
export function refEq(a, b) {
return a === b;
};
}

exports.createTextNode = function (s, doc) {
export function createTextNode(s, doc) {
return doc.createTextNode(s);
};
}

exports.setTextContent = function (s, n) {
export function setTextContent(s, n) {
n.textContent = s;
};
}

exports.createElement = function (ns, name, doc) {
export function createElement(ns, name, doc) {
if (ns != null) {
return doc.createElementNS(ns, name);
} else {
return doc.createElement(name)
}
};
}

exports.insertChildIx = function (i, a, b) {
export function insertChildIx(i, a, b) {
var n = b.childNodes.item(i) || null;
if (n !== a) {
b.insertBefore(a, n);
}
};
}

exports.removeChild = function (a, b) {
export function removeChild(a, b) {
if (b && a.parentNode === b) {
b.removeChild(a);
}
};
}

exports.parentNode = function (a) {
export function parentNode(a) {
return a.parentNode;
};
}

exports.setAttribute = function (ns, attr, val, el) {
export function setAttribute(ns, attr, val, el) {
if (ns != null) {
el.setAttributeNS(ns, attr, val);
} else {
el.setAttribute(attr, val);
}
};
}

exports.removeAttribute = function (ns, attr, el) {
export function removeAttribute(ns, attr, el) {
if (ns != null) {
el.removeAttributeNS(ns, attr);
} else {
el.removeAttribute(attr);
}
};
}

exports.hasAttribute = function (ns, attr, el) {
export function hasAttribute(ns, attr, el) {
if (ns != null) {
return el.hasAttributeNS(ns, attr);
} else {
return el.hasAttribute(attr);
}
};
}

exports.addEventListener = function (ev, listener, el) {
export function addEventListener(ev, listener, el) {
el.addEventListener(ev, listener, false);
};
}

exports.removeEventListener = function (ev, listener, el) {
export function removeEventListener(ev, listener, el) {
el.removeEventListener(ev, listener, false);
};
}

exports.jsUndefined = void 0;
export var jsUndefined = void 0;
20 changes: 10 additions & 10 deletions test/Main.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
exports.getData = function () {
export function getData() {
return ENV.generateData().toArray();
};
}

exports.getTimeout = function () {
export function getTimeout() {
return ENV.timeout;
};
}

exports.pingRenderRate = function () {
export function pingRenderRate() {
Monitoring.renderRate.ping();
};
}

exports.setTimeout = function (ms) {
export function setTimeout(ms) {
return function (fn) {
return function () {
return setTimeout(fn, ms);
};
};
};
}

exports.requestAnimationFrame = function (f) {
export function requestAnimationFrame(f) {
return function () {
window.requestAnimationFrame(function () {
f();
});
};
};
}

0 comments on commit e663002

Please sign in to comment.