Skip to content

Commit

Permalink
Merge pull request #27 from Araxeus/v1.5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Araxeus authored Jul 20, 2024
2 parents ce677e8 + 4994d58 commit 1fb2967
Show file tree
Hide file tree
Showing 14 changed files with 214 additions and 249 deletions.
5 changes: 3 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
interval: "monthly"
versioning-strategy: 'increase'

- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
interval: "monthly"
13 changes: 4 additions & 9 deletions .github/workflows/check-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@ jobs:
- name: "Dependency Review"
uses: actions/dependency-review-action@v3

rome-ci:
bun-ci:
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v3

- uses: rome/setup-rome@v0.4
with:
version: latest
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun ci

- name: "Run rome ci ."
run: rome ci .
26 changes: 26 additions & 0 deletions .github/workflows/dependabot_patch_bun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# https://github.com/dependabot/dependabot-core/issues/6528#issuecomment-2013695799
name: 'Dependabot: Update bun.lockb'
on:
pull_request:
paths:
- 'package.json'
permissions:
contents: write
jobs:
update-bun-lockb:
name: 'Update bun.lockb'
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- uses: oven-sh/setup-bun@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- run: |
bun install
git add bun.lockb
git config --global user.name 'dependabot[bot]'
git config --global user.email 'dependabot[bot]@users.noreply.github.com'
git commit --amend --no-edit
git push --force
4 changes: 1 addition & 3 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"recommendations": [
"rome.rome"
]
"recommendations": ["biomejs.biome"]
}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ There is also an option for a button with user-defined `onclick` function.
```bash
yarn add custom-electron-prompt
```
or
```bash
bun add custom-electron-prompt
```


* 2: Import prompt

Expand Down
52 changes: 52 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"organizeImports": {
"enabled": true
},
"files": {
"ignore": ["./node_modules/**", "./example/**", "./package.json"]
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 4
},
"json": {
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"linter": {
"enabled": true
}
},
"css": {
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"linter": {
"enabled": true
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"nursery": {
"recommended": true
},
"style": {
"useNumberNamespace": "off",
"noParameterAssign": "off"
}
}
}
}
Binary file added bun.lockb
Binary file not shown.
57 changes: 28 additions & 29 deletions lib/dark-prompt.css
Original file line number Diff line number Diff line change
@@ -1,79 +1,78 @@
body {
background-color: rgba(0, 0, 0, 0.3);
background-image: linear-gradient(315deg, #200000 0%, #13253a 74%);
color: whitesmoke;
background-color: rgba(0, 0, 0, 0.3);
background-image: linear-gradient(315deg, #200000 0%, #13253a 74%);
color: whitesmoke;
}

#label {
text-align: center;
text-align: center;
}

#container {
background: rgba(0, 0, 0, 0.7);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-radius: 10px;
border: 1px solid rgba(80, 0, 0, 0.4);
overflow: hidden;
background: rgba(0, 0, 0, 0.7);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-radius: 10px;
border: 1px solid rgba(80, 0, 0, 0.4);
overflow: hidden;
}

#data,
.keybindData {
background: unset;
color: whitesmoke;
border: 1px solid rgb(54, 54, 54);
background: unset;
color: whitesmoke;
border: 1px solid rgb(54, 54, 54);
}

#data:hover {
border: 1px solid rgb(85, 85, 85);
border: 1px solid rgb(85, 85, 85);
}

#data:focus {
outline: unset;
border: 1px solid rgb(85, 85, 85);
outline: unset;
border: 1px solid rgb(85, 85, 85);
}

#ok:hover,
#ok:focus,
#custom:hover,
#custon:focus
#cancel:hover,
#custon:focus #cancel:hover,
#cancel:focus {
outline: rgba(60, 0, 0, 0.4) solid 2px;
outline: rgba(60, 0, 0, 0.4) solid 2px;
}

#ok,
#cancel,
#custom,
.clearButton {
background-color: rgb(0, 0, 0);
color: whitesmoke;
background-color: rgb(0, 0, 0);
color: whitesmoke;
}

/* For Counter Prompt */
.minus,
.plus {
background: rgb(0, 0, 0);
background: rgb(0, 0, 0);
}

/* For Select Prompt */
option {
background-color: #07070C;
background-color: #07070c;
}

/* For Keybind Prompt */
.clearButton:focus {
outline: none;
outline: none;
}
.clearButton:hover {
background-color: rgb(5, 5, 5);
background-color: rgb(5, 5, 5);
}
.keybindData:hover {
border: 1px solid rgb(56, 0, 0);
border: 1px solid rgb(56, 0, 0);
}

.keybindData:focus {
outline: 3px solid #1E0919;
border: 1px solid rgb(56, 0, 0);
outline: 3px solid #1e0919;
border: 1px solid rgb(56, 0, 0);
}
22 changes: 12 additions & 10 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { BrowserWindow, ipcMain } = require('electron');

const url = require('url');
const path = require('path');
const url = require('node:url');
const path = require('node:path');

const DEFAULT_WIDTH = 370;
const DEFAULT_KEYBIND_WIDTH = 420;
Expand All @@ -21,8 +21,8 @@ function electronPrompt(options, parentWindow) {
options?.type === 'counter'
? DEFAULT_COUNTER_WIDTH
: options?.type === 'keybind'
? DEFAULT_KEYBIND_WIDTH
: DEFAULT_WIDTH,
? DEFAULT_KEYBIND_WIDTH
: DEFAULT_WIDTH,
height:
options?.type === 'keybind' && options?.keybindOptions
? DEFAULT_KEYBIND_HEIGHT(options.keybindOptions)
Expand Down Expand Up @@ -57,7 +57,7 @@ function electronPrompt(options, parentWindow) {
);

if (options_.customStylesheet === 'dark') {
options_.customStylesheet = require('path').join(
options_.customStylesheet = require('node:path').join(
__dirname,
'dark-prompt.css',
);
Expand Down Expand Up @@ -127,9 +127,11 @@ function electronPrompt(options, parentWindow) {
);
ipcMain.removeListener(`prompt-post-data:${id}`, postDataListener);
ipcMain.removeListener(`prompt-error:${id}`, errorListener);

parentWindow?.focus();
};

const cleanAndDestroy = () => {
cleanup();
if (promptWindow) {
promptWindow.destroy();
promptWindow = null;
Expand All @@ -155,19 +157,19 @@ function electronPrompt(options, parentWindow) {
}
resolve(value);
event.returnValue = null;
cleanup();
cleanAndDestroy();
};

const unresponsiveListener = () => {
reject(new Error('Window was unresponsive'));
cleanup();
cleanAndDestroy();
};

//get error from front
const errorListener = (event, message) => {
reject(new Error(message));
event.returnValue = null;
cleanup();
cleanAndDestroy();
};

//attach listeners
Expand All @@ -193,7 +195,7 @@ function electronPrompt(options, parentWindow) {
};
reject(
new Error(
'prompt.html did-fail-load, log:\n' + log.toString(),
`prompt.html did-fail-load, log:\n${log.toString()}`,
),
);
},
Expand Down
Loading

0 comments on commit 1fb2967

Please sign in to comment.