Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
matrix: ${{ steps.matrix.outputs.matrix }}

steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# Need this to be able to inquire about origin/master
filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# Need this to be able to inquire about origin/master
filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
- test

steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-for-scripts

- name: Get suggestions dir
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'

steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-for-scripts

- run: pnpm tsc -p ./scripts
2 changes: 1 addition & 1 deletion .github/workflows/UpdateCodeowners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'

steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format-and-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# Use a deploy key so that CI triggers on pushes; we want to know if formatting broke something.
ssh-key: ${{ secrets.DEPLOY_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ghostbuster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'

steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-for-scripts
- run: node ./scripts/ghostbuster.js > ${{ runner.temp }}/comment.md
env:
Expand All @@ -42,7 +42,7 @@ jobs:
fi

- if: ${{ inputs.skipPR != 'true' }}
uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Remove contributors with deleted accounts #no-publishing-comment'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-md.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-for-scripts
- run: pnpm remark --frail . .github
2 changes: 1 addition & 1 deletion .github/workflows/pnpm-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.repository == 'DefinitelyTyped/DefinitelyTyped' }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '20'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/support-window.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-for-scripts

- name: Fetch TypeScript versions and release dates from npm
Expand Down
5 changes: 5 additions & 0 deletions types/dom-eyedropper/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
61 changes: 61 additions & 0 deletions types/dom-eyedropper/dom-eyedropper-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Basic constructor test
const eyeDropper = new EyeDropper();

// Test open() with no options
eyeDropper.open().then((result) => {
// $ExpectType ColorSelectionResult
result;

// $ExpectType string
result.sRGBHex;
});

// Test open() with empty options
eyeDropper.open({}).then((result) => {
// $ExpectType ColorSelectionResult
result;
});

// Test open() with AbortSignal
const controller = new AbortController();
eyeDropper.open({ signal: controller.signal }).then((result) => {
// $ExpectType ColorSelectionResult
result;

// $ExpectType string
result.sRGBHex;
});

// Test aborting the eyedropper
const controller2 = new AbortController();
const promise = eyeDropper.open({ signal: controller2.signal });
controller2.abort();
promise.catch((error) => {
// $ExpectType any
error;
});

// Test using async/await
async function selectColor() {
const eyeDropper = new EyeDropper();
const result = await eyeDropper.open();

// $ExpectType ColorSelectionResult
result;

// $ExpectType string
result.sRGBHex;

return result.sRGBHex;
}

// Test with user interaction (e.g., button click)
document.getElementById("color-picker")?.addEventListener("click", async () => {
const eyeDropper = new EyeDropper();
try {
const result = await eyeDropper.open();
console.log(result.sRGBHex);
} catch (error) {
console.error("Color selection failed:", error);
}
});
47 changes: 47 additions & 0 deletions types/dom-eyedropper/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Options passed to the open() method of the EyeDropper API
*/
interface ColorSelectionOptions {
/**
* An AbortSignal. The eyedropper selection is aborted when abort() is called on the associated AbortController.
*/
signal?: AbortSignal;
}

/**
* Result returned from the open() method of the EyeDropper API when a color is successfully selected
*/
interface ColorSelectionResult {
/**
* A string in hexadecimal sRGB format (#RRGGBB) representing the selected color
*/
sRGBHex: string;
}

/**
* The EyeDropper interface provides access to a browser-supplied eyedropper tool.
* It allows users to sample colors from their screen, including content outside of the browser window.
*/
interface EyeDropper {
/**
* Initiates the eyedropper mode.
* Returns a promise that resolves with the selected color when the user selects a pixel,
* or rejects if the operation is cancelled or fails.
*
* @param options - Optional configuration including an AbortSignal to cancel the operation
* @returns A promise that resolves to a ColorSelectionResult containing the selected color in sRGB hex format
* @throws {DOMException} NotAllowedError if user activation is required but not present
* @throws {DOMException} InvalidStateError if the eyedropper is already open
* @throws {DOMException} AbortError if the operation is aborted via the AbortSignal
* @throws {DOMException} OperationError if the operation fails for other reasons
*/
open(options?: ColorSelectionOptions): Promise<ColorSelectionResult>;
}

declare var EyeDropper: {
prototype: EyeDropper;
/**
* Creates a new EyeDropper instance
*/
new(): EyeDropper;
};
19 changes: 19 additions & 0 deletions types/dom-eyedropper/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"private": true,
"name": "@types/dom-eyedropper",
"version": "0.1.9999",
"nonNpm": true,
"nonNpmDescription": "EyeDropper API",
"projects": [
"https://wicg.github.io/eyedropper-api/"
],
"devDependencies": {
"@types/dom-eyedropper": "workspace:."
},
"owners": [
{
"name": "Nathan Babcock",
"githubUsername": "nathanbabcock"
}
]
}
20 changes: 20 additions & 0 deletions types/dom-eyedropper/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "node16",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"dom-eyedropper-tests.ts"
]
}
5 changes: 5 additions & 0 deletions types/grenache-nodejs-link/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
29 changes: 29 additions & 0 deletions types/grenache-nodejs-link/grenache-nodejs-link-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Link from "grenache-nodejs-link";

const link = new Link({
grape: "http://127.0.0.1:30001",
});

link.start();

link.put({ hello: "world" }, (err, hash) => {
if (err) throw err;

if (hash) {
link.get(hash, (err, res) => {
if (err) throw err;
res;
});
}
});

link.lookup("test", (err, peers) => {
if (err) throw err;
peers?.forEach(p => p.toUpperCase());
});

link.startAnnouncing("test", 10000, err => {
if (err) throw err;
});

link.stop();
73 changes: 73 additions & 0 deletions types/grenache-nodejs-link/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/// <reference types="node" />

import { EventEmitter } from "events";

interface LinkOptions {
grape: string | string[];
monitorTimeout?: number | undefined;
requestTimeout?: number | undefined;
lruMaxSizeLookup?: number | undefined;
lruMaxAgeLookup?: number | undefined;
}

interface LookupOptions {
retry?: number | undefined;
}

interface AnnounceOptions {
interval?: number | undefined;
retry?: number | undefined;
}

type Callback<T = unknown> = (err: Error | null, data?: T) => void;

declare class Link extends EventEmitter {
constructor(options: LinkOptions);

start(): this;
stop(): this;

put(value: unknown, callback: Callback<string>): void;
get(hash: string, callback: Callback<unknown>): void;

lookup(
name: string,
options: LookupOptions,
callback: Callback<string[]>,
): void;

lookup(
name: string,
callback: Callback<string[]>,
): void;

announce(
name: string,
port: number,
options: AnnounceOptions,
callback?: Callback<void>,
): void;

announce(
name: string,
port: number,
callback?: Callback<void>,
): void;

startAnnouncing(
name: string,
port: number,
options: AnnounceOptions,
callback?: Callback<void>,
): void;

startAnnouncing(
name: string,
port: number,
callback?: Callback<void>,
): void;

stopAnnouncing(name?: string, port?: number): this;
}

export = Link;
20 changes: 20 additions & 0 deletions types/grenache-nodejs-link/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"private": true,
"name": "@types/grenache-nodejs-link",
"version": "1.0.9999",
"projects": [
"https://github.com/bitfinexcom/grenache-nodejs-link"
],
"dependencies": {
"@types/node": "*"
},
"devDependencies": {
"@types/grenache-nodejs-link": "workspace:."
},
"owners": [
{
"name": "Rami Mohamed [https://rami.sd]",
"githubUsername": "ramioooz"
}
]
}
Loading