-
-
Notifications
You must be signed in to change notification settings - Fork 510
Move to ESM #1599
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
Merged
Move to ESM #1599
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
55a38cb
WIP move to ESM
hovancik 541f407
Fixup WelcomeWIn
hovancik 93d6da9
More changes
hovancik 314700d
Contributor prefs
hovancik eb30045
Small fixes
hovancik 7890ae6
Small fix with handlers
hovancik 1703d5c
More fixes
hovancik c73ae7e
Update DBUS installation step to include package update
hovancik 6b89217
More changes
hovancik 50885af
More changes
hovancik 330b8d6
Simplify
hovancik 3ee19d6
Remove deprecated Quiet Hours checks and related dependencies
hovancik 164af7d
Fixes
hovancik f61e763
Remove duplication
hovancik da780b8
Another updates
hovancik 4616657
Improve notifications
hovancik b999caa
Add Plan mode for GH Copilot
hovancik ba60d0b
Refactor
hovancik 8eab816
Refactor 2
hovancik fd2f82a
Update instructions for Copilot
hovancik 11a20a5
Up some deps
hovancik 10baf05
Fixup old syntax
hovancik e95cac2
Update electron, node
hovancik ef7a5c1
Refactor
hovancik fc7445a
Update app/utils/utils.js
hovancik 86fc949
Revert dev changes
hovancik 8ae0c46
Tamil language option
hovancik 172914e
Rename
hovancik 2dfaf9d
Never show bart
hovancik 54a7ce1
Update
hovancik d4f9cef
Remove dev tools
hovancik ed22d89
Never wanna play sound here
hovancik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| description: Generate an implementation plan for new features or refactoring existing code. | ||
| tools: ['codebase', 'fetch', 'findTestFiles', 'githubRepo', 'search', 'usages'] | ||
| --- | ||
| # Planning mode instructions | ||
| You are in planning mode. Your task is to generate an implementation plan for a new feature or for refactoring existing code. | ||
|
|
||
| Create a plan that is simple and easy to follow. Do not make a lot of changes, but prefer small, incremental updates changing one thing at a time. If you see multiple ways of implementing a feature or refactoring code, lead a discussion to evaluate the options with the user. | ||
|
|
||
| Don't make any code edits, just generate a plan. | ||
|
|
||
| The plan consists of a Markdown document that describes the implementation plan, including the following sections: | ||
|
|
||
| * Overview: A brief description of the feature or refactoring task. | ||
| * Requirements: A list of requirements for the feature or refactoring task. | ||
| * Implementation Steps: A detailed list of steps to implement the feature or refactoring task. | ||
| * Testing: A list of tests that need to be implemented to verify the feature or refactoring task. | ||
| * Comments in code: Only if neccessary, when the code is not self-explanatory. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Stretchly Development Assistant | ||
|
|
||
| You are a specialized assistant for developers working on Stretchly, a break-time reminder application that encourages regular stretching and healthy work habits. | ||
|
|
||
| ## Technical Stack | ||
| - ElectronJS for cross-platform desktop functionality | ||
| - NodeJS backend | ||
| - JavaScript (following StandardJS style guidelines) using ESM (ECMAScript Modules) | ||
| - HTML and CSS for UI components | ||
|
|
||
| ## Development Guidelines | ||
| - Follow StandardJS style (like no semicolons, 2-space indentation) | ||
| - Prefer ES6+ features (like arrow functions, destructuring, etc.) | ||
| - Maintain cross-platform compatibility (Windows, macOS, Linux) | ||
| - Use appropriate Electron APIs for native functionality | ||
| - Maintain accessibility standards in UI components | ||
| - Keep performance in mind, especially for background processes | ||
| - Consider Chrome compatibility only, as Electron is built on Chromium | ||
|
|
||
| ## Code Organization | ||
| - Respect the existing project structure | ||
| - Place new functionality in appropriate modules | ||
| - Follow the established patterns for event handling | ||
|
|
||
| ## Testing Expectations | ||
| - Suggest tests for new functionality | ||
| - Consider edge cases in different operating systems | ||
|
|
||
| When suggesting code changes, explain your reasoning and how they align with Stretchly's goals of promoting healthy computer use. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 20.18.1 | ||
| 22.17.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { | ||
| exposeBreaks, | ||
| exposeI18next, | ||
| exposeProcess, | ||
| exposeSettings, | ||
| exposeStretchly, | ||
| exposeUtils | ||
| } from './utils/context-bridge-exposers.js' | ||
|
|
||
| exposeBreaks('long') | ||
| exposeI18next() | ||
| exposeProcess() | ||
| exposeSettings() | ||
| exposeStretchly() | ||
| exposeUtils() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import HtmlTranslate from './utils/htmlTranslate.js' | ||
| import './platform.js' | ||
|
|
||
| window.onload = async (event) => { | ||
| const [idea, started, duration, strictMode, postpone, | ||
| postponePercent, backgroundColor] = await window.breaks.sendBreakData() | ||
|
|
||
| new HtmlTranslate(document).translate() | ||
|
|
||
| document.ondragover = event => | ||
| event.preventDefault() | ||
|
|
||
| document.ondrop = event => | ||
| event.preventDefault() | ||
|
|
||
| document.querySelector('#close').onclick = async event => | ||
| await window.breaks.finishBreak() | ||
|
|
||
| document.querySelector('#postpone').onclick = async event => | ||
| await window.breaks.postponeBreak() | ||
|
|
||
| document.querySelector('.break-idea').textContent = idea[0] | ||
| document.querySelector('.break-text').textContent = idea[1] | ||
|
|
||
| const progress = document.querySelector('#progress') | ||
| const progressTime = document.querySelector('#progress-time') | ||
| const postponeElement = document.querySelector('#postpone') | ||
| const closeElement = document.querySelector('#close') | ||
| const mainColor = await window.settings.get('mainColor') | ||
| document.body.classList.add(mainColor.substring(1)) | ||
| document.body.style.backgroundColor = backgroundColor | ||
|
|
||
| document.querySelectorAll('.tiptext').forEach(async tt => { | ||
| const keyboardShortcut = await window.settings.get('endBreakShortcut') | ||
| tt.innerHTML = await window.utils.formatKeyboardShortcut(keyboardShortcut) | ||
| }) | ||
|
|
||
| setInterval(async () => { | ||
| if (await window.settings.get('currentTimeInBreaks')) { | ||
| document.querySelector('.breaks > :last-child').innerHTML = | ||
| (new Date()).toLocaleTimeString() | ||
| } | ||
| if (Date.now() - started < duration) { | ||
| const passedPercent = (Date.now() - started) / duration * 100 | ||
| postponeElement.style.display = | ||
| await window.utils.canPostpone(postpone, passedPercent, postponePercent) ? 'flex' : 'none' | ||
| closeElement.style.display = | ||
| await window.utils.canSkip(strictMode, postpone, passedPercent, postponePercent) ? 'flex' : 'none' | ||
| progress.value = (100 - passedPercent) * progress.max / 100 | ||
| progressTime.innerHTML = await window.utils.formatTimeRemaining(Math.trunc(duration - Date.now() + started), | ||
| await window.settings.get('language')) | ||
| } | ||
| }, 100) | ||
| await window.breaks.signalLoaded() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,4 +34,5 @@ | |
| </div> | ||
| </div> | ||
| </body> | ||
| <script type="module" src="./break-renderer.js"></script> | ||
| </html> | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { | ||
| exposeI18next, | ||
| exposeProcess, | ||
| exposeSettings | ||
| } from './utils/context-bridge-exposers.js' | ||
|
|
||
| exposeI18next() | ||
| exposeProcess() | ||
| exposeSettings() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| import HtmlTranslate from './utils/htmlTranslate.js' | ||
| import { setSameWidths } from './utils/sameWidths.js' | ||
| import './platform.js' | ||
|
|
||
| let eventsAttached = false | ||
|
|
||
| window.onload = async (event) => { | ||
| const settings = await window.settings.currentSettings() | ||
| setTimeout(() => { eventsAttached = true }, 500) | ||
|
|
||
| document.ondragover = event => | ||
| event.preventDefault() | ||
|
|
||
| document.ondrop = event => | ||
| event.preventDefault() | ||
|
|
||
| document.querySelectorAll('input[type="checkbox"]').forEach(checkbox => { | ||
| const isNegative = checkbox.classList.contains('negative') | ||
| checkbox.checked = isNegative ? !settings[checkbox.value] : settings[checkbox.value] | ||
| if (!eventsAttached) { | ||
| checkbox.onchange = (event) => | ||
| window.settings.saveSettings(checkbox.value, | ||
| isNegative ? !checkbox.checked : checkbox.checked) | ||
| } | ||
| }) | ||
|
|
||
| document.querySelectorAll('input[type="radio"]').forEach(radio => { | ||
| let value | ||
| switch (radio.value) { | ||
| case 'true': | ||
| value = true | ||
| break | ||
| case 'false': | ||
| value = false | ||
| break | ||
| default: | ||
| value = radio.value | ||
| } | ||
| radio.checked = settings[radio.name] === value | ||
| if (!eventsAttached) { | ||
| radio.onchange = (event) => { | ||
| window.settings.saveSettings(radio.name, value) | ||
| } | ||
| } | ||
| }) | ||
|
|
||
| document.querySelectorAll('select').forEach(select => { | ||
| select.value = settings[select.name] | ||
| if (!eventsAttached) { | ||
| select.onchange = (event) => { | ||
| window.settings.saveSettings(select.name, select.value) | ||
| } | ||
| } | ||
| }) | ||
|
|
||
| document.querySelectorAll('input[type="range"]').forEach(async range => { | ||
| const divisor = range.dataset.divisor | ||
| const output = range.closest('div').querySelector('output') | ||
| range.value = settings[range.name] / divisor | ||
| const unit = output.dataset.unit | ||
| output.innerHTML = await window.i18next.t(`utils.${unit}`, { count: parseInt(range.value) }) | ||
| if (!eventsAttached) { | ||
| range.onchange = async event => { | ||
| output.innerHTML = await window.i18next.t(`utils.${unit}`, { count: parseInt(range.value) }) | ||
| window.settings.saveSettings(range.name, range.value * divisor) | ||
| } | ||
| range.oninput = async event => { | ||
| output.innerHTML = await window.i18next.t(`utils.${unit}`, { count: parseInt(range.value) }) | ||
| } | ||
| } | ||
| }) | ||
|
|
||
| new HtmlTranslate(document).translate() | ||
| setSameWidths() | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -493,4 +493,5 @@ | |
| </div> | ||
| </div> | ||
| </body> | ||
| <script type="module" src="./contributor-preferences-renderer.js"></script> | ||
| </html> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.