From 8cdcda224583022c50bf4fb3cf8986db73081a1e Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:04:23 -0500 Subject: [PATCH 01/10] Migrated FFI to ES modules via 'lebab' --- src/Web/CSSOM.js | 4 ++-- src/Web/CSSOM/CSSStyleDeclaration.js | 28 +++++++++++++------------- src/Web/CSSOM/CSSStyleSheet.js | 20 +++++++++--------- src/Web/CSSOM/ElementCSSInlineStyle.js | 4 ++-- src/Web/CSSOM/MouseEvent.js | 8 ++++---- src/Web/CSSOM/StyleSheetList.js | 12 +++++------ 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Web/CSSOM.js b/src/Web/CSSOM.js index c7089bc..92bae32 100644 --- a/src/Web/CSSOM.js +++ b/src/Web/CSSOM.js @@ -1,8 +1,8 @@ // Web.CSSOM "use strict"; -exports.getStyleSheets = function(doc) { +export function getStyleSheets(doc) { return function() { return doc.styleSheets; }; -}; +} diff --git a/src/Web/CSSOM/CSSStyleDeclaration.js b/src/Web/CSSOM/CSSStyleDeclaration.js index c51e14c..09585d7 100644 --- a/src/Web/CSSOM/CSSStyleDeclaration.js +++ b/src/Web/CSSOM/CSSStyleDeclaration.js @@ -1,50 +1,50 @@ "use strict"; -exports.cssText = function (style) { +export function cssText(style) { return function () { return style.cssText; }; -}; +} -exports.setCssText = function (style) { +export function setCssText(style) { return function (newCSS) { return function () { style.cssText = newCSS; }; }; -}; +} -exports.length = function (style) { +export function length(style) { return function () { return style.length; }; -}; +} -exports.getPropertyPriority = function (style) { +export function getPropertyPriority(style) { return function (propName) { return function () { return style.getPropertyPriority(propName); }; }; -}; +} -exports.getPropertyValue = function (style) { +export function getPropertyValue(style) { return function (propName) { return function () { return style.getPropertyValue(propName); }; }; -}; +} -exports.removeProperty = function (style) { +export function removeProperty(style) { return function (propName) { return function () { style.removeProperty(propName); }; }; -}; +} -exports.setProperty = function (style) { +export function setProperty(style) { return function (propName) { return function (propValue) { return function () { @@ -52,4 +52,4 @@ exports.setProperty = function (style) { }; }; }; -}; +} diff --git a/src/Web/CSSOM/CSSStyleSheet.js b/src/Web/CSSOM/CSSStyleSheet.js index bf3e5b7..8877fcf 100644 --- a/src/Web/CSSOM/CSSStyleSheet.js +++ b/src/Web/CSSOM/CSSStyleSheet.js @@ -6,25 +6,25 @@ var getProp = function (name) { }; }; -exports.disabled = getProp("disabled"); -exports._href = getProp("href"); -exports._ownerNode = getProp("ownerNode"); -exports._parentStyleSheet = getProp("parentStyleSheet"); -exports._title = getProp("title"); -exports._type = getProp("type"); +export var disabled = getProp("disabled"); +export var _href = getProp("href"); +export var _ownerNode = getProp("ownerNode"); +export var _parentStyleSheet = getProp("parentStyleSheet"); +export var _title = getProp("title"); +export var _type = getProp("type"); -exports.setDisabled = function (bool) { +export function setDisabled(bool) { return function (sheet) { return function () { sheet.disabled = bool; }; }; -}; +} -exports.toggleDisabled = function (sheet) { +export function toggleDisabled(sheet) { return function () { var bool = !sheet.disabled; sheet.disabled = bool; return bool; }; -}; +} diff --git a/src/Web/CSSOM/ElementCSSInlineStyle.js b/src/Web/CSSOM/ElementCSSInlineStyle.js index 8fb68e6..a24b38c 100644 --- a/src/Web/CSSOM/ElementCSSInlineStyle.js +++ b/src/Web/CSSOM/ElementCSSInlineStyle.js @@ -1,7 +1,7 @@ "use strict"; -exports.style = function (el) { +export function style(el) { return function () { return el.style; }; -}; +} diff --git a/src/Web/CSSOM/MouseEvent.js b/src/Web/CSSOM/MouseEvent.js index b45f683..aeda32a 100644 --- a/src/Web/CSSOM/MouseEvent.js +++ b/src/Web/CSSOM/MouseEvent.js @@ -1,9 +1,9 @@ "use strict"; -exports.offsetX = function (e) { +export function offsetX(e) { return e.offsetX; -}; +} -exports.offsetY = function (e) { +export function offsetY(e) { return e.offsetY; -}; +} diff --git a/src/Web/CSSOM/StyleSheetList.js b/src/Web/CSSOM/StyleSheetList.js index 5da6581..94ab615 100644 --- a/src/Web/CSSOM/StyleSheetList.js +++ b/src/Web/CSSOM/StyleSheetList.js @@ -1,21 +1,21 @@ "use strict"; -exports.length = function (list) { +export function length(list) { return function () { return list.length; }; -}; +} -exports.toArray = function (list) { +export function toArray(list) { return function () { return Array.prototype.slice.call(list); }; -}; +} -exports._item = function (index) { +export function _item(index) { return function (list) { return function () { return list.item(index); }; }; -}; +} From a12f7037641328b3d6ef81afa316e41a28ccb3e0 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:04:23 -0500 Subject: [PATCH 02/10] Replaced 'export var' with 'export const' --- src/Web/CSSOM/CSSStyleSheet.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Web/CSSOM/CSSStyleSheet.js b/src/Web/CSSOM/CSSStyleSheet.js index 8877fcf..987e46c 100644 --- a/src/Web/CSSOM/CSSStyleSheet.js +++ b/src/Web/CSSOM/CSSStyleSheet.js @@ -6,12 +6,12 @@ var getProp = function (name) { }; }; -export var disabled = getProp("disabled"); -export var _href = getProp("href"); -export var _ownerNode = getProp("ownerNode"); -export var _parentStyleSheet = getProp("parentStyleSheet"); -export var _title = getProp("title"); -export var _type = getProp("type"); +export const disabled = getProp("disabled"); +export const _href = getProp("href"); +export const _ownerNode = getProp("ownerNode"); +export const _parentStyleSheet = getProp("parentStyleSheet"); +export const _title = getProp("title"); +export const _type = getProp("type"); export function setDisabled(bool) { return function (sheet) { From 7c17ad21669e419690d2d58865a019628b89af30 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:04:23 -0500 Subject: [PATCH 03/10] Removed '"use strict";' in FFI files --- src/Web/CSSOM.js | 2 -- src/Web/CSSOM/CSSStyleDeclaration.js | 2 -- src/Web/CSSOM/CSSStyleSheet.js | 2 -- src/Web/CSSOM/ElementCSSInlineStyle.js | 2 -- src/Web/CSSOM/MouseEvent.js | 2 -- src/Web/CSSOM/StyleSheetList.js | 2 -- 6 files changed, 12 deletions(-) diff --git a/src/Web/CSSOM.js b/src/Web/CSSOM.js index 92bae32..3800405 100644 --- a/src/Web/CSSOM.js +++ b/src/Web/CSSOM.js @@ -1,6 +1,4 @@ // Web.CSSOM -"use strict"; - export function getStyleSheets(doc) { return function() { return doc.styleSheets; diff --git a/src/Web/CSSOM/CSSStyleDeclaration.js b/src/Web/CSSOM/CSSStyleDeclaration.js index 09585d7..8ebb322 100644 --- a/src/Web/CSSOM/CSSStyleDeclaration.js +++ b/src/Web/CSSOM/CSSStyleDeclaration.js @@ -1,5 +1,3 @@ -"use strict"; - export function cssText(style) { return function () { return style.cssText; diff --git a/src/Web/CSSOM/CSSStyleSheet.js b/src/Web/CSSOM/CSSStyleSheet.js index 987e46c..aca208a 100644 --- a/src/Web/CSSOM/CSSStyleSheet.js +++ b/src/Web/CSSOM/CSSStyleSheet.js @@ -1,5 +1,3 @@ -"use strict"; - var getProp = function (name) { return function (sheet) { return sheet[name]; diff --git a/src/Web/CSSOM/ElementCSSInlineStyle.js b/src/Web/CSSOM/ElementCSSInlineStyle.js index a24b38c..476f255 100644 --- a/src/Web/CSSOM/ElementCSSInlineStyle.js +++ b/src/Web/CSSOM/ElementCSSInlineStyle.js @@ -1,5 +1,3 @@ -"use strict"; - export function style(el) { return function () { return el.style; diff --git a/src/Web/CSSOM/MouseEvent.js b/src/Web/CSSOM/MouseEvent.js index aeda32a..0416d5b 100644 --- a/src/Web/CSSOM/MouseEvent.js +++ b/src/Web/CSSOM/MouseEvent.js @@ -1,5 +1,3 @@ -"use strict"; - export function offsetX(e) { return e.offsetX; } diff --git a/src/Web/CSSOM/StyleSheetList.js b/src/Web/CSSOM/StyleSheetList.js index 94ab615..1825e98 100644 --- a/src/Web/CSSOM/StyleSheetList.js +++ b/src/Web/CSSOM/StyleSheetList.js @@ -1,5 +1,3 @@ -"use strict"; - export function length(list) { return function () { return list.length; From 84c052aa156942b9ee6c34aeeebe493b01ce1076 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:04:23 -0500 Subject: [PATCH 04/10] Update to CI to use 'unstable' purescript --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 063845e..f5a96fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main + with: + purescript: "unstable" - uses: actions/setup-node@v1 with: From eb3919fc3232c45c062782fc4b5e55a1c9ce0a12 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:04:23 -0500 Subject: [PATCH 05/10] Update Bower dependencies to master or main --- bower.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index 8fb882f..6327f7c 100644 --- a/bower.json +++ b/bower.json @@ -15,8 +15,8 @@ "package.json" ], "dependencies": { - "purescript-web-dom": "^5.0.0", - "purescript-web-html": "^3.0.0", - "purescript-web-uievents": "^3.0.0" + "purescript-web-dom": "master", + "purescript-web-html": "master", + "purescript-web-uievents": "master" } } From 65df50e33f011a286ee250143b511b1ce9e07398 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:04:23 -0500 Subject: [PATCH 06/10] Update pulp to 16.0.0-0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1c67b54..18136bd 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ }, "devDependencies": { "eslint": "^7.15.0", - "pulp": "^15.0.0", + "pulp": "16.0.0-0", "purescript-psa": "^0.8.0", "rimraf": "^3.0.2" } From 3602f9ff326e62190cb48f281ad7cb067d7d5dc3 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:04:23 -0500 Subject: [PATCH 07/10] Update psa to 0.8.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 18136bd..4ea39f9 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "devDependencies": { "eslint": "^7.15.0", "pulp": "16.0.0-0", - "purescript-psa": "^0.8.0", + "purescript-psa": "^0.8.2", "rimraf": "^3.0.2" } } From bea415927a2bf677e5d1d34ec19c4460fca7e5b4 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 16:41:42 -0500 Subject: [PATCH 08/10] Update .eslintrc.json to ES6 --- .eslintrc.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index cb9c786..3a97d05 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,10 @@ { "parserOptions": { - "ecmaVersion": 5 + "ecmaVersion": 6, + "sourceType": "module" }, "extends": "eslint:recommended", "env": { - "commonjs": true, "browser": true }, "rules": { From 7e48976d1b29968e5ddcff05055d4af4db1d4907 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 17:50:27 -0500 Subject: [PATCH 09/10] Update CI to use Node 14 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5a96fe..06ed895 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,9 @@ jobs: with: purescript: "unstable" - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: - node-version: "10" + node-version: "14" - name: Install dependencies run: | From 8bbfc8ad5b46a45e64b032297ea6e8058e8ca6a2 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 18:04:22 -0500 Subject: [PATCH 10/10] Added changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 385a89e..3664ba2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] Breaking changes: +- Migrate FFI to ES modules (#14 by @JordanMartinez) New features: