Skip to content

Commit

Permalink
0.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminAster committed Jan 20, 2024
1 parent 8bbd9cf commit c2fdea0
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 31 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ The type declarations in this repository include the following specifications (g
- [WebCodecs](https://w3c.github.io/webcodecs/)
- [Window Management](https://w3c.github.io/window-management/)
- [Web Hypertext Application Technology Working Group (WHATWG)](https://spec.whatwg.org):
- [File System Observer](https://github.com/whatwg/fs/blob/main/proposals/FileSystemObserver.md)
- [File System](https://fs.spec.whatwg.org)
- [HTML](https://html.spec.whatwg.org/multipage/)
- [Web Bluetooth Community Group](https://webbluetoothcg.github.io):
Expand All @@ -135,4 +136,4 @@ The type declarations in this repository include the following specifications (g
- [Global Privacy Control](https://privacycg.github.io/gpc-spec/)
- [TC39](https://tc39.es):
- [Array.fromAsync](https://tc39.es/proposal-array-from-async/)
- [ECMAScript Language Specification](https://tc39.es/ecma262/)
- [ECMAScript](https://tc39.es/ecma262/)
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

/// <reference path="./webbluetoothcg/bluetooth.d.ts" />

/// <reference path="./whatwg/file-system-observer.d.ts" />
/// <reference path="./whatwg/file-system.d.ts" />
/// <reference path="./whatwg/html.d.ts" />

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new-javascript",
"version": "0.4.1",
"version": "0.4.2",
"description": "TypeScript type definitions for new JavaScript stuff that isn't yet in TypeScript's standard type definitions",
"main": "./index.d.ts",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion tc39/esnext.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// ECMAScript Language Specification
// ECMAScript
// Specification: https://tc39.es/ecma262/multipage/
// Repository: https://github.com/tc39/ecma262

Expand Down
35 changes: 28 additions & 7 deletions test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// import css from "sdlkfjasdf.css" assert { type: "css" };

// / <reference no-default-lib="true" />
// / <reference lib="ESNext" />
// / <reference lib="DOM" />
// / <reference lib="DOM.Iterable" />
/// <reference lib="ESNext" />
/// <reference lib="DOM" />
/// <reference lib="DOM.Iterable" />
// / <reference path="./worker.d.ts" />
/// <reference path="./index.d.ts" />
// / <reference path="./worklet/paint.d.ts" />
Expand All @@ -19,8 +19,20 @@ Promise.allSettled

ArrayBuffer.prototype

const observer = new FileSystemObserver((changes) => {

})

observer.observe

SharedArrayBuffer.prototype

// import("./package.json", {
// with: {
// type: "json"
// }
// })

let buffer = new ArrayBuffer(5)
buffer.resize(10)

Expand All @@ -31,10 +43,10 @@ sab.growable && sab.grow(20)
"".toWellFormed()
"".isWellFormed()

;[].toReversed
;[].toSorted
;[].toSpliced
;[].with
;[].toReversed
;[].toSorted
;[].toSpliced
;[].with
Uint8Array.prototype.toReversed
Uint8Array.prototype.toSorted
Uint8Array.prototype.with
Expand All @@ -43,6 +55,15 @@ new Promise<void>((res, rej) => {
res()
})

navigator.permissions.query({ name: "geolocation" })
navigator.permissions.query({ name: "web-share" })
navigator.permissions.request({ name: "geolocation" })
navigator.permissions.request({ name: "web-share" })
navigator.permissions.requestAll([{ name: "geolocation" }])
navigator.permissions.requestAll([{ name: "web-share" }])
navigator.permissions.revoke({ name: "geolocation" })
navigator.permissions.revoke({ name: "web-share" })

let { promise, resolve, reject } = Promise.withResolvers();
{
let { promise, resolve, reject } = Promise.withResolvers<number>();
Expand Down
10 changes: 10 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"module": "ESNext",
"target": "ESNext",
"noEmit": true,
"strict": false,
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"types": [],
},
}
12 changes: 5 additions & 7 deletions w3c/permissions-registry.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@

declare namespace NewJavaScript {
type PermissionName = (
// in lib.dom.d.ts:
| "geolocation"
| "notifications"
| "push"
| "persistent-storage"
| "screen-wake-lock"
| "xr-spatial-tracking"
// already in lib.dom.d.ts: "geolocation", "notifications", "persistent-storage", "push", "screen-wake-lock", "xr-spatial-tracking"

// https://w3c.github.io/permissions-registry/#registry-table-of-standardized-permissions:
| "web-share"
Expand All @@ -30,8 +24,10 @@ declare namespace NewJavaScript {
| "ambient-light-sensor"
| "gyroscope"
| "magnetometer"
| "screen-wake-lock"
| "nfc"
| "display-capture"

| "accessibility-events"
| "clipboard-read"
| "clipboard-write"
Expand All @@ -40,8 +36,10 @@ declare namespace NewJavaScript {
| "periodic-background-sync"
| "system-wake-lock"
| "storage-access"
| "window-management"
| "window-placement"
| "top-level-storage-access"
| "captured-surface-control"
);

interface PermissionDescriptor {
Expand Down
37 changes: 37 additions & 0 deletions whatwg/file-system-observer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

// File System Observer
// Explainer: https://github.com/whatwg/fs/blob/main/proposals/FileSystemObserver.md

interface FileSystemObserver {
observe(handle: FileSystemHandle, options?: FileSystemObserverObserveOptions): Promise<void>;
unobserve(handle: FileSystemHandle): void;
disconnect(): void;
}

declare var FileSystemObserver: {
prototype: FileSystemObserver;
new(callback: FileSystemObserverCallback): FileSystemObserver;
};

type FileSystemObserverCallback = (records: FileSystemChangeRecord[], observer: FileSystemObserver) => void;

type FileSystemChangeType = (
| "created"
| "deleted"
| "modified"
| "moved"
| "unsupported"
| "errored"
);

interface FileSystemObserverObserveOptions {
recursive?: boolean;
}

interface FileSystemChangeRecord {
readonly root: FileSystemHandle;
readonly changedHandle: FileSystemHandle;
readonly relativePathComponents: ReadonlyArray<string>;
readonly type: FileSystemChangeType;
readonly relativePathMovedFrom: FileSystemHandle | null;
}
8 changes: 4 additions & 4 deletions whatwg/file-system.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
// Repository: https://github.com/whatwg/fs

interface FileSystemHandle {
// non-standard getUniqueId() function (Chromium only, see https://github.com/whatwg/fs/blob/97bcadc/UniqueID.md):
// non-standard getUniqueId() function (Chromium only, see https://github.com/whatwg/fs/blob/9063e17/UniqueID.md):
getUniqueId(): Promise<string>;
}

interface FileSystemFileHandle extends FileSystemHandle {
// non-standard move() function (Chromium only, see https://whatpr.org/fs/10.html#dom-filesystemhandle-move):
move(name: string): Promise<void>;
move(parent: FileSystemDirectoryHandle): Promise<void>;
move(parent: FileSystemDirectoryHandle, name: string): Promise<void>;
move(newEntryName: string): Promise<void>;
move(destinationDirectory: FileSystemDirectoryHandle): Promise<void>;
move(destinationDirectory: FileSystemDirectoryHandle, newEntryName: string): Promise<void>;
}

interface FileSystemDirectoryHandle extends FileSystemHandle {
Expand Down
4 changes: 2 additions & 2 deletions wicg/permissions-request.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
/// <reference path="../w3c/permissions-registry.d.ts" />

interface Permissions {
request(permissionDesc: NewJavaScript.PermissionDescriptor): Promise<PermissionStatus>;
request(permissionDesc: PermissionDescriptor | NewJavaScript.PermissionDescriptor): Promise<PermissionStatus>;

// non-standard requestAll() function (https://crbug.com/516626):
requestAll(permissionsDesc: NewJavaScript.PermissionDescriptor[]): Promise<PermissionStatus>;
requestAll(permissionsDesc: (PermissionDescriptor | NewJavaScript.PermissionDescriptor)[]): Promise<PermissionStatus>;
}
2 changes: 1 addition & 1 deletion wicg/permissions-revoke.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
/// <reference path="../w3c/permissions-registry.d.ts" />

interface Permissions {
revoke(permissionDesc: NewJavaScript.PermissionDescriptor): Promise<PermissionStatus>;
revoke(permissionDesc: PermissionDescriptor | NewJavaScript.PermissionDescriptor): Promise<PermissionStatus>;
}
22 changes: 17 additions & 5 deletions wicg/ua-client-hints.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@ interface NavigatorUABrandVersion {
version?: string;
}

declare namespace NewJavaScript {
type FormFactor = (
| "Desktop"
| "Automotive"
| "Mobile"
| "Tablet"
| "XR"
| "EInk"
| "Watch"
);

/** @deprecated */
type DeprecatedUAFullVersion = "uaFullVersion";
}

interface UADataValues {
architecture?: string;
bitness?: string;
brands?: NavigatorUABrandVersion[];
formFactor?: string;
formFactor?: NewJavaScript.FormFactor[];
fullVersionList?: NavigatorUABrandVersion[];
model?: string;
mobile?: boolean;
Expand All @@ -39,16 +54,13 @@ type UAHighEntropyValueHint = (
| "wow64"
);

/** @deprecated */
type DeprecatedUAFullVersion = "uaFullVersion";

declare class NavigatorUAData {
readonly brands: ReadonlyArray<NavigatorUABrandVersion>;
readonly mobile: boolean;
readonly platform: string;
getHighEntropyValues(hints: UAHighEntropyValueHint[]): Promise<UADataValues>;
/** @deprecated The `"uaFullVersion"` high entropy value hint is deprecated. Use `"fullVersionList"` instead. */
getHighEntropyValues(hints: (UAHighEntropyValueHint | DeprecatedUAFullVersion)[]): Promise<UADataValues>;
getHighEntropyValues(hints: (UAHighEntropyValueHint | NewJavaScript.DeprecatedUAFullVersion)[]): Promise<UADataValues>;
toJSON(): UALowEntropyJSON;
}

Expand Down
2 changes: 0 additions & 2 deletions worklet/worklet-global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// https://html.spec.whatwg.org/multipage/worklets.html

/// <reference path="../tc39/array-from-async.d.ts" />
/// <reference path="../tc39/array-grouping.d.ts" />
/// <reference path="../tc39/esnext.d.ts" />
/// <reference path="../tc39/import-attributes.d.ts" />

interface WorkletGlobalScope { }

0 comments on commit c2fdea0

Please sign in to comment.