From af65b2d430bfdea2f5b1665ad94f695c24e7a0f9 Mon Sep 17 00:00:00 2001 From: Claudia Meadows Date: Thu, 7 Nov 2024 13:33:42 -0800 Subject: [PATCH 1/5] Update pr-create-release.yml Signed-off-by: Claudia Meadows --- .github/workflows/pr-create-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-create-release.yml b/.github/workflows/pr-create-release.yml index 0d23b00e9..59e8d80d4 100644 --- a/.github/workflows/pr-create-release.yml +++ b/.github/workflows/pr-create-release.yml @@ -7,5 +7,7 @@ permissions: issues: write jobs: comment: + # Don't auto-close actual release PRs + if: ${{github.actor != 'JAForbes' || !contains(github.event.issue.title, "Release - v")}} uses: MithrilJS/infra/.github/workflows/reject-pr.yml@main secrets: inherit From 33e8ce237ab0d82d6a76dd4343463ac7f2358e0e Mon Sep 17 00:00:00 2001 From: Claudia Meadows Date: Fri, 15 Nov 2024 09:45:12 -0800 Subject: [PATCH 2/5] Delete .github/ISSUE_TEMPLATE/0-docs.yml Do a much better job discouraging filing docs bugs here Signed-off-by: Claudia Meadows --- .github/ISSUE_TEMPLATE/0-docs.yml | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/0-docs.yml diff --git a/.github/ISSUE_TEMPLATE/0-docs.yml b/.github/ISSUE_TEMPLATE/0-docs.yml deleted file mode 100644 index 964a2b689..000000000 --- a/.github/ISSUE_TEMPLATE/0-docs.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: '📃 Documentation Issue' -description: Report an issue with Mithril.js's documentation -assignees: dead-claudia -labels: -- 'Area: Documentation' -body: -- type: checkboxes - attributes: - label: Is there an existing issue for this? - description: Please search to see if an issue already exists for the bug you encountered. - options: - - label: I have searched the existing issues - required: true -- type: input - attributes: - label: Offending URL - description: Provide a link to the page with the issue - placeholder: https://mithril.js.org/ - validations: - required: true -- type: textarea - attributes: - label: Issue description - description: What is the precise issue with it. Please be specific. - validations: - required: true From f3977b338f5322455dcf78230db0b40d63aa9456 Mon Sep 17 00:00:00 2001 From: Claudia Meadows Date: Fri, 15 Nov 2024 09:50:00 -0800 Subject: [PATCH 3/5] Update config.yml Signed-off-by: Claudia Meadows --- .github/ISSUE_TEMPLATE/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 425bfdba0..676f7e949 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -13,6 +13,9 @@ contact_links: - name: 🚀 Feature Request or Enhancement url: https://github.com/MithrilJS/mithril.js/discussions/new?category=ideas about: Got a feature request? Let us know here! We do those in our discussion forum. + - name: 📄 Documentation issue + url: https://github.com/MithrilJS/docs + about: Found an issue with our documentation? File that in our docs repo instead. - name: 💻 Zulip Chat url: https://mithril.zulipchat.com/ about: Not sure about something? Just want to hang out? Come over to our Zulip chat! From ffafe51e4071f7c23bc3578eb5e4afd7fd5612ca Mon Sep 17 00:00:00 2001 From: kfule Date: Tue, 19 Nov 2024 05:27:22 +0900 Subject: [PATCH 4/5] updateStyle(): use setProperty() when css vars and dashed-properties, fixes #2989 (#2991) --- render/render.js | 6 +-- render/tests/test-updateElement.js | 69 ++++++++++++++++++++++++++++++ test-utils/domMock.js | 18 +++++--- 3 files changed, 84 insertions(+), 9 deletions(-) diff --git a/render/render.js b/render/render.js index 6888d06f5..6ecb38ee5 100644 --- a/render/render.js +++ b/render/render.js @@ -794,7 +794,7 @@ module.exports = function() { for (var key in style) { var value = style[key] if (value != null) { - if (key[0] === "-" && key[1] === "-") element.style.setProperty(key, String(value)) + if (key.includes("-")) element.style.setProperty(key, String(value)) else element.style[key] = String(value) } } @@ -804,14 +804,14 @@ module.exports = function() { for (var key in style) { var value = style[key] if (value != null && (value = String(value)) !== String(old[key])) { - if (key[0] === "-" && key[1] === "-") element.style.setProperty(key, value) + if (key.includes("-")) element.style.setProperty(key, value) else element.style[key] = value } } // Remove style properties that no longer exist for (var key in old) { if (old[key] != null && style[key] == null) { - if (key[0] === "-" && key[1] === "-") element.style.removeProperty(key) + if (key.includes("-")) element.style.removeProperty(key) else element.style[key] = "" } } diff --git a/render/tests/test-updateElement.js b/render/tests/test-updateElement.js index eb41e06f4..771b4a405 100644 --- a/render/tests/test-updateElement.js +++ b/render/tests/test-updateElement.js @@ -257,6 +257,75 @@ o.spec("updateElement", function() { } }) + o("use style property setter only when cameCase keys", function() { + var spySetProperty = o.spy() + var spyRemoveProperty = o.spy() + var spyDashed1 = o.spy() + var spyDashed2 = o.spy() + var spyDashed3 = o.spy() + var spyCamelCase1 = o.spy() + var spyCamelCase2 = o.spy() + + render(root, m("a")) + var el = root.firstChild + + el.style.setProperty = spySetProperty + el.style.removeProperty = spyRemoveProperty + Object.defineProperties(el.style, { + /* eslint-disable accessor-pairs */ + "background-color": {set: spyDashed1}, + "-webkit-border-radius": {set: spyDashed2}, + "--foo": {set: spyDashed3}, + backgroundColor: {set: spyCamelCase1}, + color: {set: spyCamelCase2} + /* eslint-enable accessor-pairs */ + }) + + // sets dashed properties + render(root, m("a", { + style: { + "background-color": "red", + "-webkit-border-radius": "10px", + "--foo": "bar" + } + })) + o(spySetProperty.callCount).equals(3) + o(spySetProperty.calls[0].args).deepEquals(["background-color", "red"]) + o(spySetProperty.calls[1].args).deepEquals(["-webkit-border-radius", "10px"]) + o(spySetProperty.calls[2].args).deepEquals(["--foo", "bar"]) + + // sets camelCase properties and removes dashed properties + render(root, m("a", { + style: { + backgroundColor: "green", + color: "red", + } + })) + o(spyCamelCase1.callCount).equals(1) + o(spyCamelCase2.callCount).equals(1) + o(spyCamelCase1.calls[0].args).deepEquals(["green"]) + o(spyCamelCase2.calls[0].args).deepEquals(["red"]) + o(spyRemoveProperty.callCount).equals(3) + o(spyRemoveProperty.calls[0].args).deepEquals(["background-color"]) + o(spyRemoveProperty.calls[1].args).deepEquals(["-webkit-border-radius"]) + o(spyRemoveProperty.calls[2].args).deepEquals(["--foo"]) + + // updates "color" and removes "backgroundColor" + render(root, m("a", {style: {color: "blue"}})) + o(spyCamelCase1.callCount).equals(2) // set and remove + o(spyCamelCase2.callCount).equals(2) // set and update + o(spyCamelCase1.calls[1].args).deepEquals([""]) + o(spyCamelCase2.calls[1].args).deepEquals(["blue"]) + + // unchanged by camelCase properties + o(spySetProperty.callCount).equals(3) + o(spyRemoveProperty.callCount).equals(3) + + // never calls dashed property setter + o(spyDashed1.callCount).equals(0) + o(spyDashed2.callCount).equals(0) + o(spyDashed3.callCount).equals(0) + }) o("replaces el", function() { var vnode = m("a") var updated = m("b") diff --git a/test-utils/domMock.js b/test-utils/domMock.js index 5536b49fd..3a86504af 100644 --- a/test-utils/domMock.js +++ b/test-utils/domMock.js @@ -284,12 +284,18 @@ module.exports = function(options) { getPropertyValue: {value: function(key){ return style[key] }}, - removeProperty: {value: function(key){ - style[key] = style[camelCase(key)] = "" - }}, - setProperty: {value: function(key, value){ - style[key] = style[camelCase(key)] = value - }} + removeProperty: { + writable: true, + value: function(key){ + style[key] = style[camelCase(key)] = "" + } + }, + setProperty: { + writable: true, + value: function(key, value){ + style[key] = style[camelCase(key)] = value + } + } }) var events = {} var element = { From 44eec1acfc9c890d8596140137f6ff96e033b9a2 Mon Sep 17 00:00:00 2001 From: James Forbes Date: Wed, 20 Nov 2024 06:03:16 +0000 Subject: [PATCH 5/5] Use new pr-release prerelease hook (Fixes #2987) --- .github/workflows/push-release.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/push-release.yml b/.github/workflows/push-release.yml index aa7139499..4e131505e 100644 --- a/.github/workflows/push-release.yml +++ b/.github/workflows/push-release.yml @@ -20,14 +20,11 @@ jobs: node-version: 20 - run: npm ci - run: npm run build - - run: npx pr-release merge --target release --source main --commit --force --clean --changelog ./docs/recent-changes.md --compact --minimize-semver-change - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - - run: bash scripts/set-versioned-branch.sh release - # The following will publish the release to npm - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc name: Setup NPM Auth env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - run: npm publish - name: Publish + - run: npx pr-release merge --target release --source main --commit --force --clean --changelog ./docs/recent-changes.md --compact --minimize-semver-change --prerelease="npm publish" + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - run: bash scripts/set-versioned-branch.sh release