diff --git a/types/d3-tile/.npmignore b/types/d3-tile/.npmignore new file mode 100644 index 00000000000000..93e307400a5456 --- /dev/null +++ b/types/d3-tile/.npmignore @@ -0,0 +1,5 @@ +* +!**/*.d.ts +!**/*.d.cts +!**/*.d.mts +!**/*.d.*.ts diff --git a/types/d3-tile/d3-tile-tests.ts b/types/d3-tile/d3-tile-tests.ts new file mode 100644 index 00000000000000..d49e69c987d044 --- /dev/null +++ b/types/d3-tile/d3-tile-tests.ts @@ -0,0 +1,93 @@ +import * as d3 from "d3"; + +// test variables +let tileLayout: d3.TileLayout; +let tile: d3.Tile; +let tiles: d3.Tiles; +let zoomTransform: d3.ZoomTransform; + +// test tile() constructor +tileLayout = d3.tile(); + +// test invoke with no arguments +tiles = tileLayout(); + +// test invoke with ZoomTransform argument +zoomTransform = d3.zoomTransform(document.createElement("svg")); +tiles = tileLayout(zoomTransform); + +// test size getter/setter +let sizeValue: [number, number] = tileLayout.size(); +tileLayout = tileLayout.size([800, 600]); + +// test scale getter/setter with number +let scaleFunc: (...args: any[]) => number = tileLayout.scale(); +tileLayout = tileLayout.scale(256); +tileLayout = tileLayout.scale((...args: any[]) => 256); + +// test translate getter/setter with array +let translateFunc: (...args: any[]) => [number, number] = tileLayout.translate(); +tileLayout = tileLayout.translate([0, 0]); +tileLayout = tileLayout.translate((...args: any[]) => [0, 0]); + +// test zoomDelta getter/setter +let zoomDeltaValue: number = tileLayout.zoomDelta(); +tileLayout = tileLayout.zoomDelta(0); +tileLayout = tileLayout.zoomDelta(-1); +tileLayout = tileLayout.zoomDelta(1); + +// test clamp getter/setter +let clampValue: boolean = tileLayout.clamp(); +tileLayout = tileLayout.clamp(true); +tileLayout = tileLayout.clamp(false); + +// test clampX getter/setter +let clampXValue: boolean = tileLayout.clampX(); +tileLayout = tileLayout.clampX(true); +tileLayout = tileLayout.clampX(false); + +// test clampY getter/setter +let clampYValue: boolean = tileLayout.clampY(); +tileLayout = tileLayout.clampY(true); +tileLayout = tileLayout.clampY(false); + +// test tileSize getter/setter +let tileSizeValue: number = tileLayout.tileSize(); +tileLayout = tileLayout.tileSize(256); +tileLayout = tileLayout.tileSize(512); + +// test extent getter/setter +let extentValue: [[number, number], [number, number]] = tileLayout.extent(); +tileLayout = tileLayout.extent([[0, 0], [960, 500]]); +tileLayout = tileLayout.extent([[0, 0], [1920, 1080]]); + +// test tiles array properties +let tilesLength: number = tiles.length; +let tilesScale: number = tiles.scale; +let tilesTranslate: [number, number] = tiles.translate; + +// test tile coordinates +for (let i = 0; i < tiles.length; i++) { + let tileCoord: d3.Tile = tiles[i]; + let x: number = tileCoord[0]; + let y: number = tileCoord[1]; + let z: number = tileCoord[2]; +} + +// test tileWrap function +let wrappedTile: [number, number, number] = d3.tileWrap([1, 2, 3]); +let wrappedX: number = wrappedTile[0]; +let wrappedY: number = wrappedTile[1]; +let wrappedZ: number = wrappedTile[2]; + +// test method chaining +tileLayout + .size([800, 600]) + .scale(256) + .translate([0, 0]) + .zoomDelta(0) + .clamp(true) + .clampX(true) + .clampY(true) + .tileSize(256) + .extent([[0, 0], [960, 500]]); diff --git a/types/d3-tile/index.d.ts b/types/d3-tile/index.d.ts new file mode 100644 index 00000000000000..ee0bb504ff2817 --- /dev/null +++ b/types/d3-tile/index.d.ts @@ -0,0 +1,150 @@ +import { ZoomTransform } from "d3"; + +declare module "d3" { + type Tile = [number, number, number]; + + interface Tiles extends Array { + translate: [number, number]; + scale: number; + } + + interface TileLayout { + /** + * Computes the set of tiles to display given the current settings, + * computing the scale and translate by invoking the corresponding + * accessors with the given arguments. Returns an array of [x, y, z] + * arrays representing the x- (horizontal), y- (vertical) and z- (zoom) + * coordinates of the visible tiles. The returned tiles array also has + * tiles.scale and tiles.translate properties which together with an + * individual tile’s x and y determine the intended location of the tile + * in the viewport. + */ + (): Tiles; + (t: ZoomTransform): Tiles; + + /** + * If size is specified, sets this tile layout’s viewport size to the + * specified array of numbers [width, height] and returns this tile + * layout. If size is not specified, returns the current viewport size, + * which defaults to [960, 500]. This is a convenience method for setting + * the viewport extent to [[0, 0], [width, height]]. + */ + size(): [number, number]; + size(size: [number, number]): this; + + /** + * If scale is specified, sets this tile layout’s scale function and + * returns this tile layout. If scale is a function, it is invoked when + * the tile layout is invoked, being passed the same arguments as the tile + * layout; this function must return a number indicating the desired width + * and height of the world tile [0, 0, 0]. If scale is not a function, it + * assumed to be a constant number, and is wrapped in a function which + * returns the specified number. If scale is not specified, returns the + * current layout scale function. + */ + scale(): (...args: any[]) => number; + scale(scale: number | ((...args: any[]) => number)): this; + + /** + * If translate is specified, sets this tile layout’s translate function + * and returns this tile layout. If translate is a function, it is invoked + * when the tile layout is invoked, being passed the same arguments as the + * tile layout; this function must return an array of numbers [x, y] + * indicating the desired coordinates the center of the world tile [0, 0, + * 0]. If translate is not a function, it is assumed to be a constant + * array [x, y] and is wrapped in a function which returns the specified + * array. If translate is not specified, returns the current layout + * translate function. + */ + translate(): (...args: any[]) => [number, number]; + translate( + translate: [ + number, + number, + ] | ((...args: any[]) => [number, number]), + ): this; + + /** + * If zoomDelta is specified, sets this tile layout’s zoom offset to the + * specified number zoomDelta and returns this tile layout. If zoomDelta + * is not specified, returns the current zoom offset, which defaults to 0. + * The zoom offset affects which z-coordinate is chosen based on the + * current scale; the default zoom offset of 0 which choose the z that is + * closest the displayed size; a zoom offset of -1 will use z - 1, giving + * tiles that are twice as big (lower resolution); a zoom offset of +1 + * will use z + 1, giving tiles that are twice as small (higher + * resolution). The latter might be appropriate for showing 256×256 tiles + * in a 128×128 space on a high-resolution screen. + */ + zoomDelta(): number; + zoomDelta(zoomDelta: number): this; + + /** + * If clamp is specified, sets tile.clampX and tile.clampY to the + * specified boolean clamp and returns this tile layout. If clamp is not + * specified, returns true if tile.clampX and tile.clampY are both true, + * and false otherwise. + */ + clamp(): boolean; + clamp(clamp: boolean): this; + + /** + * If clamp is specified, sets whether or not the visible tiles will be + * clamped in the x-coordinate and returns this tile layout. If clamp is + * not specified, returns the current x-clamp, which defaults to true. If + * the x-clamp is false, then the tile layout will return tiles that are + * outside the “world” tile [0, 0, 0], with x-coordinates that are outside + * the normal bounds 0 ≤ x < 2^z. See d3.tileWrap for converting these + * coordinates to wrapped in-world coordinates. + */ + clampX(): boolean; + clampX(clamp: boolean): this; + + /** + * If clamp is specified, sets whether or not the visible tiles will be + * clamped in the y-coordinate and returns this tile layout. If clamp is + * not specified, returns the current y-clamp, which defaults to true. If + * the y-clamp is false, then the tile layout will return tiles that are + * outside the “world” tile [0, 0, 0], with y-coordinates that are outside + * the normal bounds 0 ≤ y < 2^z. See d3.tileWrap for converting these + * coordinates to wrapped in-world coordinates. See also tile.clampX. + */ + clampY(): boolean; + clampY(clamp: boolean): this; + + /** + * If tileSize is specified, sets this tile layout’s tile width and height + * to the specified number tileSize and returns this tile layout. If + * tileSize is not specified, returns the current layout tile size, which + * defaults to 256. 256×256 is the most common tile size among tile + * providers. + */ + tileSize(): number; + tileSize(tileSize: number): this; + + /** + * If extent is specified, sets this tile layout’s viewport extent to the + * specified array [[x0, y0], [x1, y1]], where [x0, y0] is the top-left + * corner and [x1, y1] is the bottom-right corner, and returns this tile + * layout. If extent is not specified, returns the current viewport + * extent, which defaults to [[0, 0], [960, 500]]. Setting the viewport + * extent implicitly sets the viewport size. + */ + extent(): [[number, number], [number, number]]; + extent(extent: [[number, number], [number, number]]): this; + } + + /** + * Constructs a new tile layout with the default settings. + */ + function tile(): TileLayout; + + /** + * Given tile coordinates [x, y, z], where x and y may be outside the + * "world" tile [0, 0, 0], returns the wrapped tile coordinates [x′, y′, z] + * where j = 2 ^ z, x′ = x - ⌊x / j⌋ * j and y′ = y - ⌊y / j⌋ * j. This + * function is most commonly used in conjunction with tile.clampX to allow + * horizontal wrapping of web Mercator tiles. + */ + function tileWrap(tile: [number, number, number]): [number, number, number]; +} diff --git a/types/d3-tile/package.json b/types/d3-tile/package.json new file mode 100644 index 00000000000000..e7dd07fb75cda2 --- /dev/null +++ b/types/d3-tile/package.json @@ -0,0 +1,20 @@ +{ + "private": true, + "name": "@types/d3-tile", + "version": "1.0.9999", + "projects": [ + "https://github.com/d3/d3-tile" + ], + "dependencies": { + "@types/d3": "*" + }, + "devDependencies": { + "@types/d3-tile": "workspace:." + }, + "owners": [ + { + "name": "Mouad Naciri", + "githubUsername": "NaciriMouad" + } + ] +} diff --git a/types/d3-tile/tsconfig.json b/types/d3-tile/tsconfig.json new file mode 100644 index 00000000000000..561596c48f3d43 --- /dev/null +++ b/types/d3-tile/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "node16", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "d3-tile-tests.ts" + ] +} diff --git a/types/primer__octicons/index.d.ts b/types/primer__octicons/index.d.ts index 1cf15f89be3cdc..aafeea25095790 100644 --- a/types/primer__octicons/index.d.ts +++ b/types/primer__octicons/index.d.ts @@ -87,6 +87,7 @@ declare namespace octicons { type IconName = | "accessibility" | "accessibility-inset" + | "agent" | "ai-model" | "alert" | "alert-fill" @@ -111,8 +112,11 @@ declare namespace octicons { | "book" | "bookmark" | "bookmark-fill" + | "bookmark-filled" | "bookmark-slash" | "bookmark-slash-fill" + | "boolean-off" + | "boolean-on" | "briefcase" | "broadcast" | "browser" @@ -123,6 +127,7 @@ declare namespace octicons { | "check-circle" | "check-circle-fill" | "checkbox" + | "checkbox-fill" | "checklist" | "chevron-down" | "chevron-left" @@ -144,7 +149,9 @@ declare namespace octicons { | "columns" | "command-palette" | "comment" + | "comment-ai" | "comment-discussion" + | "compose" | "container" | "copilot" | "copilot-error" @@ -153,6 +160,7 @@ declare namespace octicons { | "cpu" | "credit-card" | "cross-reference" + | "crosshairs" | "dash" | "database" | "dependabot" @@ -163,6 +171,7 @@ declare namespace octicons { | "device-mobile" | "devices" | "diamond" + | "dice" | "diff" | "diff-added" | "diff-ignored" @@ -177,6 +186,7 @@ declare namespace octicons { | "download" | "duplicate" | "ellipsis" + | "exclamation" | "eye" | "eye-closed" | "feed-discussion" @@ -202,6 +212,7 @@ declare namespace octicons { | "file-added" | "file-badge" | "file-binary" + | "file-check" | "file-code" | "file-diff" | "file-directory" @@ -218,12 +229,15 @@ declare namespace octicons { | "filter-remove" | "fiscal-host" | "flame" + | "flowchart" + | "focus-center" | "fold" | "fold-down" | "fold-up" | "gear" | "gift" | "git-branch" + | "git-branch-check" | "git-commit" | "git-compare" | "git-merge" @@ -235,6 +249,8 @@ declare namespace octicons { | "goal" | "grabber" | "graph" + | "graph-bar-horizontal" + | "graph-bar-vertical" | "hash" | "heading" | "heart" @@ -248,14 +264,15 @@ declare namespace octicons { | "id-badge" | "image" | "inbox" + | "inbox-fill" | "infinity" | "info" | "issue-closed" | "issue-draft" | "issue-opened" | "issue-reopened" - | "issue-tracks" | "issue-tracked-by" + | "issue-tracks" | "italic" | "iterations" | "kebab-horizontal" @@ -272,13 +289,17 @@ declare namespace octicons { | "log" | "logo-gist" | "logo-github" + | "loop" | "mail" | "mark-github" | "markdown" + | "maximize" + | "mcp" | "megaphone" | "mention" | "meter" | "milestone" + | "minimize" | "mirror" | "moon" | "mortar-board" @@ -289,6 +310,8 @@ declare namespace octicons { | "multi-select" | "mute" | "no-entry" + | "no-entry-fill" + | "node" | "north-star" | "note" | "number" @@ -301,7 +324,9 @@ declare namespace octicons { | "paperclip" | "passkey-fill" | "paste" + | "pause" | "pencil" + | "pencil-ai" | "people" | "person" | "person-add" @@ -358,11 +383,23 @@ declare namespace octicons { | "skip-fill" | "sliders" | "smiley" + | "smiley-frown" + | "smiley-frustrated" + | "smiley-grin" + | "smiley-neutral" | "sort-asc" | "sort-desc" + | "space" + | "spacing-large" + | "spacing-medium" + | "spacing-small" + | "sparkle" | "sparkle-fill" + | "sparkles-fill" + | "split-view" | "sponsor-tiers" | "square" + | "square-circle" | "square-fill" | "squirrel" | "stack" @@ -401,12 +438,15 @@ declare namespace octicons { | "unmute" | "unread" | "unverified" + | "unwrap" | "upload" | "verified" | "versions" | "video" + | "vscode" | "webhook" | "workflow" + | "wrap" | "x" | "x-circle" | "x-circle-fill" diff --git a/types/primer__octicons/package.json b/types/primer__octicons/package.json index 2d0701b1317556..55aa5c41252c10 100644 --- a/types/primer__octicons/package.json +++ b/types/primer__octicons/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/primer__octicons", - "version": "19.11.9999", + "version": "19.21.9999", "projects": [ "https://github.com/primer/octicons" ], diff --git a/types/prismjs/dependencies.d.ts b/types/prismjs/dependencies.d.ts new file mode 100644 index 00000000000000..1c150b0616eb61 --- /dev/null +++ b/types/prismjs/dependencies.d.ts @@ -0,0 +1,35 @@ +export interface ComponentEntry { + title?: string; + owner?: string; + noCSS?: boolean; + alias?: string | readonly string[]; + aliasTitles?: Readonly>; + + optional?: string | readonly string[]; + require?: string | readonly string[]; + modify?: string | readonly string[]; +} + +export type ComponentCategory = Record>; + +export type Components = Record>; + +export interface LoadChainer { + series: (before: T, after: () => T) => T; + parallel: (values: readonly T[]) => T; +} + +export type LoadFunction = (loadComponent: (id: string) => T, chainer?: Readonly>) => T; + +export interface Loader { + getIds: () => string[]; + load: LoadFunction; +} + +function getLoader( + components: Readonly, + load: readonly string[], + loaded?: readonly string[], +): Loader; + +export = getLoader; diff --git a/types/serviceworker-webpack-plugin/tsconfig.json b/types/serviceworker-webpack-plugin/tsconfig.json index 800bade5ae5c20..af11649ac15095 100644 --- a/types/serviceworker-webpack-plugin/tsconfig.json +++ b/types/serviceworker-webpack-plugin/tsconfig.json @@ -2,8 +2,8 @@ "compilerOptions": { "module": "node16", "lib": [ - "dom", - "es6" + "es6", + "webworker" ], "noImplicitAny": true, "noImplicitThis": true,