Skip to content
Merged
19 changes: 16 additions & 3 deletions types/chrome/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7878,16 +7878,29 @@ declare namespace chrome.scripting {
/* The JavaScript world for a script to execute within. */
export type ExecutionWorld = "ISOLATED" | "MAIN";

export interface InjectionResult<T> {
/* The frame associated with the injection. */
export interface InjectionResult<T extends any = any> {
/**
* The document associated with the injection.
* @since Chrome 106.
*/
documentId: string;
/**
* The frame associated with the injection.
* @since Chrome 90.
*/
frameId: number;
/* The result of the script execution. */
result: T;
result?: T | undefined;
}

export interface InjectionTarget {
/* Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if frameIds is specified. */
allFrames?: boolean | undefined;
/**
* The IDs of specific documentIds to inject into. This must not be set if frameIds is set.
* @since Chrome 106.
*/
documentIds?: string[] | undefined;
/* The IDs of specific frames to inject into. */
frameIds?: number[] | undefined;
/* The ID of the tab into which to inject. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ declare namespace GoogleAppsScript {
*/
enum OnClose {
NOTHING,
RELOAD,
RELOAD_ADD_ON,
}
/**
Expand Down
9 changes: 9 additions & 0 deletions types/google-apps-script/test/google-apps-script-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,15 @@ CardService.newTimePicker().setTitle(""); // $ExpectType TimePicker
CardService.DisplayStyle.PEEK;
CardService.DisplayStyle.REPLACE;

CardService.OnClose.NOTHING;
CardService.OnClose.RELOAD;
CardService.OnClose.RELOAD_ADD_ON;

CardService.newOpenLink(); // $ExpectType OpenLink
CardService.newOpenLink().setOnClose(CardService.OnClose.NOTHING); // $ExpectType OpenLink
CardService.newOpenLink().setOnClose(CardService.OnClose.RELOAD); // $ExpectType OpenLink
CardService.newOpenLink().setOnClose(CardService.OnClose.RELOAD_ADD_ON); // $ExpectType OpenLink

DriveApp.createShortcut("").getTargetId();
DriveApp.createFile("", "").moveTo(DriveApp.getFolderById(""));

Expand Down
12 changes: 10 additions & 2 deletions types/google-publisher-tag/google-publisher-tag-tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Tests for Google Publisher Tag 1.20231211
// Synced from: https://github.com/googleads/google-publisher-tag-types/commit/e9b791a4a49d911e5e04660c08dcd2039978813c
// Tests for Google Publisher Tag 1.20240122
// Synced from: https://github.com/googleads/google-publisher-tag-types/commit/7c4703abbdfb54ccce8c8fd245b5e4f3ad68d0d8

// Test for googletag.cmd
function test_googletag_cmd() {
Expand Down Expand Up @@ -629,6 +629,14 @@ function test_googletag_slot_updateTargetingFromMap() {
});
}

// Test for googletag.config.AdExpansionConfig
function test_googletag_config_adExpansionConfig() {
// Enable ad slot expansion across the entire page.
googletag.setConfig({
adExpansion: { enabled: true },
});
}

// Test for googletag.config.PrivacyTreatmentsConfig.treatments
function test_googletag_config_privacyTreatmentsConfig_treatments() {
// Disable personalization across the entire page.
Expand Down
99 changes: 63 additions & 36 deletions types/google-publisher-tag/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1682,50 +1682,31 @@ declare namespace googletag {
type SizeMappingArray = SizeMapping[];

/**
* This is the namespace that GPT uses for enum types.
* Main configuration interface for page-level settings.
*/
namespace enums {
/**
* Out-of-page formats supported by GPT.
*
* @see {@link defineOutOfPageSlot}
*/
enum OutOfPageFormat {
/** Anchor format where slot sticks to the top of the viewport. */
TOP_ANCHOR,
/** Anchor format where slot sticks to the bottom of the viewport. */
BOTTOM_ANCHOR,
/** Web interstitial creative format. */
INTERSTITIAL,
/** Rewarded format. */
REWARDED,
/** Left side rail format. */
LEFT_SIDE_RAIL,
/** Right side rail format. */
RIGHT_SIDE_RAIL,
}

namespace config {
/**
* [Traffic sources](https://support.google.com/admanager/answer/11233407)
* supported by GPT.
* Settings to control ad expansion.
*
* @see {@link PrivacySettingsConfig.trafficSource}
* @example
* // Enable ad slot expansion across the entire page.
* googletag.setConfig({
* adExpansion: {enabled: true}
* });
*/
enum TrafficSource {
interface AdExpansionConfig {
/**
* Traffic redirected from properties other than owned (acquired or otherwise
* incentivized activity).
* Whether ad expansion is enabled or disabled.
*
* Setting this value overrides the default configured in
* Google Ad Manager.
*
* @see [Expand ads on desktop and tablet](https://support.google.com/admanager/answer/9384852)
* @see [Expand ads on mobile web (partial screen)](https://support.google.com/admanager/answer/9117822)
*/
PURCHASED,
/** Direct URL entry, site search, or app download. */
ORGANIC,
enabled?: boolean;
}
}

/**
* Main configuration interface for page-level settings.
*/
namespace config {
/**
* Main configuration interface for page-level settings.
*
Expand Down Expand Up @@ -1789,6 +1770,11 @@ declare namespace googletag {
* Settings to control publisher privacy treatments.
*/
privacyTreatments?: PrivacyTreatmentsConfig | null;

/**
* Settings to control ad expansion.
*/
adExpansion?: AdExpansionConfig | null;
}

/**
Expand Down Expand Up @@ -1940,6 +1926,47 @@ declare namespace googletag {
type InterstitialTrigger = "unhideWindow";
}

/**
* This is the namespace that GPT uses for enum types.
*/
namespace enums {
/**
* Out-of-page formats supported by GPT.
*
* @see {@link defineOutOfPageSlot}
*/
enum OutOfPageFormat {
/** Anchor format where slot sticks to the top of the viewport. */
TOP_ANCHOR,
/** Anchor format where slot sticks to the bottom of the viewport. */
BOTTOM_ANCHOR,
/** Web interstitial creative format. */
INTERSTITIAL,
/** Rewarded format. */
REWARDED,
/** Left side rail format. */
LEFT_SIDE_RAIL,
/** Right side rail format. */
RIGHT_SIDE_RAIL,
}

/**
* [Traffic sources](https://support.google.com/admanager/answer/11233407)
* supported by GPT.
*
* @see {@link PrivacySettingsConfig.trafficSource}
*/
enum TrafficSource {
/**
* Traffic redirected from properties other than owned (acquired or otherwise
* incentivized activity).
*/
PURCHASED,
/** Direct URL entry, site search, or app download. */
ORGANIC,
}
}

/**
* This is the namespace that GPT uses for managing secure signals.
*/
Expand Down
2 changes: 1 addition & 1 deletion types/google-publisher-tag/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/google-publisher-tag",
"version": "1.20231211.9999",
"version": "1.20240122.9999",
"nonNpm": true,
"nonNpmDescription": "Google Publisher Tag",
"projects": [
Expand Down
5 changes: 5 additions & 0 deletions types/mapboxgl-spiderifier/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
73 changes: 73 additions & 0 deletions types/mapboxgl-spiderifier/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// https://github.com/bewithjonam/mapboxgl-spiderifier
import { LngLat, Map, MapboxGeoJSONFeature, Marker } from "mapbox-gl";

export function popupOffsetForSpiderLeg(spiderLeg: SpiderLeg, offset?: number): SpiderLegOffsets;

export interface SpiderLegOffsets {
top: SpiderLegOffset;
"top-left": SpiderlegOffset;
"top-right": SpiderlegOffset;
bottom: SpiderlegOffset;
"bottom-left": SpiderlegOffset;
"bottom-right": SpiderlegOffset;
left: SpiderlegOffset;
right: SpiderlegOffset;
}
export type SpiderLegOffset = [number, number];

class MapboxglSpiderifier {
constructor(map: Map, options: Options);

each: (spiderLeg: SpiderLeg) => void;
spiderfy: (latLng: LngLat | [number, number], features: Array<Record<string, unknown>>) => void;
unspiderfy: () => void;
}

export interface Options {
/** Default: false */
animate?: boolean;
/**
* Number in milliseconds
* Default 200 */
animationSpeed?: number;
/**
* number of markers till which the spider will be circular and beyond this threshold,
* it will spider in spiral.
* Default: 9
*/
circleSpiralSwitchover?: number;
customPin?: boolean;
initializeLeg?: (spiderLeg: SpiderLeg) => void;
onClick?: (event: MouseEvent, spiderLeg: SpiderLeg) => void;
// --- <SPIDER TUNING Params>
// circleSpiralSwitchover: show spiral instead of circle from this marker count upwards
// 0 -> always spiral; Infinity -> always circle
circleSpiralSwitchover?: number; // Default: 9,
circleFootSeparation?: number; // Default: 25, // related to circumference of circle
spiralFootSeparation?: number; // Default: 28, // related to size of spiral (experiment!)
spiralLengthStart?: number; // Default: 15, // ditto
spiralLengthFactor?: number; // Default: 4, // ditto
}
export default MapboxglSpiderifier;

export interface SpiderLeg {
feature: MapboxGeoJSONFeature;
elements: {
container: HTMLElement;
line: HTMLElement;
pin: HTMLElement;
};
mapboxMarker: Marker;
params: {
/** horizontal offset of pin from the center of spider */
x: number;
/** vertical offset of pin from the center of spider */
y: number;
/** angle of line from the center of spider */
angle: number;
/** leg line length */
legLength: number;
/** index of spider leg */
index: number;
};
}
59 changes: 59 additions & 0 deletions types/mapboxgl-spiderifier/mapboxgl-spiderifier.tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import MapboxglSpiderifier, {
Options,
popupOffsetForSpiderLeg,
SpiderLeg,
SpiderLegOffsets
} from "mapboxgl-spiderifier";


export const getInitializeSpiderLeg =
(map: Map): Options["initializeLeg"] =>
(spiderLeg: SpiderLeg): void => {
let popup: Popup;
const pinElem = spiderLeg.elements.pin;
const properties = spiderLeg.feature.properties;

pinElem.innerHTML = properties?.title.replace(/[^\w\s\d.]/i, " ") || "?";
)
;
if (properties?.isSelected === "1") {
pinElem.classList.add("spider-leg-pin--isSelected");
}

pinElem.addEventListener("click", (ev) => {
ev.preventDefault();
});

pinElem.addEventListener("mouseenter", () => {
const offset = popupOffsetForSpiderLeg(spiderLeg, avatarWidth / 2);
popup = new Popup({
closeButton: false,
offset,
}).setText(properties?.title);
spiderLeg.mapboxMarker.setPopup(popup);
popup.addTo(map);
});

pinElem.addEventListener("mouseleave", () => {
popup.remove();
});
};

// $ExpectType MapboxglSpiderifier
const spiderfier = new MapboxglSpiderifier(map, {
animate: true,
animationSpeed: 200,
onClick: (e, marker) => {
console.info(e, marker.feature);
},
customPin: true,
initializeLeg: getInitializeSpiderLeg(map),
circleFootSeparation: 50,
});

// $ExpectType void
const unspiderfyResult = spiderfier.unspiderfy();


// $ExpectType SpiderLegOffsets
const offset = popupOffsetForSpiderLeg(spiderLeg, 20);
21 changes: 21 additions & 0 deletions types/mapboxgl-spiderifier/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"private": true,
"name": "@types/mapboxgl-spiderifier",
"version": "1.0.9999",
"projects": [
"https://github.com/bewithjonam/mapboxgl-spiderifier"
],
"devDependencies": {
"@types/mapboxgl-spiderifier": "workspace:."
},
"owners": [
{
"name": "manoj kumar",
"githubUsername": "bewithjonam"
},
{
"name": "Lance Gliser",
"githubUsername": "lancegliser"
}
]
}
19 changes: 19 additions & 0 deletions types/mapboxgl-spiderifier/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts"
]
}
Loading