hunk
dict
file
stringlengths
0
11.8M
file_path
stringlengths
2
234
label
int64
0
1
commit_url
stringlengths
74
103
dependency_score
sequencelengths
5
5
{ "id": 0, "code_window": [ " }\n", "\n", " onEntryFinished(entry: har.Entry) {\n", " const event: trace.ResourceSnapshotTraceEvent = { type: 'resource-snapshot', snapshot: entry };\n", " this._appendTraceOperation(async () => {\n", " visitSha1s(event, this._state!.networkSha1s);\n", " await fs.promises.appendFile(this._state!.networkFile, JSON.stringify(event) + '\\n');\n", " });\n", " }\n", "\n", " onContentBlob(sha1: string, buffer: Buffer) {\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " const visited = visitTraceEvent(event, this._state!.networkSha1s);\n", " await fs.promises.appendFile(this._state!.networkFile, JSON.stringify(visited) + '\\n');\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 369 }
/** * Copyright 2018 Google Inc. All rights reserved. * Modifications copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { test as it, expect } from './pageTest'; it('should work', async ({ page }) => { const windowHandle = await page.evaluateHandle(() => window); expect(windowHandle).toBeTruthy(); }); it('should accept object handle as an argument', async ({ page }) => { const navigatorHandle = await page.evaluateHandle(() => navigator); const text = await page.evaluate(e => e.userAgent, navigatorHandle); expect(text).toContain('Mozilla'); }); it('should accept object handle to primitive types', async ({ page }) => { const aHandle = await page.evaluateHandle(() => 5); const isFive = await page.evaluate(e => Object.is(e, 5), aHandle); expect(isFive).toBeTruthy(); }); it('should accept nested handle', async ({ page }) => { const foo = await page.evaluateHandle(() => ({ x: 1, y: 'foo' })); const result = await page.evaluate(({ foo }) => { return foo; }, { foo }); expect(result).toEqual({ x: 1, y: 'foo' }); }); it('should accept nested window handle', async ({ page }) => { const foo = await page.evaluateHandle(() => window); const result = await page.evaluate(({ foo }) => { return foo === window; }, { foo }); expect(result).toBe(true); }); it('should accept multiple nested handles', async ({ page }) => { const foo = await page.evaluateHandle(() => ({ x: 1, y: 'foo' })); const bar = await page.evaluateHandle(() => 5); const baz = await page.evaluateHandle(() => (['baz'])); const result = await page.evaluate(x => { return JSON.stringify(x); }, { a1: { foo }, a2: { bar, arr: [{ baz }] } }); expect(JSON.parse(result)).toEqual({ a1: { foo: { x: 1, y: 'foo' } }, a2: { bar: 5, arr: [{ baz: ['baz'] }] } }); }); it('should accept same handle multiple times', async ({ page }) => { const foo = await page.evaluateHandle(() => 1); expect(await page.evaluate(x => x, { foo, bar: [foo], baz: { foo } })).toEqual({ foo: 1, bar: [1], baz: { foo: 1 } }); }); it('should accept same nested object multiple times', async ({ page }) => { const foo = { x: 1 }; expect(await page.evaluate(x => x, { foo, bar: [foo], baz: { foo } })).toEqual({ foo: { x: 1 }, bar: [{ x: 1 }], baz: { foo: { x: 1 } } }); }); it('should accept object handle to unserializable value', async ({ page }) => { const aHandle = await page.evaluateHandle(() => Infinity); expect(await page.evaluate(e => Object.is(e, Infinity), aHandle)).toBe(true); }); it('should pass configurable args', async ({ page }) => { const result = await page.evaluate(arg => { if (arg.foo !== 42) throw new Error('Not a 42'); arg.foo = 17; if (arg.foo !== 17) throw new Error('Not 17'); delete arg.foo; if (arg.foo === 17) throw new Error('Still 17'); return arg; }, { foo: 42 }); expect(result).toEqual({}); }); it('should work with primitives', async ({ page }) => { const aHandle = await page.evaluateHandle(() => { window['FOO'] = 123; return window; }); expect(await page.evaluate(e => e['FOO'], aHandle)).toBe(123); });
tests/page/page-evaluate-handle.spec.ts
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.00017609733913559467, 0.00017285614740103483, 0.0001707936025923118, 0.00017300501349382102, 0.0000014689469480799744 ]
{ "id": 0, "code_window": [ " }\n", "\n", " onEntryFinished(entry: har.Entry) {\n", " const event: trace.ResourceSnapshotTraceEvent = { type: 'resource-snapshot', snapshot: entry };\n", " this._appendTraceOperation(async () => {\n", " visitSha1s(event, this._state!.networkSha1s);\n", " await fs.promises.appendFile(this._state!.networkFile, JSON.stringify(event) + '\\n');\n", " });\n", " }\n", "\n", " onContentBlob(sha1: string, buffer: Buffer) {\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " const visited = visitTraceEvent(event, this._state!.networkSha1s);\n", " await fs.promises.appendFile(this._state!.networkFile, JSON.stringify(visited) + '\\n');\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 369 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { PlaywrightTestConfig } from '@playwright/experimental-ct-svelte'; import { devices } from '@playwright/test'; const config: PlaywrightTestConfig = { testDir: 'src', forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, reporter: 'html', use: { trace: 'on-first-retry', }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'] }, }, { name: 'firefox', use: { ...devices['Desktop Firefox'] }, }, { name: 'webkit', use: { ...devices['Desktop Safari'] }, }, ], }; export default config;
tests/components/ct-svelte/playwright.config.ts
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.0001775087002897635, 0.0001746027555782348, 0.0001704334281384945, 0.00017487134027760476, 0.0000023417560441885144 ]
{ "id": 1, "code_window": [ "\n", " private _appendTraceEvent(event: trace.TraceEvent) {\n", " this._appendTraceOperation(async () => {\n", " visitSha1s(event, this._state!.traceSha1s);\n", " await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(event) + '\\n');\n", " });\n", " }\n", "\n" ], "labels": [ "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep" ], "after_edit": [ " const visited = visitTraceEvent(event, this._state!.traceSha1s);\n", " await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(visited) + '\\n');\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 410 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { EventEmitter } from 'events'; import fs from 'fs'; import os from 'os'; import path from 'path'; import type { NameValue } from '../../../common/types'; import type { TracingTracingStopChunkParams } from '@protocol/channels'; import { commandsWithTracingSnapshots } from '../../../protocol/debug'; import { ManualPromise } from '../../../utils/manualPromise'; import type { RegisteredListener } from '../../../utils/eventsHelper'; import { eventsHelper } from '../../../utils/eventsHelper'; import { assert, calculateSha1, createGuid, monotonicTime } from '../../../utils'; import { mkdirIfNeeded, removeFolders } from '../../../utils/fileUtils'; import { Artifact } from '../../artifact'; import { BrowserContext } from '../../browserContext'; import { ElementHandle } from '../../dom'; import type { APIRequestContext } from '../../fetch'; import type { CallMetadata, InstrumentationListener } from '../../instrumentation'; import { SdkObject } from '../../instrumentation'; import { Page } from '../../page'; import type * as har from '@trace/har'; import type { HarTracerDelegate } from '../../har/harTracer'; import { HarTracer } from '../../har/harTracer'; import type { FrameSnapshot } from '@trace/snapshot'; import type * as trace from '@trace/trace'; import type { VERSION } from '@trace/trace'; import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter'; import { Snapshotter } from './snapshotter'; import { yazl } from '../../../zipBundle'; const version: VERSION = 3; export type TracerOptions = { name?: string; snapshots?: boolean; screenshots?: boolean; sources?: boolean; }; type RecordingState = { options: TracerOptions, traceName: string, networkFile: string, traceFile: string, tracesDir: string, resourcesDir: string, filesCount: number, networkSha1s: Set<string>, traceSha1s: Set<string>, sources: Set<string>, recording: boolean; }; const kScreencastOptions = { width: 800, height: 600, quality: 90 }; export class Tracing extends SdkObject implements InstrumentationListener, SnapshotterDelegate, HarTracerDelegate { private _writeChain = Promise.resolve(); private _snapshotter?: Snapshotter; private _harTracer: HarTracer; private _screencastListeners: RegisteredListener[] = []; private _pendingCalls = new Map<string, { sdkObject: SdkObject, metadata: CallMetadata, beforeSnapshot: Promise<void>, actionSnapshot?: Promise<void>, afterSnapshot?: Promise<void> }>(); private _context: BrowserContext | APIRequestContext; private _state: RecordingState | undefined; private _isStopping = false; private _precreatedTracesDir: string | undefined; private _tracesTmpDir: string | undefined; private _allResources = new Set<string>(); private _contextCreatedEvent: trace.ContextCreatedTraceEvent; constructor(context: BrowserContext | APIRequestContext, tracesDir: string | undefined) { super(context, 'tracing'); this._context = context; this._precreatedTracesDir = tracesDir; this._harTracer = new HarTracer(context, null, this, { content: 'attach', includeTraceInfo: true, recordRequestOverrides: false, waitForContentOnStop: false, skipScripts: true, }); this._contextCreatedEvent = { version, type: 'context-options', browserName: '', options: {}, platform: process.platform, wallTime: 0, }; if (context instanceof BrowserContext) { this._snapshotter = new Snapshotter(context, this); assert(tracesDir, 'tracesDir must be specified for BrowserContext'); this._contextCreatedEvent.browserName = context._browser.options.name; this._contextCreatedEvent.options = context._options; } } async start(options: TracerOptions) { if (this._isStopping) throw new Error('Cannot start tracing while stopping'); if (this._state) { const o = this._state.options; if (o.name !== options.name || !o.screenshots !== !options.screenshots || !o.snapshots !== !options.snapshots) throw new Error('Tracing has been already started with different options'); return; } // TODO: passing the same name for two contexts makes them write into a single file // and conflict. const traceName = options.name || createGuid(); // Init the state synchrounously. this._state = { options, traceName, traceFile: '', networkFile: '', tracesDir: '', resourcesDir: '', filesCount: 0, traceSha1s: new Set(), networkSha1s: new Set(), sources: new Set(), recording: false }; const state = this._state; state.tracesDir = await this._createTracesDirIfNeeded(); state.resourcesDir = path.join(state.tracesDir, 'resources'); state.traceFile = path.join(state.tracesDir, traceName + '.trace'); state.networkFile = path.join(state.tracesDir, traceName + '.network'); this._writeChain = fs.promises.mkdir(state.resourcesDir, { recursive: true }).then(() => fs.promises.writeFile(state.networkFile, '')); if (options.snapshots) this._harTracer.start(); } async startChunk(options: { title?: string } = {}) { if (this._state && this._state.recording) await this.stopChunk({ mode: 'doNotSave' }); if (!this._state) throw new Error('Must start tracing before starting a new chunk'); if (this._isStopping) throw new Error('Cannot start a trace chunk while stopping'); const state = this._state; const suffix = state.filesCount ? `-${state.filesCount}` : ``; state.filesCount++; state.traceFile = path.join(state.tracesDir, `${state.traceName}${suffix}.trace`); state.recording = true; this._appendTraceOperation(async () => { await mkdirIfNeeded(state.traceFile); await fs.promises.appendFile(state.traceFile, JSON.stringify({ ...this._contextCreatedEvent, title: options.title, wallTime: Date.now() }) + '\n'); }); this._context.instrumentation.addListener(this, this._context); if (state.options.screenshots) this._startScreencast(); if (state.options.snapshots) await this._snapshotter?.start(); } private _startScreencast() { if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) this._startScreencastInPage(page); this._screencastListeners.push( eventsHelper.addEventListener(this._context, BrowserContext.Events.Page, this._startScreencastInPage.bind(this)), ); } private _stopScreencast() { eventsHelper.removeEventListeners(this._screencastListeners); if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) page.setScreencastOptions(null); } async stop() { if (!this._state) return; if (this._isStopping) throw new Error(`Tracing is already stopping`); if (this._state.recording) throw new Error(`Must stop trace file before stopping tracing`); this._harTracer.stop(); await this._writeChain; this._state = undefined; } async deleteTmpTracesDir() { if (this._tracesTmpDir) await removeFolders([this._tracesTmpDir]); } private async _createTracesDirIfNeeded() { if (this._precreatedTracesDir) return this._precreatedTracesDir; this._tracesTmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'playwright-tracing-')); return this._tracesTmpDir; } async dispose() { this._snapshotter?.dispose(); this._harTracer.stop(); await this._writeChain; } async stopChunk(params: TracingTracingStopChunkParams): Promise<{ artifact: Artifact | null, sourceEntries: NameValue[] | undefined }> { if (this._isStopping) throw new Error(`Tracing is already stopping`); this._isStopping = true; if (!this._state || !this._state.recording) { this._isStopping = false; if (params.mode !== 'doNotSave') throw new Error(`Must start tracing before stopping`); return { artifact: null, sourceEntries: [] }; } const state = this._state!; this._context.instrumentation.removeListener(this); if (this._state?.options.screenshots) this._stopScreencast(); for (const { sdkObject, metadata, beforeSnapshot, actionSnapshot, afterSnapshot } of this._pendingCalls.values()) { await Promise.all([beforeSnapshot, actionSnapshot, afterSnapshot]); let callMetadata = metadata; if (!afterSnapshot) { // Note: we should not modify metadata here to avoid side-effects in any other place. callMetadata = { ...metadata, error: { error: { name: 'Error', message: 'Action was interrupted' } }, }; } await this.onAfterCall(sdkObject, callMetadata); } if (state.options.snapshots) await this._snapshotter?.stop(); // Chain the export operation against write operations, // so that neither trace files nor sha1s change during the export. return await this._appendTraceOperation(async () => { if (params.mode === 'doNotSave') return { artifact: null, sourceEntries: undefined }; // Har files a live, make a snapshot before returning the resulting entries. const networkFile = path.join(state.networkFile, '..', createGuid()); await fs.promises.copyFile(state.networkFile, networkFile); const entries: NameValue[] = []; entries.push({ name: 'trace.trace', value: state.traceFile }); entries.push({ name: 'trace.network', value: networkFile }); for (const sha1 of new Set([...state.traceSha1s, ...state.networkSha1s])) entries.push({ name: path.join('resources', sha1), value: path.join(state.resourcesDir, sha1) }); let sourceEntries: NameValue[] | undefined; if (state.sources.size) { sourceEntries = []; for (const value of state.sources) { const entry = { name: 'resources/src@' + calculateSha1(value) + '.txt', value }; if (params.mode === 'compressTraceAndSources') { if (fs.existsSync(entry.value)) entries.push(entry); } else { sourceEntries.push(entry); } } } const artifact = await this._exportZip(entries, state).catch(() => null); return { artifact, sourceEntries }; }).finally(() => { // Only reset trace sha1s, network resources are preserved between chunks. state.traceSha1s = new Set(); state.sources = new Set(); this._isStopping = false; state.recording = false; }) || { artifact: null, sourceEntries: undefined }; } private async _exportZip(entries: NameValue[], state: RecordingState): Promise<Artifact | null> { const zipFile = new yazl.ZipFile(); const result = new ManualPromise<Artifact | null>(); (zipFile as any as EventEmitter).on('error', error => result.reject(error)); for (const entry of entries) zipFile.addFile(entry.value, entry.name); zipFile.end(); const zipFileName = state.traceFile + '.zip'; zipFile.outputStream.pipe(fs.createWriteStream(zipFileName)).on('close', () => { const artifact = new Artifact(this._context, zipFileName); artifact.reportFinished(); result.resolve(artifact); }); return result; } async _captureSnapshot(name: 'before' | 'after' | 'action' | 'event', sdkObject: SdkObject, metadata: CallMetadata, element?: ElementHandle) { if (!this._snapshotter) return; if (!sdkObject.attribution.page) return; if (!this._snapshotter.started()) return; if (!shouldCaptureSnapshot(metadata)) return; const snapshotName = `${name}@${metadata.id}`; metadata.snapshots.push({ title: name, snapshotName }); // We have |element| for input actions (page.click and handle.click) // and |sdkObject| element for accessors like handle.textContent. if (!element && sdkObject instanceof ElementHandle) element = sdkObject; await this._snapshotter.captureSnapshot(sdkObject.attribution.page, snapshotName, element).catch(() => {}); } async onBeforeCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); // Set afterSnapshot name for all the actions that operate selectors. // Elements resolved from selectors will be marked on the snapshot. metadata.afterSnapshot = `after@${metadata.id}`; const beforeSnapshot = this._captureSnapshot('before', sdkObject, metadata); this._pendingCalls.set(metadata.id, { sdkObject, metadata, beforeSnapshot }); if (this._state?.options.sources) { for (const frame of metadata.stack || []) this._state.sources.add(frame.file); } await beforeSnapshot; } async onBeforeInputAction(sdkObject: SdkObject, metadata: CallMetadata, element: ElementHandle) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const actionSnapshot = this._captureSnapshot('action', sdkObject, metadata, element); this._pendingCalls.get(metadata.id)!.actionSnapshot = actionSnapshot; await actionSnapshot; } async onAfterCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const pendingCall = this._pendingCalls.get(metadata.id); if (!pendingCall || pendingCall.afterSnapshot) return; if (!sdkObject.attribution.context) { this._pendingCalls.delete(metadata.id); return; } pendingCall.afterSnapshot = this._captureSnapshot('after', sdkObject, metadata); await pendingCall.afterSnapshot; const event: trace.ActionTraceEvent = { type: 'action', metadata }; this._appendTraceEvent(event); this._pendingCalls.delete(metadata.id); } onEvent(sdkObject: SdkObject, metadata: CallMetadata) { if (!sdkObject.attribution.context) return; const event: trace.ActionTraceEvent = { type: 'event', metadata }; this._appendTraceEvent(event); } onEntryStarted(entry: har.Entry) { } onEntryFinished(entry: har.Entry) { const event: trace.ResourceSnapshotTraceEvent = { type: 'resource-snapshot', snapshot: entry }; this._appendTraceOperation(async () => { visitSha1s(event, this._state!.networkSha1s); await fs.promises.appendFile(this._state!.networkFile, JSON.stringify(event) + '\n'); }); } onContentBlob(sha1: string, buffer: Buffer) { this._appendResource(sha1, buffer); } onSnapshotterBlob(blob: SnapshotterBlob): void { this._appendResource(blob.sha1, blob.buffer); } onFrameSnapshot(snapshot: FrameSnapshot): void { this._appendTraceEvent({ type: 'frame-snapshot', snapshot }); } private _startScreencastInPage(page: Page) { page.setScreencastOptions(kScreencastOptions); const prefix = page.guid; this._screencastListeners.push( eventsHelper.addEventListener(page, Page.Events.ScreencastFrame, params => { const suffix = params.timestamp || Date.now(); const sha1 = `${prefix}-${suffix}.jpeg`; const event: trace.ScreencastFrameTraceEvent = { type: 'screencast-frame', pageId: page.guid, sha1, width: params.width, height: params.height, timestamp: monotonicTime() }; // Make sure to write the screencast frame before adding a reference to it. this._appendResource(sha1, params.buffer); this._appendTraceEvent(event); }), ); } private _appendTraceEvent(event: trace.TraceEvent) { this._appendTraceOperation(async () => { visitSha1s(event, this._state!.traceSha1s); await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(event) + '\n'); }); } private _appendResource(sha1: string, buffer: Buffer) { if (this._allResources.has(sha1)) return; this._allResources.add(sha1); const resourcePath = path.join(this._state!.resourcesDir, sha1); this._appendTraceOperation(async () => { try { // Perhaps we've already written this resource? await fs.promises.access(resourcePath); } catch (e) { // If not, let's write! Note that async access is safe because we // never remove resources until the very end. await fs.promises.writeFile(resourcePath, buffer).catch(() => {}); } }); } private async _appendTraceOperation<T>(cb: () => Promise<T>): Promise<T | undefined> { // This method serializes all writes to the trace. let error: Error | undefined; let result: T | undefined; this._writeChain = this._writeChain.then(async () => { // This check is here because closing the browser removes the tracesDir and tracing // dies trying to archive. if (this._context instanceof BrowserContext && !this._context._browser.isConnected()) return; try { result = await cb(); } catch (e) { error = e; } }); await this._writeChain; if (error) throw error; return result; } } function visitSha1s(object: any, sha1s: Set<string>) { if (Array.isArray(object)) { object.forEach(o => visitSha1s(o, sha1s)); return; } if (typeof object === 'object') { for (const key in object) { if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) { const sha1 = object[key]; if (sha1) sha1s.add(sha1); } visitSha1s(object[key], sha1s); } return; } } export function shouldCaptureSnapshot(metadata: CallMetadata): boolean { return commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method); }
packages/playwright-core/src/server/trace/recorder/tracing.ts
1
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.9984586238861084, 0.11222998052835464, 0.0001660580892348662, 0.00030363636324182153, 0.29623687267303467 ]
{ "id": 1, "code_window": [ "\n", " private _appendTraceEvent(event: trace.TraceEvent) {\n", " this._appendTraceOperation(async () => {\n", " visitSha1s(event, this._state!.traceSha1s);\n", " await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(event) + '\\n');\n", " });\n", " }\n", "\n" ], "labels": [ "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep" ], "after_edit": [ " const visited = visitTraceEvent(event, this._state!.traceSha1s);\n", " await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(visited) + '\\n');\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 410 }
<root> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="metadata"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" /> </xsd:sequence> <xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> <xsd:complexType> <xsd:attribute name="alias" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" /> </xsd:complexType> </xsd:element> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>2.0</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> </root>
tests/webview2/webview2-app/Form1.resx
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.00017621053848415613, 0.0001745766930980608, 0.00017330650007352233, 0.00017463955737184733, 8.547922902835126e-7 ]
{ "id": 1, "code_window": [ "\n", " private _appendTraceEvent(event: trace.TraceEvent) {\n", " this._appendTraceOperation(async () => {\n", " visitSha1s(event, this._state!.traceSha1s);\n", " await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(event) + '\\n');\n", " });\n", " }\n", "\n" ], "labels": [ "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep" ], "after_edit": [ " const visited = visitTraceEvent(event, this._state!.traceSha1s);\n", " await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(visited) + '\\n');\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 410 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { register } from './registerSource.mjs'; export default components => { register(components); };
packages/playwright-ct-vue/register.mjs
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.00017918406229000539, 0.00017734103312250227, 0.0001758979633450508, 0.0001769410737324506, 0.0000013710306348002632 ]
{ "id": 1, "code_window": [ "\n", " private _appendTraceEvent(event: trace.TraceEvent) {\n", " this._appendTraceOperation(async () => {\n", " visitSha1s(event, this._state!.traceSha1s);\n", " await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(event) + '\\n');\n", " });\n", " }\n", "\n" ], "labels": [ "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep" ], "after_edit": [ " const visited = visitTraceEvent(event, this._state!.traceSha1s);\n", " await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(visited) + '\\n');\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 410 }
name: "tests 1" on: push: branches: - main - release-* pull_request: paths-ignore: - 'browser_patches/**' - 'docs/**' branches: - main - release-* concurrency: # For pull requests, cancel all currently-running jobs for this workflow # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true env: # Force terminal colors. @see https://www.npmjs.com/package/colors FORCE_COLOR: 1 FLAKINESS_CONNECTION_STRING: ${{ secrets.FLAKINESS_CONNECTION_STRING }} jobs: test_linux: name: ${{ matrix.os }} (${{ matrix.browser }} - Node.js ${{ matrix.node-version }}) strategy: fail-fast: false matrix: browser: [chromium, firefox, webkit] os: [ubuntu-22.04] node-version: [14] include: - os: ubuntu-22.04 node-version: 16 browser: chromium - os: ubuntu-22.04 node-version: 18 browser: chromium runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - run: npm i -g npm@8 - run: npm ci env: DEBUG: pw:install PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: npm run build - run: npx playwright install --with-deps ${{ matrix.browser }} chromium - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }} - run: node tests/config/checkCoverage.js ${{ matrix.browser }} - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() shell: bash - uses: actions/upload-artifact@v3 if: always() with: name: ${{ matrix.browser }}-${{ matrix.os }}-test-results path: test-results test_linux_chromium_tot: name: ${{ matrix.os }} (chromium tip-of-tree) strategy: fail-fast: false matrix: os: [ubuntu-20.04] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: 14 - run: npm i -g npm@8 - run: npm ci env: DEBUG: pw:install PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: npm run build - run: npx playwright install --with-deps chromium-tip-of-tree - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=chromium env: PWTEST_CHANNEL: chromium-tip-of-tree - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() shell: bash - uses: actions/upload-artifact@v3 if: always() with: name: ${{ matrix.browser }}-chromium-tip-of-tree-test-results path: test-results test_test_runner: name: Test Runner strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] node-version: [14] include: - os: ubuntu-latest node-version: 16 - os: ubuntu-latest node-version: 18 - os: windows-latest node-version: 16 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: ${{matrix.node-version}} - run: npm i -g npm@8 - run: npm ci env: DEBUG: pw:install - run: npm run build - run: npx playwright install --with-deps - run: npm run ttest if: matrix.os != 'ubuntu-latest' - run: xvfb-run npm run ttest if: matrix.os == 'ubuntu-latest' - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() shell: bash test_web_components: name: Web Components runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: # Component tests require Node.js 16+ (they require ESM via TS) node-version: 16 - run: npm i -g npm@8 - run: npm ci env: DEBUG: pw:install - run: npm run build - run: npx playwright install --with-deps - run: | ./utils/docker/build.sh --amd64 focal $PWTEST_DOCKER_BASE_IMAGE npx playwright docker build xvfb-run npm run test-html-reporter env: PLAYWRIGHT_DOCKER: 1 PWTEST_DOCKER_BASE_IMAGE: playwright:localbuild - run: xvfb-run npm run test-web if: always() test-package-installations: name: "Installation Test ${{ matrix.os }} (${{ matrix.node_version }})" runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: - ubuntu-latest - macos-latest - windows-latest node_version: - "^14.1.0" # pre 14.1, zip extraction was broken (https://github.com/microsoft/playwright/issues/1988) timeout-minutes: 30 steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node_version }} - run: npm i -g npm@8 - run: npm ci env: DEBUG: pw:install - run: npm run build - run: npx playwright install-deps - run: npm run itest if: matrix.os != 'ubuntu-latest' - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run itest if: matrix.os == 'ubuntu-latest' - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() shell: bash
.github/workflows/tests_primary.yml
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.00017859728541225195, 0.00017467352154199034, 0.00016375798441004008, 0.00017554627265781164, 0.0000036381416066433303 ]
{ "id": 2, "code_window": [ " }\n", "}\n", "\n", "function visitSha1s(object: any, sha1s: Set<string>) {\n", " if (Array.isArray(object)) {\n", " object.forEach(o => visitSha1s(o, sha1s));\n", " return;\n", " }\n", " if (typeof object === 'object') {\n" ], "labels": [ "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep" ], "after_edit": [ "function visitTraceEvent(object: any, sha1s: Set<string>): any {\n", " if (Array.isArray(object))\n", " return object.map(o => visitTraceEvent(o, sha1s));\n", " if (object instanceof Buffer)\n", " return undefined;\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 454 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { EventEmitter } from 'events'; import fs from 'fs'; import os from 'os'; import path from 'path'; import type { NameValue } from '../../../common/types'; import type { TracingTracingStopChunkParams } from '@protocol/channels'; import { commandsWithTracingSnapshots } from '../../../protocol/debug'; import { ManualPromise } from '../../../utils/manualPromise'; import type { RegisteredListener } from '../../../utils/eventsHelper'; import { eventsHelper } from '../../../utils/eventsHelper'; import { assert, calculateSha1, createGuid, monotonicTime } from '../../../utils'; import { mkdirIfNeeded, removeFolders } from '../../../utils/fileUtils'; import { Artifact } from '../../artifact'; import { BrowserContext } from '../../browserContext'; import { ElementHandle } from '../../dom'; import type { APIRequestContext } from '../../fetch'; import type { CallMetadata, InstrumentationListener } from '../../instrumentation'; import { SdkObject } from '../../instrumentation'; import { Page } from '../../page'; import type * as har from '@trace/har'; import type { HarTracerDelegate } from '../../har/harTracer'; import { HarTracer } from '../../har/harTracer'; import type { FrameSnapshot } from '@trace/snapshot'; import type * as trace from '@trace/trace'; import type { VERSION } from '@trace/trace'; import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter'; import { Snapshotter } from './snapshotter'; import { yazl } from '../../../zipBundle'; const version: VERSION = 3; export type TracerOptions = { name?: string; snapshots?: boolean; screenshots?: boolean; sources?: boolean; }; type RecordingState = { options: TracerOptions, traceName: string, networkFile: string, traceFile: string, tracesDir: string, resourcesDir: string, filesCount: number, networkSha1s: Set<string>, traceSha1s: Set<string>, sources: Set<string>, recording: boolean; }; const kScreencastOptions = { width: 800, height: 600, quality: 90 }; export class Tracing extends SdkObject implements InstrumentationListener, SnapshotterDelegate, HarTracerDelegate { private _writeChain = Promise.resolve(); private _snapshotter?: Snapshotter; private _harTracer: HarTracer; private _screencastListeners: RegisteredListener[] = []; private _pendingCalls = new Map<string, { sdkObject: SdkObject, metadata: CallMetadata, beforeSnapshot: Promise<void>, actionSnapshot?: Promise<void>, afterSnapshot?: Promise<void> }>(); private _context: BrowserContext | APIRequestContext; private _state: RecordingState | undefined; private _isStopping = false; private _precreatedTracesDir: string | undefined; private _tracesTmpDir: string | undefined; private _allResources = new Set<string>(); private _contextCreatedEvent: trace.ContextCreatedTraceEvent; constructor(context: BrowserContext | APIRequestContext, tracesDir: string | undefined) { super(context, 'tracing'); this._context = context; this._precreatedTracesDir = tracesDir; this._harTracer = new HarTracer(context, null, this, { content: 'attach', includeTraceInfo: true, recordRequestOverrides: false, waitForContentOnStop: false, skipScripts: true, }); this._contextCreatedEvent = { version, type: 'context-options', browserName: '', options: {}, platform: process.platform, wallTime: 0, }; if (context instanceof BrowserContext) { this._snapshotter = new Snapshotter(context, this); assert(tracesDir, 'tracesDir must be specified for BrowserContext'); this._contextCreatedEvent.browserName = context._browser.options.name; this._contextCreatedEvent.options = context._options; } } async start(options: TracerOptions) { if (this._isStopping) throw new Error('Cannot start tracing while stopping'); if (this._state) { const o = this._state.options; if (o.name !== options.name || !o.screenshots !== !options.screenshots || !o.snapshots !== !options.snapshots) throw new Error('Tracing has been already started with different options'); return; } // TODO: passing the same name for two contexts makes them write into a single file // and conflict. const traceName = options.name || createGuid(); // Init the state synchrounously. this._state = { options, traceName, traceFile: '', networkFile: '', tracesDir: '', resourcesDir: '', filesCount: 0, traceSha1s: new Set(), networkSha1s: new Set(), sources: new Set(), recording: false }; const state = this._state; state.tracesDir = await this._createTracesDirIfNeeded(); state.resourcesDir = path.join(state.tracesDir, 'resources'); state.traceFile = path.join(state.tracesDir, traceName + '.trace'); state.networkFile = path.join(state.tracesDir, traceName + '.network'); this._writeChain = fs.promises.mkdir(state.resourcesDir, { recursive: true }).then(() => fs.promises.writeFile(state.networkFile, '')); if (options.snapshots) this._harTracer.start(); } async startChunk(options: { title?: string } = {}) { if (this._state && this._state.recording) await this.stopChunk({ mode: 'doNotSave' }); if (!this._state) throw new Error('Must start tracing before starting a new chunk'); if (this._isStopping) throw new Error('Cannot start a trace chunk while stopping'); const state = this._state; const suffix = state.filesCount ? `-${state.filesCount}` : ``; state.filesCount++; state.traceFile = path.join(state.tracesDir, `${state.traceName}${suffix}.trace`); state.recording = true; this._appendTraceOperation(async () => { await mkdirIfNeeded(state.traceFile); await fs.promises.appendFile(state.traceFile, JSON.stringify({ ...this._contextCreatedEvent, title: options.title, wallTime: Date.now() }) + '\n'); }); this._context.instrumentation.addListener(this, this._context); if (state.options.screenshots) this._startScreencast(); if (state.options.snapshots) await this._snapshotter?.start(); } private _startScreencast() { if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) this._startScreencastInPage(page); this._screencastListeners.push( eventsHelper.addEventListener(this._context, BrowserContext.Events.Page, this._startScreencastInPage.bind(this)), ); } private _stopScreencast() { eventsHelper.removeEventListeners(this._screencastListeners); if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) page.setScreencastOptions(null); } async stop() { if (!this._state) return; if (this._isStopping) throw new Error(`Tracing is already stopping`); if (this._state.recording) throw new Error(`Must stop trace file before stopping tracing`); this._harTracer.stop(); await this._writeChain; this._state = undefined; } async deleteTmpTracesDir() { if (this._tracesTmpDir) await removeFolders([this._tracesTmpDir]); } private async _createTracesDirIfNeeded() { if (this._precreatedTracesDir) return this._precreatedTracesDir; this._tracesTmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'playwright-tracing-')); return this._tracesTmpDir; } async dispose() { this._snapshotter?.dispose(); this._harTracer.stop(); await this._writeChain; } async stopChunk(params: TracingTracingStopChunkParams): Promise<{ artifact: Artifact | null, sourceEntries: NameValue[] | undefined }> { if (this._isStopping) throw new Error(`Tracing is already stopping`); this._isStopping = true; if (!this._state || !this._state.recording) { this._isStopping = false; if (params.mode !== 'doNotSave') throw new Error(`Must start tracing before stopping`); return { artifact: null, sourceEntries: [] }; } const state = this._state!; this._context.instrumentation.removeListener(this); if (this._state?.options.screenshots) this._stopScreencast(); for (const { sdkObject, metadata, beforeSnapshot, actionSnapshot, afterSnapshot } of this._pendingCalls.values()) { await Promise.all([beforeSnapshot, actionSnapshot, afterSnapshot]); let callMetadata = metadata; if (!afterSnapshot) { // Note: we should not modify metadata here to avoid side-effects in any other place. callMetadata = { ...metadata, error: { error: { name: 'Error', message: 'Action was interrupted' } }, }; } await this.onAfterCall(sdkObject, callMetadata); } if (state.options.snapshots) await this._snapshotter?.stop(); // Chain the export operation against write operations, // so that neither trace files nor sha1s change during the export. return await this._appendTraceOperation(async () => { if (params.mode === 'doNotSave') return { artifact: null, sourceEntries: undefined }; // Har files a live, make a snapshot before returning the resulting entries. const networkFile = path.join(state.networkFile, '..', createGuid()); await fs.promises.copyFile(state.networkFile, networkFile); const entries: NameValue[] = []; entries.push({ name: 'trace.trace', value: state.traceFile }); entries.push({ name: 'trace.network', value: networkFile }); for (const sha1 of new Set([...state.traceSha1s, ...state.networkSha1s])) entries.push({ name: path.join('resources', sha1), value: path.join(state.resourcesDir, sha1) }); let sourceEntries: NameValue[] | undefined; if (state.sources.size) { sourceEntries = []; for (const value of state.sources) { const entry = { name: 'resources/src@' + calculateSha1(value) + '.txt', value }; if (params.mode === 'compressTraceAndSources') { if (fs.existsSync(entry.value)) entries.push(entry); } else { sourceEntries.push(entry); } } } const artifact = await this._exportZip(entries, state).catch(() => null); return { artifact, sourceEntries }; }).finally(() => { // Only reset trace sha1s, network resources are preserved between chunks. state.traceSha1s = new Set(); state.sources = new Set(); this._isStopping = false; state.recording = false; }) || { artifact: null, sourceEntries: undefined }; } private async _exportZip(entries: NameValue[], state: RecordingState): Promise<Artifact | null> { const zipFile = new yazl.ZipFile(); const result = new ManualPromise<Artifact | null>(); (zipFile as any as EventEmitter).on('error', error => result.reject(error)); for (const entry of entries) zipFile.addFile(entry.value, entry.name); zipFile.end(); const zipFileName = state.traceFile + '.zip'; zipFile.outputStream.pipe(fs.createWriteStream(zipFileName)).on('close', () => { const artifact = new Artifact(this._context, zipFileName); artifact.reportFinished(); result.resolve(artifact); }); return result; } async _captureSnapshot(name: 'before' | 'after' | 'action' | 'event', sdkObject: SdkObject, metadata: CallMetadata, element?: ElementHandle) { if (!this._snapshotter) return; if (!sdkObject.attribution.page) return; if (!this._snapshotter.started()) return; if (!shouldCaptureSnapshot(metadata)) return; const snapshotName = `${name}@${metadata.id}`; metadata.snapshots.push({ title: name, snapshotName }); // We have |element| for input actions (page.click and handle.click) // and |sdkObject| element for accessors like handle.textContent. if (!element && sdkObject instanceof ElementHandle) element = sdkObject; await this._snapshotter.captureSnapshot(sdkObject.attribution.page, snapshotName, element).catch(() => {}); } async onBeforeCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); // Set afterSnapshot name for all the actions that operate selectors. // Elements resolved from selectors will be marked on the snapshot. metadata.afterSnapshot = `after@${metadata.id}`; const beforeSnapshot = this._captureSnapshot('before', sdkObject, metadata); this._pendingCalls.set(metadata.id, { sdkObject, metadata, beforeSnapshot }); if (this._state?.options.sources) { for (const frame of metadata.stack || []) this._state.sources.add(frame.file); } await beforeSnapshot; } async onBeforeInputAction(sdkObject: SdkObject, metadata: CallMetadata, element: ElementHandle) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const actionSnapshot = this._captureSnapshot('action', sdkObject, metadata, element); this._pendingCalls.get(metadata.id)!.actionSnapshot = actionSnapshot; await actionSnapshot; } async onAfterCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const pendingCall = this._pendingCalls.get(metadata.id); if (!pendingCall || pendingCall.afterSnapshot) return; if (!sdkObject.attribution.context) { this._pendingCalls.delete(metadata.id); return; } pendingCall.afterSnapshot = this._captureSnapshot('after', sdkObject, metadata); await pendingCall.afterSnapshot; const event: trace.ActionTraceEvent = { type: 'action', metadata }; this._appendTraceEvent(event); this._pendingCalls.delete(metadata.id); } onEvent(sdkObject: SdkObject, metadata: CallMetadata) { if (!sdkObject.attribution.context) return; const event: trace.ActionTraceEvent = { type: 'event', metadata }; this._appendTraceEvent(event); } onEntryStarted(entry: har.Entry) { } onEntryFinished(entry: har.Entry) { const event: trace.ResourceSnapshotTraceEvent = { type: 'resource-snapshot', snapshot: entry }; this._appendTraceOperation(async () => { visitSha1s(event, this._state!.networkSha1s); await fs.promises.appendFile(this._state!.networkFile, JSON.stringify(event) + '\n'); }); } onContentBlob(sha1: string, buffer: Buffer) { this._appendResource(sha1, buffer); } onSnapshotterBlob(blob: SnapshotterBlob): void { this._appendResource(blob.sha1, blob.buffer); } onFrameSnapshot(snapshot: FrameSnapshot): void { this._appendTraceEvent({ type: 'frame-snapshot', snapshot }); } private _startScreencastInPage(page: Page) { page.setScreencastOptions(kScreencastOptions); const prefix = page.guid; this._screencastListeners.push( eventsHelper.addEventListener(page, Page.Events.ScreencastFrame, params => { const suffix = params.timestamp || Date.now(); const sha1 = `${prefix}-${suffix}.jpeg`; const event: trace.ScreencastFrameTraceEvent = { type: 'screencast-frame', pageId: page.guid, sha1, width: params.width, height: params.height, timestamp: monotonicTime() }; // Make sure to write the screencast frame before adding a reference to it. this._appendResource(sha1, params.buffer); this._appendTraceEvent(event); }), ); } private _appendTraceEvent(event: trace.TraceEvent) { this._appendTraceOperation(async () => { visitSha1s(event, this._state!.traceSha1s); await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(event) + '\n'); }); } private _appendResource(sha1: string, buffer: Buffer) { if (this._allResources.has(sha1)) return; this._allResources.add(sha1); const resourcePath = path.join(this._state!.resourcesDir, sha1); this._appendTraceOperation(async () => { try { // Perhaps we've already written this resource? await fs.promises.access(resourcePath); } catch (e) { // If not, let's write! Note that async access is safe because we // never remove resources until the very end. await fs.promises.writeFile(resourcePath, buffer).catch(() => {}); } }); } private async _appendTraceOperation<T>(cb: () => Promise<T>): Promise<T | undefined> { // This method serializes all writes to the trace. let error: Error | undefined; let result: T | undefined; this._writeChain = this._writeChain.then(async () => { // This check is here because closing the browser removes the tracesDir and tracing // dies trying to archive. if (this._context instanceof BrowserContext && !this._context._browser.isConnected()) return; try { result = await cb(); } catch (e) { error = e; } }); await this._writeChain; if (error) throw error; return result; } } function visitSha1s(object: any, sha1s: Set<string>) { if (Array.isArray(object)) { object.forEach(o => visitSha1s(o, sha1s)); return; } if (typeof object === 'object') { for (const key in object) { if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) { const sha1 = object[key]; if (sha1) sha1s.add(sha1); } visitSha1s(object[key], sha1s); } return; } } export function shouldCaptureSnapshot(metadata: CallMetadata): boolean { return commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method); }
packages/playwright-core/src/server/trace/recorder/tracing.ts
1
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.9992213249206543, 0.16573333740234375, 0.0001658084220252931, 0.00017249491065740585, 0.3685680627822876 ]
{ "id": 2, "code_window": [ " }\n", "}\n", "\n", "function visitSha1s(object: any, sha1s: Set<string>) {\n", " if (Array.isArray(object)) {\n", " object.forEach(o => visitSha1s(o, sha1s));\n", " return;\n", " }\n", " if (typeof object === 'object') {\n" ], "labels": [ "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep" ], "after_edit": [ "function visitTraceEvent(object: any, sha1s: Set<string>): any {\n", " if (Array.isArray(object))\n", " return object.map(o => visitTraceEvent(o, sha1s));\n", " if (object instanceof Buffer)\n", " return undefined;\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 454 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { debug } from '../utilsBundle'; import { ws as WebSocket } from '../utilsBundle'; import { PlaywrightConnection } from '../remote/playwrightConnection'; import { gracefullyCloseAll } from '../utils/processLauncher'; function launchGridBrowserWorker(gridURL: string, agentId: string, workerId: string, browserName: string) { const log = debug(`pw:grid:worker:${workerId}`); log('created'); const ws = new WebSocket(gridURL.replace('http://', 'ws://') + `/registerWorker?agentId=${agentId}&workerId=${workerId}`); new PlaywrightConnection(Promise.resolve(), 'auto', ws, false, { enableSocksProxy: true, browserName, launchOptions: {} }, { playwright: null, browser: null }, log, async () => { log('exiting process'); setTimeout(() => process.exit(0), 30000); // Meanwhile, try to gracefully close all browsers. await gracefullyCloseAll(); process.exit(0); }); } launchGridBrowserWorker(process.argv[2], process.argv[3], process.argv[4], process.argv[5]);
packages/playwright-core/src/grid/gridBrowserWorker.ts
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.00017729302635416389, 0.0001745194458635524, 0.00017018399375956506, 0.0001753003743942827, 0.000002648127974680392 ]
{ "id": 2, "code_window": [ " }\n", "}\n", "\n", "function visitSha1s(object: any, sha1s: Set<string>) {\n", " if (Array.isArray(object)) {\n", " object.forEach(o => visitSha1s(o, sha1s));\n", " return;\n", " }\n", " if (typeof object === 'object') {\n" ], "labels": [ "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep" ], "after_edit": [ "function visitTraceEvent(object: any, sha1s: Set<string>): any {\n", " if (Array.isArray(object))\n", " return object.map(o => visitTraceEvent(o, sha1s));\n", " if (object instanceof Buffer)\n", " return undefined;\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 454 }
console.log(3);
tests/assets/jscoverage/script1.js
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.00017285399371758103, 0.00017285399371758103, 0.00017285399371758103, 0.00017285399371758103, 0 ]
{ "id": 2, "code_window": [ " }\n", "}\n", "\n", "function visitSha1s(object: any, sha1s: Set<string>) {\n", " if (Array.isArray(object)) {\n", " object.forEach(o => visitSha1s(o, sha1s));\n", " return;\n", " }\n", " if (typeof object === 'object') {\n" ], "labels": [ "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep" ], "after_edit": [ "function visitTraceEvent(object: any, sha1s: Set<string>): any {\n", " if (Array.isArray(object))\n", " return object.map(o => visitTraceEvent(o, sha1s));\n", " if (object instanceof Buffer)\n", " return undefined;\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 454 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { test } from './npmTest'; import fs from 'fs'; import path from 'path'; test('playwright should work with relative home path', async ({ exec, tmpWorkspace }) => { await fs.promises.mkdir(path.join(tmpWorkspace, 'foo')); // Make sure that browsers path is resolved relative to the `npm install` call location. await exec('npm i --foreground-scripts playwright', { cwd: path.join(tmpWorkspace, 'foo'), env: { PLAYWRIGHT_BROWSERS_PATH: path.join('..', 'relative') } }); await exec('node sanity.js playwright', { env: { PLAYWRIGHT_BROWSERS_PATH: path.join('.', 'relative') } }); });
tests/installation/playwright-should-work-with-relative-browsers-path.spec.ts
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.0001769935479387641, 0.00017513810598757118, 0.00017270703392568976, 0.0001757137360982597, 0.0000017966752920983708 ]
{ "id": 3, "code_window": [ " if (typeof object === 'object') {\n", " for (const key in object) {\n", " if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) {\n", " const sha1 = object[key];\n" ], "labels": [ "add", "keep", "keep", "keep" ], "after_edit": [ " const result: any = {};\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "add", "edit_start_line_idx": 460 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { EventEmitter } from 'events'; import fs from 'fs'; import os from 'os'; import path from 'path'; import type { NameValue } from '../../../common/types'; import type { TracingTracingStopChunkParams } from '@protocol/channels'; import { commandsWithTracingSnapshots } from '../../../protocol/debug'; import { ManualPromise } from '../../../utils/manualPromise'; import type { RegisteredListener } from '../../../utils/eventsHelper'; import { eventsHelper } from '../../../utils/eventsHelper'; import { assert, calculateSha1, createGuid, monotonicTime } from '../../../utils'; import { mkdirIfNeeded, removeFolders } from '../../../utils/fileUtils'; import { Artifact } from '../../artifact'; import { BrowserContext } from '../../browserContext'; import { ElementHandle } from '../../dom'; import type { APIRequestContext } from '../../fetch'; import type { CallMetadata, InstrumentationListener } from '../../instrumentation'; import { SdkObject } from '../../instrumentation'; import { Page } from '../../page'; import type * as har from '@trace/har'; import type { HarTracerDelegate } from '../../har/harTracer'; import { HarTracer } from '../../har/harTracer'; import type { FrameSnapshot } from '@trace/snapshot'; import type * as trace from '@trace/trace'; import type { VERSION } from '@trace/trace'; import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter'; import { Snapshotter } from './snapshotter'; import { yazl } from '../../../zipBundle'; const version: VERSION = 3; export type TracerOptions = { name?: string; snapshots?: boolean; screenshots?: boolean; sources?: boolean; }; type RecordingState = { options: TracerOptions, traceName: string, networkFile: string, traceFile: string, tracesDir: string, resourcesDir: string, filesCount: number, networkSha1s: Set<string>, traceSha1s: Set<string>, sources: Set<string>, recording: boolean; }; const kScreencastOptions = { width: 800, height: 600, quality: 90 }; export class Tracing extends SdkObject implements InstrumentationListener, SnapshotterDelegate, HarTracerDelegate { private _writeChain = Promise.resolve(); private _snapshotter?: Snapshotter; private _harTracer: HarTracer; private _screencastListeners: RegisteredListener[] = []; private _pendingCalls = new Map<string, { sdkObject: SdkObject, metadata: CallMetadata, beforeSnapshot: Promise<void>, actionSnapshot?: Promise<void>, afterSnapshot?: Promise<void> }>(); private _context: BrowserContext | APIRequestContext; private _state: RecordingState | undefined; private _isStopping = false; private _precreatedTracesDir: string | undefined; private _tracesTmpDir: string | undefined; private _allResources = new Set<string>(); private _contextCreatedEvent: trace.ContextCreatedTraceEvent; constructor(context: BrowserContext | APIRequestContext, tracesDir: string | undefined) { super(context, 'tracing'); this._context = context; this._precreatedTracesDir = tracesDir; this._harTracer = new HarTracer(context, null, this, { content: 'attach', includeTraceInfo: true, recordRequestOverrides: false, waitForContentOnStop: false, skipScripts: true, }); this._contextCreatedEvent = { version, type: 'context-options', browserName: '', options: {}, platform: process.platform, wallTime: 0, }; if (context instanceof BrowserContext) { this._snapshotter = new Snapshotter(context, this); assert(tracesDir, 'tracesDir must be specified for BrowserContext'); this._contextCreatedEvent.browserName = context._browser.options.name; this._contextCreatedEvent.options = context._options; } } async start(options: TracerOptions) { if (this._isStopping) throw new Error('Cannot start tracing while stopping'); if (this._state) { const o = this._state.options; if (o.name !== options.name || !o.screenshots !== !options.screenshots || !o.snapshots !== !options.snapshots) throw new Error('Tracing has been already started with different options'); return; } // TODO: passing the same name for two contexts makes them write into a single file // and conflict. const traceName = options.name || createGuid(); // Init the state synchrounously. this._state = { options, traceName, traceFile: '', networkFile: '', tracesDir: '', resourcesDir: '', filesCount: 0, traceSha1s: new Set(), networkSha1s: new Set(), sources: new Set(), recording: false }; const state = this._state; state.tracesDir = await this._createTracesDirIfNeeded(); state.resourcesDir = path.join(state.tracesDir, 'resources'); state.traceFile = path.join(state.tracesDir, traceName + '.trace'); state.networkFile = path.join(state.tracesDir, traceName + '.network'); this._writeChain = fs.promises.mkdir(state.resourcesDir, { recursive: true }).then(() => fs.promises.writeFile(state.networkFile, '')); if (options.snapshots) this._harTracer.start(); } async startChunk(options: { title?: string } = {}) { if (this._state && this._state.recording) await this.stopChunk({ mode: 'doNotSave' }); if (!this._state) throw new Error('Must start tracing before starting a new chunk'); if (this._isStopping) throw new Error('Cannot start a trace chunk while stopping'); const state = this._state; const suffix = state.filesCount ? `-${state.filesCount}` : ``; state.filesCount++; state.traceFile = path.join(state.tracesDir, `${state.traceName}${suffix}.trace`); state.recording = true; this._appendTraceOperation(async () => { await mkdirIfNeeded(state.traceFile); await fs.promises.appendFile(state.traceFile, JSON.stringify({ ...this._contextCreatedEvent, title: options.title, wallTime: Date.now() }) + '\n'); }); this._context.instrumentation.addListener(this, this._context); if (state.options.screenshots) this._startScreencast(); if (state.options.snapshots) await this._snapshotter?.start(); } private _startScreencast() { if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) this._startScreencastInPage(page); this._screencastListeners.push( eventsHelper.addEventListener(this._context, BrowserContext.Events.Page, this._startScreencastInPage.bind(this)), ); } private _stopScreencast() { eventsHelper.removeEventListeners(this._screencastListeners); if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) page.setScreencastOptions(null); } async stop() { if (!this._state) return; if (this._isStopping) throw new Error(`Tracing is already stopping`); if (this._state.recording) throw new Error(`Must stop trace file before stopping tracing`); this._harTracer.stop(); await this._writeChain; this._state = undefined; } async deleteTmpTracesDir() { if (this._tracesTmpDir) await removeFolders([this._tracesTmpDir]); } private async _createTracesDirIfNeeded() { if (this._precreatedTracesDir) return this._precreatedTracesDir; this._tracesTmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'playwright-tracing-')); return this._tracesTmpDir; } async dispose() { this._snapshotter?.dispose(); this._harTracer.stop(); await this._writeChain; } async stopChunk(params: TracingTracingStopChunkParams): Promise<{ artifact: Artifact | null, sourceEntries: NameValue[] | undefined }> { if (this._isStopping) throw new Error(`Tracing is already stopping`); this._isStopping = true; if (!this._state || !this._state.recording) { this._isStopping = false; if (params.mode !== 'doNotSave') throw new Error(`Must start tracing before stopping`); return { artifact: null, sourceEntries: [] }; } const state = this._state!; this._context.instrumentation.removeListener(this); if (this._state?.options.screenshots) this._stopScreencast(); for (const { sdkObject, metadata, beforeSnapshot, actionSnapshot, afterSnapshot } of this._pendingCalls.values()) { await Promise.all([beforeSnapshot, actionSnapshot, afterSnapshot]); let callMetadata = metadata; if (!afterSnapshot) { // Note: we should not modify metadata here to avoid side-effects in any other place. callMetadata = { ...metadata, error: { error: { name: 'Error', message: 'Action was interrupted' } }, }; } await this.onAfterCall(sdkObject, callMetadata); } if (state.options.snapshots) await this._snapshotter?.stop(); // Chain the export operation against write operations, // so that neither trace files nor sha1s change during the export. return await this._appendTraceOperation(async () => { if (params.mode === 'doNotSave') return { artifact: null, sourceEntries: undefined }; // Har files a live, make a snapshot before returning the resulting entries. const networkFile = path.join(state.networkFile, '..', createGuid()); await fs.promises.copyFile(state.networkFile, networkFile); const entries: NameValue[] = []; entries.push({ name: 'trace.trace', value: state.traceFile }); entries.push({ name: 'trace.network', value: networkFile }); for (const sha1 of new Set([...state.traceSha1s, ...state.networkSha1s])) entries.push({ name: path.join('resources', sha1), value: path.join(state.resourcesDir, sha1) }); let sourceEntries: NameValue[] | undefined; if (state.sources.size) { sourceEntries = []; for (const value of state.sources) { const entry = { name: 'resources/src@' + calculateSha1(value) + '.txt', value }; if (params.mode === 'compressTraceAndSources') { if (fs.existsSync(entry.value)) entries.push(entry); } else { sourceEntries.push(entry); } } } const artifact = await this._exportZip(entries, state).catch(() => null); return { artifact, sourceEntries }; }).finally(() => { // Only reset trace sha1s, network resources are preserved between chunks. state.traceSha1s = new Set(); state.sources = new Set(); this._isStopping = false; state.recording = false; }) || { artifact: null, sourceEntries: undefined }; } private async _exportZip(entries: NameValue[], state: RecordingState): Promise<Artifact | null> { const zipFile = new yazl.ZipFile(); const result = new ManualPromise<Artifact | null>(); (zipFile as any as EventEmitter).on('error', error => result.reject(error)); for (const entry of entries) zipFile.addFile(entry.value, entry.name); zipFile.end(); const zipFileName = state.traceFile + '.zip'; zipFile.outputStream.pipe(fs.createWriteStream(zipFileName)).on('close', () => { const artifact = new Artifact(this._context, zipFileName); artifact.reportFinished(); result.resolve(artifact); }); return result; } async _captureSnapshot(name: 'before' | 'after' | 'action' | 'event', sdkObject: SdkObject, metadata: CallMetadata, element?: ElementHandle) { if (!this._snapshotter) return; if (!sdkObject.attribution.page) return; if (!this._snapshotter.started()) return; if (!shouldCaptureSnapshot(metadata)) return; const snapshotName = `${name}@${metadata.id}`; metadata.snapshots.push({ title: name, snapshotName }); // We have |element| for input actions (page.click and handle.click) // and |sdkObject| element for accessors like handle.textContent. if (!element && sdkObject instanceof ElementHandle) element = sdkObject; await this._snapshotter.captureSnapshot(sdkObject.attribution.page, snapshotName, element).catch(() => {}); } async onBeforeCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); // Set afterSnapshot name for all the actions that operate selectors. // Elements resolved from selectors will be marked on the snapshot. metadata.afterSnapshot = `after@${metadata.id}`; const beforeSnapshot = this._captureSnapshot('before', sdkObject, metadata); this._pendingCalls.set(metadata.id, { sdkObject, metadata, beforeSnapshot }); if (this._state?.options.sources) { for (const frame of metadata.stack || []) this._state.sources.add(frame.file); } await beforeSnapshot; } async onBeforeInputAction(sdkObject: SdkObject, metadata: CallMetadata, element: ElementHandle) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const actionSnapshot = this._captureSnapshot('action', sdkObject, metadata, element); this._pendingCalls.get(metadata.id)!.actionSnapshot = actionSnapshot; await actionSnapshot; } async onAfterCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const pendingCall = this._pendingCalls.get(metadata.id); if (!pendingCall || pendingCall.afterSnapshot) return; if (!sdkObject.attribution.context) { this._pendingCalls.delete(metadata.id); return; } pendingCall.afterSnapshot = this._captureSnapshot('after', sdkObject, metadata); await pendingCall.afterSnapshot; const event: trace.ActionTraceEvent = { type: 'action', metadata }; this._appendTraceEvent(event); this._pendingCalls.delete(metadata.id); } onEvent(sdkObject: SdkObject, metadata: CallMetadata) { if (!sdkObject.attribution.context) return; const event: trace.ActionTraceEvent = { type: 'event', metadata }; this._appendTraceEvent(event); } onEntryStarted(entry: har.Entry) { } onEntryFinished(entry: har.Entry) { const event: trace.ResourceSnapshotTraceEvent = { type: 'resource-snapshot', snapshot: entry }; this._appendTraceOperation(async () => { visitSha1s(event, this._state!.networkSha1s); await fs.promises.appendFile(this._state!.networkFile, JSON.stringify(event) + '\n'); }); } onContentBlob(sha1: string, buffer: Buffer) { this._appendResource(sha1, buffer); } onSnapshotterBlob(blob: SnapshotterBlob): void { this._appendResource(blob.sha1, blob.buffer); } onFrameSnapshot(snapshot: FrameSnapshot): void { this._appendTraceEvent({ type: 'frame-snapshot', snapshot }); } private _startScreencastInPage(page: Page) { page.setScreencastOptions(kScreencastOptions); const prefix = page.guid; this._screencastListeners.push( eventsHelper.addEventListener(page, Page.Events.ScreencastFrame, params => { const suffix = params.timestamp || Date.now(); const sha1 = `${prefix}-${suffix}.jpeg`; const event: trace.ScreencastFrameTraceEvent = { type: 'screencast-frame', pageId: page.guid, sha1, width: params.width, height: params.height, timestamp: monotonicTime() }; // Make sure to write the screencast frame before adding a reference to it. this._appendResource(sha1, params.buffer); this._appendTraceEvent(event); }), ); } private _appendTraceEvent(event: trace.TraceEvent) { this._appendTraceOperation(async () => { visitSha1s(event, this._state!.traceSha1s); await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(event) + '\n'); }); } private _appendResource(sha1: string, buffer: Buffer) { if (this._allResources.has(sha1)) return; this._allResources.add(sha1); const resourcePath = path.join(this._state!.resourcesDir, sha1); this._appendTraceOperation(async () => { try { // Perhaps we've already written this resource? await fs.promises.access(resourcePath); } catch (e) { // If not, let's write! Note that async access is safe because we // never remove resources until the very end. await fs.promises.writeFile(resourcePath, buffer).catch(() => {}); } }); } private async _appendTraceOperation<T>(cb: () => Promise<T>): Promise<T | undefined> { // This method serializes all writes to the trace. let error: Error | undefined; let result: T | undefined; this._writeChain = this._writeChain.then(async () => { // This check is here because closing the browser removes the tracesDir and tracing // dies trying to archive. if (this._context instanceof BrowserContext && !this._context._browser.isConnected()) return; try { result = await cb(); } catch (e) { error = e; } }); await this._writeChain; if (error) throw error; return result; } } function visitSha1s(object: any, sha1s: Set<string>) { if (Array.isArray(object)) { object.forEach(o => visitSha1s(o, sha1s)); return; } if (typeof object === 'object') { for (const key in object) { if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) { const sha1 = object[key]; if (sha1) sha1s.add(sha1); } visitSha1s(object[key], sha1s); } return; } } export function shouldCaptureSnapshot(metadata: CallMetadata): boolean { return commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method); }
packages/playwright-core/src/server/trace/recorder/tracing.ts
1
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.998345136642456, 0.1265045553445816, 0.00016334239626303315, 0.00017271593969780952, 0.32430458068847656 ]
{ "id": 3, "code_window": [ " if (typeof object === 'object') {\n", " for (const key in object) {\n", " if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) {\n", " const sha1 = object[key];\n" ], "labels": [ "add", "keep", "keep", "keep" ], "after_edit": [ " const result: any = {};\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "add", "edit_start_line_idx": 460 }
node_modules dist
tests/components/ct-solid/.gitignore
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.00017178156122099608, 0.00017178156122099608, 0.00017178156122099608, 0.00017178156122099608, 0 ]
{ "id": 3, "code_window": [ " if (typeof object === 'object') {\n", " for (const key in object) {\n", " if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) {\n", " const sha1 = object[key];\n" ], "labels": [ "add", "keep", "keep", "keep" ], "after_edit": [ " const result: any = {};\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "add", "edit_start_line_idx": 460 }
/* * Copyright (C) 2006, 2008, 2013-2015 Apple Inc. All rights reserved. * Copyright (C) 2009, 2011 Brent Fulgham. All rights reserved. * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved. * Copyright (C) 2013 Alex Christensen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "stdafx.h" #include "Common.h" #include "DialogHelper.h" #include "PlaywrightLibResource.h" #include "PlaywrightReplace.h" #include <dbghelp.h> #include <shlobj.h> #include <wtf/StdLibExtras.h> #include <vector> // Global Variables: HINSTANCE hInst; // Support moving the transparent window POINT s_windowPosition = { 100, 100 }; SIZE s_windowSize = { 500, 200 }; namespace WebCore { float deviceScaleFactorForWindow(HWND); } void computeFullDesktopFrame() { RECT desktop; if (!::SystemParametersInfo(SPI_GETWORKAREA, 0, static_cast<void*>(&desktop), 0)) return; float scaleFactor = WebCore::deviceScaleFactorForWindow(nullptr); s_windowPosition.x = 0; s_windowPosition.y = 0; s_windowSize.cx = scaleFactor * (desktop.right - desktop.left); s_windowSize.cy = scaleFactor * (desktop.bottom - desktop.top); } BOOL WINAPI DllMain(HINSTANCE dllInstance, DWORD reason, LPVOID) { if (reason == DLL_PROCESS_ATTACH) hInst = dllInstance; return TRUE; } bool getAppDataFolder(_bstr_t& directory) { wchar_t appDataDirectory[MAX_PATH]; if (FAILED(SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, 0, 0, appDataDirectory))) return false; wchar_t executablePath[MAX_PATH]; if (!::GetModuleFileNameW(0, executablePath, MAX_PATH)) return false; ::PathRemoveExtensionW(executablePath); directory = _bstr_t(appDataDirectory) + L"\\" + ::PathFindFileNameW(executablePath); return true; } void createCrashReport(EXCEPTION_POINTERS* exceptionPointers) { _bstr_t directory; if (!getAppDataFolder(directory)) return; if (::SHCreateDirectoryEx(0, directory, 0) != ERROR_SUCCESS && ::GetLastError() != ERROR_FILE_EXISTS && ::GetLastError() != ERROR_ALREADY_EXISTS) return; std::wstring fileName = std::wstring(static_cast<const wchar_t*>(directory)) + L"\\CrashReport.dmp"; HANDLE miniDumpFile = ::CreateFile(fileName.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (miniDumpFile && miniDumpFile != INVALID_HANDLE_VALUE) { MINIDUMP_EXCEPTION_INFORMATION mdei; mdei.ThreadId = ::GetCurrentThreadId(); mdei.ExceptionPointers = exceptionPointers; mdei.ClientPointers = 0; #ifdef _DEBUG MINIDUMP_TYPE dumpType = MiniDumpWithFullMemory; #else MINIDUMP_TYPE dumpType = MiniDumpNormal; #endif ::MiniDumpWriteDump(::GetCurrentProcess(), ::GetCurrentProcessId(), miniDumpFile, dumpType, &mdei, 0, 0); ::CloseHandle(miniDumpFile); processCrashReport(fileName.c_str()); } } std::optional<Credential> askCredential(HWND hwnd, const std::wstring& realm) { struct AuthDialog : public Dialog { std::wstring realm; Credential credential; protected: void setup() { setText(IDC_REALM_TEXT, realm); } void ok() final { credential.username = getText(IDC_AUTH_USER); credential.password = getText(IDC_AUTH_PASSWORD); } }; AuthDialog dialog; dialog.realm = realm; if (dialog.run(hInst, hwnd, IDD_AUTH)) return dialog.credential; return std::nullopt; } bool askServerTrustEvaluation(HWND hwnd, const std::wstring& text) { class ServerTrustEvaluationDialog : public Dialog { public: ServerTrustEvaluationDialog(const std::wstring& text) : m_text { text } { SendMessage(GetDlgItem(this->hDlg(), IDC_SERVER_TRUST_TEXT), WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), TRUE); } protected: std::wstring m_text; void setup() { setText(IDC_SERVER_TRUST_TEXT, m_text); } void ok() final { } }; ServerTrustEvaluationDialog dialog { text }; return dialog.run(hInst, hwnd, IDD_SERVER_TRUST); } CommandLineOptions parseCommandLine() { CommandLineOptions options; int argc = 0; WCHAR** argv = CommandLineToArgvW(GetCommandLineW(), &argc); for (int i = 1; i < argc; ++i) { if (!wcsicmp(argv[i], L"--desktop")) options.useFullDesktop = true; else if (!wcsicmp(argv[i], L"--inspector-pipe")) options.inspectorPipe = true; else if (!wcsncmp(argv[i], L"--user-data-dir=", 16)) options.userDataDir = argv[i] + 16; else if (!wcsncmp(argv[i], L"--curl-proxy=", 13)) options.curloptProxy = argv[i] + 13; else if (!wcsncmp(argv[i], L"--curl-noproxy=", 15)) options.curloptNoproxy = argv[i] + 15; else if (!wcsicmp(argv[i], L"--headless")) options.headless = true; else if (!wcsicmp(argv[i], L"--no-startup-window")) options.noStartupWindow = true; else if (!wcsicmp(argv[i], L"--disable-accelerated-compositing")) options.disableAcceleratedCompositing = true; else if (!options.requestedURL) options.requestedURL = argv[i]; } return options; } std::wstring replaceString(std::wstring src, const std::wstring& oldValue, const std::wstring& newValue) { if (src.empty() || oldValue.empty()) return src; size_t pos = 0; while ((pos = src.find(oldValue, pos)) != src.npos) { src.replace(pos, oldValue.length(), newValue); pos += newValue.length(); } return src; } std::wstring createString(WKStringRef wkString) { size_t maxSize = WKStringGetLength(wkString); std::vector<WKChar> wkCharBuffer(maxSize); size_t actualLength = WKStringGetCharacters(wkString, wkCharBuffer.data(), maxSize); return std::wstring(wkCharBuffer.data(), actualLength); } std::wstring createString(WKURLRef wkURL) { if (!wkURL) return { }; WKRetainPtr<WKStringRef> url = adoptWK(WKURLCopyString(wkURL)); return createString(url.get()); } std::string createUTF8String(const wchar_t* src, size_t srcLength) { int length = WideCharToMultiByte(CP_UTF8, 0, src, srcLength, 0, 0, nullptr, nullptr); std::vector<char> buffer(length); size_t actualLength = WideCharToMultiByte(CP_UTF8, 0, src, srcLength, buffer.data(), length, nullptr, nullptr); return { buffer.data(), actualLength }; } WKRetainPtr<WKStringRef> createWKString(_bstr_t str) { auto utf8 = createUTF8String(str, str.length()); return adoptWK(WKStringCreateWithUTF8CString(utf8.data())); } WKRetainPtr<WKStringRef> createWKString(const std::wstring& str) { auto utf8 = createUTF8String(str.c_str(), str.length()); return adoptWK(WKStringCreateWithUTF8CString(utf8.data())); } WKRetainPtr<WKURLRef> createWKURL(_bstr_t str) { auto utf8 = createUTF8String(str, str.length()); return adoptWK(WKURLCreateWithUTF8CString(utf8.data())); } WKRetainPtr<WKURLRef> createWKURL(const std::wstring& str) { auto utf8 = createUTF8String(str.c_str(), str.length()); return adoptWK(WKURLCreateWithUTF8CString(utf8.data())); }
browser_patches/webkit/embedder/Playwright/win/Common.cpp
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.004620478488504887, 0.00032876740442588925, 0.00016001549374777824, 0.00017008587019518018, 0.000825948198325932 ]
{ "id": 3, "code_window": [ " if (typeof object === 'object') {\n", " for (const key in object) {\n", " if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) {\n", " const sha1 = object[key];\n" ], "labels": [ "add", "keep", "keep", "keep" ], "after_edit": [ " const result: any = {};\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "add", "edit_start_line_idx": 460 }
{ "theme_color": "#000", "background_color": "#fff", "display": "browser", "start_url": "index.html", "name": "Playwright Trace Viewer", "short_name": "Trace Viewer", "icons": [ { "src": "icon-192x192.png", "sizes": "192x192", "type": "image/png" }, { "src": "icon-256x256.png", "sizes": "256x256", "type": "image/png" }, { "src": "icon-384x384.png", "sizes": "384x384", "type": "image/png" }, { "src": "icon-512x512.png", "sizes": "512x512", "type": "image/png" } ] }
packages/trace-viewer/public/manifest.webmanifest
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.0001731535594444722, 0.0001714622922008857, 0.00016960405628196895, 0.00017154577653855085, 0.0000013382804127104464 ]
{ "id": 4, "code_window": [ " if (sha1)\n", " sha1s.add(sha1);\n", " }\n", " visitSha1s(object[key], sha1s);\n", " }\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep" ], "after_edit": [ " result[key] = visitTraceEvent(object[key], sha1s);\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 466 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { EventEmitter } from 'events'; import fs from 'fs'; import os from 'os'; import path from 'path'; import type { NameValue } from '../../../common/types'; import type { TracingTracingStopChunkParams } from '@protocol/channels'; import { commandsWithTracingSnapshots } from '../../../protocol/debug'; import { ManualPromise } from '../../../utils/manualPromise'; import type { RegisteredListener } from '../../../utils/eventsHelper'; import { eventsHelper } from '../../../utils/eventsHelper'; import { assert, calculateSha1, createGuid, monotonicTime } from '../../../utils'; import { mkdirIfNeeded, removeFolders } from '../../../utils/fileUtils'; import { Artifact } from '../../artifact'; import { BrowserContext } from '../../browserContext'; import { ElementHandle } from '../../dom'; import type { APIRequestContext } from '../../fetch'; import type { CallMetadata, InstrumentationListener } from '../../instrumentation'; import { SdkObject } from '../../instrumentation'; import { Page } from '../../page'; import type * as har from '@trace/har'; import type { HarTracerDelegate } from '../../har/harTracer'; import { HarTracer } from '../../har/harTracer'; import type { FrameSnapshot } from '@trace/snapshot'; import type * as trace from '@trace/trace'; import type { VERSION } from '@trace/trace'; import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter'; import { Snapshotter } from './snapshotter'; import { yazl } from '../../../zipBundle'; const version: VERSION = 3; export type TracerOptions = { name?: string; snapshots?: boolean; screenshots?: boolean; sources?: boolean; }; type RecordingState = { options: TracerOptions, traceName: string, networkFile: string, traceFile: string, tracesDir: string, resourcesDir: string, filesCount: number, networkSha1s: Set<string>, traceSha1s: Set<string>, sources: Set<string>, recording: boolean; }; const kScreencastOptions = { width: 800, height: 600, quality: 90 }; export class Tracing extends SdkObject implements InstrumentationListener, SnapshotterDelegate, HarTracerDelegate { private _writeChain = Promise.resolve(); private _snapshotter?: Snapshotter; private _harTracer: HarTracer; private _screencastListeners: RegisteredListener[] = []; private _pendingCalls = new Map<string, { sdkObject: SdkObject, metadata: CallMetadata, beforeSnapshot: Promise<void>, actionSnapshot?: Promise<void>, afterSnapshot?: Promise<void> }>(); private _context: BrowserContext | APIRequestContext; private _state: RecordingState | undefined; private _isStopping = false; private _precreatedTracesDir: string | undefined; private _tracesTmpDir: string | undefined; private _allResources = new Set<string>(); private _contextCreatedEvent: trace.ContextCreatedTraceEvent; constructor(context: BrowserContext | APIRequestContext, tracesDir: string | undefined) { super(context, 'tracing'); this._context = context; this._precreatedTracesDir = tracesDir; this._harTracer = new HarTracer(context, null, this, { content: 'attach', includeTraceInfo: true, recordRequestOverrides: false, waitForContentOnStop: false, skipScripts: true, }); this._contextCreatedEvent = { version, type: 'context-options', browserName: '', options: {}, platform: process.platform, wallTime: 0, }; if (context instanceof BrowserContext) { this._snapshotter = new Snapshotter(context, this); assert(tracesDir, 'tracesDir must be specified for BrowserContext'); this._contextCreatedEvent.browserName = context._browser.options.name; this._contextCreatedEvent.options = context._options; } } async start(options: TracerOptions) { if (this._isStopping) throw new Error('Cannot start tracing while stopping'); if (this._state) { const o = this._state.options; if (o.name !== options.name || !o.screenshots !== !options.screenshots || !o.snapshots !== !options.snapshots) throw new Error('Tracing has been already started with different options'); return; } // TODO: passing the same name for two contexts makes them write into a single file // and conflict. const traceName = options.name || createGuid(); // Init the state synchrounously. this._state = { options, traceName, traceFile: '', networkFile: '', tracesDir: '', resourcesDir: '', filesCount: 0, traceSha1s: new Set(), networkSha1s: new Set(), sources: new Set(), recording: false }; const state = this._state; state.tracesDir = await this._createTracesDirIfNeeded(); state.resourcesDir = path.join(state.tracesDir, 'resources'); state.traceFile = path.join(state.tracesDir, traceName + '.trace'); state.networkFile = path.join(state.tracesDir, traceName + '.network'); this._writeChain = fs.promises.mkdir(state.resourcesDir, { recursive: true }).then(() => fs.promises.writeFile(state.networkFile, '')); if (options.snapshots) this._harTracer.start(); } async startChunk(options: { title?: string } = {}) { if (this._state && this._state.recording) await this.stopChunk({ mode: 'doNotSave' }); if (!this._state) throw new Error('Must start tracing before starting a new chunk'); if (this._isStopping) throw new Error('Cannot start a trace chunk while stopping'); const state = this._state; const suffix = state.filesCount ? `-${state.filesCount}` : ``; state.filesCount++; state.traceFile = path.join(state.tracesDir, `${state.traceName}${suffix}.trace`); state.recording = true; this._appendTraceOperation(async () => { await mkdirIfNeeded(state.traceFile); await fs.promises.appendFile(state.traceFile, JSON.stringify({ ...this._contextCreatedEvent, title: options.title, wallTime: Date.now() }) + '\n'); }); this._context.instrumentation.addListener(this, this._context); if (state.options.screenshots) this._startScreencast(); if (state.options.snapshots) await this._snapshotter?.start(); } private _startScreencast() { if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) this._startScreencastInPage(page); this._screencastListeners.push( eventsHelper.addEventListener(this._context, BrowserContext.Events.Page, this._startScreencastInPage.bind(this)), ); } private _stopScreencast() { eventsHelper.removeEventListeners(this._screencastListeners); if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) page.setScreencastOptions(null); } async stop() { if (!this._state) return; if (this._isStopping) throw new Error(`Tracing is already stopping`); if (this._state.recording) throw new Error(`Must stop trace file before stopping tracing`); this._harTracer.stop(); await this._writeChain; this._state = undefined; } async deleteTmpTracesDir() { if (this._tracesTmpDir) await removeFolders([this._tracesTmpDir]); } private async _createTracesDirIfNeeded() { if (this._precreatedTracesDir) return this._precreatedTracesDir; this._tracesTmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'playwright-tracing-')); return this._tracesTmpDir; } async dispose() { this._snapshotter?.dispose(); this._harTracer.stop(); await this._writeChain; } async stopChunk(params: TracingTracingStopChunkParams): Promise<{ artifact: Artifact | null, sourceEntries: NameValue[] | undefined }> { if (this._isStopping) throw new Error(`Tracing is already stopping`); this._isStopping = true; if (!this._state || !this._state.recording) { this._isStopping = false; if (params.mode !== 'doNotSave') throw new Error(`Must start tracing before stopping`); return { artifact: null, sourceEntries: [] }; } const state = this._state!; this._context.instrumentation.removeListener(this); if (this._state?.options.screenshots) this._stopScreencast(); for (const { sdkObject, metadata, beforeSnapshot, actionSnapshot, afterSnapshot } of this._pendingCalls.values()) { await Promise.all([beforeSnapshot, actionSnapshot, afterSnapshot]); let callMetadata = metadata; if (!afterSnapshot) { // Note: we should not modify metadata here to avoid side-effects in any other place. callMetadata = { ...metadata, error: { error: { name: 'Error', message: 'Action was interrupted' } }, }; } await this.onAfterCall(sdkObject, callMetadata); } if (state.options.snapshots) await this._snapshotter?.stop(); // Chain the export operation against write operations, // so that neither trace files nor sha1s change during the export. return await this._appendTraceOperation(async () => { if (params.mode === 'doNotSave') return { artifact: null, sourceEntries: undefined }; // Har files a live, make a snapshot before returning the resulting entries. const networkFile = path.join(state.networkFile, '..', createGuid()); await fs.promises.copyFile(state.networkFile, networkFile); const entries: NameValue[] = []; entries.push({ name: 'trace.trace', value: state.traceFile }); entries.push({ name: 'trace.network', value: networkFile }); for (const sha1 of new Set([...state.traceSha1s, ...state.networkSha1s])) entries.push({ name: path.join('resources', sha1), value: path.join(state.resourcesDir, sha1) }); let sourceEntries: NameValue[] | undefined; if (state.sources.size) { sourceEntries = []; for (const value of state.sources) { const entry = { name: 'resources/src@' + calculateSha1(value) + '.txt', value }; if (params.mode === 'compressTraceAndSources') { if (fs.existsSync(entry.value)) entries.push(entry); } else { sourceEntries.push(entry); } } } const artifact = await this._exportZip(entries, state).catch(() => null); return { artifact, sourceEntries }; }).finally(() => { // Only reset trace sha1s, network resources are preserved between chunks. state.traceSha1s = new Set(); state.sources = new Set(); this._isStopping = false; state.recording = false; }) || { artifact: null, sourceEntries: undefined }; } private async _exportZip(entries: NameValue[], state: RecordingState): Promise<Artifact | null> { const zipFile = new yazl.ZipFile(); const result = new ManualPromise<Artifact | null>(); (zipFile as any as EventEmitter).on('error', error => result.reject(error)); for (const entry of entries) zipFile.addFile(entry.value, entry.name); zipFile.end(); const zipFileName = state.traceFile + '.zip'; zipFile.outputStream.pipe(fs.createWriteStream(zipFileName)).on('close', () => { const artifact = new Artifact(this._context, zipFileName); artifact.reportFinished(); result.resolve(artifact); }); return result; } async _captureSnapshot(name: 'before' | 'after' | 'action' | 'event', sdkObject: SdkObject, metadata: CallMetadata, element?: ElementHandle) { if (!this._snapshotter) return; if (!sdkObject.attribution.page) return; if (!this._snapshotter.started()) return; if (!shouldCaptureSnapshot(metadata)) return; const snapshotName = `${name}@${metadata.id}`; metadata.snapshots.push({ title: name, snapshotName }); // We have |element| for input actions (page.click and handle.click) // and |sdkObject| element for accessors like handle.textContent. if (!element && sdkObject instanceof ElementHandle) element = sdkObject; await this._snapshotter.captureSnapshot(sdkObject.attribution.page, snapshotName, element).catch(() => {}); } async onBeforeCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); // Set afterSnapshot name for all the actions that operate selectors. // Elements resolved from selectors will be marked on the snapshot. metadata.afterSnapshot = `after@${metadata.id}`; const beforeSnapshot = this._captureSnapshot('before', sdkObject, metadata); this._pendingCalls.set(metadata.id, { sdkObject, metadata, beforeSnapshot }); if (this._state?.options.sources) { for (const frame of metadata.stack || []) this._state.sources.add(frame.file); } await beforeSnapshot; } async onBeforeInputAction(sdkObject: SdkObject, metadata: CallMetadata, element: ElementHandle) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const actionSnapshot = this._captureSnapshot('action', sdkObject, metadata, element); this._pendingCalls.get(metadata.id)!.actionSnapshot = actionSnapshot; await actionSnapshot; } async onAfterCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const pendingCall = this._pendingCalls.get(metadata.id); if (!pendingCall || pendingCall.afterSnapshot) return; if (!sdkObject.attribution.context) { this._pendingCalls.delete(metadata.id); return; } pendingCall.afterSnapshot = this._captureSnapshot('after', sdkObject, metadata); await pendingCall.afterSnapshot; const event: trace.ActionTraceEvent = { type: 'action', metadata }; this._appendTraceEvent(event); this._pendingCalls.delete(metadata.id); } onEvent(sdkObject: SdkObject, metadata: CallMetadata) { if (!sdkObject.attribution.context) return; const event: trace.ActionTraceEvent = { type: 'event', metadata }; this._appendTraceEvent(event); } onEntryStarted(entry: har.Entry) { } onEntryFinished(entry: har.Entry) { const event: trace.ResourceSnapshotTraceEvent = { type: 'resource-snapshot', snapshot: entry }; this._appendTraceOperation(async () => { visitSha1s(event, this._state!.networkSha1s); await fs.promises.appendFile(this._state!.networkFile, JSON.stringify(event) + '\n'); }); } onContentBlob(sha1: string, buffer: Buffer) { this._appendResource(sha1, buffer); } onSnapshotterBlob(blob: SnapshotterBlob): void { this._appendResource(blob.sha1, blob.buffer); } onFrameSnapshot(snapshot: FrameSnapshot): void { this._appendTraceEvent({ type: 'frame-snapshot', snapshot }); } private _startScreencastInPage(page: Page) { page.setScreencastOptions(kScreencastOptions); const prefix = page.guid; this._screencastListeners.push( eventsHelper.addEventListener(page, Page.Events.ScreencastFrame, params => { const suffix = params.timestamp || Date.now(); const sha1 = `${prefix}-${suffix}.jpeg`; const event: trace.ScreencastFrameTraceEvent = { type: 'screencast-frame', pageId: page.guid, sha1, width: params.width, height: params.height, timestamp: monotonicTime() }; // Make sure to write the screencast frame before adding a reference to it. this._appendResource(sha1, params.buffer); this._appendTraceEvent(event); }), ); } private _appendTraceEvent(event: trace.TraceEvent) { this._appendTraceOperation(async () => { visitSha1s(event, this._state!.traceSha1s); await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(event) + '\n'); }); } private _appendResource(sha1: string, buffer: Buffer) { if (this._allResources.has(sha1)) return; this._allResources.add(sha1); const resourcePath = path.join(this._state!.resourcesDir, sha1); this._appendTraceOperation(async () => { try { // Perhaps we've already written this resource? await fs.promises.access(resourcePath); } catch (e) { // If not, let's write! Note that async access is safe because we // never remove resources until the very end. await fs.promises.writeFile(resourcePath, buffer).catch(() => {}); } }); } private async _appendTraceOperation<T>(cb: () => Promise<T>): Promise<T | undefined> { // This method serializes all writes to the trace. let error: Error | undefined; let result: T | undefined; this._writeChain = this._writeChain.then(async () => { // This check is here because closing the browser removes the tracesDir and tracing // dies trying to archive. if (this._context instanceof BrowserContext && !this._context._browser.isConnected()) return; try { result = await cb(); } catch (e) { error = e; } }); await this._writeChain; if (error) throw error; return result; } } function visitSha1s(object: any, sha1s: Set<string>) { if (Array.isArray(object)) { object.forEach(o => visitSha1s(o, sha1s)); return; } if (typeof object === 'object') { for (const key in object) { if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) { const sha1 = object[key]; if (sha1) sha1s.add(sha1); } visitSha1s(object[key], sha1s); } return; } } export function shouldCaptureSnapshot(metadata: CallMetadata): boolean { return commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method); }
packages/playwright-core/src/server/trace/recorder/tracing.ts
1
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.9925162196159363, 0.023046819493174553, 0.00016466333181597292, 0.0001723953173495829, 0.1418546438217163 ]
{ "id": 4, "code_window": [ " if (sha1)\n", " sha1s.add(sha1);\n", " }\n", " visitSha1s(object[key], sha1s);\n", " }\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep" ], "after_edit": [ " result[key] = visitTraceEvent(object[key], sha1s);\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 466 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the 'License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type * as channels from '@protocol/channels'; import type { Tracing } from '../trace/recorder/tracing'; import { ArtifactDispatcher } from './artifactDispatcher'; import { Dispatcher, existingDispatcher } from './dispatcher'; import type { BrowserContextDispatcher } from './browserContextDispatcher'; import type { APIRequestContextDispatcher } from './networkDispatchers'; export class TracingDispatcher extends Dispatcher<Tracing, channels.TracingChannel, BrowserContextDispatcher | APIRequestContextDispatcher> implements channels.TracingChannel { _type_Tracing = true; static from(scope: BrowserContextDispatcher | APIRequestContextDispatcher, tracing: Tracing): TracingDispatcher { const result = existingDispatcher<TracingDispatcher>(tracing); return result || new TracingDispatcher(scope, tracing); } constructor(scope: BrowserContextDispatcher | APIRequestContextDispatcher, tracing: Tracing) { super(scope, tracing, 'Tracing', {}); } async tracingStart(params: channels.TracingTracingStartParams): Promise<channels.TracingTracingStartResult> { await this._object.start(params); } async tracingStartChunk(params: channels.TracingTracingStartChunkParams): Promise<channels.TracingTracingStartChunkResult> { await this._object.startChunk(params); } async tracingStopChunk(params: channels.TracingTracingStopChunkParams): Promise<channels.TracingTracingStopChunkResult> { const { artifact, sourceEntries } = await this._object.stopChunk(params); return { artifact: artifact ? new ArtifactDispatcher(this, artifact) : undefined, sourceEntries }; } async tracingStop(params: channels.TracingTracingStopParams): Promise<channels.TracingTracingStopResult> { await this._object.stop(); } }
packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.0006588863907381892, 0.0002562346344348043, 0.00016911652346607298, 0.00017730414401739836, 0.0001801012404030189 ]
{ "id": 4, "code_window": [ " if (sha1)\n", " sha1s.add(sha1);\n", " }\n", " visitSha1s(object[key], sha1s);\n", " }\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep" ], "after_edit": [ " result[key] = visitTraceEvent(object[key], sha1s);\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 466 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import crypto from 'crypto'; import os from 'os'; import path from 'path'; import fs from 'fs'; import { sourceMapSupport, pirates } from './utilsBundle'; import url from 'url'; import type { Location } from './types'; import type { TsConfigLoaderResult } from './third_party/tsconfig-loader'; import { tsConfigLoader } from './third_party/tsconfig-loader'; import Module from 'module'; import type { BabelTransformFunction } from './babelBundle'; const version = 13; const cacheDir = process.env.PWTEST_CACHE_DIR || path.join(os.tmpdir(), 'playwright-transform-cache'); const sourceMaps: Map<string, string> = new Map(); type ParsedTsConfigData = { absoluteBaseUrl: string; paths: { key: string, values: string[] }[]; }; const cachedTSConfigs = new Map<string, ParsedTsConfigData | undefined>(); const kStackTraceLimit = 15; Error.stackTraceLimit = kStackTraceLimit; sourceMapSupport.install({ environment: 'node', handleUncaughtExceptions: false, retrieveSourceMap(source) { if (!sourceMaps.has(source)) return null; const sourceMapPath = sourceMaps.get(source)!; if (!fs.existsSync(sourceMapPath)) return null; return { map: JSON.parse(fs.readFileSync(sourceMapPath, 'utf-8')), url: source }; } }); function calculateCachePath(content: string, filePath: string, isModule: boolean): string { const hash = crypto.createHash('sha1') .update(process.env.PW_TEST_SOURCE_TRANSFORM || '') .update(isModule ? 'esm' : 'no_esm') .update(content) .update(filePath) .update(String(version)) .digest('hex'); const fileName = path.basename(filePath, path.extname(filePath)).replace(/\W/g, '') + '_' + hash; return path.join(cacheDir, hash[0] + hash[1], fileName); } function validateTsConfig(tsconfig: TsConfigLoaderResult): ParsedTsConfigData | undefined { if (!tsconfig.tsConfigPath || !tsconfig.baseUrl) return; // Make 'baseUrl' absolute, because it is relative to the tsconfig.json, not to cwd. const absoluteBaseUrl = path.resolve(path.dirname(tsconfig.tsConfigPath), tsconfig.baseUrl); const paths = tsconfig.paths || { '*': ['*'] }; return { absoluteBaseUrl, paths: Object.entries(paths).map(([key, values]) => ({ key, values })) }; } function loadAndValidateTsconfigForFile(file: string): ParsedTsConfigData | undefined { const cwd = path.dirname(file); if (!cachedTSConfigs.has(cwd)) { const loaded = tsConfigLoader({ cwd }); cachedTSConfigs.set(cwd, validateTsConfig(loaded)); } return cachedTSConfigs.get(cwd); } const pathSeparator = process.platform === 'win32' ? ';' : ':'; const scriptPreprocessor = process.env.PW_TEST_SOURCE_TRANSFORM ? require(process.env.PW_TEST_SOURCE_TRANSFORM) : undefined; const builtins = new Set(Module.builtinModules); export function resolveHook(isModule: boolean, filename: string, specifier: string): string | undefined { if (builtins.has(specifier)) return; const isTypeScript = filename.endsWith('.ts') || filename.endsWith('.tsx'); const tsconfig = isTypeScript ? loadAndValidateTsconfigForFile(filename) : undefined; if (tsconfig && !isRelativeSpecifier(specifier)) { let longestPrefixLength = -1; let pathMatchedByLongestPrefix: string | undefined; for (const { key, values } of tsconfig.paths) { let matchedPartOfSpecifier = specifier; const [keyPrefix, keySuffix] = key.split('*'); if (key.includes('*')) { // * If pattern contains '*' then to match pattern "<prefix>*<suffix>" module name must start with the <prefix> and end with <suffix>. // * <MatchedStar> denotes part of the module name between <prefix> and <suffix>. // * If module name can be matches with multiple patterns then pattern with the longest prefix will be picked. // https://github.com/microsoft/TypeScript/blob/f82d0cb3299c04093e3835bc7e29f5b40475f586/src/compiler/moduleNameResolver.ts#L1049 if (keyPrefix) { if (!specifier.startsWith(keyPrefix)) continue; matchedPartOfSpecifier = matchedPartOfSpecifier.substring(keyPrefix.length, matchedPartOfSpecifier.length); } if (keySuffix) { if (!specifier.endsWith(keySuffix)) continue; matchedPartOfSpecifier = matchedPartOfSpecifier.substring(0, matchedPartOfSpecifier.length - keySuffix.length); } } else { if (specifier !== key) continue; matchedPartOfSpecifier = specifier; } for (const value of values) { let candidate: string = value; if (value.includes('*')) candidate = candidate.replace('*', matchedPartOfSpecifier); candidate = path.resolve(tsconfig.absoluteBaseUrl, candidate.replace(/\//g, path.sep)); if (isModule) { const transformed = js2ts(candidate); if (transformed || fs.existsSync(candidate)) { if (keyPrefix.length > longestPrefixLength) { longestPrefixLength = keyPrefix.length; pathMatchedByLongestPrefix = transformed || candidate; } } } else { for (const ext of ['', '.js', '.ts', '.mjs', '.cjs', '.jsx', '.tsx', '.cjs', '.mts', '.cts']) { if (fs.existsSync(candidate + ext)) { if (keyPrefix.length > longestPrefixLength) { longestPrefixLength = keyPrefix.length; pathMatchedByLongestPrefix = candidate; } } } } } } if (pathMatchedByLongestPrefix) return pathMatchedByLongestPrefix; } if (isModule) return js2ts(path.resolve(path.dirname(filename), specifier)); } export function js2ts(resolved: string): string | undefined { const match = resolved.match(/(.*)(\.js|\.jsx|\.mjs)$/); if (match) { const tsResolved = match[1] + match[2].replace('j', 't'); if (!fs.existsSync(resolved) && fs.existsSync(tsResolved)) return tsResolved; } } export function transformHook(code: string, filename: string, moduleUrl?: string): string { // If we are not TypeScript and there is no applicable preprocessor - bail out. const isModule = !!moduleUrl; const isTypeScript = filename.endsWith('.ts') || filename.endsWith('.tsx'); const hasPreprocessor = process.env.PW_TEST_SOURCE_TRANSFORM && process.env.PW_TEST_SOURCE_TRANSFORM_SCOPE && process.env.PW_TEST_SOURCE_TRANSFORM_SCOPE.split(pathSeparator).some(f => filename.startsWith(f)); const cachePath = calculateCachePath(code, filename, isModule); const codePath = cachePath + '.js'; const sourceMapPath = cachePath + '.map'; sourceMaps.set(moduleUrl || filename, sourceMapPath); if (!process.env.PW_IGNORE_COMPILE_CACHE && fs.existsSync(codePath)) return fs.readFileSync(codePath, 'utf8'); // We don't use any browserslist data, but babel checks it anyway. // Silence the annoying warning. process.env.BROWSERSLIST_IGNORE_OLD_DATA = 'true'; try { const { babelTransform }: { babelTransform: BabelTransformFunction } = require('./babelBundle'); const result = babelTransform(filename, isTypeScript, isModule, hasPreprocessor ? scriptPreprocessor : undefined, [require.resolve('./tsxTransform')]); if (result.code) { fs.mkdirSync(path.dirname(cachePath), { recursive: true }); if (result.map) fs.writeFileSync(sourceMapPath, JSON.stringify(result.map), 'utf8'); fs.writeFileSync(codePath, result.code, 'utf8'); } return result.code || ''; } catch (e) { // Re-throw error with a playwright-test stack // that could be filtered out. throw new Error(e.message); } } export function installTransform(): () => void { let reverted = false; const originalResolveFilename = (Module as any)._resolveFilename; function resolveFilename(this: any, specifier: string, parent: Module, ...rest: any[]) { if (!reverted && parent) { const resolved = resolveHook(false, parent.filename, specifier); if (resolved !== undefined) specifier = resolved; } return originalResolveFilename.call(this, specifier, parent, ...rest); } (Module as any)._resolveFilename = resolveFilename; const revertPirates = pirates.addHook((code: string, filename: string) => { if (belongsToNodeModules(filename)) return code; return transformHook(code, filename); }, { exts: ['.ts', '.tsx', '.js', '.jsx', '.mjs'] }); return () => { reverted = true; (Module as any)._resolveFilename = originalResolveFilename; revertPirates(); }; } export function wrapFunctionWithLocation<A extends any[], R>(func: (location: Location, ...args: A) => R): (...args: A) => R { return (...args) => { const oldPrepareStackTrace = Error.prepareStackTrace; Error.prepareStackTrace = (error, stackFrames) => { const frame: NodeJS.CallSite = sourceMapSupport.wrapCallSite(stackFrames[1]); const fileName = frame.getFileName(); // Node error stacks for modules use file:// urls instead of paths. const file = (fileName && fileName.startsWith('file://')) ? url.fileURLToPath(fileName) : fileName; return { file, line: frame.getLineNumber(), column: frame.getColumnNumber(), }; }; Error.stackTraceLimit = 2; const obj: { stack: Location } = {} as any; Error.captureStackTrace(obj); const location = obj.stack; Error.stackTraceLimit = kStackTraceLimit; Error.prepareStackTrace = oldPrepareStackTrace; return func(location, ...args); }; } // This will catch the playwright-test package as well const kPlaywrightInternalPrefix = path.resolve(__dirname, '../../playwright'); const kPlaywrightCoveragePrefix = path.resolve(__dirname, '../../../tests/config/coverage.js'); export function belongsToNodeModules(file: string) { if (file.includes(`${path.sep}node_modules${path.sep}`)) return true; if (file.startsWith(kPlaywrightInternalPrefix)) return true; if (file.startsWith(kPlaywrightCoveragePrefix)) return true; return false; } function isRelativeSpecifier(specifier: string) { return specifier === '.' || specifier === '..' || specifier.startsWith('./') || specifier.startsWith('../'); }
packages/playwright-test/src/transform.ts
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.0028503688517957926, 0.00034547358518466353, 0.00016692487406544387, 0.0001721539010759443, 0.0005999274435453117 ]
{ "id": 4, "code_window": [ " if (sha1)\n", " sha1s.add(sha1);\n", " }\n", " visitSha1s(object[key], sha1s);\n", " }\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep" ], "after_edit": [ " result[key] = visitTraceEvent(object[key], sha1s);\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 466 }
import '../src/assets/index.css'; import { beforeMount, afterMount } from '@playwright/experimental-ct-solid/hooks'; beforeMount(async ({ hooksConfig }) => { console.log(`Before mount: ${JSON.stringify(hooksConfig)}`); }); afterMount(async ({}) => { console.log(`After mount`); });
tests/components/ct-solid/playwright/index.js
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.0001790991664165631, 0.00017789486446417868, 0.00017669054795987904, 0.00017789486446417868, 0.0000012043092283420265 ]
{ "id": 5, "code_window": [ " }\n", " return;\n", " }\n" ], "labels": [ "keep", "replace", "keep" ], "after_edit": [ " return result;\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 468 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { EventEmitter } from 'events'; import fs from 'fs'; import os from 'os'; import path from 'path'; import type { NameValue } from '../../../common/types'; import type { TracingTracingStopChunkParams } from '@protocol/channels'; import { commandsWithTracingSnapshots } from '../../../protocol/debug'; import { ManualPromise } from '../../../utils/manualPromise'; import type { RegisteredListener } from '../../../utils/eventsHelper'; import { eventsHelper } from '../../../utils/eventsHelper'; import { assert, calculateSha1, createGuid, monotonicTime } from '../../../utils'; import { mkdirIfNeeded, removeFolders } from '../../../utils/fileUtils'; import { Artifact } from '../../artifact'; import { BrowserContext } from '../../browserContext'; import { ElementHandle } from '../../dom'; import type { APIRequestContext } from '../../fetch'; import type { CallMetadata, InstrumentationListener } from '../../instrumentation'; import { SdkObject } from '../../instrumentation'; import { Page } from '../../page'; import type * as har from '@trace/har'; import type { HarTracerDelegate } from '../../har/harTracer'; import { HarTracer } from '../../har/harTracer'; import type { FrameSnapshot } from '@trace/snapshot'; import type * as trace from '@trace/trace'; import type { VERSION } from '@trace/trace'; import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter'; import { Snapshotter } from './snapshotter'; import { yazl } from '../../../zipBundle'; const version: VERSION = 3; export type TracerOptions = { name?: string; snapshots?: boolean; screenshots?: boolean; sources?: boolean; }; type RecordingState = { options: TracerOptions, traceName: string, networkFile: string, traceFile: string, tracesDir: string, resourcesDir: string, filesCount: number, networkSha1s: Set<string>, traceSha1s: Set<string>, sources: Set<string>, recording: boolean; }; const kScreencastOptions = { width: 800, height: 600, quality: 90 }; export class Tracing extends SdkObject implements InstrumentationListener, SnapshotterDelegate, HarTracerDelegate { private _writeChain = Promise.resolve(); private _snapshotter?: Snapshotter; private _harTracer: HarTracer; private _screencastListeners: RegisteredListener[] = []; private _pendingCalls = new Map<string, { sdkObject: SdkObject, metadata: CallMetadata, beforeSnapshot: Promise<void>, actionSnapshot?: Promise<void>, afterSnapshot?: Promise<void> }>(); private _context: BrowserContext | APIRequestContext; private _state: RecordingState | undefined; private _isStopping = false; private _precreatedTracesDir: string | undefined; private _tracesTmpDir: string | undefined; private _allResources = new Set<string>(); private _contextCreatedEvent: trace.ContextCreatedTraceEvent; constructor(context: BrowserContext | APIRequestContext, tracesDir: string | undefined) { super(context, 'tracing'); this._context = context; this._precreatedTracesDir = tracesDir; this._harTracer = new HarTracer(context, null, this, { content: 'attach', includeTraceInfo: true, recordRequestOverrides: false, waitForContentOnStop: false, skipScripts: true, }); this._contextCreatedEvent = { version, type: 'context-options', browserName: '', options: {}, platform: process.platform, wallTime: 0, }; if (context instanceof BrowserContext) { this._snapshotter = new Snapshotter(context, this); assert(tracesDir, 'tracesDir must be specified for BrowserContext'); this._contextCreatedEvent.browserName = context._browser.options.name; this._contextCreatedEvent.options = context._options; } } async start(options: TracerOptions) { if (this._isStopping) throw new Error('Cannot start tracing while stopping'); if (this._state) { const o = this._state.options; if (o.name !== options.name || !o.screenshots !== !options.screenshots || !o.snapshots !== !options.snapshots) throw new Error('Tracing has been already started with different options'); return; } // TODO: passing the same name for two contexts makes them write into a single file // and conflict. const traceName = options.name || createGuid(); // Init the state synchrounously. this._state = { options, traceName, traceFile: '', networkFile: '', tracesDir: '', resourcesDir: '', filesCount: 0, traceSha1s: new Set(), networkSha1s: new Set(), sources: new Set(), recording: false }; const state = this._state; state.tracesDir = await this._createTracesDirIfNeeded(); state.resourcesDir = path.join(state.tracesDir, 'resources'); state.traceFile = path.join(state.tracesDir, traceName + '.trace'); state.networkFile = path.join(state.tracesDir, traceName + '.network'); this._writeChain = fs.promises.mkdir(state.resourcesDir, { recursive: true }).then(() => fs.promises.writeFile(state.networkFile, '')); if (options.snapshots) this._harTracer.start(); } async startChunk(options: { title?: string } = {}) { if (this._state && this._state.recording) await this.stopChunk({ mode: 'doNotSave' }); if (!this._state) throw new Error('Must start tracing before starting a new chunk'); if (this._isStopping) throw new Error('Cannot start a trace chunk while stopping'); const state = this._state; const suffix = state.filesCount ? `-${state.filesCount}` : ``; state.filesCount++; state.traceFile = path.join(state.tracesDir, `${state.traceName}${suffix}.trace`); state.recording = true; this._appendTraceOperation(async () => { await mkdirIfNeeded(state.traceFile); await fs.promises.appendFile(state.traceFile, JSON.stringify({ ...this._contextCreatedEvent, title: options.title, wallTime: Date.now() }) + '\n'); }); this._context.instrumentation.addListener(this, this._context); if (state.options.screenshots) this._startScreencast(); if (state.options.snapshots) await this._snapshotter?.start(); } private _startScreencast() { if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) this._startScreencastInPage(page); this._screencastListeners.push( eventsHelper.addEventListener(this._context, BrowserContext.Events.Page, this._startScreencastInPage.bind(this)), ); } private _stopScreencast() { eventsHelper.removeEventListeners(this._screencastListeners); if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) page.setScreencastOptions(null); } async stop() { if (!this._state) return; if (this._isStopping) throw new Error(`Tracing is already stopping`); if (this._state.recording) throw new Error(`Must stop trace file before stopping tracing`); this._harTracer.stop(); await this._writeChain; this._state = undefined; } async deleteTmpTracesDir() { if (this._tracesTmpDir) await removeFolders([this._tracesTmpDir]); } private async _createTracesDirIfNeeded() { if (this._precreatedTracesDir) return this._precreatedTracesDir; this._tracesTmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'playwright-tracing-')); return this._tracesTmpDir; } async dispose() { this._snapshotter?.dispose(); this._harTracer.stop(); await this._writeChain; } async stopChunk(params: TracingTracingStopChunkParams): Promise<{ artifact: Artifact | null, sourceEntries: NameValue[] | undefined }> { if (this._isStopping) throw new Error(`Tracing is already stopping`); this._isStopping = true; if (!this._state || !this._state.recording) { this._isStopping = false; if (params.mode !== 'doNotSave') throw new Error(`Must start tracing before stopping`); return { artifact: null, sourceEntries: [] }; } const state = this._state!; this._context.instrumentation.removeListener(this); if (this._state?.options.screenshots) this._stopScreencast(); for (const { sdkObject, metadata, beforeSnapshot, actionSnapshot, afterSnapshot } of this._pendingCalls.values()) { await Promise.all([beforeSnapshot, actionSnapshot, afterSnapshot]); let callMetadata = metadata; if (!afterSnapshot) { // Note: we should not modify metadata here to avoid side-effects in any other place. callMetadata = { ...metadata, error: { error: { name: 'Error', message: 'Action was interrupted' } }, }; } await this.onAfterCall(sdkObject, callMetadata); } if (state.options.snapshots) await this._snapshotter?.stop(); // Chain the export operation against write operations, // so that neither trace files nor sha1s change during the export. return await this._appendTraceOperation(async () => { if (params.mode === 'doNotSave') return { artifact: null, sourceEntries: undefined }; // Har files a live, make a snapshot before returning the resulting entries. const networkFile = path.join(state.networkFile, '..', createGuid()); await fs.promises.copyFile(state.networkFile, networkFile); const entries: NameValue[] = []; entries.push({ name: 'trace.trace', value: state.traceFile }); entries.push({ name: 'trace.network', value: networkFile }); for (const sha1 of new Set([...state.traceSha1s, ...state.networkSha1s])) entries.push({ name: path.join('resources', sha1), value: path.join(state.resourcesDir, sha1) }); let sourceEntries: NameValue[] | undefined; if (state.sources.size) { sourceEntries = []; for (const value of state.sources) { const entry = { name: 'resources/src@' + calculateSha1(value) + '.txt', value }; if (params.mode === 'compressTraceAndSources') { if (fs.existsSync(entry.value)) entries.push(entry); } else { sourceEntries.push(entry); } } } const artifact = await this._exportZip(entries, state).catch(() => null); return { artifact, sourceEntries }; }).finally(() => { // Only reset trace sha1s, network resources are preserved between chunks. state.traceSha1s = new Set(); state.sources = new Set(); this._isStopping = false; state.recording = false; }) || { artifact: null, sourceEntries: undefined }; } private async _exportZip(entries: NameValue[], state: RecordingState): Promise<Artifact | null> { const zipFile = new yazl.ZipFile(); const result = new ManualPromise<Artifact | null>(); (zipFile as any as EventEmitter).on('error', error => result.reject(error)); for (const entry of entries) zipFile.addFile(entry.value, entry.name); zipFile.end(); const zipFileName = state.traceFile + '.zip'; zipFile.outputStream.pipe(fs.createWriteStream(zipFileName)).on('close', () => { const artifact = new Artifact(this._context, zipFileName); artifact.reportFinished(); result.resolve(artifact); }); return result; } async _captureSnapshot(name: 'before' | 'after' | 'action' | 'event', sdkObject: SdkObject, metadata: CallMetadata, element?: ElementHandle) { if (!this._snapshotter) return; if (!sdkObject.attribution.page) return; if (!this._snapshotter.started()) return; if (!shouldCaptureSnapshot(metadata)) return; const snapshotName = `${name}@${metadata.id}`; metadata.snapshots.push({ title: name, snapshotName }); // We have |element| for input actions (page.click and handle.click) // and |sdkObject| element for accessors like handle.textContent. if (!element && sdkObject instanceof ElementHandle) element = sdkObject; await this._snapshotter.captureSnapshot(sdkObject.attribution.page, snapshotName, element).catch(() => {}); } async onBeforeCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); // Set afterSnapshot name for all the actions that operate selectors. // Elements resolved from selectors will be marked on the snapshot. metadata.afterSnapshot = `after@${metadata.id}`; const beforeSnapshot = this._captureSnapshot('before', sdkObject, metadata); this._pendingCalls.set(metadata.id, { sdkObject, metadata, beforeSnapshot }); if (this._state?.options.sources) { for (const frame of metadata.stack || []) this._state.sources.add(frame.file); } await beforeSnapshot; } async onBeforeInputAction(sdkObject: SdkObject, metadata: CallMetadata, element: ElementHandle) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const actionSnapshot = this._captureSnapshot('action', sdkObject, metadata, element); this._pendingCalls.get(metadata.id)!.actionSnapshot = actionSnapshot; await actionSnapshot; } async onAfterCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const pendingCall = this._pendingCalls.get(metadata.id); if (!pendingCall || pendingCall.afterSnapshot) return; if (!sdkObject.attribution.context) { this._pendingCalls.delete(metadata.id); return; } pendingCall.afterSnapshot = this._captureSnapshot('after', sdkObject, metadata); await pendingCall.afterSnapshot; const event: trace.ActionTraceEvent = { type: 'action', metadata }; this._appendTraceEvent(event); this._pendingCalls.delete(metadata.id); } onEvent(sdkObject: SdkObject, metadata: CallMetadata) { if (!sdkObject.attribution.context) return; const event: trace.ActionTraceEvent = { type: 'event', metadata }; this._appendTraceEvent(event); } onEntryStarted(entry: har.Entry) { } onEntryFinished(entry: har.Entry) { const event: trace.ResourceSnapshotTraceEvent = { type: 'resource-snapshot', snapshot: entry }; this._appendTraceOperation(async () => { visitSha1s(event, this._state!.networkSha1s); await fs.promises.appendFile(this._state!.networkFile, JSON.stringify(event) + '\n'); }); } onContentBlob(sha1: string, buffer: Buffer) { this._appendResource(sha1, buffer); } onSnapshotterBlob(blob: SnapshotterBlob): void { this._appendResource(blob.sha1, blob.buffer); } onFrameSnapshot(snapshot: FrameSnapshot): void { this._appendTraceEvent({ type: 'frame-snapshot', snapshot }); } private _startScreencastInPage(page: Page) { page.setScreencastOptions(kScreencastOptions); const prefix = page.guid; this._screencastListeners.push( eventsHelper.addEventListener(page, Page.Events.ScreencastFrame, params => { const suffix = params.timestamp || Date.now(); const sha1 = `${prefix}-${suffix}.jpeg`; const event: trace.ScreencastFrameTraceEvent = { type: 'screencast-frame', pageId: page.guid, sha1, width: params.width, height: params.height, timestamp: monotonicTime() }; // Make sure to write the screencast frame before adding a reference to it. this._appendResource(sha1, params.buffer); this._appendTraceEvent(event); }), ); } private _appendTraceEvent(event: trace.TraceEvent) { this._appendTraceOperation(async () => { visitSha1s(event, this._state!.traceSha1s); await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(event) + '\n'); }); } private _appendResource(sha1: string, buffer: Buffer) { if (this._allResources.has(sha1)) return; this._allResources.add(sha1); const resourcePath = path.join(this._state!.resourcesDir, sha1); this._appendTraceOperation(async () => { try { // Perhaps we've already written this resource? await fs.promises.access(resourcePath); } catch (e) { // If not, let's write! Note that async access is safe because we // never remove resources until the very end. await fs.promises.writeFile(resourcePath, buffer).catch(() => {}); } }); } private async _appendTraceOperation<T>(cb: () => Promise<T>): Promise<T | undefined> { // This method serializes all writes to the trace. let error: Error | undefined; let result: T | undefined; this._writeChain = this._writeChain.then(async () => { // This check is here because closing the browser removes the tracesDir and tracing // dies trying to archive. if (this._context instanceof BrowserContext && !this._context._browser.isConnected()) return; try { result = await cb(); } catch (e) { error = e; } }); await this._writeChain; if (error) throw error; return result; } } function visitSha1s(object: any, sha1s: Set<string>) { if (Array.isArray(object)) { object.forEach(o => visitSha1s(o, sha1s)); return; } if (typeof object === 'object') { for (const key in object) { if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) { const sha1 = object[key]; if (sha1) sha1s.add(sha1); } visitSha1s(object[key], sha1s); } return; } } export function shouldCaptureSnapshot(metadata: CallMetadata): boolean { return commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method); }
packages/playwright-core/src/server/trace/recorder/tracing.ts
1
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.12207186967134476, 0.0028543954249471426, 0.00016421222244389355, 0.00017193461826536804, 0.017396382987499237 ]
{ "id": 5, "code_window": [ " }\n", " return;\n", " }\n" ], "labels": [ "keep", "replace", "keep" ], "after_edit": [ " return result;\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 468 }
/** * Copyright 2017 Google Inc. All rights reserved. * Modifications copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { test as it, expect } from './pageTest'; const expectedOutput = '<html><head></head><body><div>hello</div></body></html>'; it('should work @smoke', async ({ page, server }) => { await page.setContent('<div>hello</div>'); const result = await page.content(); expect(result).toBe(expectedOutput); }); it('should work with domcontentloaded', async ({ page, server }) => { await page.setContent('<div>hello</div>', { waitUntil: 'domcontentloaded' }); const result = await page.content(); expect(result).toBe(expectedOutput); }); it('should work with commit', async ({ page }) => { await page.setContent('<div>hello</div>', { waitUntil: 'commit' }); const result = await page.content(); expect(result).toBe(expectedOutput); }); it('should work with doctype', async ({ page, server }) => { const doctype = '<!DOCTYPE html>'; await page.setContent(`${doctype}<div>hello</div>`); const result = await page.content(); expect(result).toBe(`${doctype}${expectedOutput}`); }); it('should work with HTML 4 doctype', async ({ page, server }) => { const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" ' + '"http://www.w3.org/TR/html4/strict.dtd">'; await page.setContent(`${doctype}<div>hello</div>`); const result = await page.content(); expect(result).toBe(`${doctype}${expectedOutput}`); }); it('should respect timeout', async ({ page, server, playwright }) => { const imgPath = '/img.png'; // stall for image server.setRoute(imgPath, (req, res) => {}); let error = null; await page.setContent(`<img src="${server.PREFIX + imgPath}"></img>`, { timeout: 1 }).catch(e => error = e); expect(error).toBeInstanceOf(playwright.errors.TimeoutError); }); it('should respect default navigation timeout', async ({ page, server, playwright }) => { page.setDefaultNavigationTimeout(1); const imgPath = '/img.png'; // stall for image server.setRoute(imgPath, (req, res) => {}); const error = await page.setContent(`<img src="${server.PREFIX + imgPath}"></img>`).catch(e => e); expect(error.message).toContain('page.setContent: Timeout 1ms exceeded.'); expect(error).toBeInstanceOf(playwright.errors.TimeoutError); }); it('should await resources to load', async ({ page, server }) => { const imgPath = '/img.png'; let imgResponse = null; server.setRoute(imgPath, (req, res) => imgResponse = res); let loaded = false; const contentPromise = page.setContent(`<img src="${server.PREFIX + imgPath}"></img>`).then(() => loaded = true); await server.waitForRequest(imgPath); expect(loaded).toBe(false); imgResponse.end(); await contentPromise; }); it('should work fast enough', async ({ page, server }) => { for (let i = 0; i < 20; ++i) await page.setContent('<div>yo</div>'); }); it('should work with tricky content', async ({ page, server }) => { await page.setContent('<div>hello world</div>' + '\x7F'); expect(await page.$eval('div', div => div.textContent)).toBe('hello world'); }); it('should work with accents', async ({ page, server }) => { await page.setContent('<div>aberración</div>'); expect(await page.$eval('div', div => div.textContent)).toBe('aberración'); }); it('should work with emojis', async ({ page, server }) => { await page.setContent('<div>🐥</div>'); expect(await page.$eval('div', div => div.textContent)).toBe('🐥'); }); it('should work with newline', async ({ page, server }) => { await page.setContent('<div>\n</div>'); expect(await page.$eval('div', div => div.textContent)).toBe('\n'); }); it('content() should throw nice error during navigation', async ({ page, server }) => { for (let timeout = 0; timeout < 200; timeout += 20) { await page.setContent('<div>hello</div>'); const promise = page.goto(server.EMPTY_PAGE); await page.waitForTimeout(timeout); const [contentOrError] = await Promise.all([ page.content().catch(e => e), promise, ]); const emptyOutput = '<html><head></head><body></body></html>'; if (contentOrError !== expectedOutput && contentOrError !== emptyOutput) expect(contentOrError?.message).toContain('Unable to retrieve content because the page is navigating and changing the content.'); } }); it('should return empty content there is no iframe src', async ({ page }) => { it.fixme(true, 'Hangs in all browsers because there is no utility context'); await page.setContent(`<iframe src="javascript:console.log(1)"></iframe>`); expect(page.frames().length).toBe(2); expect(await page.frames()[1].content()).toBe('<html><head></head><body></body></html>'); });
tests/page/page-set-content.spec.ts
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.0003937448491342366, 0.00019030780822504312, 0.00016538619820494205, 0.00016900734044611454, 0.00005831027738167904 ]
{ "id": 5, "code_window": [ " }\n", " return;\n", " }\n" ], "labels": [ "keep", "replace", "keep" ], "after_edit": [ " return result;\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 468 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import dns from 'dns'; import EventEmitter from 'events'; import type { AddressInfo } from 'net'; import net from 'net'; import util from 'util'; import { debugLogger } from './debugLogger'; import { createSocket } from './netUtils'; import { assert, createGuid } from '../utils'; const dnsLookupAsync = util.promisify(dns.lookup); // https://tools.ietf.org/html/rfc1928 enum SocksAuth { NO_AUTHENTICATION_REQUIRED = 0x00, GSSAPI = 0x01, USERNAME_PASSWORD = 0x02, NO_ACCEPTABLE_METHODS = 0xFF } enum SocksAddressType { IPv4 = 0x01, FqName = 0x03, IPv6 = 0x04 } enum SocksCommand { CONNECT = 0x01, BIND = 0x02, UDP_ASSOCIATE = 0x03 } enum SocksReply { Succeeded = 0x00, GeneralServerFailure = 0x01, NotAllowedByRuleSet = 0x02, NetworkUnreachable = 0x03, HostUnreachable = 0x04, ConnectionRefused = 0x05, TtlExpired = 0x06, CommandNotSupported = 0x07, AddressTypeNotSupported = 0x08 } export type SocksSocketRequestedPayload = { uid: string, host: string, port: number }; export type SocksSocketConnectedPayload = { uid: string, host: string, port: number }; export type SocksSocketDataPayload = { uid: string, data: Buffer }; export type SocksSocketErrorPayload = { uid: string, error: string }; export type SocksSocketFailedPayload = { uid: string, errorCode: string }; export type SocksSocketClosedPayload = { uid: string }; export type SocksSocketEndPayload = { uid: string }; interface SocksConnectionClient { onSocketRequested(payload: SocksSocketRequestedPayload): void; onSocketData(payload: SocksSocketDataPayload): void; onSocketClosed(payload: SocksSocketClosedPayload): void; } class SocksConnection { private _buffer = Buffer.from([]); private _offset = 0; private _fence = 0; private _fenceCallback: (() => void) | undefined; private _socket: net.Socket; private _boundOnData: (buffer: Buffer) => void; private _uid: string; private _client: SocksConnectionClient; constructor(uid: string, socket: net.Socket, client: SocksConnectionClient) { this._uid = uid; this._socket = socket; this._client = client; this._boundOnData = this._onData.bind(this); socket.on('data', this._boundOnData); socket.on('close', () => this._onClose()); socket.on('end', () => this._onClose()); socket.on('error', () => this._onClose()); this._run().catch(() => this._socket.end()); } async _run() { assert(await this._authenticate()); const { command, host, port } = await this._parseRequest(); if (command !== SocksCommand.CONNECT) { this._writeBytes(Buffer.from([ 0x05, SocksReply.CommandNotSupported, 0x00, // RSV 0x01, // IPv4 0x00, 0x00, 0x00, 0x00, // Address 0x00, 0x00 // Port ])); return; } this._socket.off('data', this._boundOnData); this._client.onSocketRequested({ uid: this._uid, host, port }); } async _authenticate(): Promise<boolean> { // Request: // +----+----------+----------+ // |VER | NMETHODS | METHODS | // +----+----------+----------+ // | 1 | 1 | 1 to 255 | // +----+----------+----------+ // Response: // +----+--------+ // |VER | METHOD | // +----+--------+ // | 1 | 1 | // +----+--------+ const version = await this._readByte(); assert(version === 0x05, 'The VER field must be set to x05 for this version of the protocol, was ' + version); const nMethods = await this._readByte(); assert(nMethods, 'No authentication methods specified'); const methods = await this._readBytes(nMethods); for (const method of methods) { if (method === 0) { this._writeBytes(Buffer.from([version, method])); return true; } } this._writeBytes(Buffer.from([version, SocksAuth.NO_ACCEPTABLE_METHODS])); return false; } async _parseRequest(): Promise<{ host: string, port: number, command: SocksCommand }> { // Request. // +----+-----+-------+------+----------+----------+ // |VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT | // +----+-----+-------+------+----------+----------+ // | 1 | 1 | X'00' | 1 | Variable | 2 | // +----+-----+-------+------+----------+----------+ // Response. // +----+-----+-------+------+----------+----------+ // |VER | REP | RSV | ATYP | BND.ADDR | BND.PORT | // +----+-----+-------+------+----------+----------+ // | 1 | 1 | X'00' | 1 | Variable | 2 | // +----+-----+-------+------+----------+----------+ const version = await this._readByte(); assert(version === 0x05, 'The VER field must be set to x05 for this version of the protocol, was ' + version); const command = await this._readByte(); await this._readByte(); // skip reserved. const addressType = await this._readByte(); let host = ''; switch (addressType) { case SocksAddressType.IPv4: host = (await this._readBytes(4)).join('.'); break; case SocksAddressType.FqName: const length = await this._readByte(); host = (await this._readBytes(length)).toString(); break; case SocksAddressType.IPv6: const bytes = await this._readBytes(16); const tokens = []; for (let i = 0; i < 8; ++i) tokens.push(bytes.readUInt16BE(i * 2)); host = tokens.join(':'); break; } const port = (await this._readBytes(2)).readUInt16BE(0); this._buffer = Buffer.from([]); this._offset = 0; this._fence = 0; return { command, host, port }; } private async _readByte(): Promise<number> { const buffer = await this._readBytes(1); return buffer[0]; } private async _readBytes(length: number): Promise<Buffer> { this._fence = this._offset + length; if (!this._buffer || this._buffer.length < this._fence) await new Promise<void>(f => this._fenceCallback = f); this._offset += length; return this._buffer.slice(this._offset - length, this._offset); } private _writeBytes(buffer: Buffer) { if (this._socket.writable) this._socket.write(buffer); } private _onClose() { this._client.onSocketClosed({ uid: this._uid }); } private _onData(buffer: Buffer) { this._buffer = Buffer.concat([this._buffer, buffer]); if (this._fenceCallback && this._buffer.length >= this._fence) { const callback = this._fenceCallback; this._fenceCallback = undefined; callback(); } } socketConnected(host: string, port: number) { this._writeBytes(Buffer.from([ 0x05, SocksReply.Succeeded, 0x00, // RSV 0x01, // IPv4 ...parseIP(host), // Address port << 8, port & 0xFF // Port ])); this._socket.on('data', data => this._client.onSocketData({ uid: this._uid, data })); } socketFailed(errorCode: string) { const buffer = Buffer.from([ 0x05, 0, 0x00, // RSV 0x01, // IPv4 ...parseIP('0.0.0.0'), // Address 0, 0 // Port ]); switch (errorCode) { case 'ENOENT': case 'ENOTFOUND': case 'ETIMEDOUT': case 'EHOSTUNREACH': buffer[1] = SocksReply.HostUnreachable; break; case 'ENETUNREACH': buffer[1] = SocksReply.NetworkUnreachable; break; case 'ECONNREFUSED': buffer[1] = SocksReply.ConnectionRefused; break; } this._writeBytes(buffer); this._socket.end(); } sendData(data: Buffer) { this._socket.write(data); } end() { this._socket.end(); } error(error: string) { this._socket.destroy(new Error(error)); } } function parseIP(address: string): number[] { if (!net.isIPv4(address)) throw new Error('IPv6 is not supported'); return address.split('.', 4).map(t => +t); } export class SocksProxy extends EventEmitter implements SocksConnectionClient { static Events = { SocksRequested: 'socksRequested', SocksData: 'socksData', SocksClosed: 'socksClosed', }; private _server: net.Server; private _connections = new Map<string, SocksConnection>(); private _sockets = new Set<net.Socket>(); private _closed = false; constructor() { super(); this._server = new net.Server((socket: net.Socket) => { const uid = createGuid(); const connection = new SocksConnection(uid, socket, this); this._connections.set(uid, connection); }); this._server.on('connection', socket => { if (this._closed) { socket.destroy(); return; } this._sockets.add(socket); socket.once('close', () => this._sockets.delete(socket)); }); } async listen(port: number): Promise<number> { return new Promise(f => { this._server.listen(port, () => { const port = (this._server.address() as AddressInfo).port; debugLogger.log('proxy', `Starting socks proxy server on port ${port}`); f(port); }); }); } async close() { this._closed = true; for (const socket of this._sockets) socket.destroy(); this._sockets.clear(); await new Promise(f => this._server.close(f)); } onSocketRequested(payload: SocksSocketRequestedPayload) { this.emit(SocksProxy.Events.SocksRequested, payload); } onSocketData(payload: SocksSocketDataPayload): void { this.emit(SocksProxy.Events.SocksData, payload); } onSocketClosed(payload: SocksSocketClosedPayload): void { this.emit(SocksProxy.Events.SocksClosed, payload); } socketConnected({ uid, host, port }: SocksSocketConnectedPayload) { this._connections.get(uid)?.socketConnected(host, port); } socketFailed({ uid, errorCode }: SocksSocketFailedPayload) { this._connections.get(uid)?.socketFailed(errorCode); } sendSocketData({ uid, data }: SocksSocketDataPayload) { this._connections.get(uid)?.sendData(data); } sendSocketEnd({ uid }: SocksSocketEndPayload) { this._connections.get(uid)?.end(); } sendSocketError({ uid, error }: SocksSocketErrorPayload) { this._connections.get(uid)?.error(error); } } export class SocksProxyHandler extends EventEmitter { static Events = { SocksConnected: 'socksConnected', SocksData: 'socksData', SocksError: 'socksError', SocksFailed: 'socksFailed', SocksEnd: 'socksEnd', }; private _sockets = new Map<string, net.Socket>(); private _redirectPortForTest: number | undefined; constructor(redirectPortForTest?: number) { super(); this._redirectPortForTest = redirectPortForTest; } cleanup() { for (const uid of this._sockets.keys()) this.socketClosed({ uid }); } async socketRequested({ uid, host, port }: SocksSocketRequestedPayload): Promise<void> { if (host === 'local.playwright') host = '127.0.0.1'; // Node.js 17 does resolve localhost to ipv6 if (host === 'localhost') host = '127.0.0.1'; try { if (this._redirectPortForTest) port = this._redirectPortForTest; const { address } = await dnsLookupAsync(host); const socket = await createSocket(address, port); socket.on('data', data => { const payload: SocksSocketDataPayload = { uid, data }; this.emit(SocksProxyHandler.Events.SocksData, payload); }); socket.on('error', error => { const payload: SocksSocketErrorPayload = { uid, error: error.message }; this.emit(SocksProxyHandler.Events.SocksError, payload); this._sockets.delete(uid); }); socket.on('end', () => { const payload: SocksSocketEndPayload = { uid }; this.emit(SocksProxyHandler.Events.SocksEnd, payload); this._sockets.delete(uid); }); const localAddress = socket.localAddress; const localPort = socket.localPort; this._sockets.set(uid, socket); const payload: SocksSocketConnectedPayload = { uid, host: localAddress, port: localPort }; this.emit(SocksProxyHandler.Events.SocksConnected, payload); } catch (error) { const payload: SocksSocketFailedPayload = { uid, errorCode: error.code }; this.emit(SocksProxyHandler.Events.SocksFailed, payload); } } sendSocketData({ uid, data }: SocksSocketDataPayload): void { this._sockets.get(uid)?.write(data); } socketClosed({ uid }: SocksSocketClosedPayload): void { this._sockets.get(uid)?.destroy(); this._sockets.delete(uid); } }
packages/playwright-core/src/common/socksProxy.ts
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.003583678975701332, 0.00033906151656992733, 0.0001650433987379074, 0.0001767238136380911, 0.0005860652308911085 ]
{ "id": 5, "code_window": [ " }\n", " return;\n", " }\n" ], "labels": [ "keep", "replace", "keep" ], "after_edit": [ " return result;\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "replace", "edit_start_line_idx": 468 }
/** * Copyright Microsoft Corporation. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import child_process from 'child_process'; import path from 'path'; import { EventEmitter } from 'events'; import type { RunPayload, TestBeginPayload, TestEndPayload, DonePayload, TestOutputPayload, WorkerInitParams, StepBeginPayload, StepEndPayload, SerializedLoaderData, TeardownErrorsPayload, WatchTestResolvedPayload, WorkerIsolation } from './ipc'; import type { TestResult, Reporter, TestStep, TestError } from '../types/testReporter'; import type { Suite } from './test'; import type { Loader } from './loader'; import { TestCase } from './test'; import { ManualPromise } from 'playwright-core/lib/utils/manualPromise'; import { TestTypeImpl } from './testType'; export type TestGroup = { workerHash: string; requireFile: string; repeatEachIndex: number; projectId: string; stopOnFailure: boolean; canShard: boolean; tests: TestCase[]; watchMode: boolean; }; type TestResultData = { result: TestResult; steps: Map<string, TestStep>; stepStack: Set<TestStep>; }; type TestData = { test: TestCase; resultByWorkerIndex: Map<number, TestResultData>; }; type WorkerExitData = { unexpectedly: boolean; code: number | null; signal: NodeJS.Signals | null; }; export class Dispatcher { private _workerSlots: { busy: boolean, worker?: Worker }[] = []; private _queue: TestGroup[] = []; private _queuedOrRunningHashCount = new Map<string, number>(); private _finished = new ManualPromise<void>(); private _isStopped = false; private _testById = new Map<string, TestData>(); private _loader: Loader; private _reporter: Reporter; private _hasWorkerErrors = false; private _failureCount = 0; constructor(loader: Loader, testGroups: TestGroup[], reporter: Reporter) { this._loader = loader; this._reporter = reporter; this._queue = testGroups; for (const group of testGroups) { this._queuedOrRunningHashCount.set(group.workerHash, 1 + (this._queuedOrRunningHashCount.get(group.workerHash) || 0)); for (const test of group.tests) this._testById.set(test.id, { test, resultByWorkerIndex: new Map() }); } } private async _scheduleJob() { // 1. Find a job to run. if (this._isStopped || !this._queue.length) return; const job = this._queue[0]; // 2. Find a worker with the same hash, or just some free worker. let index = this._workerSlots.findIndex(w => !w.busy && w.worker && w.worker.hash() === job.workerHash && !w.worker.didSendStop()); if (index === -1) index = this._workerSlots.findIndex(w => !w.busy); // No workers available, bail out. if (index === -1) return; // 3. Claim both the job and the worker, run the job and release the worker. this._queue.shift(); this._workerSlots[index].busy = true; await this._startJobInWorker(index, job); this._workerSlots[index].busy = false; // 4. Check the "finished" condition. this._checkFinished(); // 5. We got a free worker - perhaps we can immediately start another job? this._scheduleJob(); } private async _startJobInWorker(index: number, job: TestGroup) { let worker = this._workerSlots[index].worker; // 1. Restart the worker if it has the wrong hash or is being stopped already. if (worker && (worker.hash() !== job.workerHash || worker.didSendStop())) { await worker.stop(); worker = undefined; if (this._isStopped) // Check stopped signal after async hop. return; } // 2. Start the worker if it is down. if (!worker) { worker = this._createWorker(job.workerHash, index); this._workerSlots[index].worker = worker; worker.on('exit', () => this._workerSlots[index].worker = undefined); await worker.init(job, this._loader.serialize()); if (this._isStopped) // Check stopped signal after async hop. return; } // 3. Run the job. await this._runJob(worker, job); } private _checkFinished() { if (this._finished.isDone()) return; // Check that we have no more work to do. if (this._queue.length && !this._isStopped) return; // Make sure all workers have finished the current job. if (this._workerSlots.some(w => w.busy)) return; for (const { test } of this._testById.values()) { // Emulate skipped test run if we have stopped early. if (!test.results.length) test._appendTestResult().status = 'skipped'; } this._finished.resolve(); } private _isWorkerRedundant(worker: Worker) { let workersWithSameHash = 0; for (const slot of this._workerSlots) { if (slot.worker && !slot.worker.didSendStop() && slot.worker.hash() === worker.hash()) workersWithSameHash++; } return workersWithSameHash > this._queuedOrRunningHashCount.get(worker.hash())!; } async run() { this._workerSlots = []; // 1. Allocate workers. for (let i = 0; i < this._loader.fullConfig().workers; i++) this._workerSlots.push({ busy: false }); // 2. Schedule enough jobs. for (let i = 0; i < this._workerSlots.length; i++) this._scheduleJob(); this._checkFinished(); // 3. More jobs are scheduled when the worker becomes free, or a new job is added. // 4. Wait for all jobs to finish. await this._finished; } async _runJob(worker: Worker, testGroup: TestGroup) { worker.run(testGroup); let doneCallback = () => {}; const result = new Promise<void>(f => doneCallback = f); const doneWithJob = () => { worker.removeListener('watchTestResolved', onWatchTestResolved); worker.removeListener('testBegin', onTestBegin); worker.removeListener('testEnd', onTestEnd); worker.removeListener('stepBegin', onStepBegin); worker.removeListener('stepEnd', onStepEnd); worker.removeListener('done', onDone); worker.removeListener('exit', onExit); doneCallback(); }; const remainingByTestId = new Map(testGroup.tests.map(e => [e.id, e])); const failedTestIds = new Set<string>(); const onWatchTestResolved = (params: WatchTestResolvedPayload) => { const test = new TestCase(params.title, () => {}, new TestTypeImpl([]), params.location); this._testById.set(params.testId, { test, resultByWorkerIndex: new Map() }); }; worker.addListener('watchTestResolved', onWatchTestResolved); const onTestBegin = (params: TestBeginPayload) => { const data = this._testById.get(params.testId)!; const result = data.test._appendTestResult(); data.resultByWorkerIndex.set(worker.workerIndex, { result, stepStack: new Set(), steps: new Map() }); result.workerIndex = worker.workerIndex; result.startTime = new Date(params.startWallTime); this._reporter.onTestBegin?.(data.test, result); }; worker.addListener('testBegin', onTestBegin); const onTestEnd = (params: TestEndPayload) => { remainingByTestId.delete(params.testId); if (this._hasReachedMaxFailures()) { // Do not show more than one error to avoid confusion, but report // as interrupted to indicate that we did actually start the test. params.status = 'interrupted'; params.errors = []; } const data = this._testById.get(params.testId)!; const test = data.test; const { result } = data.resultByWorkerIndex.get(worker.workerIndex)!; data.resultByWorkerIndex.delete(worker.workerIndex); result.duration = params.duration; result.errors = params.errors; result.error = result.errors[0]; result.attachments = params.attachments.map(a => ({ name: a.name, path: a.path, contentType: a.contentType, body: a.body !== undefined ? Buffer.from(a.body, 'base64') : undefined })); result.status = params.status; test.expectedStatus = params.expectedStatus; test._annotateWithInheritence(params.annotations); test.timeout = params.timeout; const isFailure = result.status !== 'skipped' && result.status !== test.expectedStatus; if (isFailure) failedTestIds.add(params.testId); this._reportTestEnd(test, result); }; worker.addListener('testEnd', onTestEnd); const onStepBegin = (params: StepBeginPayload) => { const data = this._testById.get(params.testId)!; const runData = data.resultByWorkerIndex.get(worker.workerIndex); if (!runData) { // The test has finished, but steps are still coming. Just ignore them. return; } const { result, steps, stepStack } = runData; const parentStep = params.forceNoParent ? undefined : [...stepStack].pop(); const step: TestStep = { title: params.title, titlePath: () => { const parentPath = parentStep?.titlePath() || []; return [...parentPath, params.title]; }, parent: parentStep, category: params.category, startTime: new Date(params.wallTime), duration: -1, steps: [], location: params.location, }; steps.set(params.stepId, step); (parentStep || result).steps.push(step); if (params.canHaveChildren) stepStack.add(step); this._reporter.onStepBegin?.(data.test, result, step); }; worker.on('stepBegin', onStepBegin); const onStepEnd = (params: StepEndPayload) => { const data = this._testById.get(params.testId)!; const runData = data.resultByWorkerIndex.get(worker.workerIndex); if (!runData) { // The test has finished, but steps are still coming. Just ignore them. return; } const { result, steps, stepStack } = runData; const step = steps.get(params.stepId); if (!step) { this._reporter.onStdErr?.('Internal error: step end without step begin: ' + params.stepId, data.test, result); return; } if (params.refinedTitle) step.title = params.refinedTitle; step.duration = params.wallTime - step.startTime.getTime(); if (params.error) step.error = params.error; stepStack.delete(step); steps.delete(params.stepId); this._reporter.onStepEnd?.(data.test, result, step); }; worker.on('stepEnd', onStepEnd); const onDone = (params: DonePayload & { unexpectedExitError?: TestError }) => { this._queuedOrRunningHashCount.set(worker.hash(), this._queuedOrRunningHashCount.get(worker.hash())! - 1); let remaining = [...remainingByTestId.values()]; // We won't file remaining if: // - there are no remaining // - we are here not because something failed // - no unrecoverable worker error if (!remaining.length && !failedTestIds.size && !params.fatalErrors.length && !params.skipTestsDueToSetupFailure.length && !params.fatalUnknownTestIds && !params.unexpectedExitError) { if (this._isWorkerRedundant(worker)) worker.stop(); doneWithJob(); return; } // When worker encounters error, we will stop it and create a new one. worker.stop(true /* didFail */); const massSkipTestsFromRemaining = (testIds: Set<string>, errors: TestError[], onlyStartedTests?: boolean) => { remaining = remaining.filter(test => { if (!testIds.has(test.id)) return true; if (!this._hasReachedMaxFailures()) { const data = this._testById.get(test.id)!; const runData = data.resultByWorkerIndex.get(worker.workerIndex); // There might be a single test that has started but has not finished yet. let result: TestResult; if (runData) { result = runData.result; } else { if (onlyStartedTests) return true; result = data.test._appendTestResult(); this._reporter.onTestBegin?.(test, result); } result.errors = [...errors]; result.error = result.errors[0]; result.status = errors.length ? 'failed' : 'skipped'; this._reportTestEnd(test, result); failedTestIds.add(test.id); errors = []; // Only report errors for the first test. } return false; }); if (errors.length) { // We had fatal errors after all tests have passed - most likely in some teardown. // Let's just fail the test run. this._hasWorkerErrors = true; for (const error of params.fatalErrors) this._reporter.onError?.(error); } }; if (params.fatalUnknownTestIds) { const titles = params.fatalUnknownTestIds.map(testId => { const test = this._testById.get(testId)!.test; return test.titlePath().slice(1).join(' > '); }); massSkipTestsFromRemaining(new Set(params.fatalUnknownTestIds), [{ message: `Unknown test(s) in worker:\n${titles.join('\n')}` }]); } if (params.fatalErrors.length) { // In case of fatal errors, report first remaining test as failing with these errors, // and all others as skipped. massSkipTestsFromRemaining(new Set(remaining.map(test => test.id)), params.fatalErrors); } // Handle tests that should be skipped because of the setup failure. massSkipTestsFromRemaining(new Set(params.skipTestsDueToSetupFailure), []); // Handle unexpected worker exit. if (params.unexpectedExitError) massSkipTestsFromRemaining(new Set(remaining.map(test => test.id)), [params.unexpectedExitError], true /* onlyStartedTests */); const retryCandidates = new Set<string>(); const serialSuitesWithFailures = new Set<Suite>(); for (const failedTestId of failedTestIds) { retryCandidates.add(failedTestId); let outermostSerialSuite: Suite | undefined; for (let parent: Suite | undefined = this._testById.get(failedTestId)!.test.parent; parent; parent = parent.parent) { if (parent._parallelMode === 'serial') outermostSerialSuite = parent; } if (outermostSerialSuite) serialSuitesWithFailures.add(outermostSerialSuite); } // We have failed tests that belong to a serial suite. // We should skip all future tests from the same serial suite. remaining = remaining.filter(test => { let parent: Suite | undefined = test.parent; while (parent && !serialSuitesWithFailures.has(parent)) parent = parent.parent; // Does not belong to the failed serial suite, keep it. if (!parent) return true; // Emulate a "skipped" run, and drop this test from remaining. const result = test._appendTestResult(); this._reporter.onTestBegin?.(test, result); result.status = 'skipped'; this._reportTestEnd(test, result); return false; }); for (const serialSuite of serialSuitesWithFailures) { // Add all tests from faiiled serial suites for possible retry. // These will only be retried together, because they have the same // "retries" setting and the same number of previous runs. serialSuite.allTests().forEach(test => retryCandidates.add(test.id)); } for (const testId of retryCandidates) { const pair = this._testById.get(testId)!; if (!this._isStopped && pair.test.results.length < pair.test.retries + 1) remaining.push(pair.test); } if (remaining.length) { this._queue.unshift({ ...testGroup, tests: remaining }); this._queuedOrRunningHashCount.set(testGroup.workerHash, this._queuedOrRunningHashCount.get(testGroup.workerHash)! + 1); // Perhaps we can immediately start the new job if there is a worker available? this._scheduleJob(); } // This job is over, we just scheduled another one. doneWithJob(); }; worker.on('done', onDone); const onExit = (data: WorkerExitData) => { const unexpectedExitError = data.unexpectedly ? { value: `Worker process exited unexpectedly (code=${data.code}, signal=${data.signal})` } : undefined; onDone({ skipTestsDueToSetupFailure: [], fatalErrors: [], unexpectedExitError }); }; worker.on('exit', onExit); return result; } _createWorker(hash: string, parallelIndex: number) { const worker = new Worker(hash, parallelIndex, this._loader.fullConfig()._workerIsolation); const handleOutput = (params: TestOutputPayload) => { const chunk = chunkFromParams(params); if (worker.didFail()) { // Note: we keep reading stdio from workers that are currently stopping after failure, // to debug teardown issues. However, we avoid spoiling the test result from // the next retry. return { chunk }; } if (!params.testId) return { chunk }; const data = this._testById.get(params.testId)!; return { chunk, test: data.test, result: data.resultByWorkerIndex.get(worker.workerIndex)?.result }; }; worker.on('stdOut', (params: TestOutputPayload) => { const { chunk, test, result } = handleOutput(params); result?.stdout.push(chunk); this._reporter.onStdOut?.(chunk, test, result); }); worker.on('stdErr', (params: TestOutputPayload) => { const { chunk, test, result } = handleOutput(params); result?.stderr.push(chunk); this._reporter.onStdErr?.(chunk, test, result); }); worker.on('teardownErrors', (params: TeardownErrorsPayload) => { this._hasWorkerErrors = true; for (const error of params.fatalErrors) this._reporter.onError?.(error); }); return worker; } async stop() { if (this._isStopped) return; this._isStopped = true; await Promise.all(this._workerSlots.map(({ worker }) => worker?.stop())); this._checkFinished(); } private _hasReachedMaxFailures() { const maxFailures = this._loader.fullConfig().maxFailures; return maxFailures > 0 && this._failureCount >= maxFailures; } private _reportTestEnd(test: TestCase, result: TestResult) { if (result.status !== 'skipped' && result.status !== test.expectedStatus) ++this._failureCount; this._reporter.onTestEnd?.(test, result); const maxFailures = this._loader.fullConfig().maxFailures; if (maxFailures && this._failureCount === maxFailures) this.stop().catch(e => {}); } hasWorkerErrors(): boolean { return this._hasWorkerErrors; } } let lastWorkerIndex = 0; class Worker extends EventEmitter { private process: child_process.ChildProcess; private _hash: string; private parallelIndex: number; readonly workerIndex: number; private _didSendStop = false; private _didFail = false; private didExit = false; private _ready: Promise<void>; workerIsolation: WorkerIsolation; constructor(hash: string, parallelIndex: number, workerIsolation: WorkerIsolation) { super(); this.workerIndex = lastWorkerIndex++; this._hash = hash; this.parallelIndex = parallelIndex; this.workerIsolation = workerIsolation; this.process = child_process.fork(path.join(__dirname, 'worker.js'), { detached: false, env: { FORCE_COLOR: '1', DEBUG_COLORS: '1', TEST_WORKER_INDEX: String(this.workerIndex), TEST_PARALLEL_INDEX: String(this.parallelIndex), ...process.env }, // Can't pipe since piping slows down termination for some reason. stdio: ['ignore', 'ignore', process.env.PW_RUNNER_DEBUG ? 'inherit' : 'ignore', 'ipc'] }); this.process.on('exit', (code, signal) => { this.didExit = true; this.emit('exit', { unexpectedly: !this._didSendStop, code, signal } as WorkerExitData); }); this.process.on('error', e => {}); // do not yell at a send to dead process. this.process.on('message', (message: any) => { const { method, params } = message; this.emit(method, params); }); this._ready = new Promise((resolve, reject) => { this.process.once('exit', (code, signal) => reject(new Error(`worker exited with code "${code}" and signal "${signal}" before it became ready`))); this.once('ready', () => resolve()); }); } async init(testGroup: TestGroup, loaderData: SerializedLoaderData) { await this._ready; const params: WorkerInitParams = { workerIsolation: this.workerIsolation, workerIndex: this.workerIndex, parallelIndex: this.parallelIndex, repeatEachIndex: testGroup.repeatEachIndex, projectId: testGroup.projectId, loader: loaderData, stdoutParams: { rows: process.stdout.rows, columns: process.stdout.columns, colorDepth: process.stdout.getColorDepth?.() || 8 }, stderrParams: { rows: process.stderr.rows, columns: process.stderr.columns, colorDepth: process.stderr.getColorDepth?.() || 8 }, }; this.send({ method: 'init', params }); } run(testGroup: TestGroup) { const runPayload: RunPayload = { file: testGroup.requireFile, entries: testGroup.tests.map(test => { return { testId: test.id, retry: test.results.length }; }), watchMode: testGroup.watchMode, }; this.send({ method: 'run', params: runPayload }); } didFail() { return this._didFail; } didSendStop() { return this._didSendStop; } hash() { return this._hash; } async stop(didFail?: boolean) { if (didFail) this._didFail = true; if (this.didExit) return; if (!this._didSendStop) { this.send({ method: 'stop' }); this._didSendStop = true; } await new Promise(f => this.once('exit', f)); } private send(message: any) { // This is a great place for debug logging. this.process.send(message); } } function chunkFromParams(params: TestOutputPayload): string | Buffer { if (typeof params.text === 'string') return params.text; return Buffer.from(params.buffer!, 'base64'); }
packages/playwright-test/src/dispatcher.ts
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.01646309532225132, 0.0005785872344858944, 0.0001647451426833868, 0.000179938884684816, 0.0020735585130751133 ]
{ "id": 6, "code_window": [ " }\n", "}\n", "\n", "export function shouldCaptureSnapshot(metadata: CallMetadata): boolean {\n", " return commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method);\n", "}" ], "labels": [ "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " return object;\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "add", "edit_start_line_idx": 470 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { EventEmitter } from 'events'; import fs from 'fs'; import os from 'os'; import path from 'path'; import type { NameValue } from '../../../common/types'; import type { TracingTracingStopChunkParams } from '@protocol/channels'; import { commandsWithTracingSnapshots } from '../../../protocol/debug'; import { ManualPromise } from '../../../utils/manualPromise'; import type { RegisteredListener } from '../../../utils/eventsHelper'; import { eventsHelper } from '../../../utils/eventsHelper'; import { assert, calculateSha1, createGuid, monotonicTime } from '../../../utils'; import { mkdirIfNeeded, removeFolders } from '../../../utils/fileUtils'; import { Artifact } from '../../artifact'; import { BrowserContext } from '../../browserContext'; import { ElementHandle } from '../../dom'; import type { APIRequestContext } from '../../fetch'; import type { CallMetadata, InstrumentationListener } from '../../instrumentation'; import { SdkObject } from '../../instrumentation'; import { Page } from '../../page'; import type * as har from '@trace/har'; import type { HarTracerDelegate } from '../../har/harTracer'; import { HarTracer } from '../../har/harTracer'; import type { FrameSnapshot } from '@trace/snapshot'; import type * as trace from '@trace/trace'; import type { VERSION } from '@trace/trace'; import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter'; import { Snapshotter } from './snapshotter'; import { yazl } from '../../../zipBundle'; const version: VERSION = 3; export type TracerOptions = { name?: string; snapshots?: boolean; screenshots?: boolean; sources?: boolean; }; type RecordingState = { options: TracerOptions, traceName: string, networkFile: string, traceFile: string, tracesDir: string, resourcesDir: string, filesCount: number, networkSha1s: Set<string>, traceSha1s: Set<string>, sources: Set<string>, recording: boolean; }; const kScreencastOptions = { width: 800, height: 600, quality: 90 }; export class Tracing extends SdkObject implements InstrumentationListener, SnapshotterDelegate, HarTracerDelegate { private _writeChain = Promise.resolve(); private _snapshotter?: Snapshotter; private _harTracer: HarTracer; private _screencastListeners: RegisteredListener[] = []; private _pendingCalls = new Map<string, { sdkObject: SdkObject, metadata: CallMetadata, beforeSnapshot: Promise<void>, actionSnapshot?: Promise<void>, afterSnapshot?: Promise<void> }>(); private _context: BrowserContext | APIRequestContext; private _state: RecordingState | undefined; private _isStopping = false; private _precreatedTracesDir: string | undefined; private _tracesTmpDir: string | undefined; private _allResources = new Set<string>(); private _contextCreatedEvent: trace.ContextCreatedTraceEvent; constructor(context: BrowserContext | APIRequestContext, tracesDir: string | undefined) { super(context, 'tracing'); this._context = context; this._precreatedTracesDir = tracesDir; this._harTracer = new HarTracer(context, null, this, { content: 'attach', includeTraceInfo: true, recordRequestOverrides: false, waitForContentOnStop: false, skipScripts: true, }); this._contextCreatedEvent = { version, type: 'context-options', browserName: '', options: {}, platform: process.platform, wallTime: 0, }; if (context instanceof BrowserContext) { this._snapshotter = new Snapshotter(context, this); assert(tracesDir, 'tracesDir must be specified for BrowserContext'); this._contextCreatedEvent.browserName = context._browser.options.name; this._contextCreatedEvent.options = context._options; } } async start(options: TracerOptions) { if (this._isStopping) throw new Error('Cannot start tracing while stopping'); if (this._state) { const o = this._state.options; if (o.name !== options.name || !o.screenshots !== !options.screenshots || !o.snapshots !== !options.snapshots) throw new Error('Tracing has been already started with different options'); return; } // TODO: passing the same name for two contexts makes them write into a single file // and conflict. const traceName = options.name || createGuid(); // Init the state synchrounously. this._state = { options, traceName, traceFile: '', networkFile: '', tracesDir: '', resourcesDir: '', filesCount: 0, traceSha1s: new Set(), networkSha1s: new Set(), sources: new Set(), recording: false }; const state = this._state; state.tracesDir = await this._createTracesDirIfNeeded(); state.resourcesDir = path.join(state.tracesDir, 'resources'); state.traceFile = path.join(state.tracesDir, traceName + '.trace'); state.networkFile = path.join(state.tracesDir, traceName + '.network'); this._writeChain = fs.promises.mkdir(state.resourcesDir, { recursive: true }).then(() => fs.promises.writeFile(state.networkFile, '')); if (options.snapshots) this._harTracer.start(); } async startChunk(options: { title?: string } = {}) { if (this._state && this._state.recording) await this.stopChunk({ mode: 'doNotSave' }); if (!this._state) throw new Error('Must start tracing before starting a new chunk'); if (this._isStopping) throw new Error('Cannot start a trace chunk while stopping'); const state = this._state; const suffix = state.filesCount ? `-${state.filesCount}` : ``; state.filesCount++; state.traceFile = path.join(state.tracesDir, `${state.traceName}${suffix}.trace`); state.recording = true; this._appendTraceOperation(async () => { await mkdirIfNeeded(state.traceFile); await fs.promises.appendFile(state.traceFile, JSON.stringify({ ...this._contextCreatedEvent, title: options.title, wallTime: Date.now() }) + '\n'); }); this._context.instrumentation.addListener(this, this._context); if (state.options.screenshots) this._startScreencast(); if (state.options.snapshots) await this._snapshotter?.start(); } private _startScreencast() { if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) this._startScreencastInPage(page); this._screencastListeners.push( eventsHelper.addEventListener(this._context, BrowserContext.Events.Page, this._startScreencastInPage.bind(this)), ); } private _stopScreencast() { eventsHelper.removeEventListeners(this._screencastListeners); if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) page.setScreencastOptions(null); } async stop() { if (!this._state) return; if (this._isStopping) throw new Error(`Tracing is already stopping`); if (this._state.recording) throw new Error(`Must stop trace file before stopping tracing`); this._harTracer.stop(); await this._writeChain; this._state = undefined; } async deleteTmpTracesDir() { if (this._tracesTmpDir) await removeFolders([this._tracesTmpDir]); } private async _createTracesDirIfNeeded() { if (this._precreatedTracesDir) return this._precreatedTracesDir; this._tracesTmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'playwright-tracing-')); return this._tracesTmpDir; } async dispose() { this._snapshotter?.dispose(); this._harTracer.stop(); await this._writeChain; } async stopChunk(params: TracingTracingStopChunkParams): Promise<{ artifact: Artifact | null, sourceEntries: NameValue[] | undefined }> { if (this._isStopping) throw new Error(`Tracing is already stopping`); this._isStopping = true; if (!this._state || !this._state.recording) { this._isStopping = false; if (params.mode !== 'doNotSave') throw new Error(`Must start tracing before stopping`); return { artifact: null, sourceEntries: [] }; } const state = this._state!; this._context.instrumentation.removeListener(this); if (this._state?.options.screenshots) this._stopScreencast(); for (const { sdkObject, metadata, beforeSnapshot, actionSnapshot, afterSnapshot } of this._pendingCalls.values()) { await Promise.all([beforeSnapshot, actionSnapshot, afterSnapshot]); let callMetadata = metadata; if (!afterSnapshot) { // Note: we should not modify metadata here to avoid side-effects in any other place. callMetadata = { ...metadata, error: { error: { name: 'Error', message: 'Action was interrupted' } }, }; } await this.onAfterCall(sdkObject, callMetadata); } if (state.options.snapshots) await this._snapshotter?.stop(); // Chain the export operation against write operations, // so that neither trace files nor sha1s change during the export. return await this._appendTraceOperation(async () => { if (params.mode === 'doNotSave') return { artifact: null, sourceEntries: undefined }; // Har files a live, make a snapshot before returning the resulting entries. const networkFile = path.join(state.networkFile, '..', createGuid()); await fs.promises.copyFile(state.networkFile, networkFile); const entries: NameValue[] = []; entries.push({ name: 'trace.trace', value: state.traceFile }); entries.push({ name: 'trace.network', value: networkFile }); for (const sha1 of new Set([...state.traceSha1s, ...state.networkSha1s])) entries.push({ name: path.join('resources', sha1), value: path.join(state.resourcesDir, sha1) }); let sourceEntries: NameValue[] | undefined; if (state.sources.size) { sourceEntries = []; for (const value of state.sources) { const entry = { name: 'resources/src@' + calculateSha1(value) + '.txt', value }; if (params.mode === 'compressTraceAndSources') { if (fs.existsSync(entry.value)) entries.push(entry); } else { sourceEntries.push(entry); } } } const artifact = await this._exportZip(entries, state).catch(() => null); return { artifact, sourceEntries }; }).finally(() => { // Only reset trace sha1s, network resources are preserved between chunks. state.traceSha1s = new Set(); state.sources = new Set(); this._isStopping = false; state.recording = false; }) || { artifact: null, sourceEntries: undefined }; } private async _exportZip(entries: NameValue[], state: RecordingState): Promise<Artifact | null> { const zipFile = new yazl.ZipFile(); const result = new ManualPromise<Artifact | null>(); (zipFile as any as EventEmitter).on('error', error => result.reject(error)); for (const entry of entries) zipFile.addFile(entry.value, entry.name); zipFile.end(); const zipFileName = state.traceFile + '.zip'; zipFile.outputStream.pipe(fs.createWriteStream(zipFileName)).on('close', () => { const artifact = new Artifact(this._context, zipFileName); artifact.reportFinished(); result.resolve(artifact); }); return result; } async _captureSnapshot(name: 'before' | 'after' | 'action' | 'event', sdkObject: SdkObject, metadata: CallMetadata, element?: ElementHandle) { if (!this._snapshotter) return; if (!sdkObject.attribution.page) return; if (!this._snapshotter.started()) return; if (!shouldCaptureSnapshot(metadata)) return; const snapshotName = `${name}@${metadata.id}`; metadata.snapshots.push({ title: name, snapshotName }); // We have |element| for input actions (page.click and handle.click) // and |sdkObject| element for accessors like handle.textContent. if (!element && sdkObject instanceof ElementHandle) element = sdkObject; await this._snapshotter.captureSnapshot(sdkObject.attribution.page, snapshotName, element).catch(() => {}); } async onBeforeCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); // Set afterSnapshot name for all the actions that operate selectors. // Elements resolved from selectors will be marked on the snapshot. metadata.afterSnapshot = `after@${metadata.id}`; const beforeSnapshot = this._captureSnapshot('before', sdkObject, metadata); this._pendingCalls.set(metadata.id, { sdkObject, metadata, beforeSnapshot }); if (this._state?.options.sources) { for (const frame of metadata.stack || []) this._state.sources.add(frame.file); } await beforeSnapshot; } async onBeforeInputAction(sdkObject: SdkObject, metadata: CallMetadata, element: ElementHandle) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const actionSnapshot = this._captureSnapshot('action', sdkObject, metadata, element); this._pendingCalls.get(metadata.id)!.actionSnapshot = actionSnapshot; await actionSnapshot; } async onAfterCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const pendingCall = this._pendingCalls.get(metadata.id); if (!pendingCall || pendingCall.afterSnapshot) return; if (!sdkObject.attribution.context) { this._pendingCalls.delete(metadata.id); return; } pendingCall.afterSnapshot = this._captureSnapshot('after', sdkObject, metadata); await pendingCall.afterSnapshot; const event: trace.ActionTraceEvent = { type: 'action', metadata }; this._appendTraceEvent(event); this._pendingCalls.delete(metadata.id); } onEvent(sdkObject: SdkObject, metadata: CallMetadata) { if (!sdkObject.attribution.context) return; const event: trace.ActionTraceEvent = { type: 'event', metadata }; this._appendTraceEvent(event); } onEntryStarted(entry: har.Entry) { } onEntryFinished(entry: har.Entry) { const event: trace.ResourceSnapshotTraceEvent = { type: 'resource-snapshot', snapshot: entry }; this._appendTraceOperation(async () => { visitSha1s(event, this._state!.networkSha1s); await fs.promises.appendFile(this._state!.networkFile, JSON.stringify(event) + '\n'); }); } onContentBlob(sha1: string, buffer: Buffer) { this._appendResource(sha1, buffer); } onSnapshotterBlob(blob: SnapshotterBlob): void { this._appendResource(blob.sha1, blob.buffer); } onFrameSnapshot(snapshot: FrameSnapshot): void { this._appendTraceEvent({ type: 'frame-snapshot', snapshot }); } private _startScreencastInPage(page: Page) { page.setScreencastOptions(kScreencastOptions); const prefix = page.guid; this._screencastListeners.push( eventsHelper.addEventListener(page, Page.Events.ScreencastFrame, params => { const suffix = params.timestamp || Date.now(); const sha1 = `${prefix}-${suffix}.jpeg`; const event: trace.ScreencastFrameTraceEvent = { type: 'screencast-frame', pageId: page.guid, sha1, width: params.width, height: params.height, timestamp: monotonicTime() }; // Make sure to write the screencast frame before adding a reference to it. this._appendResource(sha1, params.buffer); this._appendTraceEvent(event); }), ); } private _appendTraceEvent(event: trace.TraceEvent) { this._appendTraceOperation(async () => { visitSha1s(event, this._state!.traceSha1s); await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(event) + '\n'); }); } private _appendResource(sha1: string, buffer: Buffer) { if (this._allResources.has(sha1)) return; this._allResources.add(sha1); const resourcePath = path.join(this._state!.resourcesDir, sha1); this._appendTraceOperation(async () => { try { // Perhaps we've already written this resource? await fs.promises.access(resourcePath); } catch (e) { // If not, let's write! Note that async access is safe because we // never remove resources until the very end. await fs.promises.writeFile(resourcePath, buffer).catch(() => {}); } }); } private async _appendTraceOperation<T>(cb: () => Promise<T>): Promise<T | undefined> { // This method serializes all writes to the trace. let error: Error | undefined; let result: T | undefined; this._writeChain = this._writeChain.then(async () => { // This check is here because closing the browser removes the tracesDir and tracing // dies trying to archive. if (this._context instanceof BrowserContext && !this._context._browser.isConnected()) return; try { result = await cb(); } catch (e) { error = e; } }); await this._writeChain; if (error) throw error; return result; } } function visitSha1s(object: any, sha1s: Set<string>) { if (Array.isArray(object)) { object.forEach(o => visitSha1s(o, sha1s)); return; } if (typeof object === 'object') { for (const key in object) { if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) { const sha1 = object[key]; if (sha1) sha1s.add(sha1); } visitSha1s(object[key], sha1s); } return; } } export function shouldCaptureSnapshot(metadata: CallMetadata): boolean { return commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method); }
packages/playwright-core/src/server/trace/recorder/tracing.ts
1
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.9992503523826599, 0.14092278480529785, 0.00016473335563205183, 0.00021740389638580382, 0.33731165528297424 ]
{ "id": 6, "code_window": [ " }\n", "}\n", "\n", "export function shouldCaptureSnapshot(metadata: CallMetadata): boolean {\n", " return commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method);\n", "}" ], "labels": [ "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " return object;\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "add", "edit_start_line_idx": 470 }
#!/usr/bin/env node /** * Copyright 2017 Google Inc. All rights reserved. * Modifications copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const path = require('path'); const { Registry } = require('../packages/playwright-core/lib/server'); const fs = require('fs'); const protocolGenerator = require('./protocol-types-generator'); const {execSync} = require('child_process'); const playwright = require('playwright-core'); const SCRIPT_NAME = path.basename(__filename); const CORE_PATH = path.resolve(path.join(__dirname, '..', 'packages', 'playwright-core')); function usage() { return ` usage: ${SCRIPT_NAME} <browser> <revision> Roll the <browser> to a specific <revision> and generate new protocol. Supported browsers: chromium, firefox, webkit, ffmpeg, firefox-beta. Example: ${SCRIPT_NAME} chromium 123456 `; } (async () => { // 1. Parse CLI arguments const args = process.argv.slice(2); if (args.some(arg => arg === '--help')) { console.log(usage()); process.exit(1); } else if (args.length < 1) { console.log(`Please specify the browser name, e.g. 'chromium'.`); console.log(`Try running ${SCRIPT_NAME} --help`); process.exit(1); } else if (args.length < 2) { console.log(`Please specify the revision`); console.log(`Try running ${SCRIPT_NAME} --help`); process.exit(1); } const browsersJSON = require(path.join(CORE_PATH, 'browsers.json')); const browserName = args[0].toLowerCase(); const descriptors = [browsersJSON.browsers.find(b => b.name === browserName)]; if (browserName === 'chromium') descriptors.push(browsersJSON.browsers.find(b => b.name === 'chromium-with-symbols')); if (!descriptors.every(d => !!d)) { console.log(`Unknown browser "${browserName}"`); console.log(`Try running ${SCRIPT_NAME} --help`); process.exit(1); } const revision = args[1]; console.log(`Rolling ${browserName} to ${revision}`); // 2. Update browser revisions in browsers.json. console.log('\nUpdating revision in browsers.json...'); for (const descriptor of descriptors) descriptor.revision = String(revision); fs.writeFileSync(path.join(CORE_PATH, 'browsers.json'), JSON.stringify(browsersJSON, null, 2) + '\n'); // 3. Download new browser. console.log('\nDownloading new browser...'); const registry = new Registry(browsersJSON); const executable = registry.findExecutable(browserName); await registry.install([...registry.defaultExecutables(), executable]); // 4. Update browser version if rolling WebKit / Firefox / Chromium. const browserType = playwright[browserName.split('-')[0]]; if (browserType) { const browser = await browserType.launch({ executablePath: executable.executablePath('javascript'), }); const browserVersion = await browser.version(); await browser.close(); console.log('\nUpdating browser version in browsers.json...'); for (const descriptor of descriptors) descriptor.browserVersion = browserVersion; fs.writeFileSync(path.join(CORE_PATH, 'browsers.json'), JSON.stringify(browsersJSON, null, 2) + '\n'); } if (browserType && descriptors[0].installByDefault) { // 5. Generate types. console.log('\nGenerating protocol types...'); const executablePath = registry.findExecutable(browserName).executablePathOrDie(); await protocolGenerator.generateProtocol(browserName, executablePath).catch(console.warn); // 6. Update docs. console.log('\nUpdating documentation...'); try { process.stdout.write(execSync('npm run --silent doc')); } catch (e) { } } console.log(`\nRolled ${browserName} to ${revision}`); })().catch(err => { console.error(err); process.exit(1); });
utils/roll_browser.js
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.000175820488948375, 0.00017015823686961085, 0.00016485717787873, 0.00016982926172204316, 0.0000028194788228574907 ]
{ "id": 6, "code_window": [ " }\n", "}\n", "\n", "export function shouldCaptureSnapshot(metadata: CallMetadata): boolean {\n", " return commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method);\n", "}" ], "labels": [ "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " return object;\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "add", "edit_start_line_idx": 470 }
/* Copyright (c) Microsoft Corporation. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ export function msToString(ms: number): string { if (!isFinite(ms)) return '-'; if (ms === 0) return '0'; if (ms < 1000) return ms.toFixed(0) + 'ms'; const seconds = ms / 1000; if (seconds < 60) return seconds.toFixed(1) + 's'; const minutes = seconds / 60; if (minutes < 60) return minutes.toFixed(1) + 'm'; const hours = minutes / 60; if (hours < 24) return hours.toFixed(1) + 'h'; const days = hours / 24; return days.toFixed(1) + 'd'; }
packages/html-reporter/src/uiUtils.ts
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.0001771679671946913, 0.00017262966139242053, 0.00016855227295309305, 0.00017221763846464455, 0.0000028456863674364286 ]
{ "id": 6, "code_window": [ " }\n", "}\n", "\n", "export function shouldCaptureSnapshot(metadata: CallMetadata): boolean {\n", " return commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method);\n", "}" ], "labels": [ "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " return object;\n" ], "file_path": "packages/playwright-core/src/server/trace/recorder/tracing.ts", "type": "add", "edit_start_line_idx": 470 }
"use strict";(self.webpackChunkstress_test=self.webpackChunkstress_test||[]).push([[787],{787:function(e,t,n){n.r(t),n.d(t,{getCLS:function(){return y},getFCP:function(){return g},getFID:function(){return C},getLCP:function(){return P},getTTFB:function(){return D}});var i,r,a,o,u=function(e,t){return{name:e,value:void 0===t?-1:t,delta:0,entries:[],id:"v2-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},c=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if("first-input"===e&&!("PerformanceEventTiming"in self))return;var n=new PerformanceObserver((function(e){return e.getEntries().map(t)}));return n.observe({type:e,buffered:!0}),n}}catch(e){}},s=function(e,t){var n=function n(i){"pagehide"!==i.type&&"hidden"!==document.visibilityState||(e(i),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},f=function(e){addEventListener("pageshow",(function(t){t.persisted&&e(t)}),!0)},m=function(e,t,n){var i;return function(r){t.value>=0&&(r||n)&&(t.delta=t.value-(i||0),(t.delta||void 0===i)&&(i=t.value,e(t)))}},v=-1,p=function(){return"hidden"===document.visibilityState?0:1/0},d=function(){s((function(e){var t=e.timeStamp;v=t}),!0)},l=function(){return v<0&&(v=p(),d(),f((function(){setTimeout((function(){v=p(),d()}),0)}))),{get firstHiddenTime(){return v}}},g=function(e,t){var n,i=l(),r=u("FCP"),a=function(e){"first-contentful-paint"===e.name&&(s&&s.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=e.startTime,r.entries.push(e),n(!0)))},o=window.performance&&performance.getEntriesByName&&performance.getEntriesByName("first-contentful-paint")[0],s=o?null:c("paint",a);(o||s)&&(n=m(e,r,t),o&&a(o),f((function(i){r=u("FCP"),n=m(e,r,t),requestAnimationFrame((function(){requestAnimationFrame((function(){r.value=performance.now()-i.timeStamp,n(!0)}))}))})))},h=!1,T=-1,y=function(e,t){h||(g((function(e){T=e.value})),h=!0);var n,i=function(t){T>-1&&e(t)},r=u("CLS",0),a=0,o=[],v=function(e){if(!e.hadRecentInput){var t=o[0],i=o[o.length-1];a&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(a+=e.value,o.push(e)):(a=e.value,o=[e]),a>r.value&&(r.value=a,r.entries=o,n())}},p=c("layout-shift",v);p&&(n=m(i,r,t),s((function(){p.takeRecords().map(v),n(!0)})),f((function(){a=0,T=-1,r=u("CLS",0),n=m(i,r,t)})))},E={passive:!0,capture:!0},w=new Date,L=function(e,t){i||(i=t,r=e,a=new Date,F(removeEventListener),S())},S=function(){if(r>=0&&r<a-w){var e={entryType:"first-input",name:i.type,target:i.target,cancelable:i.cancelable,startTime:i.timeStamp,processingStart:i.timeStamp+r};o.forEach((function(t){t(e)})),o=[]}},b=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){L(e,t),r()},i=function(){r()},r=function(){removeEventListener("pointerup",n,E),removeEventListener("pointercancel",i,E)};addEventListener("pointerup",n,E),addEventListener("pointercancel",i,E)}(t,e):L(t,e)}},F=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,b,E)}))},C=function(e,t){var n,a=l(),v=u("FID"),p=function(e){e.startTime<a.firstHiddenTime&&(v.value=e.processingStart-e.startTime,v.entries.push(e),n(!0))},d=c("first-input",p);n=m(e,v,t),d&&s((function(){d.takeRecords().map(p),d.disconnect()}),!0),d&&f((function(){var a;v=u("FID"),n=m(e,v,t),o=[],r=-1,i=null,F(addEventListener),a=p,o.push(a),S()}))},k={},P=function(e,t){var n,i=l(),r=u("LCP"),a=function(e){var t=e.startTime;t<i.firstHiddenTime&&(r.value=t,r.entries.push(e),n())},o=c("largest-contentful-paint",a);if(o){n=m(e,r,t);var v=function(){k[r.id]||(o.takeRecords().map(a),o.disconnect(),k[r.id]=!0,n(!0))};["keydown","click"].forEach((function(e){addEventListener(e,v,{once:!0,capture:!0})})),s(v,!0),f((function(i){r=u("LCP"),n=m(e,r,t),requestAnimationFrame((function(){requestAnimationFrame((function(){r.value=performance.now()-i.timeStamp,k[r.id]=!0,n(!0)}))}))}))}},D=function(e){var t,n=u("TTFB");t=function(){try{var t=performance.getEntriesByType("navigation")[0]||function(){var e=performance.timing,t={entryType:"navigation",startTime:0};for(var n in e)"navigationStart"!==n&&"toJSON"!==n&&(t[n]=Math.max(e[n]-e.navigationStart,0));return t}();if(n.value=n.delta=t.responseStart,n.value<0||n.value>performance.now())return;n.entries=[t],e(n)}catch(e){}},"complete"===document.readyState?setTimeout(t,0):addEventListener("load",(function(){return setTimeout(t,0)}))}}}]); //# sourceMappingURL=787.2f3b90fa.chunk.js.map
tests/assets/stress/static/js/787.2f3b90fa.chunk.js
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.00016610085731372237, 0.00016610085731372237, 0.00016610085731372237, 0.00016610085731372237, 0 ]
{ "id": 7, "code_window": [ " expect(events.some(e => e.type === 'resource-snapshot')).toBeFalsy();\n", "});\n", "\n", "test('should exclude internal pages', async ({ browserName, context, page, server }, testInfo) => {\n", " test.fixme(true, 'https://github.com/microsoft/playwright/issues/6743');\n", " await page.goto(server.EMPTY_PAGE);\n", "\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "test('should not include buffers in the trace', async ({ context, page, server }, testInfo) => {\n", " await context.tracing.start({ snapshots: true });\n", " await page.goto(server.PREFIX + '/empty.html');\n", " await page.screenshot();\n", " await context.tracing.stop({ path: testInfo.outputPath('trace.zip') });\n", " const { events } = await parseTrace(testInfo.outputPath('trace.zip'));\n", " const screenshotEvent = events.find(e => e.type === 'action' && e.metadata.apiName === 'page.screenshot');\n", " expect(screenshotEvent.metadata.snapshots.length).toBe(2);\n", " expect(screenshotEvent.metadata.result).toEqual({});\n", "});\n", "\n" ], "file_path": "tests/library/tracing.spec.ts", "type": "add", "edit_start_line_idx": 109 }
/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { EventEmitter } from 'events'; import fs from 'fs'; import os from 'os'; import path from 'path'; import type { NameValue } from '../../../common/types'; import type { TracingTracingStopChunkParams } from '@protocol/channels'; import { commandsWithTracingSnapshots } from '../../../protocol/debug'; import { ManualPromise } from '../../../utils/manualPromise'; import type { RegisteredListener } from '../../../utils/eventsHelper'; import { eventsHelper } from '../../../utils/eventsHelper'; import { assert, calculateSha1, createGuid, monotonicTime } from '../../../utils'; import { mkdirIfNeeded, removeFolders } from '../../../utils/fileUtils'; import { Artifact } from '../../artifact'; import { BrowserContext } from '../../browserContext'; import { ElementHandle } from '../../dom'; import type { APIRequestContext } from '../../fetch'; import type { CallMetadata, InstrumentationListener } from '../../instrumentation'; import { SdkObject } from '../../instrumentation'; import { Page } from '../../page'; import type * as har from '@trace/har'; import type { HarTracerDelegate } from '../../har/harTracer'; import { HarTracer } from '../../har/harTracer'; import type { FrameSnapshot } from '@trace/snapshot'; import type * as trace from '@trace/trace'; import type { VERSION } from '@trace/trace'; import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter'; import { Snapshotter } from './snapshotter'; import { yazl } from '../../../zipBundle'; const version: VERSION = 3; export type TracerOptions = { name?: string; snapshots?: boolean; screenshots?: boolean; sources?: boolean; }; type RecordingState = { options: TracerOptions, traceName: string, networkFile: string, traceFile: string, tracesDir: string, resourcesDir: string, filesCount: number, networkSha1s: Set<string>, traceSha1s: Set<string>, sources: Set<string>, recording: boolean; }; const kScreencastOptions = { width: 800, height: 600, quality: 90 }; export class Tracing extends SdkObject implements InstrumentationListener, SnapshotterDelegate, HarTracerDelegate { private _writeChain = Promise.resolve(); private _snapshotter?: Snapshotter; private _harTracer: HarTracer; private _screencastListeners: RegisteredListener[] = []; private _pendingCalls = new Map<string, { sdkObject: SdkObject, metadata: CallMetadata, beforeSnapshot: Promise<void>, actionSnapshot?: Promise<void>, afterSnapshot?: Promise<void> }>(); private _context: BrowserContext | APIRequestContext; private _state: RecordingState | undefined; private _isStopping = false; private _precreatedTracesDir: string | undefined; private _tracesTmpDir: string | undefined; private _allResources = new Set<string>(); private _contextCreatedEvent: trace.ContextCreatedTraceEvent; constructor(context: BrowserContext | APIRequestContext, tracesDir: string | undefined) { super(context, 'tracing'); this._context = context; this._precreatedTracesDir = tracesDir; this._harTracer = new HarTracer(context, null, this, { content: 'attach', includeTraceInfo: true, recordRequestOverrides: false, waitForContentOnStop: false, skipScripts: true, }); this._contextCreatedEvent = { version, type: 'context-options', browserName: '', options: {}, platform: process.platform, wallTime: 0, }; if (context instanceof BrowserContext) { this._snapshotter = new Snapshotter(context, this); assert(tracesDir, 'tracesDir must be specified for BrowserContext'); this._contextCreatedEvent.browserName = context._browser.options.name; this._contextCreatedEvent.options = context._options; } } async start(options: TracerOptions) { if (this._isStopping) throw new Error('Cannot start tracing while stopping'); if (this._state) { const o = this._state.options; if (o.name !== options.name || !o.screenshots !== !options.screenshots || !o.snapshots !== !options.snapshots) throw new Error('Tracing has been already started with different options'); return; } // TODO: passing the same name for two contexts makes them write into a single file // and conflict. const traceName = options.name || createGuid(); // Init the state synchrounously. this._state = { options, traceName, traceFile: '', networkFile: '', tracesDir: '', resourcesDir: '', filesCount: 0, traceSha1s: new Set(), networkSha1s: new Set(), sources: new Set(), recording: false }; const state = this._state; state.tracesDir = await this._createTracesDirIfNeeded(); state.resourcesDir = path.join(state.tracesDir, 'resources'); state.traceFile = path.join(state.tracesDir, traceName + '.trace'); state.networkFile = path.join(state.tracesDir, traceName + '.network'); this._writeChain = fs.promises.mkdir(state.resourcesDir, { recursive: true }).then(() => fs.promises.writeFile(state.networkFile, '')); if (options.snapshots) this._harTracer.start(); } async startChunk(options: { title?: string } = {}) { if (this._state && this._state.recording) await this.stopChunk({ mode: 'doNotSave' }); if (!this._state) throw new Error('Must start tracing before starting a new chunk'); if (this._isStopping) throw new Error('Cannot start a trace chunk while stopping'); const state = this._state; const suffix = state.filesCount ? `-${state.filesCount}` : ``; state.filesCount++; state.traceFile = path.join(state.tracesDir, `${state.traceName}${suffix}.trace`); state.recording = true; this._appendTraceOperation(async () => { await mkdirIfNeeded(state.traceFile); await fs.promises.appendFile(state.traceFile, JSON.stringify({ ...this._contextCreatedEvent, title: options.title, wallTime: Date.now() }) + '\n'); }); this._context.instrumentation.addListener(this, this._context); if (state.options.screenshots) this._startScreencast(); if (state.options.snapshots) await this._snapshotter?.start(); } private _startScreencast() { if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) this._startScreencastInPage(page); this._screencastListeners.push( eventsHelper.addEventListener(this._context, BrowserContext.Events.Page, this._startScreencastInPage.bind(this)), ); } private _stopScreencast() { eventsHelper.removeEventListeners(this._screencastListeners); if (!(this._context instanceof BrowserContext)) return; for (const page of this._context.pages()) page.setScreencastOptions(null); } async stop() { if (!this._state) return; if (this._isStopping) throw new Error(`Tracing is already stopping`); if (this._state.recording) throw new Error(`Must stop trace file before stopping tracing`); this._harTracer.stop(); await this._writeChain; this._state = undefined; } async deleteTmpTracesDir() { if (this._tracesTmpDir) await removeFolders([this._tracesTmpDir]); } private async _createTracesDirIfNeeded() { if (this._precreatedTracesDir) return this._precreatedTracesDir; this._tracesTmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'playwright-tracing-')); return this._tracesTmpDir; } async dispose() { this._snapshotter?.dispose(); this._harTracer.stop(); await this._writeChain; } async stopChunk(params: TracingTracingStopChunkParams): Promise<{ artifact: Artifact | null, sourceEntries: NameValue[] | undefined }> { if (this._isStopping) throw new Error(`Tracing is already stopping`); this._isStopping = true; if (!this._state || !this._state.recording) { this._isStopping = false; if (params.mode !== 'doNotSave') throw new Error(`Must start tracing before stopping`); return { artifact: null, sourceEntries: [] }; } const state = this._state!; this._context.instrumentation.removeListener(this); if (this._state?.options.screenshots) this._stopScreencast(); for (const { sdkObject, metadata, beforeSnapshot, actionSnapshot, afterSnapshot } of this._pendingCalls.values()) { await Promise.all([beforeSnapshot, actionSnapshot, afterSnapshot]); let callMetadata = metadata; if (!afterSnapshot) { // Note: we should not modify metadata here to avoid side-effects in any other place. callMetadata = { ...metadata, error: { error: { name: 'Error', message: 'Action was interrupted' } }, }; } await this.onAfterCall(sdkObject, callMetadata); } if (state.options.snapshots) await this._snapshotter?.stop(); // Chain the export operation against write operations, // so that neither trace files nor sha1s change during the export. return await this._appendTraceOperation(async () => { if (params.mode === 'doNotSave') return { artifact: null, sourceEntries: undefined }; // Har files a live, make a snapshot before returning the resulting entries. const networkFile = path.join(state.networkFile, '..', createGuid()); await fs.promises.copyFile(state.networkFile, networkFile); const entries: NameValue[] = []; entries.push({ name: 'trace.trace', value: state.traceFile }); entries.push({ name: 'trace.network', value: networkFile }); for (const sha1 of new Set([...state.traceSha1s, ...state.networkSha1s])) entries.push({ name: path.join('resources', sha1), value: path.join(state.resourcesDir, sha1) }); let sourceEntries: NameValue[] | undefined; if (state.sources.size) { sourceEntries = []; for (const value of state.sources) { const entry = { name: 'resources/src@' + calculateSha1(value) + '.txt', value }; if (params.mode === 'compressTraceAndSources') { if (fs.existsSync(entry.value)) entries.push(entry); } else { sourceEntries.push(entry); } } } const artifact = await this._exportZip(entries, state).catch(() => null); return { artifact, sourceEntries }; }).finally(() => { // Only reset trace sha1s, network resources are preserved between chunks. state.traceSha1s = new Set(); state.sources = new Set(); this._isStopping = false; state.recording = false; }) || { artifact: null, sourceEntries: undefined }; } private async _exportZip(entries: NameValue[], state: RecordingState): Promise<Artifact | null> { const zipFile = new yazl.ZipFile(); const result = new ManualPromise<Artifact | null>(); (zipFile as any as EventEmitter).on('error', error => result.reject(error)); for (const entry of entries) zipFile.addFile(entry.value, entry.name); zipFile.end(); const zipFileName = state.traceFile + '.zip'; zipFile.outputStream.pipe(fs.createWriteStream(zipFileName)).on('close', () => { const artifact = new Artifact(this._context, zipFileName); artifact.reportFinished(); result.resolve(artifact); }); return result; } async _captureSnapshot(name: 'before' | 'after' | 'action' | 'event', sdkObject: SdkObject, metadata: CallMetadata, element?: ElementHandle) { if (!this._snapshotter) return; if (!sdkObject.attribution.page) return; if (!this._snapshotter.started()) return; if (!shouldCaptureSnapshot(metadata)) return; const snapshotName = `${name}@${metadata.id}`; metadata.snapshots.push({ title: name, snapshotName }); // We have |element| for input actions (page.click and handle.click) // and |sdkObject| element for accessors like handle.textContent. if (!element && sdkObject instanceof ElementHandle) element = sdkObject; await this._snapshotter.captureSnapshot(sdkObject.attribution.page, snapshotName, element).catch(() => {}); } async onBeforeCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); // Set afterSnapshot name for all the actions that operate selectors. // Elements resolved from selectors will be marked on the snapshot. metadata.afterSnapshot = `after@${metadata.id}`; const beforeSnapshot = this._captureSnapshot('before', sdkObject, metadata); this._pendingCalls.set(metadata.id, { sdkObject, metadata, beforeSnapshot }); if (this._state?.options.sources) { for (const frame of metadata.stack || []) this._state.sources.add(frame.file); } await beforeSnapshot; } async onBeforeInputAction(sdkObject: SdkObject, metadata: CallMetadata, element: ElementHandle) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const actionSnapshot = this._captureSnapshot('action', sdkObject, metadata, element); this._pendingCalls.get(metadata.id)!.actionSnapshot = actionSnapshot; await actionSnapshot; } async onAfterCall(sdkObject: SdkObject, metadata: CallMetadata) { sdkObject.attribution.page?.temporarlyDisableTracingScreencastThrottling(); const pendingCall = this._pendingCalls.get(metadata.id); if (!pendingCall || pendingCall.afterSnapshot) return; if (!sdkObject.attribution.context) { this._pendingCalls.delete(metadata.id); return; } pendingCall.afterSnapshot = this._captureSnapshot('after', sdkObject, metadata); await pendingCall.afterSnapshot; const event: trace.ActionTraceEvent = { type: 'action', metadata }; this._appendTraceEvent(event); this._pendingCalls.delete(metadata.id); } onEvent(sdkObject: SdkObject, metadata: CallMetadata) { if (!sdkObject.attribution.context) return; const event: trace.ActionTraceEvent = { type: 'event', metadata }; this._appendTraceEvent(event); } onEntryStarted(entry: har.Entry) { } onEntryFinished(entry: har.Entry) { const event: trace.ResourceSnapshotTraceEvent = { type: 'resource-snapshot', snapshot: entry }; this._appendTraceOperation(async () => { visitSha1s(event, this._state!.networkSha1s); await fs.promises.appendFile(this._state!.networkFile, JSON.stringify(event) + '\n'); }); } onContentBlob(sha1: string, buffer: Buffer) { this._appendResource(sha1, buffer); } onSnapshotterBlob(blob: SnapshotterBlob): void { this._appendResource(blob.sha1, blob.buffer); } onFrameSnapshot(snapshot: FrameSnapshot): void { this._appendTraceEvent({ type: 'frame-snapshot', snapshot }); } private _startScreencastInPage(page: Page) { page.setScreencastOptions(kScreencastOptions); const prefix = page.guid; this._screencastListeners.push( eventsHelper.addEventListener(page, Page.Events.ScreencastFrame, params => { const suffix = params.timestamp || Date.now(); const sha1 = `${prefix}-${suffix}.jpeg`; const event: trace.ScreencastFrameTraceEvent = { type: 'screencast-frame', pageId: page.guid, sha1, width: params.width, height: params.height, timestamp: monotonicTime() }; // Make sure to write the screencast frame before adding a reference to it. this._appendResource(sha1, params.buffer); this._appendTraceEvent(event); }), ); } private _appendTraceEvent(event: trace.TraceEvent) { this._appendTraceOperation(async () => { visitSha1s(event, this._state!.traceSha1s); await fs.promises.appendFile(this._state!.traceFile, JSON.stringify(event) + '\n'); }); } private _appendResource(sha1: string, buffer: Buffer) { if (this._allResources.has(sha1)) return; this._allResources.add(sha1); const resourcePath = path.join(this._state!.resourcesDir, sha1); this._appendTraceOperation(async () => { try { // Perhaps we've already written this resource? await fs.promises.access(resourcePath); } catch (e) { // If not, let's write! Note that async access is safe because we // never remove resources until the very end. await fs.promises.writeFile(resourcePath, buffer).catch(() => {}); } }); } private async _appendTraceOperation<T>(cb: () => Promise<T>): Promise<T | undefined> { // This method serializes all writes to the trace. let error: Error | undefined; let result: T | undefined; this._writeChain = this._writeChain.then(async () => { // This check is here because closing the browser removes the tracesDir and tracing // dies trying to archive. if (this._context instanceof BrowserContext && !this._context._browser.isConnected()) return; try { result = await cb(); } catch (e) { error = e; } }); await this._writeChain; if (error) throw error; return result; } } function visitSha1s(object: any, sha1s: Set<string>) { if (Array.isArray(object)) { object.forEach(o => visitSha1s(o, sha1s)); return; } if (typeof object === 'object') { for (const key in object) { if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) { const sha1 = object[key]; if (sha1) sha1s.add(sha1); } visitSha1s(object[key], sha1s); } return; } } export function shouldCaptureSnapshot(metadata: CallMetadata): boolean { return commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method); }
packages/playwright-core/src/server/trace/recorder/tracing.ts
1
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.007507141213864088, 0.0005262451595626771, 0.00016309945203829557, 0.00017636833945289254, 0.0013741819420829415 ]
{ "id": 7, "code_window": [ " expect(events.some(e => e.type === 'resource-snapshot')).toBeFalsy();\n", "});\n", "\n", "test('should exclude internal pages', async ({ browserName, context, page, server }, testInfo) => {\n", " test.fixme(true, 'https://github.com/microsoft/playwright/issues/6743');\n", " await page.goto(server.EMPTY_PAGE);\n", "\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "test('should not include buffers in the trace', async ({ context, page, server }, testInfo) => {\n", " await context.tracing.start({ snapshots: true });\n", " await page.goto(server.PREFIX + '/empty.html');\n", " await page.screenshot();\n", " await context.tracing.stop({ path: testInfo.outputPath('trace.zip') });\n", " const { events } = await parseTrace(testInfo.outputPath('trace.zip'));\n", " const screenshotEvent = events.find(e => e.type === 'action' && e.metadata.apiName === 'page.screenshot');\n", " expect(screenshotEvent.metadata.snapshots.length).toBe(2);\n", " expect(screenshotEvent.metadata.result).toEqual({});\n", "});\n", "\n" ], "file_path": "tests/library/tracing.spec.ts", "type": "add", "edit_start_line_idx": 109 }
<!doctype html> <html> <head> <title>Name file-label-embedded-spinbutton</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <link rel="stylesheet" href="/wai-aria/scripts/manual.css"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/wai-aria/scripts/ATTAcomm.js"></script> <script> setup({explicit_timeout: true, explicit_done: true }); var theTest = new ATTAcomm( { "steps" : [ { "element" : "test", "test" : { "ATK" : [ [ "property", "name", "is", "foo 5 baz" ] ], "AXAPI" : [ [ "property", "AXDescription", "is", "foo 5 baz" ] ], "IAccessible2" : [ [ "property", "accName", "is", "foo 5 baz" ] ], "UIA" : [ [ "property", "Name", "is", "foo 5 baz" ] ] }, "title" : "step 1", "type" : "test" } ], "title" : "Name file-label-embedded-spinbutton" } ) ; </script> </head> <body> <p>This test examines the ARIA properties for Name file-label-embedded-spinbutton.</p> <input type="file" id="test" /> <label for="test">foo <input role="spinbutton" type="number" value="5" min="1" max="10" aria-valuenow="5" aria-valuemin="1" aria-valuemax="10"> baz </label> <div id="manualMode"></div> <div id="log"></div> <div id="ATTAmessages"></div> </body> </html>
tests/assets/wpt/accname/name_file-label-embedded-spinbutton-manual.html
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.00017568693147040904, 0.00017273319826927036, 0.00017109711188822985, 0.00017246785864699632, 0.0000012573281082950416 ]
{ "id": 7, "code_window": [ " expect(events.some(e => e.type === 'resource-snapshot')).toBeFalsy();\n", "});\n", "\n", "test('should exclude internal pages', async ({ browserName, context, page, server }, testInfo) => {\n", " test.fixme(true, 'https://github.com/microsoft/playwright/issues/6743');\n", " await page.goto(server.EMPTY_PAGE);\n", "\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "test('should not include buffers in the trace', async ({ context, page, server }, testInfo) => {\n", " await context.tracing.start({ snapshots: true });\n", " await page.goto(server.PREFIX + '/empty.html');\n", " await page.screenshot();\n", " await context.tracing.stop({ path: testInfo.outputPath('trace.zip') });\n", " const { events } = await parseTrace(testInfo.outputPath('trace.zip'));\n", " const screenshotEvent = events.find(e => e.type === 'action' && e.metadata.apiName === 'page.screenshot');\n", " expect(screenshotEvent.metadata.snapshots.length).toBe(2);\n", " expect(screenshotEvent.metadata.result).toEqual({});\n", "});\n", "\n" ], "file_path": "tests/library/tracing.spec.ts", "type": "add", "edit_start_line_idx": 109 }
/** * Copyright 2017 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // @ts-check const md = require('../markdown'); /** @typedef {import('../markdown').MarkdownNode} MarkdownNode */ /** * @typedef {{ * name: string, * args: ParsedType | null, * retType: ParsedType | null, * template: ParsedType | null, * union: ParsedType | null, * unionName?: string, * next: ParsedType | null, * }} ParsedType */ /** * @typedef {{ * only?: string[], * aliases?: Object<string, string>, * types?: Object<string, Documentation.Type>, * overrides?: Object<string, Documentation.Member>, * }} Langs */ /** * @typedef {function({ * clazz?: Documentation.Class, * member?: Documentation.Member, * param?: string, * option?: string * }): string} Renderer */ /** * @typedef {{ * langs: Langs, * since: string, * experimental: boolean * }} Metainfo */ class Documentation { /** * @param {!Array<!Documentation.Class>} classesArray */ constructor(classesArray) { this.classesArray = classesArray; /** @type {!Map<string, !Documentation.Class>} */ this.classes = new Map(); this.index(); } /** * @param {!Documentation} documentation * @return {!Documentation} */ mergeWith(documentation) { return new Documentation([...this.classesArray, ...documentation.classesArray].map(cls => cls.clone())); } /** * @param {string[]} errors */ copyDocsFromSuperclasses(errors) { for (const [name, clazz] of this.classes.entries()) { clazz.validateOrder(errors, clazz); if (!clazz.extends || ['EventEmitter', 'Error', 'Exception', 'RuntimeException'].includes(clazz.extends)) continue; const superClass = this.classes.get(clazz.extends); if (!superClass) { errors.push(`Undefined superclass: ${superClass} in ${name}`); continue; } for (const memberName of clazz.members.keys()) { if (superClass.members.has(memberName)) errors.push(`Member documentation overrides base: ${name}.${memberName} over ${clazz.extends}.${memberName}`); } clazz.membersArray = [...clazz.membersArray, ...superClass.membersArray.map(c => c.clone())]; clazz.index(); } } /** * @param {string} lang */ filterForLanguage(lang) { const classesArray = []; for (const clazz of this.classesArray) { if (clazz.langs.only && !clazz.langs.only.includes(lang)) continue; clazz.filterForLanguage(lang); classesArray.push(clazz); } this.classesArray = classesArray; this.index(); } filterOutExperimental() { const classesArray = []; for (const clazz of this.classesArray) { if (clazz.experimental) continue; clazz.filterOutExperimental(); classesArray.push(clazz); } this.classesArray = classesArray; this.index(); } index() { for (const cls of this.classesArray) { this.classes.set(cls.name, cls); cls.index(); } } /** * @param {Renderer} linkRenderer */ setLinkRenderer(linkRenderer) { // @type {Map<string, Documentation.Class>} const classesMap = new Map(); const membersMap = new Map(); for (const clazz of this.classesArray) { classesMap.set(clazz.name, clazz); for (const member of clazz.membersArray) membersMap.set(`${member.kind}: ${clazz.name}.${member.name}`, member); } /** * @param {Documentation.Class|Documentation.Member|null} classOrMember * @param {MarkdownNode[] | undefined} nodes */ this._patchLinks = (classOrMember, nodes) => patchLinks(classOrMember, nodes, classesMap, membersMap, linkRenderer); for (const clazz of this.classesArray) clazz.visit(item => this._patchLinks?.(item, item.spec)); } /** * @param {MarkdownNode[]} nodes */ renderLinksInText(nodes) { this._patchLinks?.(null, nodes); } generateSourceCodeComments() { for (const clazz of this.classesArray) clazz.visit(item => item.comment = generateSourceCodeComment(item.spec)); } clone() { return new Documentation(this.classesArray.map(cls => cls.clone())); } } Documentation.Class = class { /** * @param {Metainfo} metainfo * @param {string} name * @param {!Array<!Documentation.Member>} membersArray * @param {?string=} extendsName * @param {MarkdownNode[]=} spec */ constructor(metainfo, name, membersArray, extendsName = null, spec = undefined) { this.langs = metainfo.langs; this.experimental = metainfo.experimental; this.since = metainfo.since; this.name = name; this.membersArray = membersArray; this.spec = spec; this.extends = extendsName; this.comment = ''; this.index(); const match = /** @type {string[]} */(name.match(/(API|JS|CDP|[A-Z])(.*)/)); this.varName = match[1].toLowerCase() + match[2]; /** @type {!Map<string, !Documentation.Member>} */ this.members = new Map(); /** @type {!Map<string, !Documentation.Member>} */ this.properties = new Map(); /** @type {!Array<!Documentation.Member>} */ this.propertiesArray = []; /** @type {!Map<string, !Documentation.Member>} */ this.methods = new Map(); /** @type {!Array<!Documentation.Member>} */ this.methodsArray = []; /** @type {!Map<string, !Documentation.Member>} */ this.events = new Map(); /** @type {!Array<!Documentation.Member>} */ this.eventsArray = []; } index() { this.members = new Map(); this.properties = new Map(); this.propertiesArray = []; this.methods = new Map(); this.methodsArray = []; this.events = new Map(); this.eventsArray = []; for (const member of this.membersArray) { this.members.set(member.name, member); if (member.kind === 'method') { this.methods.set(member.name, member); this.methodsArray.push(member); } else if (member.kind === 'property') { this.properties.set(member.name, member); this.propertiesArray.push(member); } else if (member.kind === 'event') { this.events.set(member.name, member); this.eventsArray.push(member); } member.clazz = this; member.index(); } } clone() { const cls = new Documentation.Class({ langs: this.langs, experimental: this.experimental, since: this.since }, this.name, this.membersArray.map(m => m.clone()), this.extends, this.spec); cls.comment = this.comment; return cls; } /** * @param {string} lang */ filterForLanguage(lang) { const membersArray = []; for (const member of this.membersArray) { if (member.langs.only && !member.langs.only.includes(lang)) continue; member.filterForLanguage(lang); membersArray.push(member); } this.membersArray = membersArray; } filterOutExperimental() { const membersArray = []; for (const member of this.membersArray) { if (member.experimental) continue; member.filterOutExperimental(); membersArray.push(member); } this.membersArray = membersArray; } validateOrder(errors, cls) { const members = this.membersArray; // Events should go first. let eventIndex = 0; for (; eventIndex < members.length && members[eventIndex].kind === 'event'; ++eventIndex); for (; eventIndex < members.length && members[eventIndex].kind !== 'event'; ++eventIndex); if (eventIndex < members.length) errors.push(`Events should go first. Event '${members[eventIndex].name}' in class ${cls.name} breaks order`); // Constructor should be right after events and before all other members. const constructorIndex = members.findIndex(member => member.kind === 'method' && member.name === 'constructor'); if (constructorIndex > 0 && members[constructorIndex - 1].kind !== 'event') errors.push(`Constructor of ${cls.name} should go before other methods`); // Events should be sorted alphabetically. for (let i = 0; i < members.length - 1; ++i) { const member1 = this.membersArray[i]; const member2 = this.membersArray[i + 1]; if (member1.kind !== 'event' || member2.kind !== 'event') continue; if (member1.name.localeCompare(member2.name, 'en', { sensitivity: 'base' }) > 0) errors.push(`Event '${member1.name}' in class ${this.name} breaks alphabetic ordering of events`); } // All other members should be sorted alphabetically. for (let i = 0; i < members.length - 1; ++i) { const member1 = this.membersArray[i]; const member2 = this.membersArray[i + 1]; if (member1.kind === 'event' || member2.kind === 'event') continue; if (member1.kind === 'method' && member1.name === 'constructor') continue; if (member1.name.replace(/^\$+/, '$').localeCompare(member2.name.replace(/^\$+/, '$'), 'en', { sensitivity: 'base' }) > 0) { let memberName1 = `${this.name}.${member1.name}`; if (member1.kind === 'method') memberName1 += '()'; let memberName2 = `${this.name}.${member2.name}`; if (member2.kind === 'method') memberName2 += '()'; errors.push(`Bad alphabetic ordering of ${this.name} members: ${memberName1} should go after ${memberName2}`); } } } /** * @param {function(Documentation.Member|Documentation.Class): void} visitor */ visit(visitor) { visitor(this); for (const p of this.propertiesArray) p.visit(visitor); for (const m of this.methodsArray) m.visit(visitor); for (const e of this.eventsArray) e.visit(visitor); } }; Documentation.Member = class { /** * @param {string} kind * @param {Metainfo} metainfo * @param {string} name * @param {?Documentation.Type} type * @param {!Array<!Documentation.Member>} argsArray * @param {MarkdownNode[]=} spec * @param {boolean=} required */ constructor(kind, metainfo, name, type, argsArray, spec = undefined, required = true) { this.kind = kind; this.langs = metainfo.langs; this.experimental = metainfo.experimental; this.since = metainfo.since; this.name = name; this.type = type; this.spec = spec; this.argsArray = argsArray; this.required = required; this.comment = ''; /** @type {!Map<string, !Documentation.Member>} */ this.args = new Map(); this.index(); /** @type {!Documentation.Class | null} */ this.clazz = null; /** @type {Documentation.Member=} */ this.enclosingMethod = undefined; this.deprecated = false; if (spec) { md.visitAll(spec, node => { if (node.text && node.text.includes('**DEPRECATED**')) this.deprecated = true; }); }; this.async = false; this.alias = name; this.overloadIndex = 0; if (name.includes('#')) { const match = /** @type {string[]} */(name.match(/(.*)#(.*)/)); this.alias = match[1]; this.overloadIndex = (+match[2]) - 1; } /** * Param is true and option false * @type {Boolean | null} */ this.paramOrOption = null; } index() { this.args = new Map(); if (this.kind === 'method') this.enclosingMethod = this; for (const arg of this.argsArray) { this.args.set(arg.name, arg); arg.enclosingMethod = this; if (arg.name === 'options') { // @ts-ignore arg.type.properties.sort((p1, p2) => p1.name.localeCompare(p2.name)); // @ts-ignore arg.type.properties.forEach(p => p.enclosingMethod = this); } } } /** * @param {string} lang */ filterForLanguage(lang) { if (!this.type) return; if (this.langs.aliases && this.langs.aliases[lang]) this.alias = this.langs.aliases[lang]; if (this.langs.types && this.langs.types[lang]) this.type = this.langs.types[lang]; this.type.filterForLanguage(lang); const argsArray = []; for (const arg of this.argsArray) { if (arg.langs.only && !arg.langs.only.includes(lang)) continue; const overriddenArg = (arg.langs.overrides && arg.langs.overrides[lang]) || arg; overriddenArg.filterForLanguage(lang); // @ts-ignore if (overriddenArg.name === 'options' && !overriddenArg.type.properties.length) continue; // @ts-ignore overriddenArg.type.filterForLanguage(lang); argsArray.push(overriddenArg); } this.argsArray = argsArray; } filterOutExperimental() { if (!this.type) return; this.type.filterOutExperimental(); const argsArray = []; for (const arg of this.argsArray) { if (arg.experimental || !arg.type) continue; arg.type.filterOutExperimental(); argsArray.push(arg); } this.argsArray = argsArray; } clone() { const result = new Documentation.Member(this.kind, { langs: this.langs, experimental: this.experimental, since: this.since }, this.name, this.type?.clone(), this.argsArray.map(arg => arg.clone()), this.spec, this.required); result.alias = this.alias; result.async = this.async; result.paramOrOption = this.paramOrOption; return result; } /** * @param {Metainfo} metainfo * @param {string} name * @param {!Array<!Documentation.Member>} argsArray * @param {?Documentation.Type} returnType * @param {MarkdownNode[]=} spec * @return {!Documentation.Member} */ static createMethod(metainfo, name, argsArray, returnType, spec) { return new Documentation.Member('method', metainfo, name, returnType, argsArray, spec); } /** * @param {Metainfo} metainfo * @param {!string} name * @param {!Documentation.Type} type * @param {!MarkdownNode[]=} spec * @param {boolean=} required * @return {!Documentation.Member} */ static createProperty(metainfo, name, type, spec, required) { return new Documentation.Member('property', metainfo, name, type, [], spec, required); } /** * @param {Metainfo} metainfo * @param {string} name * @param {?Documentation.Type=} type * @param {MarkdownNode[]=} spec * @return {!Documentation.Member} */ static createEvent(metainfo, name, type = null, spec) { return new Documentation.Member('event', metainfo, name, type, [], spec); } /** * @param {function(Documentation.Member|Documentation.Class): void} visitor */ visit(visitor) { visitor(this); if (this.type) this.type.visit(visitor); for (const arg of this.argsArray) arg.visit(visitor); } }; Documentation.Type = class { /** * @param {string} expression * @param {!Array<!Documentation.Member>=} properties * @return {Documentation.Type} */ static parse(expression, properties = []) { expression = expression.replace(/\\\(/g, '(').replace(/\\\)/g, ')'); const type = Documentation.Type.fromParsedType(parseTypeExpression(expression)); type.expression = expression; if (type.name === 'number') throw new Error('Number types should be either int or float, not number in: ' + expression); if (!properties.length) return type; const types = []; type._collectAllTypes(types); let success = false; for (const t of types) { if (t.name === 'Object') { t.properties = properties; success = true; } } if (!success) throw new Error('Nested properties given, but there are no objects in type expression: ' + expression); return type; } /** * @param {ParsedType} parsedType * @return {Documentation.Type} */ static fromParsedType(parsedType, inUnion = false) { if (!inUnion && !parsedType.unionName && isStringUnion(parsedType) ) { throw new Error('Enum must have a name:\n' + JSON.stringify(parsedType, null, 2)); } if (!inUnion && (parsedType.union || parsedType.unionName)) { const type = new Documentation.Type(parsedType.unionName || ''); type.union = []; // @ts-ignore for (let t = parsedType; t; t = t.union) { const nestedUnion = !!t.unionName && t !== parsedType; type.union.push(Documentation.Type.fromParsedType(t, !nestedUnion)); if (nestedUnion) break; } return type; } if (parsedType.args) { const type = new Documentation.Type('function'); type.args = []; // @ts-ignore for (let t = parsedType.args; t; t = t.next) type.args.push(Documentation.Type.fromParsedType(t)); type.returnType = parsedType.retType ? Documentation.Type.fromParsedType(parsedType.retType) : undefined; return type; } if (parsedType.template) { const type = new Documentation.Type(parsedType.name); type.templates = []; // @ts-ignore for (let t = parsedType.template; t; t = t.next) type.templates.push(Documentation.Type.fromParsedType(t)); return type; } return new Documentation.Type(parsedType.name); } /** * @param {string} name * @param {!Array<!Documentation.Member>=} properties */ constructor(name, properties) { this.name = name.replace(/^\[/, '').replace(/\]$/, ''); /** @type {Documentation.Member[] | undefined} */ this.properties = this.name === 'Object' ? properties : undefined; /** @type {Documentation.Type[] | undefined} */ this.union; /** @type {Documentation.Type[] | undefined} */ this.args; /** @type {Documentation.Type | undefined} */ this.returnType; /** @type {Documentation.Type[] | undefined} */ this.templates; /** @type {string | undefined} */ this.expression; } visit(visitor) { const types = []; this._collectAllTypes(types); for (const type of types) { for (const p of type.properties || []) p.visit(visitor); } } clone() { const type = new Documentation.Type(this.name, this.properties ? this.properties.map(prop => prop.clone()) : undefined); if (this.union) type.union = this.union.map(type => type.clone()); if (this.args) type.args = this.args.map(type => type.clone()); if (this.returnType) type.returnType = this.returnType.clone(); if (this.templates) type.templates = this.templates.map(type => type.clone()); type.expression = this.expression; return type; } /** * @returns {Documentation.Member[]} */ deepProperties() { const types = []; this._collectAllTypes(types); for (const type of types) { if (type.properties && type.properties.length) return type.properties; } return []; } /** * @returns {Documentation.Member[] | undefined} */ sortedProperties() { if (!this.properties) return this.properties; const sortedProperties = [...this.properties]; sortedProperties.sort((p1, p2) => p1.name.localeCompare(p2.name)); return sortedProperties; } /** * @param {string} lang */ filterForLanguage(lang) { if (!this.properties) return; const properties = []; for (const prop of this.properties) { if (prop.langs.only && !prop.langs.only.includes(lang)) continue; prop.filterForLanguage(lang); properties.push(prop); } this.properties = properties; } filterOutExperimental() { if (!this.properties) return; const properties = []; for (const prop of this.properties) { if (prop.experimental) continue; prop.filterOutExperimental(); properties.push(prop); } this.properties = properties; } /** * @param {Documentation.Type[]} result */ _collectAllTypes(result) { result.push(this); for (const t of this.union || []) t._collectAllTypes(result); for (const t of this.args || []) t._collectAllTypes(result); for (const t of this.templates || []) t._collectAllTypes(result); if (this.returnType) this.returnType._collectAllTypes(result); } }; /** * @param {ParsedType | null} type * @returns {boolean} */ function isStringUnion(type) { while (type) { if (!type.name.startsWith('"') || !type.name.endsWith('"')) return false; type = type.union; } return true; } /** * @param {string} type * @returns {ParsedType} */ function parseTypeExpression(type) { type = type.trim(); let name = type; let next = null; let template = null; let args = null; let retType = null; let firstTypeLength = type.length; for (let i = 0; i < type.length; i++) { if (type[i] === '<') { name = type.substring(0, i); const matching = matchingBracket(type.substring(i), '<', '>'); template = parseTypeExpression(type.substring(i + 1, i + matching - 1)); firstTypeLength = i + matching; break; } if (type[i] === '(') { name = type.substring(0, i); const matching = matchingBracket(type.substring(i), '(', ')'); args = parseTypeExpression(type.substring(i + 1, i + matching - 1)); i = i + matching; if (type[i] === ':') { retType = parseTypeExpression(type.substring(i + 1)); next = retType.next; retType.next = null; break; } } if (type[i] === '|' || type[i] === ',') { name = type.substring(0, i); firstTypeLength = i; break; } } let union = null; if (type[firstTypeLength] === '|') union = parseTypeExpression(type.substring(firstTypeLength + 1)); else if (type[firstTypeLength] === ',') next = parseTypeExpression(type.substring(firstTypeLength + 1)); if (template && !template.unionName && isStringUnion(template)) { template.unionName = name; return template; } return { name, args, retType, template, union, next }; } /** * @param {string} str * @param {any} open * @param {any} close */ function matchingBracket(str, open, close) { let count = 1; let i = 1; for (; i < str.length && count; i++) { if (str[i] === open) count++; else if (str[i] === close) count--; } return i; } /** * @param {Documentation.Class|Documentation.Member|null} classOrMember * @param {MarkdownNode[]|undefined} spec * @param {Map<string, Documentation.Class>} classesMap * @param {Map<string, Documentation.Member>} membersMap * @param {Renderer} linkRenderer */ function patchLinks(classOrMember, spec, classesMap, membersMap, linkRenderer) { if (!spec) return; md.visitAll(spec, node => { if (!node.text) return; node.text = node.text.replace(/\[`(\w+): ([^\]]+)`\]/g, (match, p1, p2) => { if (['event', 'method', 'property'].includes(p1)) { const memberName = p1 + ': ' + p2; const member = membersMap.get(memberName); if (!member) throw new Error('Undefined member references: ' + match); return linkRenderer({ member }) || match; } if (p1 === 'param') { let alias = p2; if (classOrMember) { // param/option reference can only be in method or same method parameter comments. // @ts-ignore const method = classOrMember.enclosingMethod; const param = method.argsArray.find(a => a.name === p2); if (!param) throw new Error(`Referenced parameter ${match} not found in the parent method ${method.name} `); alias = param.alias; } return linkRenderer({ param: alias }) || match; } if (p1 === 'option') return linkRenderer({ option: p2 }) || match; throw new Error(`Undefined link prefix, expected event|method|property|param|option, got: ` + match); }); node.text = node.text.replace(/\[([\w]+)\]/g, (match, p1) => { const clazz = classesMap.get(p1); if (clazz) return linkRenderer({ clazz }) || match; return match; }); }); } /** * @param {MarkdownNode[] | undefined} spec */ function generateSourceCodeComment(spec) { const comments = (spec || []).filter(n => !n.type.startsWith('h') && (n.type !== 'li' || n.liType !== 'default')).map(c => md.clone(c)); md.visitAll(comments, node => { if (node.codeLang && node.codeLang.includes('tab=js-js')) node.type = 'null'; if (node.type === 'li' && node.liType === 'bullet') node.liType = 'default'; if (node.type === 'note') { // @ts-ignore node.type = 'text'; node.text = '> NOTE: ' + node.text; } }); return md.render(comments, 120); } module.exports = Documentation;
utils/doclint/documentation.js
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.0018129703821614385, 0.0002051468618446961, 0.0001623178250156343, 0.00017562563880346715, 0.00019978106138296425 ]
{ "id": 7, "code_window": [ " expect(events.some(e => e.type === 'resource-snapshot')).toBeFalsy();\n", "});\n", "\n", "test('should exclude internal pages', async ({ browserName, context, page, server }, testInfo) => {\n", " test.fixme(true, 'https://github.com/microsoft/playwright/issues/6743');\n", " await page.goto(server.EMPTY_PAGE);\n", "\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "test('should not include buffers in the trace', async ({ context, page, server }, testInfo) => {\n", " await context.tracing.start({ snapshots: true });\n", " await page.goto(server.PREFIX + '/empty.html');\n", " await page.screenshot();\n", " await context.tracing.stop({ path: testInfo.outputPath('trace.zip') });\n", " const { events } = await parseTrace(testInfo.outputPath('trace.zip'));\n", " const screenshotEvent = events.find(e => e.type === 'action' && e.metadata.apiName === 'page.screenshot');\n", " expect(screenshotEvent.metadata.snapshots.length).toBe(2);\n", " expect(screenshotEvent.metadata.result).toEqual({});\n", "});\n", "\n" ], "file_path": "tests/library/tracing.spec.ts", "type": "add", "edit_start_line_idx": 109 }
/* Copyright (c) Microsoft Corporation. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import type { ActionTraceEvent } from '@trace/trace'; import { msToString } from '@web/uiUtils'; import * as React from 'react'; import './actionList.css'; import * as modelUtil from './modelUtil'; import './tabbedPane.css'; export interface ActionListProps { actions: ActionTraceEvent[], selectedAction: ActionTraceEvent | undefined, highlightedAction: ActionTraceEvent | undefined, onSelected: (action: ActionTraceEvent) => void, onHighlighted: (action: ActionTraceEvent | undefined) => void, setSelectedTab: (tab: string) => void, } export const ActionList: React.FC<ActionListProps> = ({ actions = [], selectedAction = undefined, highlightedAction = undefined, onSelected = () => {}, onHighlighted = () => {}, setSelectedTab = () => {}, }) => { const actionListRef = React.createRef<HTMLDivElement>(); React.useEffect(() => { actionListRef.current?.focus(); }, [selectedAction, actionListRef]); return <div className='action-list vbox'> <div className='action-list-content' tabIndex={0} onKeyDown={event => { if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return; event.stopPropagation(); event.preventDefault(); const index = selectedAction ? actions.indexOf(selectedAction) : -1; let newIndex = index; if (event.key === 'ArrowDown') { if (index === -1) newIndex = 0; else newIndex = Math.min(index + 1, actions.length - 1); } if (event.key === 'ArrowUp') { if (index === -1) newIndex = actions.length - 1; else newIndex = Math.max(index - 1, 0); } const element = actionListRef.current?.children.item(newIndex); if ((element as any)?.scrollIntoViewIfNeeded) (element as any).scrollIntoViewIfNeeded(false); else element?.scrollIntoView(); onSelected(actions[newIndex]); }} ref={actionListRef} > {actions.length === 0 && <div className='no-actions-entry'>No actions recorded</div>} {actions.map(action => { const { metadata } = action; const selectedSuffix = action === selectedAction ? ' selected' : ''; const highlightedSuffix = action === highlightedAction ? ' highlighted' : ''; const error = metadata.error?.error?.message; const { errors, warnings } = modelUtil.stats(action); return <div className={'action-entry' + selectedSuffix + highlightedSuffix} key={metadata.id} onClick={() => onSelected(action)} onMouseEnter={() => onHighlighted(action)} onMouseLeave={() => (highlightedAction === action) && onHighlighted(undefined)} > <div className='action-title'> <span>{metadata.apiName}</span> {metadata.params.selector && <div className='action-selector' title={metadata.params.selector}>{metadata.params.selector}</div>} {metadata.method === 'goto' && metadata.params.url && <div className='action-url' title={metadata.params.url}>{metadata.params.url}</div>} </div> <div className='action-duration' style={{ flex: 'none' }}>{metadata.endTime ? msToString(metadata.endTime - metadata.startTime) : 'Timed Out'}</div> <div className='action-icons' onClick={() => setSelectedTab('console')}> {!!errors && <div className='action-icon'><span className={'codicon codicon-error'}></span><span className="action-icon-value">{errors}</span></div>} {!!warnings && <div className='action-icon'><span className={'codicon codicon-warning'}></span><span className="action-icon-value">{warnings}</span></div>} </div> {error && <div className='codicon codicon-issues' title={error} />} </div>; })} </div> </div>; };
packages/trace-viewer/src/ui/actionList.tsx
0
https://github.com/microsoft/playwright/commit/6d363888f27b1238986398fd1d6e1f149e039e12
[ 0.00017860170919448137, 0.00017424981342628598, 0.00016710994532331824, 0.00017524474242236465, 0.000003400509513085126 ]
{ "id": 0, "code_window": [ "name: Basic checks\n", "\n", "on:\n", " push:\n", " branches:\n", " - main\n", " pull_request:\n", " branches:\n", " - main\n", "\n", "jobs:\n", " main:\n", " if: github.ref != 'refs/heads/main'\n" ], "labels": [ "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "on: workflow_dispatch\n", "\n", "# on:\n", "# push:\n", "# branches:\n", "# - main\n", "# pull_request:\n", "# branches:\n", "# - main\n" ], "file_path": ".github/workflows/basic.yml", "type": "replace", "edit_start_line_idx": 2 }
parameters: - name: VSCODE_QUALITY type: string steps: - task: NodeTool@0 inputs: versionSpec: "16.x" - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - task: AzureKeyVault@1 displayName: "Azure Key Vault: Get Secrets" inputs: azureSubscription: "vscode-builds-subscription" KeyVaultName: vscode SecretsFilter: "github-distro-mixin-password" - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e cat << EOF > ~/.netrc machine github.com login vscode password $(github-distro-mixin-password) EOF git config user.email "[email protected]" git config user.name "VSCode" displayName: Prepare tooling - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)" git checkout FETCH_HEAD condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' ')) displayName: Checkout override commit - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro") displayName: Merge distro - script: | mkdir -p .build node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash displayName: Prepare yarn cache flags # using `genericNodeModules` instead of `nodeModules` here to avoid sharing the cache with builds running inside containers - task: Cache@2 inputs: key: "genericNodeModules | $(Agent.OS) | .build/yarnlockhash" path: .build/node_modules_cache cacheHitVar: NODE_MODULES_RESTORED displayName: Restore node_modules cache # Cache built-in extensions to avoid GH rate limits. - task: Cache@2 inputs: key: '"builtInDeps" | .build/builtindepshash' path: .build/builtInExtensions displayName: Restore built-in extensions - script: | set -e tar -xzf .build/node_modules_cache/cache.tgz condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true')) displayName: Extract node_modules cache - script: | set -e npx https://aka.ms/enablesecurefeed standAlone timeoutInMinutes: 5 retryCountOnTaskFailure: 3 condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), eq(variables['ENABLE_TERRAPIN'], 'true')) displayName: Switch to Terrapin packages - script: | set -e sudo apt update -y sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libsecret-1-dev libnotify-bin displayName: Install build tools condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) - script: | set -e for i in {1..3}; do # try 3 times, for Terrapin yarn --frozen-lockfile --check-files && break if [ $i -eq 3 ]; then echo "Yarn failed too many times" >&2 exit 1 fi echo "Yarn failed $i, trying again..." done env: ELECTRON_SKIP_BINARY_DOWNLOAD: 1 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 GITHUB_TOKEN: "$(github-distro-mixin-password)" displayName: Install dependencies condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) - script: | set -e node build/lib/builtInExtensions.js env: GITHUB_TOKEN: "$(github-distro-mixin-password)" displayName: Download missing built-in extensions - script: | set -e node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt mkdir -p .build/node_modules_cache tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) displayName: Create node_modules archive - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: # Mixin must run before optimize, because the CSS loader will inline small SVGs - script: | set -e node build/azure-pipelines/mixin displayName: Mix in quality - script: | set -e yarn npm-run-all -lp core-ci extensions-ci hygiene eslint valid-layers-check env: GITHUB_TOKEN: "$(github-distro-mixin-password)" displayName: Compile & Hygiene - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e yarn --cwd test/smoke compile yarn --cwd test/integration/browser compile displayName: Compile test suites condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - task: AzureCLI@2 inputs: azureSubscription: "vscode-builds-subscription" scriptType: pscore scriptLocation: inlineScript addSpnToEnvironment: true inlineScript: | Write-Host "##vso[task.setvariable variable=AZURE_TENANT_ID]$env:tenantId" Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_ID]$env:servicePrincipalId" Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_SECRET;issecret=true]$env:servicePrincipalKey" - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e AZURE_STORAGE_ACCOUNT="ticino" \ AZURE_TENANT_ID="$(AZURE_TENANT_ID)" \ AZURE_CLIENT_ID="$(AZURE_CLIENT_ID)" \ AZURE_CLIENT_SECRET="$(AZURE_CLIENT_SECRET)" \ node build/azure-pipelines/upload-sourcemaps displayName: Upload sourcemaps - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set - ./build/azure-pipelines/common/extract-telemetry.sh displayName: Extract Telemetry - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e tar -cz --ignore-failed-read -f $(Build.ArtifactStagingDirectory)/compilation.tar.gz .build out-* test/integration/browser/out test/smoke/out test/automation/out displayName: Compress compilation artifact - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - task: PublishPipelineArtifact@1 inputs: targetPath: $(Build.ArtifactStagingDirectory)/compilation.tar.gz artifactName: Compilation displayName: Publish compilation artifact - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \ yarn download-builtin-extensions-cg displayName: Built-in extensions component details - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: "Component Detection" inputs: sourceScanPath: $(Build.SourcesDirectory) continueOnError: true
build/azure-pipelines/product-compile.yml
1
https://github.com/microsoft/vscode/commit/7041b71cd67d65886ebf11ee65b13f10bcc193f0
[ 0.00017847488925326616, 0.00017263038898818195, 0.00016920411144383252, 0.0001722416782286018, 0.000002346424025745364 ]
{ "id": 0, "code_window": [ "name: Basic checks\n", "\n", "on:\n", " push:\n", " branches:\n", " - main\n", " pull_request:\n", " branches:\n", " - main\n", "\n", "jobs:\n", " main:\n", " if: github.ref != 'refs/heads/main'\n" ], "labels": [ "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "on: workflow_dispatch\n", "\n", "# on:\n", "# push:\n", "# branches:\n", "# - main\n", "# pull_request:\n", "# branches:\n", "# - main\n" ], "file_path": ".github/workflows/basic.yml", "type": "replace", "edit_start_line_idx": 2 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; import { BinarySizeStatusBarEntry } from './binarySizeStatusBarEntry'; import { MediaPreview, reopenAsText } from './mediaPreview'; import { escapeAttribute, getNonce } from './util/dom'; const localize = nls.loadMessageBundle(); class VideoPreviewProvider implements vscode.CustomReadonlyEditorProvider { public static readonly viewType = 'vscode.videoPreview'; constructor( private readonly extensionRoot: vscode.Uri, private readonly binarySizeStatusBarEntry: BinarySizeStatusBarEntry, ) { } public async openCustomDocument(uri: vscode.Uri) { return { uri, dispose: () => { } }; } public async resolveCustomEditor(document: vscode.CustomDocument, webviewEditor: vscode.WebviewPanel): Promise<void> { new VideoPreview(this.extensionRoot, document.uri, webviewEditor, this.binarySizeStatusBarEntry); } } class VideoPreview extends MediaPreview { constructor( private readonly extensionRoot: vscode.Uri, resource: vscode.Uri, webviewEditor: vscode.WebviewPanel, binarySizeStatusBarEntry: BinarySizeStatusBarEntry, ) { super(extensionRoot, resource, webviewEditor, binarySizeStatusBarEntry); this._register(webviewEditor.webview.onDidReceiveMessage(message => { switch (message.type) { case 'reopen-as-text': { reopenAsText(resource, webviewEditor.viewColumn); break; } } })); this.updateBinarySize(); this.render(); this.updateState(); } protected async getWebviewContents(): Promise<string> { const version = Date.now().toString(); const settings = { src: await this.getResourcePath(this.webviewEditor, this.resource, version), }; const nonce = getNonce(); const cspSource = this.webviewEditor.webview.cspSource; return /* html */`<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <!-- Disable pinch zooming --> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> <title>Video Preview</title> <link rel="stylesheet" href="${escapeAttribute(this.extensionResource('media', 'videoPreview.css'))}" type="text/css" media="screen" nonce="${nonce}"> <meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data: ${cspSource}; media-src ${cspSource}; script-src 'nonce-${nonce}'; style-src ${cspSource} 'nonce-${nonce}';"> <meta id="settings" data-settings="${escapeAttribute(JSON.stringify(settings))}"> </head> <body class="loading"> <div class="loading-indicator"></div> <div class="loading-error"> <p>${localize('preview.videoLoadError', "An error occurred while loading the video file.")}</p> <a href="#" class="open-file-link">${localize('preview.videoLoadErrorLink', "Open file using VS Code's standard text/binary editor?")}</a> </div> <script src="${escapeAttribute(this.extensionResource('media', 'videoPreview.js'))}" nonce="${nonce}"></script> </body> </html>`; } private async getResourcePath(webviewEditor: vscode.WebviewPanel, resource: vscode.Uri, version: string): Promise<string | null> { if (resource.scheme === 'git') { const stat = await vscode.workspace.fs.stat(resource); if (stat.size === 0) { // The file is stored on git lfs return null; } } // Avoid adding cache busting if there is already a query string if (resource.query) { return webviewEditor.webview.asWebviewUri(resource).toString(); } return webviewEditor.webview.asWebviewUri(resource).with({ query: `version=${version}` }).toString(); } private extensionResource(...parts: string[]) { return this.webviewEditor.webview.asWebviewUri(vscode.Uri.joinPath(this.extensionRoot, ...parts)); } } export function registerVideoPreviewSupport(context: vscode.ExtensionContext, binarySizeStatusBarEntry: BinarySizeStatusBarEntry): vscode.Disposable { const provider = new VideoPreviewProvider(context.extensionUri, binarySizeStatusBarEntry); return vscode.window.registerCustomEditorProvider(VideoPreviewProvider.viewType, provider, { supportsMultipleEditorsPerDocument: true, webviewOptions: { retainContextWhenHidden: true, } }); }
extensions/image-preview/src/videoPreview.ts
0
https://github.com/microsoft/vscode/commit/7041b71cd67d65886ebf11ee65b13f10bcc193f0
[ 0.00017938320524990559, 0.00017437597853131592, 0.00016982867964543402, 0.0001742358726914972, 0.00000247198408942495 ]
{ "id": 0, "code_window": [ "name: Basic checks\n", "\n", "on:\n", " push:\n", " branches:\n", " - main\n", " pull_request:\n", " branches:\n", " - main\n", "\n", "jobs:\n", " main:\n", " if: github.ref != 'refs/heads/main'\n" ], "labels": [ "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "on: workflow_dispatch\n", "\n", "# on:\n", "# push:\n", "# branches:\n", "# - main\n", "# pull_request:\n", "# branches:\n", "# - main\n" ], "file_path": ".github/workflows/basic.yml", "type": "replace", "edit_start_line_idx": 2 }
{ "name": "julia", "displayName": "%displayName%", "description": "%description%", "version": "1.0.0", "publisher": "vscode", "license": "MIT", "engines": { "vscode": "0.10.x" }, "scripts": { "update-grammar": "node ../node_modules/vscode-grammar-updater/bin JuliaEditorSupport/atom-language-julia grammars/julia_vscode.json ./syntaxes/julia.tmLanguage.json" }, "contributes": { "languages": [ { "id": "julia", "aliases": [ "Julia", "julia" ], "extensions": [ ".jl" ], "firstLine": "^#!\\s*/.*\\bjulia[0-9.-]*\\b", "configuration": "./language-configuration.json" }, { "id": "juliamarkdown", "aliases": [ "Julia Markdown", "juliamarkdown" ], "extensions": [ ".jmd" ] } ], "grammars": [ { "language": "julia", "scopeName": "source.julia", "path": "./syntaxes/julia.tmLanguage.json", "embeddedLanguages": { "meta.embedded.inline.cpp": "cpp", "meta.embedded.inline.javascript": "javascript", "meta.embedded.inline.python": "python", "meta.embedded.inline.r": "r", "meta.embedded.inline.sql": "sql" } } ] } }
extensions/julia/package.json
0
https://github.com/microsoft/vscode/commit/7041b71cd67d65886ebf11ee65b13f10bcc193f0
[ 0.00017709280655253679, 0.00017373054288327694, 0.0001717100094538182, 0.0001727025373838842, 0.0000022015969989297446 ]
{ "id": 0, "code_window": [ "name: Basic checks\n", "\n", "on:\n", " push:\n", " branches:\n", " - main\n", " pull_request:\n", " branches:\n", " - main\n", "\n", "jobs:\n", " main:\n", " if: github.ref != 'refs/heads/main'\n" ], "labels": [ "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ "on: workflow_dispatch\n", "\n", "# on:\n", "# push:\n", "# branches:\n", "# - main\n", "# pull_request:\n", "# branches:\n", "# - main\n" ], "file_path": ".github/workflows/basic.yml", "type": "replace", "edit_start_line_idx": 2 }
notebook-out media/*.js
extensions/markdown-language-features/.gitignore
0
https://github.com/microsoft/vscode/commit/7041b71cd67d65886ebf11ee65b13f10bcc193f0
[ 0.0001708641357254237, 0.0001708641357254237, 0.0001708641357254237, 0.0001708641357254237, 0 ]
{ "id": 1, "code_window": [ "\n", " - script: |\n", " set -e\n", " yarn npm-run-all -lp core-ci extensions-ci hygiene eslint valid-layers-check\n", " env:\n", " GITHUB_TOKEN: \"$(github-distro-mixin-password)\"\n", " displayName: Compile & Hygiene\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ " yarn npm-run-all -lp core-ci extensions-ci hygiene eslint valid-layers-check vscode-dts-compile-check tsec-compile-check\n" ], "file_path": "build/azure-pipelines/product-compile.yml", "type": "replace", "edit_start_line_idx": 128 }
parameters: - name: VSCODE_QUALITY type: string steps: - task: NodeTool@0 inputs: versionSpec: "16.x" - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - task: AzureKeyVault@1 displayName: "Azure Key Vault: Get Secrets" inputs: azureSubscription: "vscode-builds-subscription" KeyVaultName: vscode SecretsFilter: "github-distro-mixin-password" - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e cat << EOF > ~/.netrc machine github.com login vscode password $(github-distro-mixin-password) EOF git config user.email "[email protected]" git config user.name "VSCode" displayName: Prepare tooling - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)" git checkout FETCH_HEAD condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' ')) displayName: Checkout override commit - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro") displayName: Merge distro - script: | mkdir -p .build node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash displayName: Prepare yarn cache flags # using `genericNodeModules` instead of `nodeModules` here to avoid sharing the cache with builds running inside containers - task: Cache@2 inputs: key: "genericNodeModules | $(Agent.OS) | .build/yarnlockhash" path: .build/node_modules_cache cacheHitVar: NODE_MODULES_RESTORED displayName: Restore node_modules cache # Cache built-in extensions to avoid GH rate limits. - task: Cache@2 inputs: key: '"builtInDeps" | .build/builtindepshash' path: .build/builtInExtensions displayName: Restore built-in extensions - script: | set -e tar -xzf .build/node_modules_cache/cache.tgz condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true')) displayName: Extract node_modules cache - script: | set -e npx https://aka.ms/enablesecurefeed standAlone timeoutInMinutes: 5 retryCountOnTaskFailure: 3 condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), eq(variables['ENABLE_TERRAPIN'], 'true')) displayName: Switch to Terrapin packages - script: | set -e sudo apt update -y sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libsecret-1-dev libnotify-bin displayName: Install build tools condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) - script: | set -e for i in {1..3}; do # try 3 times, for Terrapin yarn --frozen-lockfile --check-files && break if [ $i -eq 3 ]; then echo "Yarn failed too many times" >&2 exit 1 fi echo "Yarn failed $i, trying again..." done env: ELECTRON_SKIP_BINARY_DOWNLOAD: 1 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 GITHUB_TOKEN: "$(github-distro-mixin-password)" displayName: Install dependencies condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) - script: | set -e node build/lib/builtInExtensions.js env: GITHUB_TOKEN: "$(github-distro-mixin-password)" displayName: Download missing built-in extensions - script: | set -e node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt mkdir -p .build/node_modules_cache tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) displayName: Create node_modules archive - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: # Mixin must run before optimize, because the CSS loader will inline small SVGs - script: | set -e node build/azure-pipelines/mixin displayName: Mix in quality - script: | set -e yarn npm-run-all -lp core-ci extensions-ci hygiene eslint valid-layers-check env: GITHUB_TOKEN: "$(github-distro-mixin-password)" displayName: Compile & Hygiene - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e yarn --cwd test/smoke compile yarn --cwd test/integration/browser compile displayName: Compile test suites condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - task: AzureCLI@2 inputs: azureSubscription: "vscode-builds-subscription" scriptType: pscore scriptLocation: inlineScript addSpnToEnvironment: true inlineScript: | Write-Host "##vso[task.setvariable variable=AZURE_TENANT_ID]$env:tenantId" Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_ID]$env:servicePrincipalId" Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_SECRET;issecret=true]$env:servicePrincipalKey" - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e AZURE_STORAGE_ACCOUNT="ticino" \ AZURE_TENANT_ID="$(AZURE_TENANT_ID)" \ AZURE_CLIENT_ID="$(AZURE_CLIENT_ID)" \ AZURE_CLIENT_SECRET="$(AZURE_CLIENT_SECRET)" \ node build/azure-pipelines/upload-sourcemaps displayName: Upload sourcemaps - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set - ./build/azure-pipelines/common/extract-telemetry.sh displayName: Extract Telemetry - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e tar -cz --ignore-failed-read -f $(Build.ArtifactStagingDirectory)/compilation.tar.gz .build out-* test/integration/browser/out test/smoke/out test/automation/out displayName: Compress compilation artifact - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - task: PublishPipelineArtifact@1 inputs: targetPath: $(Build.ArtifactStagingDirectory)/compilation.tar.gz artifactName: Compilation displayName: Publish compilation artifact - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \ yarn download-builtin-extensions-cg displayName: Built-in extensions component details - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: "Component Detection" inputs: sourceScanPath: $(Build.SourcesDirectory) continueOnError: true
build/azure-pipelines/product-compile.yml
1
https://github.com/microsoft/vscode/commit/7041b71cd67d65886ebf11ee65b13f10bcc193f0
[ 0.023097148165106773, 0.0024043130688369274, 0.00016496946045663208, 0.0002373316092416644, 0.0054197427816689014 ]
{ "id": 1, "code_window": [ "\n", " - script: |\n", " set -e\n", " yarn npm-run-all -lp core-ci extensions-ci hygiene eslint valid-layers-check\n", " env:\n", " GITHUB_TOKEN: \"$(github-distro-mixin-password)\"\n", " displayName: Compile & Hygiene\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ " yarn npm-run-all -lp core-ci extensions-ci hygiene eslint valid-layers-check vscode-dts-compile-check tsec-compile-check\n" ], "file_path": "build/azure-pipelines/product-compile.yml", "type": "replace", "edit_start_line_idx": 128 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ export interface IKeyboard { getLayoutMap(): Promise<Object>; lock(keyCodes?: string[]): Promise<void>; unlock(): void; addEventListener?(type: string, listener: () => void): void; } export type INavigatorWithKeyboard = Navigator & { keyboard: IKeyboard; };
src/vs/workbench/services/keybinding/browser/navigatorKeyboard.ts
0
https://github.com/microsoft/vscode/commit/7041b71cd67d65886ebf11ee65b13f10bcc193f0
[ 0.000176910703885369, 0.00017213908722624183, 0.00016736747056711465, 0.00017213908722624183, 0.000004771616659127176 ]
{ "id": 1, "code_window": [ "\n", " - script: |\n", " set -e\n", " yarn npm-run-all -lp core-ci extensions-ci hygiene eslint valid-layers-check\n", " env:\n", " GITHUB_TOKEN: \"$(github-distro-mixin-password)\"\n", " displayName: Compile & Hygiene\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ " yarn npm-run-all -lp core-ci extensions-ci hygiene eslint valid-layers-check vscode-dts-compile-check tsec-compile-check\n" ], "file_path": "build/azure-pipelines/product-compile.yml", "type": "replace", "edit_start_line_idx": 128 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { DEFAULT_EDITOR_ASSOCIATION, GroupIdentifier, IRevertOptions, isResourceEditorInput, IUntypedEditorInput } from 'vs/workbench/common/editor'; import { EditorInput } from 'vs/workbench/common/editor/editorInput'; import { AbstractResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput'; import { URI } from 'vs/base/common/uri'; import { ITextFileService, ITextFileSaveOptions, ILanguageSupport } from 'vs/workbench/services/textfile/common/textfiles'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IFileService } from 'vs/platform/files/common/files'; import { ILabelService } from 'vs/platform/label/common/label'; import { Schemas } from 'vs/base/common/network'; import { isEqual } from 'vs/base/common/resources'; import { ITextEditorModel, ITextModelService } from 'vs/editor/common/services/resolverService'; import { TextResourceEditorModel } from 'vs/workbench/common/editor/textResourceEditorModel'; import { IReference } from 'vs/base/common/lifecycle'; import { createTextBufferFactory } from 'vs/editor/common/model/textModel'; /** * The base class for all editor inputs that open in text editors. */ export abstract class AbstractTextResourceEditorInput extends AbstractResourceEditorInput { constructor( resource: URI, preferredResource: URI | undefined, @IEditorService protected readonly editorService: IEditorService, @ITextFileService protected readonly textFileService: ITextFileService, @ILabelService labelService: ILabelService, @IFileService fileService: IFileService ) { super(resource, preferredResource, labelService, fileService); } override save(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise<IUntypedEditorInput | undefined> { // If this is neither an `untitled` resource, nor a resource // we can handle with the file service, we can only "Save As..." if (this.resource.scheme !== Schemas.untitled && !this.fileService.hasProvider(this.resource)) { return this.saveAs(group, options); } // Normal save return this.doSave(options, false, group); } override saveAs(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise<IUntypedEditorInput | undefined> { return this.doSave(options, true, group); } private async doSave(options: ITextFileSaveOptions | undefined, saveAs: boolean, group: GroupIdentifier | undefined): Promise<IUntypedEditorInput | undefined> { // Save / Save As let target: URI | undefined; if (saveAs) { target = await this.textFileService.saveAs(this.resource, undefined, { ...options, suggestedTarget: this.preferredResource }); } else { target = await this.textFileService.save(this.resource, options); } if (!target) { return undefined; // save cancelled } return { resource: target }; } override async revert(group: GroupIdentifier, options?: IRevertOptions): Promise<void> { await this.textFileService.revert(this.resource, options); } } /** * A read-only text editor input whos contents are made of the provided resource that points to an existing * code editor model. */ export class TextResourceEditorInput extends AbstractTextResourceEditorInput implements ILanguageSupport { static readonly ID: string = 'workbench.editors.resourceEditorInput'; override get typeId(): string { return TextResourceEditorInput.ID; } override get editorId(): string | undefined { return DEFAULT_EDITOR_ASSOCIATION.id; } private cachedModel: TextResourceEditorModel | undefined = undefined; private modelReference: Promise<IReference<ITextEditorModel>> | undefined = undefined; constructor( resource: URI, private name: string | undefined, private description: string | undefined, private preferredLanguageId: string | undefined, private preferredContents: string | undefined, @ITextModelService private readonly textModelResolverService: ITextModelService, @ITextFileService textFileService: ITextFileService, @IEditorService editorService: IEditorService, @IFileService fileService: IFileService, @ILabelService labelService: ILabelService ) { super(resource, undefined, editorService, textFileService, labelService, fileService); } override getName(): string { return this.name || super.getName(); } setName(name: string): void { if (this.name !== name) { this.name = name; this._onDidChangeLabel.fire(); } } override getDescription(): string | undefined { return this.description; } setDescription(description: string): void { if (this.description !== description) { this.description = description; this._onDidChangeLabel.fire(); } } setLanguageId(languageId: string, source?: string): void { this.setPreferredLanguageId(languageId); this.cachedModel?.setLanguageId(languageId, source); } setPreferredLanguageId(languageId: string): void { this.preferredLanguageId = languageId; } setPreferredContents(contents: string): void { this.preferredContents = contents; } override async resolve(): Promise<ITextEditorModel> { // Unset preferred contents and language after resolving // once to prevent these properties to stick. We still // want the user to change the language in the editor // and want to show updated contents (if any) in future // `resolve` calls. const preferredContents = this.preferredContents; const preferredLanguageId = this.preferredLanguageId; this.preferredContents = undefined; this.preferredLanguageId = undefined; if (!this.modelReference) { this.modelReference = this.textModelResolverService.createModelReference(this.resource); } const ref = await this.modelReference; // Ensure the resolved model is of expected type const model = ref.object; if (!(model instanceof TextResourceEditorModel)) { ref.dispose(); this.modelReference = undefined; throw new Error(`Unexpected model for TextResourceEditorInput: ${this.resource}`); } this.cachedModel = model; // Set contents and language if preferred if (typeof preferredContents === 'string' || typeof preferredLanguageId === 'string') { model.updateTextEditorModel(typeof preferredContents === 'string' ? createTextBufferFactory(preferredContents) : undefined, preferredLanguageId); } return model; } override matches(otherInput: EditorInput | IUntypedEditorInput): boolean { if (this === otherInput) { return true; } if (otherInput instanceof TextResourceEditorInput) { return isEqual(otherInput.resource, this.resource); } if (isResourceEditorInput(otherInput)) { return super.matches(otherInput); } return false; } override dispose(): void { if (this.modelReference) { this.modelReference.then(ref => ref.dispose()); this.modelReference = undefined; } this.cachedModel = undefined; super.dispose(); } }
src/vs/workbench/common/editor/textResourceEditorInput.ts
0
https://github.com/microsoft/vscode/commit/7041b71cd67d65886ebf11ee65b13f10bcc193f0
[ 0.00017716897127684206, 0.00017286819638684392, 0.000162379743414931, 0.00017356712487526238, 0.00000378555682800652 ]
{ "id": 1, "code_window": [ "\n", " - script: |\n", " set -e\n", " yarn npm-run-all -lp core-ci extensions-ci hygiene eslint valid-layers-check\n", " env:\n", " GITHUB_TOKEN: \"$(github-distro-mixin-password)\"\n", " displayName: Compile & Hygiene\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep" ], "after_edit": [ " yarn npm-run-all -lp core-ci extensions-ci hygiene eslint valid-layers-check vscode-dts-compile-check tsec-compile-check\n" ], "file_path": "build/azure-pipelines/product-compile.yml", "type": "replace", "edit_start_line_idx": 128 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as glob from 'vs/base/common/glob'; import { distinct, firstOrDefault, flatten, insert } from 'vs/base/common/arrays'; import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle'; import { basename, extname, isEqual } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { EditorActivation, EditorResolution, IEditorOptions } from 'vs/platform/editor/common/editor'; import { DEFAULT_EDITOR_ASSOCIATION, EditorResourceAccessor, EditorInputWithOptions, IResourceSideBySideEditorInput, isEditorInputWithOptions, isEditorInputWithOptionsAndGroup, isResourceDiffEditorInput, isResourceSideBySideEditorInput, isUntitledResourceEditorInput, isResourceMergeEditorInput, IUntypedEditorInput, SideBySideEditor } from 'vs/workbench/common/editor'; import { EditorInput } from 'vs/workbench/common/editor/editorInput'; import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { Schemas } from 'vs/base/common/network'; import { RegisteredEditorInfo, RegisteredEditorPriority, RegisteredEditorOptions, EditorAssociation, EditorAssociations, editorsAssociationsSettingId, globMatchesResource, IEditorResolverService, priorityToRank, ResolvedEditor, ResolvedStatus, EditorInputFactoryObject } from 'vs/workbench/services/editor/common/editorResolverService'; import { QuickPickItem, IKeyMods, IQuickInputService, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; import { localize } from 'vs/nls'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { ILogService } from 'vs/platform/log/common/log'; import { findGroup } from 'vs/workbench/services/editor/common/editorGroupFinder'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { PreferredGroup } from 'vs/workbench/services/editor/common/editorService'; import { SideBySideEditorInput } from 'vs/workbench/common/editor/sideBySideEditorInput'; import { PauseableEmitter } from 'vs/base/common/event'; interface RegisteredEditor { globPattern: string | glob.IRelativePattern; editorInfo: RegisteredEditorInfo; options?: RegisteredEditorOptions; editorFactoryObject: EditorInputFactoryObject; } type RegisteredEditors = Array<RegisteredEditor>; export class EditorResolverService extends Disposable implements IEditorResolverService { readonly _serviceBrand: undefined; // Events private readonly _onDidChangeEditorRegistrations = this._register(new PauseableEmitter<void>()); readonly onDidChangeEditorRegistrations = this._onDidChangeEditorRegistrations.event; // Constants private static readonly configureDefaultID = 'promptOpenWith.configureDefault'; private static readonly cacheStorageID = 'editorOverrideService.cache'; private static readonly conflictingDefaultsStorageID = 'editorOverrideService.conflictingDefaults'; // Data Stores private _editors: Map<string | glob.IRelativePattern, Map<string, RegisteredEditors>> = new Map<string | glob.IRelativePattern, Map<string, RegisteredEditors>>(); private _flattenedEditors: Map<string | glob.IRelativePattern, RegisteredEditors> = new Map(); private _shouldReFlattenEditors: boolean = true; private cache: Set<string> | undefined; constructor( @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService, @IInstantiationService private readonly instantiationService: IInstantiationService, @IConfigurationService private readonly configurationService: IConfigurationService, @IQuickInputService private readonly quickInputService: IQuickInputService, @INotificationService private readonly notificationService: INotificationService, @ITelemetryService private readonly telemetryService: ITelemetryService, @IStorageService private readonly storageService: IStorageService, @IExtensionService private readonly extensionService: IExtensionService, @ILogService private readonly logService: ILogService ) { super(); // Read in the cache on statup this.cache = new Set<string>(JSON.parse(this.storageService.get(EditorResolverService.cacheStorageID, StorageScope.PROFILE, JSON.stringify([])))); this.storageService.remove(EditorResolverService.cacheStorageID, StorageScope.PROFILE); this._register(this.storageService.onWillSaveState(() => { // We want to store the glob patterns we would activate on, this allows us to know if we need to await the ext host on startup for opening a resource this.cacheEditors(); })); // When extensions have registered we no longer need the cache this.extensionService.onDidRegisterExtensions(() => { this.cache = undefined; }); } private resolveUntypedInputAndGroup(editor: IUntypedEditorInput, preferredGroup: PreferredGroup | undefined): [IUntypedEditorInput, IEditorGroup, EditorActivation | undefined] | undefined { const untypedEditor = editor; // Use the untyped editor to find a group const [group, activation] = this.instantiationService.invokeFunction(findGroup, untypedEditor, preferredGroup); return [untypedEditor, group, activation]; } async resolveEditor(editor: IUntypedEditorInput, preferredGroup: PreferredGroup | undefined): Promise<ResolvedEditor> { // Update the flattened editors this._flattenedEditors = this._flattenEditorsMap(); // Special case: side by side editors requires us to // independently resolve both sides and then build // a side by side editor with the result if (isResourceSideBySideEditorInput(editor)) { return this.doResolveSideBySideEditor(editor, preferredGroup); } const resolvedUntypedAndGroup = this.resolveUntypedInputAndGroup(editor, preferredGroup); if (!resolvedUntypedAndGroup) { return ResolvedStatus.NONE; } // Get the resolved untyped editor, group, and activation const [untypedEditor, group, activation] = resolvedUntypedAndGroup; if (activation) { untypedEditor.options = { ...untypedEditor.options, activation }; } let resource = EditorResourceAccessor.getCanonicalUri(untypedEditor, { supportSideBySide: SideBySideEditor.PRIMARY }); const options = untypedEditor.options; // If it was resolved before we await for the extensions to activate and then proceed with resolution or else the backing extensions won't be registered if (this.cache && resource && this.resourceMatchesCache(resource)) { await this.extensionService.whenInstalledExtensionsRegistered(); } // Undefined resource -> untilted. Other malformed URI's are unresolvable if (resource === undefined) { resource = URI.from({ scheme: Schemas.untitled }); } else if (resource.scheme === undefined || resource === null) { return ResolvedStatus.NONE; } if (untypedEditor.options?.override === EditorResolution.PICK) { const picked = await this.doPickEditor(untypedEditor); // If the picker was cancelled we will stop resolving the editor if (!picked) { return ResolvedStatus.ABORT; } // Populate the options with the new ones untypedEditor.options = picked; } // Resolved the editor ID as much as possible, now find a given editor (cast here is ok because we resolve down to a string above) let { editor: selectedEditor, conflictingDefault } = this.getEditor(resource, untypedEditor.options?.override as (string | EditorResolution.EXCLUSIVE_ONLY | undefined)); // If no editor was found and this was a typed editor or an editor with an explicit override we could not resolve it if (!selectedEditor && (untypedEditor.options?.override || isEditorInputWithOptions(editor))) { return ResolvedStatus.NONE; } else if (!selectedEditor) { // Simple untyped editors that we could not resolve will be resolved to the default editor const resolvedEditor = this.getEditor(resource, DEFAULT_EDITOR_ASSOCIATION.id); selectedEditor = resolvedEditor?.editor; conflictingDefault = resolvedEditor?.conflictingDefault; if (!selectedEditor) { return ResolvedStatus.NONE; } } // In the special case of diff editors we do some more work to determine the correct editor for both sides if (isResourceDiffEditorInput(untypedEditor) && untypedEditor.options?.override === undefined) { let resource2 = EditorResourceAccessor.getCanonicalUri(untypedEditor, { supportSideBySide: SideBySideEditor.SECONDARY }); if (!resource2) { resource2 = URI.from({ scheme: Schemas.untitled }); } const { editor: selectedEditor2 } = this.getEditor(resource2, undefined); if (!selectedEditor2 || selectedEditor.editorInfo.id !== selectedEditor2.editorInfo.id) { const { editor: selectedDiff, conflictingDefault: conflictingDefaultDiff } = this.getEditor(resource, DEFAULT_EDITOR_ASSOCIATION.id); selectedEditor = selectedDiff; conflictingDefault = conflictingDefaultDiff; } if (!selectedEditor) { return ResolvedStatus.NONE; } } // If no override we take the selected editor id so that matches works with the isActive check untypedEditor.options = { override: selectedEditor.editorInfo.id, ...untypedEditor.options }; // Check if diff can be created based on prescene of factory function if (selectedEditor.editorFactoryObject.createDiffEditorInput === undefined && isResourceDiffEditorInput(untypedEditor)) { return ResolvedStatus.NONE; } // If it's the currently active editor we shouldn't do anything const activeEditor = group.activeEditor; const isActive = activeEditor ? activeEditor.matches(untypedEditor) : false; if (activeEditor && isActive) { return { editor: activeEditor, options, group }; } const input = await this.doResolveEditor(untypedEditor, group, selectedEditor); if (conflictingDefault && input) { // Show the conflicting default dialog await this.doHandleConflictingDefaults(resource, selectedEditor.editorInfo.label, untypedEditor, input.editor, group); } if (input) { this.sendEditorResolutionTelemetry(input.editor); if (input.editor.editorId !== selectedEditor.editorInfo.id) { this.logService.warn(`Editor ID Mismatch: ${input.editor.editorId} !== ${selectedEditor.editorInfo.id}. This will cause bugs. Please ensure editorInput.editorId matches the registered id`); } return { ...input, group }; } return ResolvedStatus.ABORT; } private async doResolveSideBySideEditor(editor: IResourceSideBySideEditorInput, preferredGroup: PreferredGroup | undefined): Promise<ResolvedEditor> { const primaryResolvedEditor = await this.resolveEditor(editor.primary, preferredGroup); if (!isEditorInputWithOptionsAndGroup(primaryResolvedEditor)) { return ResolvedStatus.NONE; } const secondaryResolvedEditor = await this.resolveEditor(editor.secondary, primaryResolvedEditor.group ?? preferredGroup); if (!isEditorInputWithOptionsAndGroup(secondaryResolvedEditor)) { return ResolvedStatus.NONE; } return { group: primaryResolvedEditor.group ?? secondaryResolvedEditor.group, editor: this.instantiationService.createInstance(SideBySideEditorInput, editor.label, editor.description, secondaryResolvedEditor.editor, primaryResolvedEditor.editor), options: editor.options }; } bufferChangeEvents(callback: Function): void { this._onDidChangeEditorRegistrations.pause(); try { callback(); } finally { this._onDidChangeEditorRegistrations.resume(); } } registerEditor( globPattern: string | glob.IRelativePattern, editorInfo: RegisteredEditorInfo, options: RegisteredEditorOptions, editorFactoryObject: EditorInputFactoryObject ): IDisposable { let registeredEditor = this._editors.get(globPattern); if (registeredEditor === undefined) { registeredEditor = new Map<string, RegisteredEditors>(); this._editors.set(globPattern, registeredEditor); } let editorsWithId = registeredEditor.get(editorInfo.id); if (editorsWithId === undefined) { editorsWithId = []; } const remove = insert(editorsWithId, { globPattern, editorInfo, options, editorFactoryObject }); registeredEditor.set(editorInfo.id, editorsWithId); this._shouldReFlattenEditors = true; this._onDidChangeEditorRegistrations.fire(); return toDisposable(() => { remove(); if (editorsWithId && editorsWithId.length === 0) { registeredEditor?.delete(editorInfo.id); } this._shouldReFlattenEditors = true; this._onDidChangeEditorRegistrations.fire(); }); } getAssociationsForResource(resource: URI): EditorAssociations { const associations = this.getAllUserAssociations(); const matchingAssociations = associations.filter(association => association.filenamePattern && globMatchesResource(association.filenamePattern, resource)); const allEditors: RegisteredEditors = this._registeredEditors; // Ensure that the settings are valid editors return matchingAssociations.filter(association => allEditors.find(c => c.editorInfo.id === association.viewType)); } private getAllUserAssociations(): EditorAssociations { const inspectedEditorAssociations = this.configurationService.inspect<{ [fileNamePattern: string]: string }>(editorsAssociationsSettingId) || {}; const workspaceAssociations = inspectedEditorAssociations.workspaceValue ?? {}; const userAssociations = inspectedEditorAssociations.userValue ?? {}; const rawAssociations: { [fileNamePattern: string]: string } = { ...workspaceAssociations }; // We want to apply the user associations on top of the workspace associations but ignore duplicate keys. for (const [key, value] of Object.entries(userAssociations)) { if (rawAssociations[key] === undefined) { rawAssociations[key] = value; } } const associations = []; for (const [key, value] of Object.entries(rawAssociations)) { const association: EditorAssociation = { filenamePattern: key, viewType: value }; associations.push(association); } return associations; } /** * Given the nested nature of the editors map, we merge factories of the same glob and id to make it flat * and easier to work with */ private _flattenEditorsMap() { // If we shouldn't be re-flattening (due to lack of update) then return early if (!this._shouldReFlattenEditors) { return this._flattenedEditors; } this._shouldReFlattenEditors = false; const editors = new Map<string | glob.IRelativePattern, RegisteredEditors>(); for (const [glob, value] of this._editors) { const registeredEditors: RegisteredEditors = []; for (const editors of value.values()) { let registeredEditor: RegisteredEditor | undefined = undefined; // Merge all editors with the same id and glob pattern together for (const editor of editors) { if (!registeredEditor) { registeredEditor = { editorInfo: editor.editorInfo, globPattern: editor.globPattern, options: {}, editorFactoryObject: {} }; } // Merge options and factories registeredEditor.options = { ...registeredEditor.options, ...editor.options }; registeredEditor.editorFactoryObject = { ...registeredEditor.editorFactoryObject, ...editor.editorFactoryObject }; } if (registeredEditor) { registeredEditors.push(registeredEditor); } } editors.set(glob, registeredEditors); } return editors; } /** * Returns all editors as an array. Possible to contain duplicates */ private get _registeredEditors(): RegisteredEditors { return flatten(Array.from(this._flattenedEditors.values())); } updateUserAssociations(globPattern: string, editorID: string): void { const newAssociation: EditorAssociation = { viewType: editorID, filenamePattern: globPattern }; const currentAssociations = this.getAllUserAssociations(); const newSettingObject = Object.create(null); // Form the new setting object including the newest associations for (const association of [...currentAssociations, newAssociation]) { if (association.filenamePattern) { newSettingObject[association.filenamePattern] = association.viewType; } } this.configurationService.updateValue(editorsAssociationsSettingId, newSettingObject); } private findMatchingEditors(resource: URI): RegisteredEditor[] { // The user setting should be respected even if the editor doesn't specify that resource in package.json const userSettings = this.getAssociationsForResource(resource); const matchingEditors: RegisteredEditor[] = []; // Then all glob patterns for (const [key, editors] of this._flattenedEditors) { for (const editor of editors) { const foundInSettings = userSettings.find(setting => setting.viewType === editor.editorInfo.id); if ((foundInSettings && editor.editorInfo.priority !== RegisteredEditorPriority.exclusive) || globMatchesResource(key, resource)) { matchingEditors.push(editor); } } } // Return the editors sorted by their priority return matchingEditors.sort((a, b) => { // Very crude if priorities match longer glob wins as longer globs are normally more specific if (priorityToRank(b.editorInfo.priority) === priorityToRank(a.editorInfo.priority) && typeof b.globPattern === 'string' && typeof a.globPattern === 'string') { return b.globPattern.length - a.globPattern.length; } return priorityToRank(b.editorInfo.priority) - priorityToRank(a.editorInfo.priority); }); } public getEditors(resource?: URI): RegisteredEditorInfo[] { this._flattenedEditors = this._flattenEditorsMap(); // By resource if (URI.isUri(resource)) { const editors = this.findMatchingEditors(resource); if (editors.find(e => e.editorInfo.priority === RegisteredEditorPriority.exclusive)) { return []; } return editors.map(editor => editor.editorInfo); } // All return distinct(this._registeredEditors.map(editor => editor.editorInfo), editor => editor.id); } /** * Given a resource and an editorId selects the best possible editor * @returns The editor and whether there was another default which conflicted with it */ private getEditor(resource: URI, editorId: string | EditorResolution.EXCLUSIVE_ONLY | undefined): { editor: RegisteredEditor | undefined; conflictingDefault: boolean } { const findMatchingEditor = (editors: RegisteredEditors, viewType: string) => { return editors.find((editor) => { if (editor.options && editor.options.canSupportResource !== undefined) { return editor.editorInfo.id === viewType && editor.options.canSupportResource(resource); } return editor.editorInfo.id === viewType; }); }; if (editorId && editorId !== EditorResolution.EXCLUSIVE_ONLY) { // Specific id passed in doesn't have to match the resource, it can be anything const registeredEditors = this._registeredEditors; return { editor: findMatchingEditor(registeredEditors, editorId), conflictingDefault: false }; } const editors = this.findMatchingEditors(resource); const associationsFromSetting = this.getAssociationsForResource(resource); // We only want minPriority+ if no user defined setting is found, else we won't resolve an editor const minPriority = editorId === EditorResolution.EXCLUSIVE_ONLY ? RegisteredEditorPriority.exclusive : RegisteredEditorPriority.builtin; let possibleEditors = editors.filter(editor => priorityToRank(editor.editorInfo.priority) >= priorityToRank(minPriority) && editor.editorInfo.id !== DEFAULT_EDITOR_ASSOCIATION.id); if (possibleEditors.length === 0) { return { editor: associationsFromSetting[0] && minPriority !== RegisteredEditorPriority.exclusive ? findMatchingEditor(editors, associationsFromSetting[0].viewType) : undefined, conflictingDefault: false }; } // If the editor is exclusive we use that, else use the user setting, else use the built-in+ editor const selectedViewType = possibleEditors[0].editorInfo.priority === RegisteredEditorPriority.exclusive ? possibleEditors[0].editorInfo.id : associationsFromSetting[0]?.viewType || possibleEditors[0].editorInfo.id; let conflictingDefault = false; // Filter out exclusive before we check for conflicts as exclusive editors cannot be manually chosen possibleEditors = possibleEditors.filter(editor => editor.editorInfo.priority !== RegisteredEditorPriority.exclusive); if (associationsFromSetting.length === 0 && possibleEditors.length > 1) { conflictingDefault = true; } return { editor: findMatchingEditor(editors, selectedViewType), conflictingDefault }; } private async doResolveEditor(editor: IUntypedEditorInput, group: IEditorGroup, selectedEditor: RegisteredEditor): Promise<EditorInputWithOptions | undefined> { let options = editor.options; const resource = EditorResourceAccessor.getCanonicalUri(editor, { supportSideBySide: SideBySideEditor.PRIMARY }); // If no activation option is provided, populate it. if (options && typeof options.activation === 'undefined') { options = { ...options, activation: options.preserveFocus ? EditorActivation.RESTORE : undefined }; } // If it's a merge editor we trigger the create merge editor input if (isResourceMergeEditorInput(editor)) { if (!selectedEditor.editorFactoryObject.createMergeEditorInput) { return; } const inputWithOptions = await selectedEditor.editorFactoryObject.createMergeEditorInput(editor, group); return { editor: inputWithOptions.editor, options: inputWithOptions.options ?? options }; } // If it's a diff editor we trigger the create diff editor input if (isResourceDiffEditorInput(editor)) { if (!selectedEditor.editorFactoryObject.createDiffEditorInput) { return; } const inputWithOptions = await selectedEditor.editorFactoryObject.createDiffEditorInput(editor, group); return { editor: inputWithOptions.editor, options: inputWithOptions.options ?? options }; } if (isResourceSideBySideEditorInput(editor)) { throw new Error(`Untyped side by side editor input not supported here.`); } if (isUntitledResourceEditorInput(editor)) { if (!selectedEditor.editorFactoryObject.createUntitledEditorInput) { return; } const inputWithOptions = await selectedEditor.editorFactoryObject.createUntitledEditorInput(editor, group); return { editor: inputWithOptions.editor, options: inputWithOptions.options ?? options }; } // Should no longer have an undefined resource so lets throw an error if that's somehow the case if (resource === undefined) { throw new Error(`Undefined resource on non untitled editor input.`); } // If the editor states it can only be opened once per resource we must close all existing ones except one and move the new one into the group const singleEditorPerResource = typeof selectedEditor.options?.singlePerResource === 'function' ? selectedEditor.options.singlePerResource() : selectedEditor.options?.singlePerResource; if (singleEditorPerResource) { const foundInput = await this.moveExistingEditorForResource(resource, selectedEditor.editorInfo.id, group); if (foundInput) { return { editor: foundInput, options }; } } // If no factory is above, return flow back to caller letting them know we could not resolve it if (!selectedEditor.editorFactoryObject.createEditorInput) { return; } // Respect options passed back const inputWithOptions = await selectedEditor.editorFactoryObject.createEditorInput(editor, group); options = inputWithOptions.options ?? options; const input = inputWithOptions.editor; return { editor: input, options }; } /** * Moves an editor with the resource and viewtype to target group if one exists * Additionally will close any other editors that are open for that resource and viewtype besides the first one found * @param resource The resource of the editor * @param viewType the viewtype of the editor * @param targetGroup The group to move it to * @returns An editor input if one exists, else undefined */ private async moveExistingEditorForResource( resource: URI, viewType: string, targetGroup: IEditorGroup, ): Promise<EditorInput | undefined> { const editorInfoForResource = this.findExistingEditorsForResource(resource, viewType); if (!editorInfoForResource.length) { return; } const editorToUse = editorInfoForResource[0]; // We should only have one editor but if there are multiple we close the others for (const { editor, group } of editorInfoForResource) { if (editor !== editorToUse.editor) { const closed = await group.closeEditor(editor); if (!closed) { return; } } } // Move the editor already opened to the target group if (targetGroup.id !== editorToUse.group.id) { editorToUse.group.moveEditor(editorToUse.editor, targetGroup); return editorToUse.editor; } return; } /** * Given a resource and an editorId, returns all editors open for that resource and editorId. * @param resource The resource specified * @param editorId The editorID * @returns A list of editors */ private findExistingEditorsForResource( resource: URI, editorId: string, ): Array<{ editor: EditorInput; group: IEditorGroup }> { const out: Array<{ editor: EditorInput; group: IEditorGroup }> = []; const orderedGroups = distinct([ ...this.editorGroupService.groups, ]); for (const group of orderedGroups) { for (const editor of group.editors) { if (isEqual(editor.resource, resource) && editor.editorId === editorId) { out.push({ editor, group }); } } } return out; } private async doHandleConflictingDefaults(resource: URI, editorName: string, untypedInput: IUntypedEditorInput, currentEditor: EditorInput, group: IEditorGroup) { type StoredChoice = { [key: string]: string[]; }; const editors = this.findMatchingEditors(resource); const storedChoices: StoredChoice = JSON.parse(this.storageService.get(EditorResolverService.conflictingDefaultsStorageID, StorageScope.PROFILE, '{}')); const globForResource = `*${extname(resource)}`; // Writes to the storage service that a choice has been made for the currently installed editors const writeCurrentEditorsToStorage = () => { storedChoices[globForResource] = []; editors.forEach(editor => storedChoices[globForResource].push(editor.editorInfo.id)); this.storageService.store(EditorResolverService.conflictingDefaultsStorageID, JSON.stringify(storedChoices), StorageScope.PROFILE, StorageTarget.MACHINE); }; // If the user has already made a choice for this editor we don't want to ask them again if (storedChoices[globForResource] && storedChoices[globForResource].find(editorID => editorID === currentEditor.editorId)) { return; } const handle = this.notificationService.prompt(Severity.Warning, localize('editorResolver.conflictingDefaults', 'There are multiple default editors available for the resource.'), [{ label: localize('editorResolver.configureDefault', 'Configure Default'), run: async () => { // Show the picker and tell it to update the setting to whatever the user selected const picked = await this.doPickEditor(untypedInput, true); if (!picked) { return; } untypedInput.options = picked; const replacementEditor = await this.resolveEditor(untypedInput, group); if (replacementEditor === ResolvedStatus.ABORT || replacementEditor === ResolvedStatus.NONE) { return; } // Replace the current editor with the picked one group.replaceEditors([ { editor: currentEditor, replacement: replacementEditor.editor, options: replacementEditor.options ?? picked, } ]); } }, { label: localize('editorResolver.keepDefault', 'Keep {0}', editorName), run: writeCurrentEditorsToStorage } ]); // If the user pressed X we assume they want to keep the current editor as default const onCloseListener = handle.onDidClose(() => { writeCurrentEditorsToStorage(); onCloseListener.dispose(); }); } private mapEditorsToQuickPickEntry(resource: URI, showDefaultPicker?: boolean) { const currentEditor = firstOrDefault(this.editorGroupService.activeGroup.findEditors(resource)); // If untitled, we want all registered editors let registeredEditors = resource.scheme === Schemas.untitled ? this._registeredEditors.filter(e => e.editorInfo.priority !== RegisteredEditorPriority.exclusive) : this.findMatchingEditors(resource); // We don't want duplicate Id entries registeredEditors = distinct(registeredEditors, c => c.editorInfo.id); const defaultSetting = this.getAssociationsForResource(resource)[0]?.viewType; // Not the most efficient way to do this, but we want to ensure the text editor is at the top of the quickpick registeredEditors = registeredEditors.sort((a, b) => { if (a.editorInfo.id === DEFAULT_EDITOR_ASSOCIATION.id) { return -1; } else if (b.editorInfo.id === DEFAULT_EDITOR_ASSOCIATION.id) { return 1; } else { return priorityToRank(b.editorInfo.priority) - priorityToRank(a.editorInfo.priority); } }); const quickPickEntries: Array<QuickPickItem> = []; const currentlyActiveLabel = localize('promptOpenWith.currentlyActive', "Active"); const currentDefaultLabel = localize('promptOpenWith.currentDefault', "Default"); const currentDefaultAndActiveLabel = localize('promptOpenWith.currentDefaultAndActive', "Active and Default"); // Default order = setting -> highest priority -> text let defaultViewType = defaultSetting; if (!defaultViewType && registeredEditors.length > 2 && registeredEditors[1]?.editorInfo.priority !== RegisteredEditorPriority.option) { defaultViewType = registeredEditors[1]?.editorInfo.id; } if (!defaultViewType) { defaultViewType = DEFAULT_EDITOR_ASSOCIATION.id; } // Map the editors to quickpick entries registeredEditors.forEach(editor => { const currentViewType = currentEditor?.editorId ?? DEFAULT_EDITOR_ASSOCIATION.id; const isActive = currentEditor ? editor.editorInfo.id === currentViewType : false; const isDefault = editor.editorInfo.id === defaultViewType; const quickPickEntry: IQuickPickItem = { id: editor.editorInfo.id, label: editor.editorInfo.label, description: isActive && isDefault ? currentDefaultAndActiveLabel : isActive ? currentlyActiveLabel : isDefault ? currentDefaultLabel : undefined, detail: editor.editorInfo.detail ?? editor.editorInfo.priority, }; quickPickEntries.push(quickPickEntry); }); if (!showDefaultPicker && extname(resource) !== '') { const separator: IQuickPickSeparator = { type: 'separator' }; quickPickEntries.push(separator); const configureDefaultEntry = { id: EditorResolverService.configureDefaultID, label: localize('promptOpenWith.configureDefault', "Configure default editor for '{0}'...", `*${extname(resource)}`), }; quickPickEntries.push(configureDefaultEntry); } return quickPickEntries; } private async doPickEditor(editor: IUntypedEditorInput, showDefaultPicker?: boolean): Promise<IEditorOptions | undefined> { type EditorPick = { readonly item: IQuickPickItem; readonly keyMods?: IKeyMods; readonly openInBackground: boolean; }; let resource = EditorResourceAccessor.getOriginalUri(editor, { supportSideBySide: SideBySideEditor.PRIMARY }); if (resource === undefined) { resource = URI.from({ scheme: Schemas.untitled }); } // Get all the editors for the resource as quickpick entries const editorPicks = this.mapEditorsToQuickPickEntry(resource, showDefaultPicker); // Create the editor picker const editorPicker = this.quickInputService.createQuickPick<IQuickPickItem>(); const placeHolderMessage = showDefaultPicker ? localize('promptOpenWith.updateDefaultPlaceHolder', "Select new default editor for '{0}'", `*${extname(resource)}`) : localize('promptOpenWith.placeHolder', "Select editor for '{0}'", basename(resource)); editorPicker.placeholder = placeHolderMessage; editorPicker.canAcceptInBackground = true; editorPicker.items = editorPicks; const firstItem = editorPicker.items.find(item => item.type === 'item') as IQuickPickItem | undefined; if (firstItem) { editorPicker.selectedItems = [firstItem]; } // Prompt the user to select an editor const picked: EditorPick | undefined = await new Promise<EditorPick | undefined>(resolve => { editorPicker.onDidAccept(e => { let result: EditorPick | undefined = undefined; if (editorPicker.selectedItems.length === 1) { result = { item: editorPicker.selectedItems[0], keyMods: editorPicker.keyMods, openInBackground: e.inBackground }; } // If asked to always update the setting then update it even if the gear isn't clicked if (resource && showDefaultPicker && result?.item.id) { this.updateUserAssociations(`*${extname(resource)}`, result.item.id,); } resolve(result); }); editorPicker.onDidHide(() => resolve(undefined)); editorPicker.onDidTriggerItemButton(e => { // Trigger opening and close picker resolve({ item: e.item, openInBackground: false }); // Persist setting if (resource && e.item && e.item.id) { this.updateUserAssociations(`*${extname(resource)}`, e.item.id,); } }); editorPicker.show(); }); // Close picker editorPicker.dispose(); // If the user picked an editor, look at how the picker was // used (e.g. modifier keys, open in background) and create the // options and group to use accordingly if (picked) { // If the user selected to configure default we trigger this picker again and tell it to show the default picker if (picked.item.id === EditorResolverService.configureDefaultID) { return this.doPickEditor(editor, true); } // Figure out options const targetOptions: IEditorOptions = { ...editor.options, override: picked.item.id, preserveFocus: picked.openInBackground || editor.options?.preserveFocus, }; return targetOptions; } return undefined; } private sendEditorResolutionTelemetry(chosenInput: EditorInput): void { type editorResolutionClassification = { viewType: { classification: 'PublicNonPersonalData'; purpose: 'FeatureInsight'; comment: 'The id of the editor opened. Used to gain an understanding of what editors are most popular' }; owner: 'lramos15'; comment: 'An event that fires when an editor type is picked'; }; type editorResolutionEvent = { viewType: string; }; if (chosenInput.editorId) { this.telemetryService.publicLog2<editorResolutionEvent, editorResolutionClassification>('override.viewType', { viewType: chosenInput.editorId }); } } private cacheEditors() { // Create a set to store glob patterns const cacheStorage: Set<string> = new Set<string>(); // Store just the relative pattern pieces without any path info for (const [globPattern, contribPoint] of this._flattenedEditors) { const nonOptional = !!contribPoint.find(c => c.editorInfo.priority !== RegisteredEditorPriority.option && c.editorInfo.id !== DEFAULT_EDITOR_ASSOCIATION.id); // Don't keep a cache of the optional ones as those wouldn't be opened on start anyways if (!nonOptional) { continue; } if (glob.isRelativePattern(globPattern)) { cacheStorage.add(`${globPattern.pattern}`); } else { cacheStorage.add(globPattern); } } // Also store the users settings as those would have to activate on startup as well const userAssociations = this.getAllUserAssociations(); for (const association of userAssociations) { if (association.filenamePattern) { cacheStorage.add(association.filenamePattern); } } this.storageService.store(EditorResolverService.cacheStorageID, JSON.stringify(Array.from(cacheStorage)), StorageScope.PROFILE, StorageTarget.MACHINE); } private resourceMatchesCache(resource: URI): boolean { if (!this.cache) { return false; } for (const cacheEntry of this.cache) { if (globMatchesResource(cacheEntry, resource)) { return true; } } return false; } } registerSingleton(IEditorResolverService, EditorResolverService, false);
src/vs/workbench/services/editor/browser/editorResolverService.ts
0
https://github.com/microsoft/vscode/commit/7041b71cd67d65886ebf11ee65b13f10bcc193f0
[ 0.00017738805036060512, 0.00017343710351269692, 0.0001608570310054347, 0.00017401629884261638, 0.000002778691623461782 ]
{ "id": 2, "code_window": [ " env:\n", " GITHUB_TOKEN: \"$(github-distro-mixin-password)\"\n", " displayName: Compile & Hygiene\n", "\n", " - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:\n", " - script: |\n", " set -e\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " - script: |\n", " set -e\n", " yarn --cwd build compile\n", " ./.github/workflows/check-clean-git-state.sh\n", " displayName: Check /build/ folder\n", "\n" ], "file_path": "build/azure-pipelines/product-compile.yml", "type": "add", "edit_start_line_idx": 133 }
parameters: - name: VSCODE_QUALITY type: string steps: - task: NodeTool@0 inputs: versionSpec: "16.x" - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - task: AzureKeyVault@1 displayName: "Azure Key Vault: Get Secrets" inputs: azureSubscription: "vscode-builds-subscription" KeyVaultName: vscode SecretsFilter: "github-distro-mixin-password" - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e cat << EOF > ~/.netrc machine github.com login vscode password $(github-distro-mixin-password) EOF git config user.email "[email protected]" git config user.name "VSCode" displayName: Prepare tooling - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)" git checkout FETCH_HEAD condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' ')) displayName: Checkout override commit - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro") displayName: Merge distro - script: | mkdir -p .build node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash displayName: Prepare yarn cache flags # using `genericNodeModules` instead of `nodeModules` here to avoid sharing the cache with builds running inside containers - task: Cache@2 inputs: key: "genericNodeModules | $(Agent.OS) | .build/yarnlockhash" path: .build/node_modules_cache cacheHitVar: NODE_MODULES_RESTORED displayName: Restore node_modules cache # Cache built-in extensions to avoid GH rate limits. - task: Cache@2 inputs: key: '"builtInDeps" | .build/builtindepshash' path: .build/builtInExtensions displayName: Restore built-in extensions - script: | set -e tar -xzf .build/node_modules_cache/cache.tgz condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true')) displayName: Extract node_modules cache - script: | set -e npx https://aka.ms/enablesecurefeed standAlone timeoutInMinutes: 5 retryCountOnTaskFailure: 3 condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), eq(variables['ENABLE_TERRAPIN'], 'true')) displayName: Switch to Terrapin packages - script: | set -e sudo apt update -y sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libsecret-1-dev libnotify-bin displayName: Install build tools condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) - script: | set -e for i in {1..3}; do # try 3 times, for Terrapin yarn --frozen-lockfile --check-files && break if [ $i -eq 3 ]; then echo "Yarn failed too many times" >&2 exit 1 fi echo "Yarn failed $i, trying again..." done env: ELECTRON_SKIP_BINARY_DOWNLOAD: 1 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 GITHUB_TOKEN: "$(github-distro-mixin-password)" displayName: Install dependencies condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) - script: | set -e node build/lib/builtInExtensions.js env: GITHUB_TOKEN: "$(github-distro-mixin-password)" displayName: Download missing built-in extensions - script: | set -e node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt mkdir -p .build/node_modules_cache tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) displayName: Create node_modules archive - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: # Mixin must run before optimize, because the CSS loader will inline small SVGs - script: | set -e node build/azure-pipelines/mixin displayName: Mix in quality - script: | set -e yarn npm-run-all -lp core-ci extensions-ci hygiene eslint valid-layers-check env: GITHUB_TOKEN: "$(github-distro-mixin-password)" displayName: Compile & Hygiene - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e yarn --cwd test/smoke compile yarn --cwd test/integration/browser compile displayName: Compile test suites condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - task: AzureCLI@2 inputs: azureSubscription: "vscode-builds-subscription" scriptType: pscore scriptLocation: inlineScript addSpnToEnvironment: true inlineScript: | Write-Host "##vso[task.setvariable variable=AZURE_TENANT_ID]$env:tenantId" Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_ID]$env:servicePrincipalId" Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_SECRET;issecret=true]$env:servicePrincipalKey" - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e AZURE_STORAGE_ACCOUNT="ticino" \ AZURE_TENANT_ID="$(AZURE_TENANT_ID)" \ AZURE_CLIENT_ID="$(AZURE_CLIENT_ID)" \ AZURE_CLIENT_SECRET="$(AZURE_CLIENT_SECRET)" \ node build/azure-pipelines/upload-sourcemaps displayName: Upload sourcemaps - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set - ./build/azure-pipelines/common/extract-telemetry.sh displayName: Extract Telemetry - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e tar -cz --ignore-failed-read -f $(Build.ArtifactStagingDirectory)/compilation.tar.gz .build out-* test/integration/browser/out test/smoke/out test/automation/out displayName: Compress compilation artifact - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - task: PublishPipelineArtifact@1 inputs: targetPath: $(Build.ArtifactStagingDirectory)/compilation.tar.gz artifactName: Compilation displayName: Publish compilation artifact - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - script: | set -e VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \ yarn download-builtin-extensions-cg displayName: Built-in extensions component details - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}: - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: "Component Detection" inputs: sourceScanPath: $(Build.SourcesDirectory) continueOnError: true
build/azure-pipelines/product-compile.yml
1
https://github.com/microsoft/vscode/commit/7041b71cd67d65886ebf11ee65b13f10bcc193f0
[ 0.0944545567035675, 0.007364589720964432, 0.00016560569929424673, 0.0010174380149692297, 0.020255092531442642 ]
{ "id": 2, "code_window": [ " env:\n", " GITHUB_TOKEN: \"$(github-distro-mixin-password)\"\n", " displayName: Compile & Hygiene\n", "\n", " - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:\n", " - script: |\n", " set -e\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " - script: |\n", " set -e\n", " yarn --cwd build compile\n", " ./.github/workflows/check-clean-git-state.sh\n", " displayName: Check /build/ folder\n", "\n" ], "file_path": "build/azure-pipelines/product-compile.yml", "type": "add", "edit_start_line_idx": 133 }
[ { "kind": 1, "language": "markdown", "value": "## Config" }, { "kind": 2, "language": "github-issues", "value": "$since=2021-10-01" }, { "kind": 1, "language": "markdown", "value": "# vscode\n\nQuery exceeds the maximum result. Run the query manually: `is:issue is:open closed:>2021-10-01`" }, { "kind": 2, "language": "github-issues", "value": "//repo:microsoft/vscode is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "//repo:microsoft/vscode is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-remote-release" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-remote-release is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-remote-release is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# monaco-editor" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-editor is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-editor is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-docs" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-docs is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-docs is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-js-debug" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-js-debug is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-js-debug is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# language-server-protocol" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/language-server-protocol is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/language-server-protocol is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-eslint" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-eslint is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-eslint is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-css-languageservice" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-css-languageservice is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-css-languageservice is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-test" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-test is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-test is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-pull-request-github" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-pull-request-github is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-test is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-chrome-debug-core" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-chrome-debug-core is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-chrome-debug-core is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-debugadapter-node" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-debugadapter-node is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-debugadapter-node is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-emmet-helper" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-emmet-helper is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-emmet-helper is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-extension-vscode\n\nDeprecated" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-extension-vscode is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-extension-vscode is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-extension-samples" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-extension-samples is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-extension-samples is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-filewatcher-windows" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-filewatcher-windows is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-filewatcher-windows is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-generator-code" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-generator-code is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-generator-code is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-html-languageservice" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-html-languageservice is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-html-languageservice is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-json-languageservice" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-json-languageservice is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-json-languageservice is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-languageserver-node" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-languageserver-node is:issue closed:>$since" }, { "kind": 1, "language": "markdown", "value": "" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-languageserver-node is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-loader" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-loader is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-loader is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-mono-debug" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-mono-debug is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-mono-debug is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-node-debug" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-node-debug is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-node-debug is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-node-debug2" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-node-debug2 is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-node-debug2 is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-recipes" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-recipes is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-recipes is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-textmate" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-textmate is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-textmate is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-themes" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-themes is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-themes is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-vsce" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-vsce is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-vsce is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-website" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-website is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-website is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-windows-process-tree" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-windows-process-tree is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-windows-process-tree is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# debug-adapter-protocol" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/debug-adapter-protocol is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/debug-adapter-protocol is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# inno-updater" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/inno-updater is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/inno-updater is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# monaco-languages" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-languages is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-languages is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# monaco-typescript" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-typescript is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-typescript is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# monaco-css" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-css is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-css is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# monaco-json" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-json is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-json is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# monaco-html" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-html is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-html is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# monaco-editor-webpack-plugin" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-editor-webpack-plugin is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/monaco-editor-webpack-plugin is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# node-jsonc-parser" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/node-jsonc-parser is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/node-jsonc-parser is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-jupyter" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-jupyter is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-jupyter is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-python" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-python is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-python is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "# vscode-livepreview" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-livepreview is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-livepreview is:issue created:>$since" }, { "kind": 1, "language": "markdown", "value": "" }, { "kind": 1, "language": "markdown", "value": "# vscode-test" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-test is:issue closed:>$since" }, { "kind": 2, "language": "github-issues", "value": "repo:microsoft/vscode-test is:issue created:>$since" } ]
.vscode/notebooks/grooming-delta.github-issues
0
https://github.com/microsoft/vscode/commit/7041b71cd67d65886ebf11ee65b13f10bcc193f0
[ 0.00017509525059722364, 0.0001718558487482369, 0.00016698538092896342, 0.00017238374857697636, 0.00000170973203239555 ]
{ "id": 2, "code_window": [ " env:\n", " GITHUB_TOKEN: \"$(github-distro-mixin-password)\"\n", " displayName: Compile & Hygiene\n", "\n", " - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:\n", " - script: |\n", " set -e\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " - script: |\n", " set -e\n", " yarn --cwd build compile\n", " ./.github/workflows/check-clean-git-state.sh\n", " displayName: Check /build/ folder\n", "\n" ], "file_path": "build/azure-pipelines/product-compile.yml", "type": "add", "edit_start_line_idx": 133 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; import * as sinon from 'sinon'; import { URI } from 'vs/base/common/uri'; import { Registry } from 'vs/platform/registry/common/platform'; import { Extensions, IConfigurationRegistry, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock'; import { MainThreadConfiguration } from 'vs/workbench/api/browser/mainThreadConfiguration'; import { SingleProxyRPCProtocol } from 'vs/workbench/api/test/common/testRPCProtocol'; import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { WorkspaceService } from 'vs/workbench/services/configuration/browser/configurationService'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; suite('MainThreadConfiguration', function () { const proxy = { $initializeConfiguration: () => { } }; let instantiationService: TestInstantiationService; let target: sinon.SinonSpy; suiteSetup(() => { Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfiguration({ 'id': 'extHostConfiguration', 'title': 'a', 'type': 'object', 'properties': { 'extHostConfiguration.resource': { 'description': 'extHostConfiguration.resource', 'type': 'boolean', 'default': true, 'scope': ConfigurationScope.RESOURCE }, 'extHostConfiguration.window': { 'description': 'extHostConfiguration.resource', 'type': 'boolean', 'default': true, 'scope': ConfigurationScope.WINDOW } } }); }); setup(() => { target = sinon.spy(); instantiationService = new TestInstantiationService(); instantiationService.stub(IConfigurationService, WorkspaceService); instantiationService.stub(IConfigurationService, 'onDidUpdateConfiguration', sinon.mock()); instantiationService.stub(IConfigurationService, 'onDidChangeConfiguration', sinon.mock()); instantiationService.stub(IConfigurationService, 'updateValue', target); instantiationService.stub(IEnvironmentService, { isBuilt: false }); }); test('update resource configuration without configuration target defaults to workspace in multi root workspace when no resource is provided', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', undefined, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('update resource configuration without configuration target defaults to workspace in folder workspace when resource is provider', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', { resource: URI.file('abc') }, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('update resource configuration without configuration target defaults to workspace in folder workspace when no resource is provider', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', undefined, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('update window configuration without configuration target defaults to workspace in multi root workspace when no resource is provided', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', undefined, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('update window configuration without configuration target defaults to workspace in multi root workspace when resource is provided', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('update window configuration without configuration target defaults to workspace in folder workspace when resource is provider', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('update window configuration without configuration target defaults to workspace in folder workspace when no resource is provider', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', undefined, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('update resource configuration without configuration target defaults to folder', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', { resource: URI.file('abc') }, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE_FOLDER, target.args[0][3]); }); test('update configuration with user configuration target', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$updateConfigurationOption(ConfigurationTarget.USER, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined); assert.strictEqual(ConfigurationTarget.USER, target.args[0][3]); }); test('update configuration with workspace configuration target', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$updateConfigurationOption(ConfigurationTarget.WORKSPACE, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('update configuration with folder configuration target', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$updateConfigurationOption(ConfigurationTarget.WORKSPACE_FOLDER, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE_FOLDER, target.args[0][3]); }); test('remove resource configuration without configuration target defaults to workspace in multi root workspace when no resource is provided', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', undefined, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('remove resource configuration without configuration target defaults to workspace in folder workspace when resource is provider', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', { resource: URI.file('abc') }, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('remove resource configuration without configuration target defaults to workspace in folder workspace when no resource is provider', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', undefined, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('remove window configuration without configuration target defaults to workspace in multi root workspace when no resource is provided', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', undefined, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('remove window configuration without configuration target defaults to workspace in multi root workspace when resource is provided', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', { resource: URI.file('abc') }, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('remove window configuration without configuration target defaults to workspace in folder workspace when resource is provider', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', { resource: URI.file('abc') }, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('remove window configuration without configuration target defaults to workspace in folder workspace when no resource is provider', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', undefined, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); test('remove configuration without configuration target defaults to folder', function () { instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', { resource: URI.file('abc') }, undefined); assert.strictEqual(ConfigurationTarget.WORKSPACE_FOLDER, target.args[0][3]); }); });
src/vs/workbench/api/test/browser/mainThreadConfiguration.test.ts
0
https://github.com/microsoft/vscode/commit/7041b71cd67d65886ebf11ee65b13f10bcc193f0
[ 0.0001784211053745821, 0.00017212884267792106, 0.00016803298785816878, 0.0001715459511615336, 0.0000022332058051688364 ]
{ "id": 2, "code_window": [ " env:\n", " GITHUB_TOKEN: \"$(github-distro-mixin-password)\"\n", " displayName: Compile & Hygiene\n", "\n", " - ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:\n", " - script: |\n", " set -e\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " - script: |\n", " set -e\n", " yarn --cwd build compile\n", " ./.github/workflows/check-clean-git-state.sh\n", " displayName: Check /build/ folder\n", "\n" ], "file_path": "build/azure-pipelines/product-compile.yml", "type": "add", "edit_start_line_idx": 133 }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { join } from 'path'; import { Application, Quality, StatusBarElement, Logger } from '../../../../automation'; import { installAllHandlers } from '../../utils'; export function setup(logger: Logger) { describe('Statusbar', () => { // Shared before/after handling installAllHandlers(logger); it('verifies presence of all default status bar elements', async function () { const app = this.app as Application; await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.BRANCH_STATUS); if (app.quality !== Quality.Dev && app.quality !== Quality.OSS) { await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.FEEDBACK_ICON); } await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.SYNC_STATUS); await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.PROBLEMS_STATUS); await app.workbench.quickaccess.openFile(join(app.workspacePathOrFolder, 'readme.md')); await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.ENCODING_STATUS); await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.EOL_STATUS); await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.INDENTATION_STATUS); await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.LANGUAGE_STATUS); await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.SELECTION_STATUS); }); it(`verifies that 'quick input' opens when clicking on status bar elements`, async function () { const app = this.app as Application; await app.workbench.statusbar.clickOn(StatusBarElement.BRANCH_STATUS); await app.workbench.quickinput.waitForQuickInputOpened(); await app.workbench.quickinput.closeQuickInput(); await app.workbench.quickaccess.openFile(join(app.workspacePathOrFolder, 'readme.md')); await app.workbench.statusbar.clickOn(StatusBarElement.INDENTATION_STATUS); await app.workbench.quickinput.waitForQuickInputOpened(); await app.workbench.quickinput.closeQuickInput(); await app.workbench.statusbar.clickOn(StatusBarElement.ENCODING_STATUS); await app.workbench.quickinput.waitForQuickInputOpened(); await app.workbench.quickinput.closeQuickInput(); await app.workbench.statusbar.clickOn(StatusBarElement.EOL_STATUS); await app.workbench.quickinput.waitForQuickInputOpened(); await app.workbench.quickinput.closeQuickInput(); await app.workbench.statusbar.clickOn(StatusBarElement.LANGUAGE_STATUS); await app.workbench.quickinput.waitForQuickInputOpened(); await app.workbench.quickinput.closeQuickInput(); }); it(`verifies that 'Problems View' appears when clicking on 'Problems' status element`, async function () { const app = this.app as Application; await app.workbench.statusbar.clickOn(StatusBarElement.PROBLEMS_STATUS); await app.workbench.problems.waitForProblemsView(); }); it(`verifies if changing EOL is reflected in the status bar`, async function () { const app = this.app as Application; await app.workbench.quickaccess.openFile(join(app.workspacePathOrFolder, 'readme.md')); await app.workbench.statusbar.clickOn(StatusBarElement.EOL_STATUS); await app.workbench.quickinput.selectQuickInputElement(1); await app.workbench.statusbar.waitForEOL('CRLF'); }); it(`verifies that 'Tweet us feedback' pop-up appears when clicking on 'Feedback' icon`, async function () { const app = this.app as Application; if (app.quality === Quality.Dev || app.quality === Quality.OSS) { return this.skip(); } await app.workbench.statusbar.clickOn(StatusBarElement.FEEDBACK_ICON); await app.code.waitForElement('.feedback-form'); }); }); }
test/smoke/src/areas/statusbar/statusbar.test.ts
0
https://github.com/microsoft/vscode/commit/7041b71cd67d65886ebf11ee65b13f10bcc193f0
[ 0.0002802253875415772, 0.00018997160077560693, 0.00016687253082636744, 0.000172113737789914, 0.00003660259972093627 ]
{ "id": 0, "code_window": [ " resolvePathInStorybookCache,\n", " validateFrameworkName,\n", "} from '@storybook/core-common';\n", "import prompts from 'prompts';\n", "import global from 'global';\n", "\n", "import { join, resolve } from 'path';\n", "import { logger } from '@storybook/node-logger';\n", "import { storybookDevServer } from './dev-server';\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "import { telemetry } from '@storybook/telemetry';\n" ], "file_path": "code/lib/core-server/src/build-dev.ts", "type": "add", "edit_start_line_idx": 18 }
import fetch from 'node-fetch'; import chalk from 'chalk'; import { colors } from '@storybook/node-logger'; import semver from 'semver'; import { dedent } from 'ts-dedent'; import { cache } from '@storybook/core-common'; import type { VersionCheck } from '@storybook/types'; import { telemetry } from '@storybook/telemetry'; const { STORYBOOK_VERSION_BASE = 'https://storybook.js.org', CI } = process.env; export const updateCheck = async (version: string): Promise<VersionCheck> => { let result; const time = Date.now(); try { const fromCache = await cache.get('lastUpdateCheck', { success: false, time: 0 }); // if last check was more then 24h ago if (time - 86400000 > fromCache.time && !CI) { telemetry('version-update'); const fromFetch: any = await Promise.race([ fetch(`${STORYBOOK_VERSION_BASE}/versions.json?current=${version}`), // if fetch is too slow, we won't wait for it new Promise((res, rej) => global.setTimeout(rej, 1500)), ]); const data = await fromFetch.json(); result = { success: true, cached: false, data, time }; await cache.set('lastUpdateCheck', result); } else { result = { ...fromCache, cached: true }; } } catch (error) { result = { success: false, cached: false, error, time }; } return result; }; export function createUpdateMessage(updateInfo: VersionCheck, version: string): string { let updateMessage; try { const suffix = semver.prerelease(updateInfo.data.latest.version) ? '--prerelease' : ''; const upgradeCommand = `npx storybook@latest upgrade ${suffix}`.trim(); updateMessage = updateInfo.success && semver.lt(version, updateInfo.data.latest.version) ? dedent` ${colors.orange( `A new version (${chalk.bold(updateInfo.data.latest.version)}) is available!` )} ${chalk.gray('Upgrade now:')} ${colors.green(upgradeCommand)} ${chalk.gray('Read full changelog:')} ${chalk.gray.underline( 'https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md' )} ` : ''; } catch (e) { updateMessage = ''; } return updateMessage; }
code/lib/core-server/src/utils/update-check.ts
1
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.00020529482571873814, 0.00017673263209871948, 0.00016633272753097117, 0.0001726087648421526, 0.000012508444342529401 ]
{ "id": 0, "code_window": [ " resolvePathInStorybookCache,\n", " validateFrameworkName,\n", "} from '@storybook/core-common';\n", "import prompts from 'prompts';\n", "import global from 'global';\n", "\n", "import { join, resolve } from 'path';\n", "import { logger } from '@storybook/node-logger';\n", "import { storybookDevServer } from './dev-server';\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "import { telemetry } from '@storybook/telemetry';\n" ], "file_path": "code/lib/core-server/src/build-dev.ts", "type": "add", "edit_start_line_idx": 18 }
<template> <div v-html="content"></div> </template> <script> export default { name: 'my-html', props: { content: { type: String, required: true, }, }, setup() { }, }; </script>
code/renderers/vue3/template/components/Html.vue
0
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.00017459943774156272, 0.00017235240375157446, 0.00017036111967172474, 0.0001720966538414359, 0.000001739710910442227 ]
{ "id": 0, "code_window": [ " resolvePathInStorybookCache,\n", " validateFrameworkName,\n", "} from '@storybook/core-common';\n", "import prompts from 'prompts';\n", "import global from 'global';\n", "\n", "import { join, resolve } from 'path';\n", "import { logger } from '@storybook/node-logger';\n", "import { storybookDevServer } from './dev-server';\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "import { telemetry } from '@storybook/telemetry';\n" ], "file_path": "code/lib/core-server/src/build-dev.ts", "type": "add", "edit_start_line_idx": 18 }
const path = require('path'); const baseConfig = require('../../jest.config.node'); module.exports = { ...baseConfig, displayName: __dirname.split(path.sep).slice(-2).join(path.posix.sep), };
code/lib/builder-webpack5/jest.config.js
0
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.0001670780620770529, 0.0001670780620770529, 0.0001670780620770529, 0.0001670780620770529, 0 ]
{ "id": 0, "code_window": [ " resolvePathInStorybookCache,\n", " validateFrameworkName,\n", "} from '@storybook/core-common';\n", "import prompts from 'prompts';\n", "import global from 'global';\n", "\n", "import { join, resolve } from 'path';\n", "import { logger } from '@storybook/node-logger';\n", "import { storybookDevServer } from './dev-server';\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ], "after_edit": [ "import { telemetry } from '@storybook/telemetry';\n" ], "file_path": "code/lib/core-server/src/build-dev.ts", "type": "add", "edit_start_line_idx": 18 }
const path = require('path'); const baseConfig = require('../../jest.config.browser'); module.exports = { ...baseConfig, displayName: __dirname.split(path.sep).slice(-2).join(path.posix.sep), };
code/renderers/preact/jest.config.js
0
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.00016673064965289086, 0.00016673064965289086, 0.00016673064965289086, 0.00016673064965289086, 0 ]
{ "id": 1, "code_window": [ " overridePresets: [],\n", " ...options,\n", " });\n", "\n", " const { renderer, builder } = await presets.apply<CoreConfig>('core', undefined);\n", " const builderName = typeof builder === 'string' ? builder : builder?.name;\n", " const [previewBuilder, managerBuilder] = await Promise.all([\n", " getPreviewBuilder(builderName, options.configDir),\n", " getManagerBuilder(),\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " const { renderer, builder, disableTelemetry } = await presets.apply<CoreConfig>(\n", " 'core',\n", " undefined\n", " );\n", "\n", " if (!options.disableTelemetry && !disableTelemetry) {\n", " if (versionCheck.success && !versionCheck.cached) {\n", " telemetry('version-update');\n", " }\n", " }\n", "\n" ], "file_path": "code/lib/core-server/src/build-dev.ts", "type": "replace", "edit_start_line_idx": 87 }
import fetch from 'node-fetch'; import chalk from 'chalk'; import { colors } from '@storybook/node-logger'; import semver from 'semver'; import { dedent } from 'ts-dedent'; import { cache } from '@storybook/core-common'; import type { VersionCheck } from '@storybook/types'; import { telemetry } from '@storybook/telemetry'; const { STORYBOOK_VERSION_BASE = 'https://storybook.js.org', CI } = process.env; export const updateCheck = async (version: string): Promise<VersionCheck> => { let result; const time = Date.now(); try { const fromCache = await cache.get('lastUpdateCheck', { success: false, time: 0 }); // if last check was more then 24h ago if (time - 86400000 > fromCache.time && !CI) { telemetry('version-update'); const fromFetch: any = await Promise.race([ fetch(`${STORYBOOK_VERSION_BASE}/versions.json?current=${version}`), // if fetch is too slow, we won't wait for it new Promise((res, rej) => global.setTimeout(rej, 1500)), ]); const data = await fromFetch.json(); result = { success: true, cached: false, data, time }; await cache.set('lastUpdateCheck', result); } else { result = { ...fromCache, cached: true }; } } catch (error) { result = { success: false, cached: false, error, time }; } return result; }; export function createUpdateMessage(updateInfo: VersionCheck, version: string): string { let updateMessage; try { const suffix = semver.prerelease(updateInfo.data.latest.version) ? '--prerelease' : ''; const upgradeCommand = `npx storybook@latest upgrade ${suffix}`.trim(); updateMessage = updateInfo.success && semver.lt(version, updateInfo.data.latest.version) ? dedent` ${colors.orange( `A new version (${chalk.bold(updateInfo.data.latest.version)}) is available!` )} ${chalk.gray('Upgrade now:')} ${colors.green(upgradeCommand)} ${chalk.gray('Read full changelog:')} ${chalk.gray.underline( 'https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md' )} ` : ''; } catch (e) { updateMessage = ''; } return updateMessage; }
code/lib/core-server/src/utils/update-check.ts
1
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.00017909453890752047, 0.00017547429888509214, 0.0001707898627500981, 0.00017611010116524994, 0.000002469018909323495 ]
{ "id": 1, "code_window": [ " overridePresets: [],\n", " ...options,\n", " });\n", "\n", " const { renderer, builder } = await presets.apply<CoreConfig>('core', undefined);\n", " const builderName = typeof builder === 'string' ? builder : builder?.name;\n", " const [previewBuilder, managerBuilder] = await Promise.all([\n", " getPreviewBuilder(builderName, options.configDir),\n", " getManagerBuilder(),\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " const { renderer, builder, disableTelemetry } = await presets.apply<CoreConfig>(\n", " 'core',\n", " undefined\n", " );\n", "\n", " if (!options.disableTelemetry && !disableTelemetry) {\n", " if (versionCheck.success && !versionCheck.cached) {\n", " telemetry('version-update');\n", " }\n", " }\n", "\n" ], "file_path": "code/lib/core-server/src/build-dev.ts", "type": "replace", "edit_start_line_idx": 87 }
import { PipeTransform, Pipe } from '@angular/core'; @Pipe({ name: 'customPipe', }) export class CustomPipePipe implements PipeTransform { transform(value: any, args?: any): any { return `CustomPipe: ${value}`; } }
code/frameworks/angular/template/stories/basics/component-with-pipe/custom.pipe.ts
0
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.00017783719522412866, 0.00017499442037660629, 0.0001721516455290839, 0.00017499442037660629, 0.000002842774847522378 ]
{ "id": 1, "code_window": [ " overridePresets: [],\n", " ...options,\n", " });\n", "\n", " const { renderer, builder } = await presets.apply<CoreConfig>('core', undefined);\n", " const builderName = typeof builder === 'string' ? builder : builder?.name;\n", " const [previewBuilder, managerBuilder] = await Promise.all([\n", " getPreviewBuilder(builderName, options.configDir),\n", " getManagerBuilder(),\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " const { renderer, builder, disableTelemetry } = await presets.apply<CoreConfig>(\n", " 'core',\n", " undefined\n", " );\n", "\n", " if (!options.disableTelemetry && !disableTelemetry) {\n", " if (versionCheck.success && !versionCheck.cached) {\n", " telemetry('version-update');\n", " }\n", " }\n", "\n" ], "file_path": "code/lib/core-server/src/build-dev.ts", "type": "replace", "edit_start_line_idx": 87 }
export type { BuilderResult, TypescriptOptions, StorybookConfig } from '@storybook/core-webpack';
code/presets/vue-webpack/src/types.ts
0
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.00022058971808291972, 0.00022058971808291972, 0.00022058971808291972, 0.00022058971808291972, 0 ]
{ "id": 1, "code_window": [ " overridePresets: [],\n", " ...options,\n", " });\n", "\n", " const { renderer, builder } = await presets.apply<CoreConfig>('core', undefined);\n", " const builderName = typeof builder === 'string' ? builder : builder?.name;\n", " const [previewBuilder, managerBuilder] = await Promise.all([\n", " getPreviewBuilder(builderName, options.configDir),\n", " getManagerBuilder(),\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " const { renderer, builder, disableTelemetry } = await presets.apply<CoreConfig>(\n", " 'core',\n", " undefined\n", " );\n", "\n", " if (!options.disableTelemetry && !disableTelemetry) {\n", " if (versionCheck.success && !versionCheck.cached) {\n", " telemetry('version-update');\n", " }\n", " }\n", "\n" ], "file_path": "code/lib/core-server/src/build-dev.ts", "type": "replace", "edit_start_line_idx": 87 }
import React from 'react'; export interface HelloProps { title: string; foo: boolean; bar?: string[]; } const Hello = ({ title }: HelloProps) => { return <div className="hello">Hello Component {title}</div>; }; Hello.defaultProps = { title: 'this is the default :)', }; export const component = Hello;
code/renderers/react/template/stories/docgen-components/9827-ts-default-values/input.tsx
0
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.00017691407992970198, 0.00017634994583204389, 0.00017578579718247056, 0.00017634994583204389, 5.641413736157119e-7 ]
{ "id": 2, "code_window": [ "import { dedent } from 'ts-dedent';\n", "import { cache } from '@storybook/core-common';\n", "import type { VersionCheck } from '@storybook/types';\n", "import { telemetry } from '@storybook/telemetry';\n", "\n", "const { STORYBOOK_VERSION_BASE = 'https://storybook.js.org', CI } = process.env;\n", "\n", "export const updateCheck = async (version: string): Promise<VersionCheck> => {\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [], "file_path": "code/lib/core-server/src/utils/update-check.ts", "type": "replace", "edit_start_line_idx": 7 }
import fetch from 'node-fetch'; import chalk from 'chalk'; import { colors } from '@storybook/node-logger'; import semver from 'semver'; import { dedent } from 'ts-dedent'; import { cache } from '@storybook/core-common'; import type { VersionCheck } from '@storybook/types'; import { telemetry } from '@storybook/telemetry'; const { STORYBOOK_VERSION_BASE = 'https://storybook.js.org', CI } = process.env; export const updateCheck = async (version: string): Promise<VersionCheck> => { let result; const time = Date.now(); try { const fromCache = await cache.get('lastUpdateCheck', { success: false, time: 0 }); // if last check was more then 24h ago if (time - 86400000 > fromCache.time && !CI) { telemetry('version-update'); const fromFetch: any = await Promise.race([ fetch(`${STORYBOOK_VERSION_BASE}/versions.json?current=${version}`), // if fetch is too slow, we won't wait for it new Promise((res, rej) => global.setTimeout(rej, 1500)), ]); const data = await fromFetch.json(); result = { success: true, cached: false, data, time }; await cache.set('lastUpdateCheck', result); } else { result = { ...fromCache, cached: true }; } } catch (error) { result = { success: false, cached: false, error, time }; } return result; }; export function createUpdateMessage(updateInfo: VersionCheck, version: string): string { let updateMessage; try { const suffix = semver.prerelease(updateInfo.data.latest.version) ? '--prerelease' : ''; const upgradeCommand = `npx storybook@latest upgrade ${suffix}`.trim(); updateMessage = updateInfo.success && semver.lt(version, updateInfo.data.latest.version) ? dedent` ${colors.orange( `A new version (${chalk.bold(updateInfo.data.latest.version)}) is available!` )} ${chalk.gray('Upgrade now:')} ${colors.green(upgradeCommand)} ${chalk.gray('Read full changelog:')} ${chalk.gray.underline( 'https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md' )} ` : ''; } catch (e) { updateMessage = ''; } return updateMessage; }
code/lib/core-server/src/utils/update-check.ts
1
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.9985277652740479, 0.42786988615989685, 0.00016681573470123112, 0.006370946764945984, 0.49172940850257874 ]
{ "id": 2, "code_window": [ "import { dedent } from 'ts-dedent';\n", "import { cache } from '@storybook/core-common';\n", "import type { VersionCheck } from '@storybook/types';\n", "import { telemetry } from '@storybook/telemetry';\n", "\n", "const { STORYBOOK_VERSION_BASE = 'https://storybook.js.org', CI } = process.env;\n", "\n", "export const updateCheck = async (version: string): Promise<VersionCheck> => {\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [], "file_path": "code/lib/core-server/src/utils/update-check.ts", "type": "replace", "edit_start_line_idx": 7 }
// @ts-expect-error The generated definition file is empty. https://github.com/egoist/tsup/issues/762 export * from '@storybook/addon-toolbars/manager';
code/addons/essentials/src/toolbars/manager.ts
0
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.00017543199646752328, 0.00017543199646752328, 0.00017543199646752328, 0.00017543199646752328, 0 ]
{ "id": 2, "code_window": [ "import { dedent } from 'ts-dedent';\n", "import { cache } from '@storybook/core-common';\n", "import type { VersionCheck } from '@storybook/types';\n", "import { telemetry } from '@storybook/telemetry';\n", "\n", "const { STORYBOOK_VERSION_BASE = 'https://storybook.js.org', CI } = process.env;\n", "\n", "export const updateCheck = async (version: string): Promise<VersionCheck> => {\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [], "file_path": "code/lib/core-server/src/utils/update-check.ts", "type": "replace", "edit_start_line_idx": 7 }
import global from 'global'; import type { FC } from 'react'; import React, { Component } from 'react'; import { styled } from '@storybook/theming'; import type { Addon_Collection } from '@storybook/types'; import type { State } from '@storybook/manager-api'; import type { SidebarProps } from '../sidebar/Sidebar'; import { Sidebar } from '../sidebar/Sidebar'; import Panel from '../panel/panel'; import { Preview } from '../preview/preview'; import { previewProps } from '../preview/preview.mockdata'; import { mockDataset } from '../sidebar/mockdata'; import type { DesktopProps } from './desktop'; const { setInterval } = global; export const shortcuts: State['shortcuts'] = { fullScreen: ['F'], togglePanel: ['A'], panelPosition: ['D'], toggleNav: ['S'], toolbar: ['T'], search: ['/'], focusNav: ['1'], focusIframe: ['2'], focusPanel: ['3'], prevComponent: ['alt', 'ArrowUp'], nextComponent: ['alt', 'ArrowDown'], prevStory: ['alt', 'ArrowLeft'], nextStory: ['alt', 'ArrowRight'], shortcutsPage: ['ctrl', 'shift', ','], aboutPage: [','], escape: ['escape'], collapseAll: ['ctrl', 'shift', 'ArrowUp'], expandAll: ['ctrl', 'shift', 'ArrowDown'], }; export const panels: Addon_Collection = { test1: { title: 'Test 1', render: ({ active, key }) => active ? ( <div id="test1" key={key}> TEST 1 </div> ) : null, }, test2: { title: 'Test 2', render: ({ active, key }) => active ? ( <div id="test2" key={key}> TEST 2 </div> ) : null, }, }; const realSidebarProps: SidebarProps = { stories: mockDataset.withRoot as SidebarProps['stories'], menu: [], refs: {}, storiesConfigured: true, }; const PlaceholderBlock = styled.div(({ color }) => ({ background: color || 'hotpink', position: 'absolute', top: 0, right: 0, bottom: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', overflow: 'hidden', })); class PlaceholderClock extends Component<{ color: string }, { count: number }> { state = { count: 1, }; interval: ReturnType<typeof setTimeout>; componentDidMount() { this.interval = setInterval(() => { const { count } = this.state; this.setState({ count: count + 1 }); }, 1000); } componentWillUnmount() { const { interval } = this; clearInterval(interval); } render() { const { children, color } = this.props; const { count } = this.state; return ( <PlaceholderBlock color={color}> <h2 style={{ position: 'absolute', bottom: 0, right: 0, color: 'rgba(0,0,0,0.2)', fontSize: '150px', lineHeight: '150px', margin: '-20px', }} > {count} </h2> {children} </PlaceholderBlock> ); } } const MockSidebar: FC<any> = (props) => ( <PlaceholderClock color="hotpink"> <pre>{JSON.stringify(props, null, 2)}</pre> </PlaceholderClock> ); const MockPreview: FC<any> = (props) => ( <PlaceholderClock color="deepskyblue"> <pre>{JSON.stringify(props, null, 2)}</pre> </PlaceholderClock> ); const MockPanel: FC<any> = (props) => ( <PlaceholderClock color="orangered"> <pre>{JSON.stringify(props, null, 2)}</pre> </PlaceholderClock> ); export const MockPage: FC<any> = (props) => ( <PlaceholderClock color="cyan"> <pre>{JSON.stringify(props, null, 2)}</pre> </PlaceholderClock> ); export const mockProps: DesktopProps = { Sidebar: MockSidebar, Preview: MockPreview, Panel: MockPanel, Notifications: () => null, pages: [], options: { isFullscreen: false, showNav: true, showPanel: true, panelPosition: 'right', showToolbar: true, initialActive: 'canvas', showTabs: true, }, viewMode: 'story', panelCount: 2, width: 900, height: 600, }; export const realProps: DesktopProps = { Sidebar: () => <Sidebar {...realSidebarProps} />, Preview: () => <Preview {...previewProps} />, Notifications: () => null, Panel: () => ( <Panel panels={panels} actions={{ onSelect: () => {}, toggleVisibility: () => {}, togglePosition: () => {} }} selectedPanel="test2" panelPosition="bottom" shortcuts={shortcuts} absolute={false} /> ), pages: [], options: { isFullscreen: false, showNav: true, showPanel: true, panelPosition: 'right', showToolbar: true, initialActive: 'canvas', showTabs: true, }, viewMode: 'story', panelCount: 2, width: 900, height: 600, };
code/ui/manager/src/components/layout/app.mockdata.tsx
0
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.0001791158865671605, 0.00017286116781178862, 0.0001654543448239565, 0.00017463814583607018, 0.0000040624404391564894 ]
{ "id": 2, "code_window": [ "import { dedent } from 'ts-dedent';\n", "import { cache } from '@storybook/core-common';\n", "import type { VersionCheck } from '@storybook/types';\n", "import { telemetry } from '@storybook/telemetry';\n", "\n", "const { STORYBOOK_VERSION_BASE = 'https://storybook.js.org', CI } = process.env;\n", "\n", "export const updateCheck = async (version: string): Promise<VersionCheck> => {\n" ], "labels": [ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [], "file_path": "code/lib/core-server/src/utils/update-check.ts", "type": "replace", "edit_start_line_idx": 7 }
```ts // LoginForm.stories.ts import { userEvent, within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; import LoginForm from './LoginForm.vue'; import type { Meta, StoryObj } from '@storybook/vue3'; const meta: Meta<typeof LoginForm> = { /* 👇 The title prop is optional. * See https://storybook.js.org/docs/7.0/vue/configure/overview#configure-story-loading * to learn how to generate automatic titles */ title: 'Form', component: LoginForm, }; export default meta; type Story = StoryObj<typeof LoginForm>; /* *👇 Render functions are a framework specific feature to allow you control on how the component renders. * See https://storybook.js.org/docs/7.0/vue/api/csf * to learn how to use render functions. */ export const EmptyForm: Story = { render: (args) => ({ components: { LoginForm }, setup() { return args; }, template: '<LoginForm @onSubmit="onSubmit" v-bind="args" />', }), }; /* * See https://storybook.js.org/docs/7.0/vue/writing-stories/play-function#working-with-the-canvas * to learn more about using the canvasElement to query the DOM */ export const FilledForm: Story = { render: (args) => ({ components: { LoginForm }, setup() { return args; }, template: '<LoginForm @onSubmit="onSubmit" v-bind="args" />', }), play: async ({ canvasElement }) => { const canvas = within(canvasElement); // 👇 Simulate interactions with the component await userEvent.type(canvas.getByTestId('email'), '[email protected]'); await userEvent.type(canvas.getByTestId('password'), 'a-random-password'); // See https://storybook.js.org/docs/7.0/vue/essentials/actions#automatically-matching-args to learn how to setup logging in the Actions panel await userEvent.click(canvas.getByRole('button')); // 👇 Assert DOM structure await expect( canvas.getByText( 'Everything is perfect. Your account is ready and we should probably get you started!' ) ).toBeInTheDocument(); }, }; ```
docs/snippets/vue/login-form-with-play-function.ts-3.ts.mdx
0
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.000404290301958099, 0.0002393342729192227, 0.00016516887990292162, 0.00020911121100652963, 0.00008348120900336653 ]
{ "id": 3, "code_window": [ " const fromCache = await cache.get('lastUpdateCheck', { success: false, time: 0 });\n", "\n", " // if last check was more then 24h ago\n", " if (time - 86400000 > fromCache.time && !CI) {\n", " telemetry('version-update');\n", "\n", " const fromFetch: any = await Promise.race([\n", " fetch(`${STORYBOOK_VERSION_BASE}/versions.json?current=${version}`),\n", " // if fetch is too slow, we won't wait for it\n", " new Promise((res, rej) => global.setTimeout(rej, 1500)),\n", " ]);\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [], "file_path": "code/lib/core-server/src/utils/update-check.ts", "type": "replace", "edit_start_line_idx": 19 }
import type { BuilderOptions, CLIOptions, CoreConfig, LoadOptions, Options, StorybookConfig, } from '@storybook/types'; import { cache, loadAllPresets, loadMainConfig, resolveAddonName, resolvePathInStorybookCache, validateFrameworkName, } from '@storybook/core-common'; import prompts from 'prompts'; import global from 'global'; import { join, resolve } from 'path'; import { logger } from '@storybook/node-logger'; import { storybookDevServer } from './dev-server'; import { getReleaseNotesData, getReleaseNotesFailedState } from './utils/release-notes'; import { outputStats } from './utils/output-stats'; import { outputStartupInformation } from './utils/output-startup-information'; import { updateCheck } from './utils/update-check'; import { getServerPort, getServerChannelUrl } from './utils/server-address'; import { getManagerBuilder, getPreviewBuilder } from './utils/get-builders'; export async function buildDevStandalone(options: CLIOptions & LoadOptions & BuilderOptions) { const { packageJson, versionUpdates, releaseNotes } = options; const { version } = packageJson; // updateInfo and releaseNotesData are cached, so this is typically pretty fast const [port, versionCheck, releaseNotesData] = await Promise.all([ getServerPort(options.port), versionUpdates ? updateCheck(version) : Promise.resolve({ success: false, cached: false, data: {}, time: Date.now() }), releaseNotes ? getReleaseNotesData(version, cache) : Promise.resolve(getReleaseNotesFailedState(version)), ]); if (!options.ci && !options.smokeTest && options.port != null && port !== options.port) { const { shouldChangePort } = await prompts({ type: 'confirm', initial: true, name: 'shouldChangePort', message: `Port ${options.port} is not available. Would you like to run Storybook on port ${port} instead?`, }); if (!shouldChangePort) process.exit(1); } /* eslint-disable no-param-reassign */ options.port = port; options.versionCheck = versionCheck; options.releaseNotesData = releaseNotesData; options.configType = 'DEVELOPMENT'; options.configDir = resolve(options.configDir); options.outputDir = options.smokeTest ? resolvePathInStorybookCache('public') : resolve(options.outputDir || resolvePathInStorybookCache('public')); options.serverChannelUrl = getServerChannelUrl(port, options); /* eslint-enable no-param-reassign */ const { framework } = loadMainConfig(options); const corePresets = []; const frameworkName = typeof framework === 'string' ? framework : framework?.name; validateFrameworkName(frameworkName); if (frameworkName) { corePresets.push(join(frameworkName, 'preset')); } else { logger.warn(`you have not specified a framework in your ${options.configDir}/main.js`); } // Load first pass: We need to determine the builder // We need to do this because builders might introduce 'overridePresets' which we need to take into account // We hope to remove this in SB8 let presets = await loadAllPresets({ corePresets, overridePresets: [], ...options, }); const { renderer, builder } = await presets.apply<CoreConfig>('core', undefined); const builderName = typeof builder === 'string' ? builder : builder?.name; const [previewBuilder, managerBuilder] = await Promise.all([ getPreviewBuilder(builderName, options.configDir), getManagerBuilder(), ]); // Load second pass: all presets are applied in order presets = await loadAllPresets({ corePresets: [ require.resolve('./presets/common-preset'), ...(managerBuilder.corePresets || []), ...(previewBuilder.corePresets || []), ...(renderer ? [resolveAddonName(options.configDir, renderer, options)] : []), ...corePresets, require.resolve('./presets/babel-cache-preset'), ], overridePresets: previewBuilder.overridePresets, ...options, }); const features = await presets.apply<StorybookConfig['features']>('features'); global.FEATURES = features; const fullOptions: Options = { ...options, presets, features, }; const { address, networkAddress, managerResult, previewResult } = await storybookDevServer( fullOptions ); const previewTotalTime = previewResult && previewResult.totalTime; const managerTotalTime = managerResult && managerResult.totalTime; const previewStats = previewResult && previewResult.stats; const managerStats = managerResult && managerResult.stats; if (options.webpackStatsJson) { const target = options.webpackStatsJson === true ? options.outputDir : options.webpackStatsJson; await outputStats(target, previewStats); } if (options.smokeTest) { const warnings: Error[] = []; warnings.push(...(managerStats?.toJson()?.warnings || [])); warnings.push(...(previewStats?.toJson()?.warnings || [])); const problems = warnings .filter((warning) => !warning.message.includes(`export 'useInsertionEffect'`)) .filter((warning) => !warning.message.includes(`compilation but it's unused`)) .filter( (warning) => !warning.message.includes(`Conflicting values for 'process.env.NODE_ENV'`) ); // eslint-disable-next-line no-console console.log(problems.map((p) => p.stack)); process.exit(problems.length > 0 ? 1 : 0); return; } const name = frameworkName.split('@storybook/').length > 1 ? frameworkName.split('@storybook/')[1] : frameworkName; outputStartupInformation({ updateInfo: versionCheck, version, name, address, networkAddress, managerTotalTime, previewTotalTime, }); }
code/lib/core-server/src/build-dev.ts
1
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.001782847917638719, 0.0002701735938899219, 0.0001620141410967335, 0.00017170279170386493, 0.000378600467229262 ]
{ "id": 3, "code_window": [ " const fromCache = await cache.get('lastUpdateCheck', { success: false, time: 0 });\n", "\n", " // if last check was more then 24h ago\n", " if (time - 86400000 > fromCache.time && !CI) {\n", " telemetry('version-update');\n", "\n", " const fromFetch: any = await Promise.race([\n", " fetch(`${STORYBOOK_VERSION_BASE}/versions.json?current=${version}`),\n", " // if fetch is too slow, we won't wait for it\n", " new Promise((res, rej) => global.setTimeout(rej, 1500)),\n", " ]);\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [], "file_path": "code/lib/core-server/src/utils/update-check.ts", "type": "replace", "edit_start_line_idx": 19 }
```js // .storybook/preview.js export const decorators = [(story) => html`<div style="margin: 3em">${story()}</div>`], ```
docs/snippets/web-components/storybook-preview-global-decorator.js.mdx
0
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.00017149580526165664, 0.00017149580526165664, 0.00017149580526165664, 0.00017149580526165664, 0 ]
{ "id": 3, "code_window": [ " const fromCache = await cache.get('lastUpdateCheck', { success: false, time: 0 });\n", "\n", " // if last check was more then 24h ago\n", " if (time - 86400000 > fromCache.time && !CI) {\n", " telemetry('version-update');\n", "\n", " const fromFetch: any = await Promise.race([\n", " fetch(`${STORYBOOK_VERSION_BASE}/versions.json?current=${version}`),\n", " // if fetch is too slow, we won't wait for it\n", " new Promise((res, rej) => global.setTimeout(rej, 1500)),\n", " ]);\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [], "file_path": "code/lib/core-server/src/utils/update-check.ts", "type": "replace", "edit_start_line_idx": 19 }
<script setup lang="ts"> defineProps<{ disabled: boolean; label: string }>(); const emit = defineEmits<{ (e: 'myChangeEvent', id: number): void; (e: 'myClickEvent', id: number): void; }>(); </script> <template> <button :disabled="disabled" @change="emit('myChangeEvent', 0)" @click="emit('myClickEvent', 0)"> {{ label }} </button> </template> <style scoped></style>
code/renderers/vue3/src/__tests__/Button.vue
0
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.0001735045952955261, 0.00017228828801307827, 0.00017107198073063046, 0.00017228828801307827, 0.000001216307282447815 ]
{ "id": 3, "code_window": [ " const fromCache = await cache.get('lastUpdateCheck', { success: false, time: 0 });\n", "\n", " // if last check was more then 24h ago\n", " if (time - 86400000 > fromCache.time && !CI) {\n", " telemetry('version-update');\n", "\n", " const fromFetch: any = await Promise.race([\n", " fetch(`${STORYBOOK_VERSION_BASE}/versions.json?current=${version}`),\n", " // if fetch is too slow, we won't wait for it\n", " new Promise((res, rej) => global.setTimeout(rej, 1500)),\n", " ]);\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [], "file_path": "code/lib/core-server/src/utils/update-check.ts", "type": "replace", "edit_start_line_idx": 19 }
{ "name": "sb", "version": "7.0.0-alpha.56", "description": "Storybook CLI", "keywords": [ "storybook" ], "homepage": "https://github.com/storybookjs/storybook/tree/main/lib/cli", "bugs": { "url": "https://github.com/storybookjs/storybook/issues" }, "repository": { "type": "git", "url": "https://github.com/storybookjs/storybook.git", "directory": "lib/cli" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" }, "license": "MIT", "bin": "./index.js", "scripts": { "prep": "node ../../../scripts/prepare.js" }, "dependencies": { "@storybook/cli": "7.0.0-alpha.56" }, "devDependencies": { "typescript": "^4.9.3" }, "publishConfig": { "access": "public" }, "gitHead": "c8e9a862bb83c4a0d6b5975e795b4ca7f7ff7bc2" }
code/lib/cli-sb/package.json
0
https://github.com/storybookjs/storybook/commit/4dbc59fd1a1a339ccff30f123aefb56677353357
[ 0.0001731535594444722, 0.00017084165301639587, 0.0001667211327003315, 0.00017174598178826272, 0.000002572111043264158 ]
{ "id": 0, "code_window": [ " /**\n", " * Emitted when the selection is cancelled. \n", " */\n", " ionCancel: EventEmitter<CustomEvent<void>>;\n", " /**\n", " * Emitted when the select has focus. \n", " */\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " /**\n", " * Emitted when the overlay is dismissed. \n", " */\n", " ionDismiss: EventEmitter<CustomEvent<void>>;\n" ], "file_path": "angular/src/directives/proxies.ts", "type": "add", "edit_start_line_idx": 1000 }
import { newE2EPage } from '@stencil/core/testing'; test('select: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true' }); const compares = []; compares.push(await page.compareScreenshot()); // Gender Alert Select let select = await page.find('#gender'); await select.click(); let alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open gender single select')); await alert.callMethod('dismiss'); // Skittles Action Sheet Select select = await page.find('#skittles'); await select.click(); let actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open skittles action sheet select')); await actionSheet.callMethod('dismiss'); // Custom Alert Select select = await page.find('#customAlertSelect'); await select.click(); alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom alert select')); await alert.callMethod('dismiss'); // Custom Popover Select select = await page.find('#customPopoverSelect'); await select.click(); let popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom popover select')); // select has no value, so first option should be focused by default const popoverOption1 = await popover.find('.select-interface-option:first-child'); expect(popoverOption1).toHaveClass('ion-focused'); let popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); await popoverOption2.click(); await page.waitForTimeout(500); await select.click(); popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); expect(popoverOption2).toHaveClass('ion-focused'); await popover.callMethod('dismiss'); // Custom Action Sheet Select select = await page.find('#customActionSheetSelect'); await select.click(); actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom action sheet select')); await actionSheet.callMethod('dismiss'); for (const compare of compares) { expect(compare).toMatchScreenshot(); } }); test('select:rtl: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true&rtl=true' }); const compares = []; compares.push(await page.compareScreenshot()); for (const compare of compares) { expect(compare).toMatchScreenshot(); } });
core/src/components/select/test/basic/e2e.ts
1
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00029592099599540234, 0.000189899408724159, 0.0001634972868487239, 0.00017537345411255956, 0.00003616275716922246 ]
{ "id": 0, "code_window": [ " /**\n", " * Emitted when the selection is cancelled. \n", " */\n", " ionCancel: EventEmitter<CustomEvent<void>>;\n", " /**\n", " * Emitted when the select has focus. \n", " */\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " /**\n", " * Emitted when the overlay is dismissed. \n", " */\n", " ionDismiss: EventEmitter<CustomEvent<void>>;\n" ], "file_path": "angular/src/directives/proxies.ts", "type": "add", "edit_start_line_idx": 1000 }
```tsx import React from 'react'; import { IonBadge, IonItem, IonLabel, IonContent } from '@ionic/react'; export const BadgeExample: React.FC = () => ( <IonContent> {/*-- Default --*/} <IonBadge>99</IonBadge> {/*-- Colors --*/} <IonBadge color="primary">11</IonBadge> <IonBadge color="secondary">22</IonBadge> <IonBadge color="tertiary">33</IonBadge> <IonBadge color="success">44</IonBadge> <IonBadge color="warning">55</IonBadge> <IonBadge color="danger">66</IonBadge> <IonBadge color="light">77</IonBadge> <IonBadge color="medium">88</IonBadge> <IonBadge color="dark">99</IonBadge> {/*-- Item with badge on left and right --*/} <IonItem> <IonBadge slot="start">11</IonBadge> <IonLabel>My Item</IonLabel> <IonBadge slot="end">22</IonBadge> </IonItem> </IonContent> ); ```
core/src/components/badge/usage/react.md
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017165546887554228, 0.00017020106315612793, 0.00016887095989659429, 0.00017007677524816245, 0.0000011401634765206836 ]
{ "id": 0, "code_window": [ " /**\n", " * Emitted when the selection is cancelled. \n", " */\n", " ionCancel: EventEmitter<CustomEvent<void>>;\n", " /**\n", " * Emitted when the select has focus. \n", " */\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " /**\n", " * Emitted when the overlay is dismissed. \n", " */\n", " ionDismiss: EventEmitter<CustomEvent<void>>;\n" ], "file_path": "angular/src/directives/proxies.ts", "type": "add", "edit_start_line_idx": 1000 }
const port = 3000; describe('IonRouterOutlet Ref', () => { /* This spec tests that setting a ref on an IonRouterOutlet works */ it('/outlet-ref, page should contain the id of the ion-router-outlet', () => { cy.visit(`http://localhost:${port}/outlet-ref`); cy.get('div').contains('main-outlet'); cy.ionPageVisible('main'); }); });
packages/react-router/test-app/cypress/integration/outlet-ref.spec.js
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00016923136718105525, 0.00016791705274954438, 0.0001666027237661183, 0.00016791705274954438, 0.0000013143217074684799 ]
{ "id": 0, "code_window": [ " /**\n", " * Emitted when the selection is cancelled. \n", " */\n", " ionCancel: EventEmitter<CustomEvent<void>>;\n", " /**\n", " * Emitted when the select has focus. \n", " */\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " /**\n", " * Emitted when the overlay is dismissed. \n", " */\n", " ionDismiss: EventEmitter<CustomEvent<void>>;\n" ], "file_path": "angular/src/directives/proxies.ts", "type": "add", "edit_start_line_idx": 1000 }
```tsx import React from 'react'; import { IonGrid, IonRow, IonCol, IonContent } from '@ionic/react'; export const GridExample: React.FC = () => ( <IonContent> <IonGrid> <IonRow> <IonCol>ion-col</IonCol> <IonCol>ion-col</IonCol> <IonCol>ion-col</IonCol> <IonCol>ion-col</IonCol> </IonRow> <IonRow> <IonCol size="6">ion-col size="6"</IonCol> <IonCol>ion-col</IonCol> <IonCol>ion-col</IonCol> </IonRow> <IonRow> <IonCol size="3">ion-col size="3"</IonCol> <IonCol>ion-col</IonCol> <IonCol size="3">ion-col size="3"</IonCol> </IonRow> <IonRow> <IonCol size="3">ion-col size="3"</IonCol> <IonCol size="3" offset="3"> ion-col size="3" offset="3" </IonCol> </IonRow> <IonRow> <IonCol>ion-col</IonCol> <IonCol> ion-col <br /># </IonCol> <IonCol> ion-col <br /># <br /># </IonCol> <IonCol> ion-col <br /># <br /># <br /># </IonCol> </IonRow> <IonRow> <IonCol className="ion-align-self-start">ion-col start</IonCol> <IonCol className="ion-align-self-center">ion-col center</IonCol> <IonCol className="ion-align-self-end">ion-col end</IonCol> <IonCol> ion-col <br /># <br /># </IonCol> </IonRow> <IonRow className="ion-align-items-start"> <IonCol>start ion-col</IonCol> <IonCol>start ion-col</IonCol> <IonCol className="ion-align-self-end">start ion-col end</IonCol> <IonCol> ion-col <br /># <br /># </IonCol> </IonRow> <IonRow className="ion-align-items-center"> <IonCol>center ion-col</IonCol> <IonCol>center ion-col</IonCol> <IonCol>center ion-col</IonCol> <IonCol> ion-col <br /># <br /># </IonCol> </IonRow> <IonRow className="ion-align-items-end"> <IonCol>end ion-col</IonCol> <IonCol className="ion-align-self-start">end ion-col start</IonCol> <IonCol>end ion-col</IonCol> <IonCol> ion-col <br /># <br /># </IonCol> </IonRow> <IonRow> <IonCol size="12" size-sm> ion-col size="12" size-sm </IonCol> <IonCol size="12" size-sm> ion-col size="12" size-sm </IonCol> <IonCol size="12" size-sm> ion-col size="12" size-sm </IonCol> <IonCol size="12" size-sm> ion-col size="12" size-sm </IonCol> </IonRow> <IonRow> <IonCol size="12" size-md> ion-col size="12" size-md </IonCol> <IonCol size="12" size-md> ion-col size="12" size-md </IonCol> <IonCol size="12" size-md> ion-col size="12" size-md </IonCol> <IonCol size="12" size-md> ion-col size="12" size-md </IonCol> </IonRow> <IonRow> <IonCol size="6" size-lg offset="3"> ion-col size="6" size-lg offset="3" </IonCol> <IonCol size="3" size-lg> ion-col size="3" size-lg </IonCol> </IonRow> </IonGrid> </IonContent> ); ```
core/src/components/grid/usage/react.md
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0001897389447549358, 0.0001738016726449132, 0.00016602232062723488, 0.00016932128346525133, 0.00000796960466686869 ]
{ "id": 1, "code_window": [ "export class IonSelect {\n", " protected el: HTMLElement;\n", " constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {\n", " c.detach();\n", " this.el = r.nativeElement;\n", " proxyOutputs(this, this.el, ['ionChange', 'ionCancel', 'ionFocus', 'ionBlur']);\n", " }\n", "}\n", "\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " proxyOutputs(this, this.el, ['ionChange', 'ionCancel', 'ionDismiss', 'ionFocus', 'ionBlur']);\n" ], "file_path": "angular/src/directives/proxies.ts", "type": "replace", "edit_start_line_idx": 1027 }
import { newE2EPage } from '@stencil/core/testing'; test('select: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true' }); const compares = []; compares.push(await page.compareScreenshot()); // Gender Alert Select let select = await page.find('#gender'); await select.click(); let alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open gender single select')); await alert.callMethod('dismiss'); // Skittles Action Sheet Select select = await page.find('#skittles'); await select.click(); let actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open skittles action sheet select')); await actionSheet.callMethod('dismiss'); // Custom Alert Select select = await page.find('#customAlertSelect'); await select.click(); alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom alert select')); await alert.callMethod('dismiss'); // Custom Popover Select select = await page.find('#customPopoverSelect'); await select.click(); let popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom popover select')); // select has no value, so first option should be focused by default const popoverOption1 = await popover.find('.select-interface-option:first-child'); expect(popoverOption1).toHaveClass('ion-focused'); let popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); await popoverOption2.click(); await page.waitForTimeout(500); await select.click(); popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); expect(popoverOption2).toHaveClass('ion-focused'); await popover.callMethod('dismiss'); // Custom Action Sheet Select select = await page.find('#customActionSheetSelect'); await select.click(); actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom action sheet select')); await actionSheet.callMethod('dismiss'); for (const compare of compares) { expect(compare).toMatchScreenshot(); } }); test('select:rtl: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true&rtl=true' }); const compares = []; compares.push(await page.compareScreenshot()); for (const compare of compares) { expect(compare).toMatchScreenshot(); } });
core/src/components/select/test/basic/e2e.ts
1
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00018011419160757214, 0.0001718525163596496, 0.00016368836804758757, 0.00017243946786038578, 0.000005624891855404712 ]
{ "id": 1, "code_window": [ "export class IonSelect {\n", " protected el: HTMLElement;\n", " constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {\n", " c.detach();\n", " this.el = r.nativeElement;\n", " proxyOutputs(this, this.el, ['ionChange', 'ionCancel', 'ionFocus', 'ionBlur']);\n", " }\n", "}\n", "\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " proxyOutputs(this, this.el, ['ionChange', 'ionCancel', 'ionDismiss', 'ionFocus', 'ionBlur']);\n" ], "file_path": "angular/src/directives/proxies.ts", "type": "replace", "edit_start_line_idx": 1027 }
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Toolbar - Spec</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link href="../../../../../css/ionic.bundle.css" rel="stylesheet"> <link href="../../../../../scripts/testing/styles.css" rel="stylesheet"> <script src="../../../../../scripts/testing/scripts.js"></script> <script nomodule src="../../../../../dist/ionic/ionic.js"></script> <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script></head> <body> <ion-app> <ion-content> <ion-toolbar color="tertiary"> <ion-buttons slot="start"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-buttons slot="primary"> <ion-button> <ion-icon slot="icon-only" name="download"></ion-icon> </ion-button> <ion-button> <ion-icon slot="icon-only" name="print"></ion-icon> </ion-button> <ion-button> <ion-icon slot="icon-only" name="bookmark"></ion-icon> </ion-button> </ion-buttons> <ion-title>Standard</ion-title> </ion-toolbar> <ion-header> <ion-toolbar color="tertiary"> <ion-buttons slot="start"> <ion-button> <ion-icon slot="icon-only" name="add"></ion-icon> </ion-button> </ion-buttons> <ion-buttons slot="primary"> <ion-button> <ion-icon slot="icon-only" name="heart"></ion-icon> </ion-button> <ion-button> <ion-icon slot="icon-only" name="search"></ion-icon> </ion-button> <ion-button> <ion-icon slot="icon-only" ios="ellipsis-horizontal" md="ellipsis-vertical"></ion-icon> </ion-button> </ion-buttons> <ion-title>Page title</ion-title> </ion-toolbar> </ion-header> <ion-header> <ion-toolbar color="tertiary"> <ion-buttons slot="start"> <ion-back-button default-href="/" text="February"></ion-back-button> </ion-buttons> <ion-buttons slot="end"> <ion-button> <ion-icon slot="icon-only" ios="list-outline" md="list-sharp"></ion-icon> </ion-button> <ion-button> <ion-icon slot="icon-only" ios="search-outline" md="search-sharp"></ion-icon> </ion-button> <ion-button> <ion-icon slot="icon-only" ios="add-outline" md="add-sharp"></ion-icon> </ion-button> </ion-buttons> </ion-toolbar> </ion-header> <ion-toolbar color="tertiary"> <ion-buttons slot="start"> <ion-button> Clearing </ion-button> </ion-buttons> <ion-buttons slot="secondary"> <ion-button> Done </ion-button> </ion-buttons> <ion-title>Text</ion-title> </ion-toolbar> <ion-toolbar color="tertiary"> <ion-buttons slot="start"> <ion-button> Start </ion-button> </ion-buttons> <ion-buttons slot="primary"> <ion-button> Pri </ion-button> </ion-buttons> <ion-buttons slot="end"> <ion-button> End </ion-button> </ion-buttons> <ion-buttons slot="secondary"> <ion-button> Sec </ion-button> </ion-buttons> <ion-title>Slots</ion-title> </ion-toolbar> <ion-toolbar color="tertiary"> <ion-buttons slot="start"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-buttons slot="primary"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-buttons slot="secondary"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-buttons slot="end"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-title>Slots</ion-title> </ion-toolbar> <ion-toolbar color="tertiary"> <ion-buttons slot="end"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-buttons slot="primary"> <ion-button> <ion-icon slot="icon-only" name="star"></ion-icon> </ion-button> </ion-buttons> <ion-buttons slot="secondary"> <ion-button> <ion-icon slot="icon-only" name="call"></ion-icon> </ion-button> </ion-buttons> <ion-buttons slot="start"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-title>Slots</ion-title> </ion-toolbar> <ion-toolbar color="tertiary"> <ion-buttons slot="end"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-buttons slot="primary"> <ion-button> <ion-icon slot="icon-only" name="star"></ion-icon> </ion-button> </ion-buttons> <ion-buttons slot="secondary"> <ion-button> <ion-icon slot="icon-only" name="call"></ion-icon> </ion-button> </ion-buttons> <ion-buttons slot="start"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-buttons slot="start"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-title>Slots</ion-title> </ion-toolbar> <ion-toolbar color="tertiary"> <ion-buttons slot="start"> <ion-back-button default-href="#"></ion-back-button> </ion-buttons> <ion-buttons slot="secondary"> <ion-button> <ion-icon slot="icon-only" name="star"></ion-icon> </ion-button> </ion-buttons> <ion-title>Text</ion-title> </ion-toolbar> <ion-toolbar color="tertiary"> <ion-segment value="all"> <ion-segment-button value="all">All</ion-segment-button> <ion-segment-button value="favorites">Favorites</ion-segment-button> </ion-segment> </ion-toolbar> <ion-toolbar color="tertiary"> <ion-buttons slot="start"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-buttons slot="end"> <ion-button> <ion-icon slot="icon-only" name="star"></ion-icon> </ion-button> </ion-buttons> <ion-segment value="all"> <ion-segment-button value="all">All</ion-segment-button> <ion-segment-button value="favorites">Favorites</ion-segment-button> </ion-segment> </ion-toolbar> <ion-toolbar color="tertiary"> <ion-buttons slot="end"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-segment value="all"> <ion-segment-button value="all">All</ion-segment-button> <ion-segment-button value="favorites">Favorites</ion-segment-button> </ion-segment> </ion-toolbar> <ion-toolbar color="tertiary"> <ion-buttons slot="start"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-segment value="all"> <ion-segment-button value="all">All</ion-segment-button> <ion-segment-button value="favorites">Favorites</ion-segment-button> </ion-segment> </ion-toolbar> <ion-toolbar color="tertiary"> <ion-buttons slot="start"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-buttons slot="end"> <ion-button> <ion-icon slot="icon-only" name="star"></ion-icon> </ion-button> </ion-buttons> <ion-searchbar></ion-searchbar> </ion-toolbar> <ion-toolbar color="tertiary"> <ion-buttons slot="start"> <ion-menu-button auto-hide="false"></ion-menu-button> </ion-buttons> <ion-buttons slot="end"> <ion-button> <ion-icon slot="icon-only" name="star"></ion-icon> </ion-button> </ion-buttons> <ion-progress-bar value=".4"></ion-progress-bar> </ion-toolbar> </ion-content> <ion-footer> <ion-toolbar> <ion-title> Click to Add Text </ion-title> <ion-buttons slot="end"> <ion-button id="changeText" onClick="toggleText()"> <ion-icon slot="start" name="refresh"></ion-icon> </ion-button> </ion-buttons> </ion-toolbar> </ion-footer> <script> const button = document.getElementById('changeText'); function toggleText() { const hasText = button.querySelector('#childText'); if (hasText) { button.removeChild(hasText); } else { var text = document.createElement('span'); text.innerHTML = 'Toggle'; text.id = 'childText'; button.appendChild(text, button); } } </script> <style> ion-toolbar { margin-bottom: 10px; } </style> </ion-app> </body> </html>
core/src/components/toolbar/test/spec/index.html
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00021910607756581157, 0.0001701158907962963, 0.0001661214482737705, 0.00016818959556985646, 0.000009169552868115716 ]
{ "id": 1, "code_window": [ "export class IonSelect {\n", " protected el: HTMLElement;\n", " constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {\n", " c.detach();\n", " this.el = r.nativeElement;\n", " proxyOutputs(this, this.el, ['ionChange', 'ionCancel', 'ionFocus', 'ionBlur']);\n", " }\n", "}\n", "\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " proxyOutputs(this, this.el, ['ionChange', 'ionCancel', 'ionDismiss', 'ionFocus', 'ionBlur']);\n" ], "file_path": "angular/src/directives/proxies.ts", "type": "replace", "edit_start_line_idx": 1027 }
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Button - Outline</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link href="../../../../../css/ionic.bundle.css" rel="stylesheet"> <link href="../../../../../scripts/testing/styles.css" rel="stylesheet"> <script src="../../../../../scripts/testing/scripts.js"></script> <script nomodule src="../../../../../dist/ionic/ionic.js"></script> <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script></head> <body> <ion-app> <ion-header> <ion-toolbar> <ion-title>Button - Outline</ion-title> </ion-toolbar> </ion-header> <ion-content class="ion-padding" id="content" no-bounce> <p> <ion-button fill="outline">Default</ion-button> <ion-button fill="outline" class="ion-activated">Default.activated</ion-button> <ion-button fill="outline" class="ion-focused">Default.focused</ion-button> <ion-button fill="outline" class="ion-activated ion-focused">Default.activated.focused</ion-button> </p> <p> <ion-button fill="outline" color="primary">Primary</ion-button> <ion-button fill="outline" class="ion-activated" color="primary">Primary.activated</ion-button> <ion-button fill="outline" class="ion-focused" color="primary">Primary.focused</ion-button> <ion-button fill="outline" class="ion-activated ion-focused" color="primary">Primary.activated.focused</ion-button> </p> <p> <ion-button fill="outline" color="secondary">Secondary</ion-button> <ion-button fill="outline" class="ion-activated" color="secondary">Secondary.activated</ion-button> <ion-button fill="outline" class="ion-focused" color="secondary">Secondary.focused</ion-button> <ion-button fill="outline" class="ion-activated ion-focused" color="secondary">Secondary.activated.focused</ion-button> </p> <p> <ion-button fill="outline" color="tertiary">Tertiary</ion-button> <ion-button fill="outline" class="ion-activated" color="tertiary">Tertiary.activated</ion-button> <ion-button fill="outline" class="ion-focused" color="tertiary">Tertiary.focused</ion-button> <ion-button fill="outline" class="ion-activated ion-focused" color="tertiary">Tertiary.activated.focused</ion-button> </p> <p> <ion-button fill="outline" color="success">Success</ion-button> <ion-button fill="outline" class="ion-activated" color="success">Success.activated</ion-button> <ion-button fill="outline" class="ion-focused" color="success">Success.focused</ion-button> <ion-button fill="outline" class="ion-activated ion-focused" color="success">Success.activated.focused</ion-button> </p> <p> <ion-button fill="outline" color="warning">Warning</ion-button> <ion-button fill="outline" class="ion-activated" color="warning">Warning.activated</ion-button> <ion-button fill="outline" class="ion-focused" color="warning">Warning.focused</ion-button> <ion-button fill="outline" class="ion-activated ion-focused" color="warning">Warning.activated.focused</ion-button> </p> <p> <ion-button fill="outline" color="danger">Danger</ion-button> <ion-button fill="outline" class="ion-activated" color="danger">Danger.activated</ion-button> <ion-button fill="outline" class="ion-focused" color="danger">Danger.focused</ion-button> <ion-button fill="outline" class="ion-activated ion-focused" color="danger">Danger.activated.focused</ion-button> </p> <p> <ion-button fill="outline" color="light">Light</ion-button> <ion-button fill="outline" class="ion-activated" color="light">Light.activated</ion-button> <ion-button fill="outline" class="ion-focused" color="light">Light.focused</ion-button> <ion-button fill="outline" class="ion-activated ion-focused" color="light">Light.activated.focused</ion-button> </p> <p> <ion-button fill="outline" color="medium">Medium</ion-button> <ion-button fill="outline" class="ion-activated" color="medium">Medium.activated</ion-button> <ion-button fill="outline" class="ion-focused" color="medium">Medium.focused</ion-button> <ion-button fill="outline" class="ion-activated ion-focused" color="medium">Medium.activated.focused</ion-button> </p> <p> <ion-button fill="outline" color="dark">Dark</ion-button> <ion-button fill="outline" class="ion-activated" color="dark">Dark.activated</ion-button> <ion-button fill="outline" class="ion-focused" color="dark">Dark.focused</ion-button> <ion-button fill="outline" class="ion-activated ion-focused" color="dark">Dark.activated.focused</ion-button> </p> <p> <ion-button fill="outline" disabled>Disabled</ion-button> <ion-button fill="outline" color="secondary" disabled>Secondary Disabled</ion-button> </p> </ion-content> </ion-app> </body> </html>
core/src/components/button/test/outline/index.html
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0001750199735397473, 0.00016826354840304703, 0.00016499542107339948, 0.00016746405162848532, 0.0000030703615720995003 ]
{ "id": 1, "code_window": [ "export class IonSelect {\n", " protected el: HTMLElement;\n", " constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {\n", " c.detach();\n", " this.el = r.nativeElement;\n", " proxyOutputs(this, this.el, ['ionChange', 'ionCancel', 'ionFocus', 'ionBlur']);\n", " }\n", "}\n", "\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ], "after_edit": [ " proxyOutputs(this, this.el, ['ionChange', 'ionCancel', 'ionDismiss', 'ionFocus', 'ionBlur']);\n" ], "file_path": "angular/src/directives/proxies.ts", "type": "replace", "edit_start_line_idx": 1027 }
// Refresher // -------------------------------------------------- /// @prop - Height of the refresher $refresher-height: 60px !default; /// @prop - Font size of the refresher icon $refresher-icon-font-size: 30px !default; /// @prop - Font size of the refresher content $refresher-text-font-size: 16px !default;
core/src/components/refresher/refresher.vars.scss
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017878350627142936, 0.00017583425506018102, 0.00017288498929701746, 0.00017583425506018102, 0.0000029492584872059524 ]
{ "id": 2, "code_window": [ "ion-select,method,open,open(event?: UIEvent | undefined) => Promise<any>\n", "ion-select,event,ionBlur,void,true\n", "ion-select,event,ionCancel,void,true\n", "ion-select,event,ionChange,SelectChangeEventDetail<any>,true\n", "ion-select,event,ionFocus,void,true\n", "ion-select,css-prop,--padding-bottom\n", "ion-select,css-prop,--padding-end\n", "ion-select,css-prop,--padding-start\n", "ion-select,css-prop,--padding-top\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "ion-select,event,ionDismiss,void,true\n" ], "file_path": "core/api.txt", "type": "add", "edit_start_line_idx": 1000 }
import { newE2EPage } from '@stencil/core/testing'; test('select: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true' }); const compares = []; compares.push(await page.compareScreenshot()); // Gender Alert Select let select = await page.find('#gender'); await select.click(); let alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open gender single select')); await alert.callMethod('dismiss'); // Skittles Action Sheet Select select = await page.find('#skittles'); await select.click(); let actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open skittles action sheet select')); await actionSheet.callMethod('dismiss'); // Custom Alert Select select = await page.find('#customAlertSelect'); await select.click(); alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom alert select')); await alert.callMethod('dismiss'); // Custom Popover Select select = await page.find('#customPopoverSelect'); await select.click(); let popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom popover select')); // select has no value, so first option should be focused by default const popoverOption1 = await popover.find('.select-interface-option:first-child'); expect(popoverOption1).toHaveClass('ion-focused'); let popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); await popoverOption2.click(); await page.waitForTimeout(500); await select.click(); popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); expect(popoverOption2).toHaveClass('ion-focused'); await popover.callMethod('dismiss'); // Custom Action Sheet Select select = await page.find('#customActionSheetSelect'); await select.click(); actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom action sheet select')); await actionSheet.callMethod('dismiss'); for (const compare of compares) { expect(compare).toMatchScreenshot(); } }); test('select:rtl: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true&rtl=true' }); const compares = []; compares.push(await page.compareScreenshot()); for (const compare of compares) { expect(compare).toMatchScreenshot(); } });
core/src/components/select/test/basic/e2e.ts
1
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0073066153563559055, 0.0012076558778062463, 0.0001673231163294986, 0.0002993405214510858, 0.0020324753131717443 ]
{ "id": 2, "code_window": [ "ion-select,method,open,open(event?: UIEvent | undefined) => Promise<any>\n", "ion-select,event,ionBlur,void,true\n", "ion-select,event,ionCancel,void,true\n", "ion-select,event,ionChange,SelectChangeEventDetail<any>,true\n", "ion-select,event,ionFocus,void,true\n", "ion-select,css-prop,--padding-bottom\n", "ion-select,css-prop,--padding-end\n", "ion-select,css-prop,--padding-start\n", "ion-select,css-prop,--padding-top\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "ion-select,event,ionDismiss,void,true\n" ], "file_path": "core/api.txt", "type": "add", "edit_start_line_idx": 1000 }
export { IonReactRouter } from './ReactRouter/IonReactRouter'; export { IonReactMemoryRouter } from './ReactRouter/IonReactMemoryRouter'; export { IonReactHashRouter } from './ReactRouter/IonReactHashRouter';
packages/react-router/src/index.ts
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00016949977725744247, 0.00016949977725744247, 0.00016949977725744247, 0.00016949977725744247, 0 ]
{ "id": 2, "code_window": [ "ion-select,method,open,open(event?: UIEvent | undefined) => Promise<any>\n", "ion-select,event,ionBlur,void,true\n", "ion-select,event,ionCancel,void,true\n", "ion-select,event,ionChange,SelectChangeEventDetail<any>,true\n", "ion-select,event,ionFocus,void,true\n", "ion-select,css-prop,--padding-bottom\n", "ion-select,css-prop,--padding-end\n", "ion-select,css-prop,--padding-start\n", "ion-select,css-prop,--padding-top\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "ion-select,event,ionDismiss,void,true\n" ], "file_path": "core/api.txt", "type": "add", "edit_start_line_idx": 1000 }
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Infinite Scroll - Basic</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link href="../../../../../css/ionic.bundle.css" rel="stylesheet"> <link href="../../../../../scripts/testing/styles.css" rel="stylesheet"> <script src="../../../../../scripts/testing/scripts.js"></script> <script nomodule src="../../../../../dist/ionic/ionic.js"></script> <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script></head> <body> <ion-app> <ion-header> <ion-toolbar> <ion-title>Infinite Scroll - Basic</ion-title> </ion-toolbar> </ion-header> <ion-content class="ion-padding" id="content"> <ion-infinite-scroll threshold="100px" id="infinite-scroll" position="top"> <ion-infinite-scroll-content loading-spinner="bubbles" loading-text="Loading more data..."> </ion-infinite-scroll-content> </ion-infinite-scroll> <ion-button onclick="toggleInfiniteScroll()" expand="block"> Toggle InfiniteScroll </ion-button> <ion-list id="list"></ion-list> </ion-content> </ion-app> <script> const list = document.getElementById('list'); const infiniteScroll = document.getElementById('infinite-scroll'); function toggleInfiniteScroll() { infiniteScroll.disabled = !infiniteScroll.disabled; } infiniteScroll.addEventListener('ionInfinite', async function () { console.log('Loading data...'); await wait(500); infiniteScroll.complete(); appendItems(); console.log('Done'); }); function appendItems() { for (var i = 0; i < 30; i++) { const el = document.createElement('ion-item'); el.textContent = `${1 + i}`; list.prepend(el); } } function wait(time) { return new Promise(resolve => { setTimeout(() => { resolve(); }, time); }); } appendItems(); </script> </body> </html>
core/src/components/infinite-scroll/test/top/index.html
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.005918638780713081, 0.002233466599136591, 0.00016594983753748238, 0.00044244201853871346, 0.002532076323404908 ]
{ "id": 2, "code_window": [ "ion-select,method,open,open(event?: UIEvent | undefined) => Promise<any>\n", "ion-select,event,ionBlur,void,true\n", "ion-select,event,ionCancel,void,true\n", "ion-select,event,ionChange,SelectChangeEventDetail<any>,true\n", "ion-select,event,ionFocus,void,true\n", "ion-select,css-prop,--padding-bottom\n", "ion-select,css-prop,--padding-end\n", "ion-select,css-prop,--padding-start\n", "ion-select,css-prop,--padding-top\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "ion-select,event,ionDismiss,void,true\n" ], "file_path": "core/api.txt", "type": "add", "edit_start_line_idx": 1000 }
import { AfterViewInit, Component, ViewChild } from '@angular/core'; import { IonSlides } from '@ionic/angular'; @Component({ selector: 'app-slides', templateUrl: './slides.component.html', }) export class SlidesComponent implements AfterViewInit { @ViewChild(IonSlides, { static: true }) slides: IonSlides; slideIndex = 0; slideIndex2 = 0; slidesData = []; constructor() { } ngAfterViewInit() { this.slides.ionSlideDidChange.subscribe(async () => { this.slideIndex2 = await this.slides.getActiveIndex(); }); } addSlides() { const start = this.slidesData.length + 1; this.slidesData.push(`Slide ${start}`, `Slide ${start + 1}`, `Slide ${start + 2}`); } prevSlide() { this.slides.slidePrev(); } nextSlide() { this.slides.slideNext(); } async checkIndex() { this.slideIndex = await this.slides.getActiveIndex(); } }
angular/test/test-app/src/app/slides/slides.component.ts
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0002039196842815727, 0.00017743319040164351, 0.00016926639364100993, 0.00017165939789265394, 0.000013294033124111593 ]
{ "id": 3, "code_window": [ " /**\n", " * Emitted when the value has changed.\n", " */\n", " \"onIonChange\"?: (event: CustomEvent<SelectChangeEventDetail>) => void;\n", " /**\n", " * Emitted when the select has focus.\n", " */\n", " \"onIonFocus\"?: (event: CustomEvent<void>) => void;\n", " /**\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " /**\n", " * Emitted when the overlay is dismissed.\n", " */\n", " \"onIonDismiss\"?: (event: CustomEvent<void>) => void;\n" ], "file_path": "core/src/components.d.ts", "type": "add", "edit_start_line_idx": 1000 }
ion-accordion,shadow ion-accordion,prop,disabled,boolean,false,false,false ion-accordion,prop,mode,"ios" | "md",undefined,false,false ion-accordion,prop,readonly,boolean,false,false,false ion-accordion,prop,toggleIcon,string,chevronDown,false,false ion-accordion,prop,toggleIconSlot,"end" | "start",'end',false,false ion-accordion,prop,value,string,`ion-accordion-${accordionIds++}`,false,false ion-accordion,part,content ion-accordion,part,expanded ion-accordion,part,header ion-accordion-group,shadow ion-accordion-group,prop,animated,boolean,true,false,false ion-accordion-group,prop,disabled,boolean,false,false,false ion-accordion-group,prop,expand,"compact" | "inset",'compact',false,false ion-accordion-group,prop,mode,"ios" | "md",undefined,false,false ion-accordion-group,prop,multiple,boolean | undefined,undefined,false,false ion-accordion-group,prop,readonly,boolean,false,false,false ion-accordion-group,prop,value,null | string | string[] | undefined,undefined,false,false ion-accordion-group,event,ionChange,AccordionGroupChangeEventDetail<any>,true ion-action-sheet,scoped ion-action-sheet,prop,animated,boolean,true,false,false ion-action-sheet,prop,backdropDismiss,boolean,true,false,false ion-action-sheet,prop,buttons,(string | ActionSheetButton<any>)[],[],false,false ion-action-sheet,prop,cssClass,string | string[] | undefined,undefined,false,false ion-action-sheet,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-action-sheet,prop,header,string | undefined,undefined,false,false ion-action-sheet,prop,htmlAttributes,ActionSheetAttributes | undefined,undefined,false,false ion-action-sheet,prop,keyboardClose,boolean,true,false,false ion-action-sheet,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-action-sheet,prop,mode,"ios" | "md",undefined,false,false ion-action-sheet,prop,subHeader,string | undefined,undefined,false,false ion-action-sheet,prop,translucent,boolean,false,false,false ion-action-sheet,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise<boolean> ion-action-sheet,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-action-sheet,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-action-sheet,method,present,present() => Promise<void> ion-action-sheet,event,ionActionSheetDidDismiss,OverlayEventDetail<any>,true ion-action-sheet,event,ionActionSheetDidPresent,void,true ion-action-sheet,event,ionActionSheetWillDismiss,OverlayEventDetail<any>,true ion-action-sheet,event,ionActionSheetWillPresent,void,true ion-action-sheet,css-prop,--backdrop-opacity ion-action-sheet,css-prop,--background ion-action-sheet,css-prop,--button-background ion-action-sheet,css-prop,--button-background-activated ion-action-sheet,css-prop,--button-background-activated-opacity ion-action-sheet,css-prop,--button-background-focused ion-action-sheet,css-prop,--button-background-focused-opacity ion-action-sheet,css-prop,--button-background-hover ion-action-sheet,css-prop,--button-background-hover-opacity ion-action-sheet,css-prop,--button-background-selected ion-action-sheet,css-prop,--button-background-selected-opacity ion-action-sheet,css-prop,--button-color ion-action-sheet,css-prop,--button-color-activated ion-action-sheet,css-prop,--button-color-focused ion-action-sheet,css-prop,--button-color-hover ion-action-sheet,css-prop,--button-color-selected ion-action-sheet,css-prop,--color ion-action-sheet,css-prop,--height ion-action-sheet,css-prop,--max-height ion-action-sheet,css-prop,--max-width ion-action-sheet,css-prop,--min-height ion-action-sheet,css-prop,--min-width ion-action-sheet,css-prop,--width ion-alert,scoped ion-alert,prop,animated,boolean,true,false,false ion-alert,prop,backdropDismiss,boolean,true,false,false ion-alert,prop,buttons,(string | AlertButton)[],[],false,false ion-alert,prop,cssClass,string | string[] | undefined,undefined,false,false ion-alert,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-alert,prop,header,string | undefined,undefined,false,false ion-alert,prop,htmlAttributes,AlertAttributes | undefined,undefined,false,false ion-alert,prop,inputs,AlertInput[],[],false,false ion-alert,prop,keyboardClose,boolean,true,false,false ion-alert,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-alert,prop,message,IonicSafeString | string | undefined,undefined,false,false ion-alert,prop,mode,"ios" | "md",undefined,false,false ion-alert,prop,subHeader,string | undefined,undefined,false,false ion-alert,prop,translucent,boolean,false,false,false ion-alert,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise<boolean> ion-alert,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-alert,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-alert,method,present,present() => Promise<void> ion-alert,event,ionAlertDidDismiss,OverlayEventDetail<any>,true ion-alert,event,ionAlertDidPresent,void,true ion-alert,event,ionAlertWillDismiss,OverlayEventDetail<any>,true ion-alert,event,ionAlertWillPresent,void,true ion-alert,css-prop,--backdrop-opacity ion-alert,css-prop,--background ion-alert,css-prop,--height ion-alert,css-prop,--max-height ion-alert,css-prop,--max-width ion-alert,css-prop,--min-height ion-alert,css-prop,--min-width ion-alert,css-prop,--width ion-app,none ion-avatar,shadow ion-avatar,css-prop,--border-radius ion-back-button,shadow ion-back-button,prop,color,string | undefined,undefined,false,true ion-back-button,prop,defaultHref,string | undefined,undefined,false,false ion-back-button,prop,disabled,boolean,false,false,true ion-back-button,prop,icon,null | string | undefined,undefined,false,false ion-back-button,prop,mode,"ios" | "md",undefined,false,false ion-back-button,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-back-button,prop,text,null | string | undefined,undefined,false,false ion-back-button,prop,type,"button" | "reset" | "submit",'button',false,false ion-back-button,css-prop,--background ion-back-button,css-prop,--background-focused ion-back-button,css-prop,--background-focused-opacity ion-back-button,css-prop,--background-hover ion-back-button,css-prop,--background-hover-opacity ion-back-button,css-prop,--border-radius ion-back-button,css-prop,--color ion-back-button,css-prop,--color-focused ion-back-button,css-prop,--color-hover ion-back-button,css-prop,--icon-font-size ion-back-button,css-prop,--icon-font-weight ion-back-button,css-prop,--icon-margin-bottom ion-back-button,css-prop,--icon-margin-end ion-back-button,css-prop,--icon-margin-start ion-back-button,css-prop,--icon-margin-top ion-back-button,css-prop,--icon-padding-bottom ion-back-button,css-prop,--icon-padding-end ion-back-button,css-prop,--icon-padding-start ion-back-button,css-prop,--icon-padding-top ion-back-button,css-prop,--margin-bottom ion-back-button,css-prop,--margin-end ion-back-button,css-prop,--margin-start ion-back-button,css-prop,--margin-top ion-back-button,css-prop,--min-height ion-back-button,css-prop,--min-width ion-back-button,css-prop,--opacity ion-back-button,css-prop,--padding-bottom ion-back-button,css-prop,--padding-end ion-back-button,css-prop,--padding-start ion-back-button,css-prop,--padding-top ion-back-button,css-prop,--ripple-color ion-back-button,css-prop,--transition ion-back-button,part,icon ion-back-button,part,native ion-back-button,part,text ion-backdrop,shadow ion-backdrop,prop,stopPropagation,boolean,true,false,false ion-backdrop,prop,tappable,boolean,true,false,false ion-backdrop,prop,visible,boolean,true,false,false ion-backdrop,event,ionBackdropTap,void,true ion-badge,shadow ion-badge,prop,color,string | undefined,undefined,false,true ion-badge,prop,mode,"ios" | "md",undefined,false,false ion-badge,css-prop,--background ion-badge,css-prop,--color ion-badge,css-prop,--padding-bottom ion-badge,css-prop,--padding-end ion-badge,css-prop,--padding-start ion-badge,css-prop,--padding-top ion-breadcrumb,shadow ion-breadcrumb,prop,active,boolean,false,false,false ion-breadcrumb,prop,color,string | undefined,undefined,false,false ion-breadcrumb,prop,disabled,boolean,false,false,false ion-breadcrumb,prop,download,string | undefined,undefined,false,false ion-breadcrumb,prop,href,string | undefined,undefined,false,false ion-breadcrumb,prop,mode,"ios" | "md",undefined,false,false ion-breadcrumb,prop,rel,string | undefined,undefined,false,false ion-breadcrumb,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-breadcrumb,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-breadcrumb,prop,separator,boolean | undefined,undefined,false,false ion-breadcrumb,prop,target,string | undefined,undefined,false,false ion-breadcrumb,event,ionBlur,void,true ion-breadcrumb,event,ionFocus,void,true ion-breadcrumb,css-prop,--background-focused ion-breadcrumb,css-prop,--color ion-breadcrumb,css-prop,--color-active ion-breadcrumb,css-prop,--color-focused ion-breadcrumb,css-prop,--color-hover ion-breadcrumb,part,collapsed-indicator ion-breadcrumb,part,native ion-breadcrumb,part,separator ion-breadcrumbs,shadow ion-breadcrumbs,prop,color,string | undefined,undefined,false,false ion-breadcrumbs,prop,itemsAfterCollapse,number,1,false,false ion-breadcrumbs,prop,itemsBeforeCollapse,number,1,false,false ion-breadcrumbs,prop,maxItems,number | undefined,undefined,false,false ion-breadcrumbs,prop,mode,"ios" | "md",undefined,false,false ion-breadcrumbs,event,ionCollapsedClick,BreadcrumbCollapsedClickEventDetail,true ion-breadcrumbs,css-prop,--background ion-breadcrumbs,css-prop,--color ion-button,shadow ion-button,prop,buttonType,string,'button',false,false ion-button,prop,color,string | undefined,undefined,false,true ion-button,prop,disabled,boolean,false,false,true ion-button,prop,download,string | undefined,undefined,false,false ion-button,prop,expand,"block" | "full" | undefined,undefined,false,true ion-button,prop,fill,"clear" | "default" | "outline" | "solid" | undefined,undefined,false,true ion-button,prop,href,string | undefined,undefined,false,false ion-button,prop,mode,"ios" | "md",undefined,false,false ion-button,prop,rel,string | undefined,undefined,false,false ion-button,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-button,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-button,prop,shape,"round" | undefined,undefined,false,true ion-button,prop,size,"default" | "large" | "small" | undefined,undefined,false,true ion-button,prop,strong,boolean,false,false,false ion-button,prop,target,string | undefined,undefined,false,false ion-button,prop,type,"button" | "reset" | "submit",'button',false,false ion-button,event,ionBlur,void,true ion-button,event,ionFocus,void,true ion-button,css-prop,--background ion-button,css-prop,--background-activated ion-button,css-prop,--background-activated-opacity ion-button,css-prop,--background-focused ion-button,css-prop,--background-focused-opacity ion-button,css-prop,--background-hover ion-button,css-prop,--background-hover-opacity ion-button,css-prop,--border-color ion-button,css-prop,--border-radius ion-button,css-prop,--border-style ion-button,css-prop,--border-width ion-button,css-prop,--box-shadow ion-button,css-prop,--color ion-button,css-prop,--color-activated ion-button,css-prop,--color-focused ion-button,css-prop,--color-hover ion-button,css-prop,--opacity ion-button,css-prop,--padding-bottom ion-button,css-prop,--padding-end ion-button,css-prop,--padding-start ion-button,css-prop,--padding-top ion-button,css-prop,--ripple-color ion-button,css-prop,--transition ion-button,part,native ion-buttons,scoped ion-buttons,prop,collapse,boolean,false,false,false ion-card,shadow ion-card,prop,button,boolean,false,false,false ion-card,prop,color,string | undefined,undefined,false,true ion-card,prop,disabled,boolean,false,false,false ion-card,prop,download,string | undefined,undefined,false,false ion-card,prop,href,string | undefined,undefined,false,false ion-card,prop,mode,"ios" | "md",undefined,false,false ion-card,prop,rel,string | undefined,undefined,false,false ion-card,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-card,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-card,prop,target,string | undefined,undefined,false,false ion-card,prop,type,"button" | "reset" | "submit",'button',false,false ion-card,css-prop,--background ion-card,css-prop,--color ion-card,part,native ion-card-content,none ion-card-content,prop,mode,"ios" | "md",undefined,false,false ion-card-header,shadow ion-card-header,prop,color,string | undefined,undefined,false,true ion-card-header,prop,mode,"ios" | "md",undefined,false,false ion-card-header,prop,translucent,boolean,false,false,false ion-card-subtitle,shadow ion-card-subtitle,prop,color,string | undefined,undefined,false,true ion-card-subtitle,prop,mode,"ios" | "md",undefined,false,false ion-card-subtitle,css-prop,--color ion-card-title,shadow ion-card-title,prop,color,string | undefined,undefined,false,true ion-card-title,prop,mode,"ios" | "md",undefined,false,false ion-card-title,css-prop,--color ion-checkbox,shadow ion-checkbox,prop,checked,boolean,false,false,false ion-checkbox,prop,color,string | undefined,undefined,false,true ion-checkbox,prop,disabled,boolean,false,false,false ion-checkbox,prop,indeterminate,boolean,false,false,false ion-checkbox,prop,mode,"ios" | "md",undefined,false,false ion-checkbox,prop,name,string,this.inputId,false,false ion-checkbox,prop,value,any,'on',false,false ion-checkbox,event,ionBlur,void,true ion-checkbox,event,ionChange,CheckboxChangeEventDetail<any>,true ion-checkbox,event,ionFocus,void,true ion-checkbox,css-prop,--background ion-checkbox,css-prop,--background-checked ion-checkbox,css-prop,--border-color ion-checkbox,css-prop,--border-color-checked ion-checkbox,css-prop,--border-radius ion-checkbox,css-prop,--border-style ion-checkbox,css-prop,--border-width ion-checkbox,css-prop,--checkmark-color ion-checkbox,css-prop,--checkmark-width ion-checkbox,css-prop,--size ion-checkbox,css-prop,--transition ion-checkbox,part,container ion-checkbox,part,mark ion-chip,shadow ion-chip,prop,color,string | undefined,undefined,false,true ion-chip,prop,disabled,boolean,false,false,false ion-chip,prop,mode,"ios" | "md",undefined,false,false ion-chip,prop,outline,boolean,false,false,false ion-chip,css-prop,--background ion-chip,css-prop,--color ion-col,shadow ion-col,prop,offset,string | undefined,undefined,false,false ion-col,prop,offsetLg,string | undefined,undefined,false,false ion-col,prop,offsetMd,string | undefined,undefined,false,false ion-col,prop,offsetSm,string | undefined,undefined,false,false ion-col,prop,offsetXl,string | undefined,undefined,false,false ion-col,prop,offsetXs,string | undefined,undefined,false,false ion-col,prop,pull,string | undefined,undefined,false,false ion-col,prop,pullLg,string | undefined,undefined,false,false ion-col,prop,pullMd,string | undefined,undefined,false,false ion-col,prop,pullSm,string | undefined,undefined,false,false ion-col,prop,pullXl,string | undefined,undefined,false,false ion-col,prop,pullXs,string | undefined,undefined,false,false ion-col,prop,push,string | undefined,undefined,false,false ion-col,prop,pushLg,string | undefined,undefined,false,false ion-col,prop,pushMd,string | undefined,undefined,false,false ion-col,prop,pushSm,string | undefined,undefined,false,false ion-col,prop,pushXl,string | undefined,undefined,false,false ion-col,prop,pushXs,string | undefined,undefined,false,false ion-col,prop,size,string | undefined,undefined,false,false ion-col,prop,sizeLg,string | undefined,undefined,false,false ion-col,prop,sizeMd,string | undefined,undefined,false,false ion-col,prop,sizeSm,string | undefined,undefined,false,false ion-col,prop,sizeXl,string | undefined,undefined,false,false ion-col,prop,sizeXs,string | undefined,undefined,false,false ion-col,css-prop,--ion-grid-column-padding ion-col,css-prop,--ion-grid-column-padding-lg ion-col,css-prop,--ion-grid-column-padding-md ion-col,css-prop,--ion-grid-column-padding-sm ion-col,css-prop,--ion-grid-column-padding-xl ion-col,css-prop,--ion-grid-column-padding-xs ion-col,css-prop,--ion-grid-columns ion-content,shadow ion-content,prop,color,string | undefined,undefined,false,true ion-content,prop,forceOverscroll,boolean | undefined,undefined,false,false ion-content,prop,fullscreen,boolean,false,false,false ion-content,prop,scrollEvents,boolean,false,false,false ion-content,prop,scrollX,boolean,false,false,false ion-content,prop,scrollY,boolean,true,false,false ion-content,method,getScrollElement,getScrollElement() => Promise<HTMLElement> ion-content,method,scrollByPoint,scrollByPoint(x: number, y: number, duration: number) => Promise<void> ion-content,method,scrollToBottom,scrollToBottom(duration?: number) => Promise<void> ion-content,method,scrollToPoint,scrollToPoint(x: number | undefined | null, y: number | undefined | null, duration?: number) => Promise<void> ion-content,method,scrollToTop,scrollToTop(duration?: number) => Promise<void> ion-content,event,ionScroll,ScrollDetail,true ion-content,event,ionScrollEnd,ScrollBaseDetail,true ion-content,event,ionScrollStart,ScrollBaseDetail,true ion-content,css-prop,--background ion-content,css-prop,--color ion-content,css-prop,--keyboard-offset ion-content,css-prop,--offset-bottom ion-content,css-prop,--offset-top ion-content,css-prop,--padding-bottom ion-content,css-prop,--padding-end ion-content,css-prop,--padding-start ion-content,css-prop,--padding-top ion-content,part,background ion-content,part,scroll ion-datetime,shadow ion-datetime,prop,cancelText,string,'Cancel',false,false ion-datetime,prop,clearText,string,'Clear',false,false ion-datetime,prop,color,string | undefined,'primary',false,false ion-datetime,prop,dayValues,number | number[] | string | undefined,undefined,false,false ion-datetime,prop,disabled,boolean,false,false,false ion-datetime,prop,doneText,string,'Done',false,false ion-datetime,prop,firstDayOfWeek,number,0,false,false ion-datetime,prop,hourCycle,"h12" | "h23" | undefined,undefined,false,false ion-datetime,prop,hourValues,number | number[] | string | undefined,undefined,false,false ion-datetime,prop,locale,string,'default',false,false ion-datetime,prop,max,string | undefined,undefined,false,false ion-datetime,prop,min,string | undefined,undefined,false,false ion-datetime,prop,minuteValues,number | number[] | string | undefined,undefined,false,false ion-datetime,prop,mode,"ios" | "md",undefined,false,false ion-datetime,prop,monthValues,number | number[] | string | undefined,undefined,false,false ion-datetime,prop,name,string,this.inputId,false,false ion-datetime,prop,presentation,"date" | "date-time" | "month" | "month-year" | "time" | "time-date" | "year",'date-time',false,false ion-datetime,prop,readonly,boolean,false,false,false ion-datetime,prop,showClearButton,boolean,false,false,false ion-datetime,prop,showDefaultButtons,boolean,false,false,false ion-datetime,prop,showDefaultTimeLabel,boolean,true,false,false ion-datetime,prop,showDefaultTitle,boolean,false,false,false ion-datetime,prop,size,"cover" | "fixed",'fixed',false,false ion-datetime,prop,value,null | string | undefined,undefined,false,false ion-datetime,prop,yearValues,number | number[] | string | undefined,undefined,false,false ion-datetime,method,cancel,cancel(closeOverlay?: boolean) => Promise<void> ion-datetime,method,confirm,confirm(closeOverlay?: boolean) => Promise<void> ion-datetime,method,reset,reset(startDate?: string | undefined) => Promise<void> ion-datetime,event,ionBlur,void,true ion-datetime,event,ionCancel,void,true ion-datetime,event,ionChange,DatetimeChangeEventDetail,true ion-datetime,event,ionFocus,void,true ion-datetime,css-prop,--background ion-datetime,css-prop,--background-rgb ion-datetime,css-prop,--title-color ion-fab,shadow ion-fab,prop,activated,boolean,false,false,false ion-fab,prop,edge,boolean,false,false,false ion-fab,prop,horizontal,"center" | "end" | "start" | undefined,undefined,false,false ion-fab,prop,vertical,"bottom" | "center" | "top" | undefined,undefined,false,false ion-fab,method,close,close() => Promise<void> ion-fab-button,shadow ion-fab-button,prop,activated,boolean,false,false,false ion-fab-button,prop,closeIcon,string,close,false,false ion-fab-button,prop,color,string | undefined,undefined,false,true ion-fab-button,prop,disabled,boolean,false,false,false ion-fab-button,prop,download,string | undefined,undefined,false,false ion-fab-button,prop,href,string | undefined,undefined,false,false ion-fab-button,prop,mode,"ios" | "md",undefined,false,false ion-fab-button,prop,rel,string | undefined,undefined,false,false ion-fab-button,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-fab-button,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-fab-button,prop,show,boolean,false,false,false ion-fab-button,prop,size,"small" | undefined,undefined,false,false ion-fab-button,prop,target,string | undefined,undefined,false,false ion-fab-button,prop,translucent,boolean,false,false,false ion-fab-button,prop,type,"button" | "reset" | "submit",'button',false,false ion-fab-button,event,ionBlur,void,true ion-fab-button,event,ionFocus,void,true ion-fab-button,css-prop,--background ion-fab-button,css-prop,--background-activated ion-fab-button,css-prop,--background-activated-opacity ion-fab-button,css-prop,--background-focused ion-fab-button,css-prop,--background-focused-opacity ion-fab-button,css-prop,--background-hover ion-fab-button,css-prop,--background-hover-opacity ion-fab-button,css-prop,--border-color ion-fab-button,css-prop,--border-radius ion-fab-button,css-prop,--border-style ion-fab-button,css-prop,--border-width ion-fab-button,css-prop,--box-shadow ion-fab-button,css-prop,--close-icon-font-size ion-fab-button,css-prop,--color ion-fab-button,css-prop,--color-activated ion-fab-button,css-prop,--color-focused ion-fab-button,css-prop,--color-hover ion-fab-button,css-prop,--padding-bottom ion-fab-button,css-prop,--padding-end ion-fab-button,css-prop,--padding-start ion-fab-button,css-prop,--padding-top ion-fab-button,css-prop,--ripple-color ion-fab-button,css-prop,--transition ion-fab-button,part,close-icon ion-fab-button,part,native ion-fab-list,shadow ion-fab-list,prop,activated,boolean,false,false,false ion-fab-list,prop,side,"bottom" | "end" | "start" | "top",'bottom',false,false ion-footer,none ion-footer,prop,collapse,"fade" | undefined,undefined,false,false ion-footer,prop,mode,"ios" | "md",undefined,false,false ion-footer,prop,translucent,boolean,false,false,false ion-grid,shadow ion-grid,prop,fixed,boolean,false,false,false ion-grid,css-prop,--ion-grid-padding ion-grid,css-prop,--ion-grid-padding-lg ion-grid,css-prop,--ion-grid-padding-md ion-grid,css-prop,--ion-grid-padding-sm ion-grid,css-prop,--ion-grid-padding-xl ion-grid,css-prop,--ion-grid-padding-xs ion-grid,css-prop,--ion-grid-width ion-grid,css-prop,--ion-grid-width-lg ion-grid,css-prop,--ion-grid-width-md ion-grid,css-prop,--ion-grid-width-sm ion-grid,css-prop,--ion-grid-width-xl ion-grid,css-prop,--ion-grid-width-xs ion-header,none ion-header,prop,collapse,"condense" | "fade" | undefined,undefined,false,false ion-header,prop,mode,"ios" | "md",undefined,false,false ion-header,prop,translucent,boolean,false,false,false ion-img,shadow ion-img,prop,alt,string | undefined,undefined,false,false ion-img,prop,src,string | undefined,undefined,false,false ion-img,event,ionError,void,true ion-img,event,ionImgDidLoad,void,true ion-img,event,ionImgWillLoad,void,true ion-img,part,image ion-infinite-scroll,none ion-infinite-scroll,prop,disabled,boolean,false,false,false ion-infinite-scroll,prop,position,"bottom" | "top",'bottom',false,false ion-infinite-scroll,prop,threshold,string,'15%',false,false ion-infinite-scroll,method,complete,complete() => Promise<void> ion-infinite-scroll,event,ionInfinite,void,true ion-infinite-scroll-content,none ion-infinite-scroll-content,prop,loadingSpinner,"bubbles" | "circles" | "circular" | "crescent" | "dots" | "lines" | "lines-sharp" | "lines-sharp-small" | "lines-small" | null | undefined,undefined,false,false ion-infinite-scroll-content,prop,loadingText,IonicSafeString | string | undefined,undefined,false,false ion-input,scoped ion-input,prop,accept,string | undefined,undefined,false,false ion-input,prop,autocapitalize,string,'off',false,false ion-input,prop,autocomplete,"off" | "on" | "name" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo",'off',false,false ion-input,prop,autocorrect,"off" | "on",'off',false,false ion-input,prop,autofocus,boolean,false,false,false ion-input,prop,clearInput,boolean,false,false,false ion-input,prop,clearOnEdit,boolean | undefined,undefined,false,false ion-input,prop,color,string | undefined,undefined,false,true ion-input,prop,debounce,number,0,false,false ion-input,prop,disabled,boolean,false,false,false ion-input,prop,enterkeyhint,"done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined,undefined,false,false ion-input,prop,inputmode,"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url" | undefined,undefined,false,false ion-input,prop,max,number | string | undefined,undefined,false,false ion-input,prop,maxlength,number | undefined,undefined,false,false ion-input,prop,min,number | string | undefined,undefined,false,false ion-input,prop,minlength,number | undefined,undefined,false,false ion-input,prop,mode,"ios" | "md",undefined,false,false ion-input,prop,multiple,boolean | undefined,undefined,false,false ion-input,prop,name,string,this.inputId,false,false ion-input,prop,pattern,string | undefined,undefined,false,false ion-input,prop,placeholder,string | undefined,undefined,false,false ion-input,prop,readonly,boolean,false,false,false ion-input,prop,required,boolean,false,false,false ion-input,prop,size,number | undefined,undefined,false,false ion-input,prop,spellcheck,boolean,false,false,false ion-input,prop,step,string | undefined,undefined,false,false ion-input,prop,type,"date" | "datetime-local" | "email" | "month" | "number" | "password" | "search" | "tel" | "text" | "time" | "url" | "week",'text',false,false ion-input,prop,value,null | number | string | undefined,'',false,false ion-input,method,getInputElement,getInputElement() => Promise<HTMLInputElement> ion-input,method,setFocus,setFocus() => Promise<void> ion-input,event,ionBlur,FocusEvent,true ion-input,event,ionChange,InputChangeEventDetail,true ion-input,event,ionFocus,FocusEvent,true ion-input,event,ionInput,InputEvent,true ion-input,css-prop,--background ion-input,css-prop,--color ion-input,css-prop,--padding-bottom ion-input,css-prop,--padding-end ion-input,css-prop,--padding-start ion-input,css-prop,--padding-top ion-input,css-prop,--placeholder-color ion-input,css-prop,--placeholder-font-style ion-input,css-prop,--placeholder-font-weight ion-input,css-prop,--placeholder-opacity ion-item,shadow ion-item,prop,button,boolean,false,false,false ion-item,prop,color,string | undefined,undefined,false,true ion-item,prop,counter,boolean,false,false,false ion-item,prop,detail,boolean | undefined,undefined,false,false ion-item,prop,detailIcon,string,chevronForward,false,false ion-item,prop,disabled,boolean,false,false,false ion-item,prop,download,string | undefined,undefined,false,false ion-item,prop,fill,"outline" | "solid" | undefined,undefined,false,false ion-item,prop,href,string | undefined,undefined,false,false ion-item,prop,lines,"full" | "inset" | "none" | undefined,undefined,false,false ion-item,prop,mode,"ios" | "md",undefined,false,false ion-item,prop,rel,string | undefined,undefined,false,false ion-item,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-item,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-item,prop,shape,"round" | undefined,undefined,false,false ion-item,prop,target,string | undefined,undefined,false,false ion-item,prop,type,"button" | "reset" | "submit",'button',false,false ion-item,css-prop,--background ion-item,css-prop,--background-activated ion-item,css-prop,--background-activated-opacity ion-item,css-prop,--background-focused ion-item,css-prop,--background-focused-opacity ion-item,css-prop,--background-hover ion-item,css-prop,--background-hover-opacity ion-item,css-prop,--border-color ion-item,css-prop,--border-radius ion-item,css-prop,--border-style ion-item,css-prop,--border-width ion-item,css-prop,--color ion-item,css-prop,--color-activated ion-item,css-prop,--color-focused ion-item,css-prop,--color-hover ion-item,css-prop,--detail-icon-color ion-item,css-prop,--detail-icon-font-size ion-item,css-prop,--detail-icon-opacity ion-item,css-prop,--highlight-color-focused ion-item,css-prop,--highlight-color-invalid ion-item,css-prop,--highlight-color-valid ion-item,css-prop,--highlight-height ion-item,css-prop,--inner-border-width ion-item,css-prop,--inner-box-shadow ion-item,css-prop,--inner-padding-bottom ion-item,css-prop,--inner-padding-end ion-item,css-prop,--inner-padding-start ion-item,css-prop,--inner-padding-top ion-item,css-prop,--min-height ion-item,css-prop,--padding-bottom ion-item,css-prop,--padding-end ion-item,css-prop,--padding-start ion-item,css-prop,--padding-top ion-item,css-prop,--ripple-color ion-item,css-prop,--transition ion-item,part,detail-icon ion-item,part,native ion-item-divider,shadow ion-item-divider,prop,color,string | undefined,undefined,false,true ion-item-divider,prop,mode,"ios" | "md",undefined,false,false ion-item-divider,prop,sticky,boolean,false,false,false ion-item-divider,css-prop,--background ion-item-divider,css-prop,--color ion-item-divider,css-prop,--inner-padding-bottom ion-item-divider,css-prop,--inner-padding-end ion-item-divider,css-prop,--inner-padding-start ion-item-divider,css-prop,--inner-padding-top ion-item-divider,css-prop,--padding-bottom ion-item-divider,css-prop,--padding-end ion-item-divider,css-prop,--padding-start ion-item-divider,css-prop,--padding-top ion-item-group,none ion-item-option,shadow ion-item-option,prop,color,string | undefined,undefined,false,true ion-item-option,prop,disabled,boolean,false,false,false ion-item-option,prop,download,string | undefined,undefined,false,false ion-item-option,prop,expandable,boolean,false,false,false ion-item-option,prop,href,string | undefined,undefined,false,false ion-item-option,prop,mode,"ios" | "md",undefined,false,false ion-item-option,prop,rel,string | undefined,undefined,false,false ion-item-option,prop,target,string | undefined,undefined,false,false ion-item-option,prop,type,"button" | "reset" | "submit",'button',false,false ion-item-option,css-prop,--background ion-item-option,css-prop,--color ion-item-option,part,native ion-item-options,none ion-item-options,prop,side,"end" | "start",'end',false,false ion-item-options,event,ionSwipe,any,true ion-item-sliding,none ion-item-sliding,prop,disabled,boolean,false,false,false ion-item-sliding,method,close,close() => Promise<void> ion-item-sliding,method,closeOpened,closeOpened() => Promise<boolean> ion-item-sliding,method,getOpenAmount,getOpenAmount() => Promise<number> ion-item-sliding,method,getSlidingRatio,getSlidingRatio() => Promise<number> ion-item-sliding,method,open,open(side: Side | undefined) => Promise<void> ion-item-sliding,event,ionDrag,any,true ion-label,scoped ion-label,prop,color,string | undefined,undefined,false,true ion-label,prop,mode,"ios" | "md",undefined,false,false ion-label,prop,position,"fixed" | "floating" | "stacked" | undefined,undefined,false,false ion-label,css-prop,--color ion-list,none ion-list,prop,inset,boolean,false,false,false ion-list,prop,lines,"full" | "inset" | "none" | undefined,undefined,false,false ion-list,prop,mode,"ios" | "md",undefined,false,false ion-list,method,closeSlidingItems,closeSlidingItems() => Promise<boolean> ion-list-header,shadow ion-list-header,prop,color,string | undefined,undefined,false,true ion-list-header,prop,lines,"full" | "inset" | "none" | undefined,undefined,false,false ion-list-header,prop,mode,"ios" | "md",undefined,false,false ion-list-header,css-prop,--background ion-list-header,css-prop,--border-color ion-list-header,css-prop,--border-style ion-list-header,css-prop,--border-width ion-list-header,css-prop,--color ion-list-header,css-prop,--inner-border-width ion-loading,scoped ion-loading,prop,animated,boolean,true,false,false ion-loading,prop,backdropDismiss,boolean,false,false,false ion-loading,prop,cssClass,string | string[] | undefined,undefined,false,false ion-loading,prop,duration,number,0,false,false ion-loading,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-loading,prop,htmlAttributes,LoadingAttributes | undefined,undefined,false,false ion-loading,prop,keyboardClose,boolean,true,false,false ion-loading,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-loading,prop,message,IonicSafeString | string | undefined,undefined,false,false ion-loading,prop,mode,"ios" | "md",undefined,false,false ion-loading,prop,showBackdrop,boolean,true,false,false ion-loading,prop,spinner,"bubbles" | "circles" | "circular" | "crescent" | "dots" | "lines" | "lines-sharp" | "lines-sharp-small" | "lines-small" | null | undefined,undefined,false,false ion-loading,prop,translucent,boolean,false,false,false ion-loading,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise<boolean> ion-loading,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-loading,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-loading,method,present,present() => Promise<void> ion-loading,event,ionLoadingDidDismiss,OverlayEventDetail<any>,true ion-loading,event,ionLoadingDidPresent,void,true ion-loading,event,ionLoadingWillDismiss,OverlayEventDetail<any>,true ion-loading,event,ionLoadingWillPresent,void,true ion-loading,css-prop,--backdrop-opacity ion-loading,css-prop,--background ion-loading,css-prop,--height ion-loading,css-prop,--max-height ion-loading,css-prop,--max-width ion-loading,css-prop,--min-height ion-loading,css-prop,--min-width ion-loading,css-prop,--spinner-color ion-loading,css-prop,--width ion-menu,shadow ion-menu,prop,contentId,string | undefined,undefined,false,true ion-menu,prop,disabled,boolean,false,false,false ion-menu,prop,maxEdgeStart,number,50,false,false ion-menu,prop,menuId,string | undefined,undefined,false,true ion-menu,prop,side,"end" | "start",'start',false,true ion-menu,prop,swipeGesture,boolean,true,false,false ion-menu,prop,type,string | undefined,undefined,false,false ion-menu,method,close,close(animated?: boolean) => Promise<boolean> ion-menu,method,isActive,isActive() => Promise<boolean> ion-menu,method,isOpen,isOpen() => Promise<boolean> ion-menu,method,open,open(animated?: boolean) => Promise<boolean> ion-menu,method,setOpen,setOpen(shouldOpen: boolean, animated?: boolean) => Promise<boolean> ion-menu,method,toggle,toggle(animated?: boolean) => Promise<boolean> ion-menu,event,ionDidClose,void,true ion-menu,event,ionDidOpen,void,true ion-menu,event,ionWillClose,void,true ion-menu,event,ionWillOpen,void,true ion-menu,css-prop,--background ion-menu,css-prop,--height ion-menu,css-prop,--max-height ion-menu,css-prop,--max-width ion-menu,css-prop,--min-height ion-menu,css-prop,--min-width ion-menu,css-prop,--width ion-menu,part,backdrop ion-menu,part,container ion-menu-button,shadow ion-menu-button,prop,autoHide,boolean,true,false,false ion-menu-button,prop,color,string | undefined,undefined,false,true ion-menu-button,prop,disabled,boolean,false,false,false ion-menu-button,prop,menu,string | undefined,undefined,false,false ion-menu-button,prop,mode,"ios" | "md",undefined,false,false ion-menu-button,prop,type,"button" | "reset" | "submit",'button',false,false ion-menu-button,css-prop,--background ion-menu-button,css-prop,--background-focused ion-menu-button,css-prop,--background-focused-opacity ion-menu-button,css-prop,--background-hover ion-menu-button,css-prop,--background-hover-opacity ion-menu-button,css-prop,--border-radius ion-menu-button,css-prop,--color ion-menu-button,css-prop,--color-focused ion-menu-button,css-prop,--color-hover ion-menu-button,css-prop,--padding-bottom ion-menu-button,css-prop,--padding-end ion-menu-button,css-prop,--padding-start ion-menu-button,css-prop,--padding-top ion-menu-button,part,icon ion-menu-button,part,native ion-menu-toggle,shadow ion-menu-toggle,prop,autoHide,boolean,true,false,false ion-menu-toggle,prop,menu,string | undefined,undefined,false,false ion-modal,shadow ion-modal,prop,animated,boolean,true,false,false ion-modal,prop,backdropBreakpoint,number,0,false,false ion-modal,prop,backdropDismiss,boolean,true,false,false ion-modal,prop,breakpoints,number[] | undefined,undefined,false,false ion-modal,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-modal,prop,handle,boolean | undefined,undefined,false,false ion-modal,prop,htmlAttributes,ModalAttributes | undefined,undefined,false,false ion-modal,prop,initialBreakpoint,number | undefined,undefined,false,false ion-modal,prop,isOpen,boolean,false,false,false ion-modal,prop,keyboardClose,boolean,true,false,false ion-modal,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-modal,prop,mode,"ios" | "md",undefined,false,false ion-modal,prop,presentingElement,HTMLElement | undefined,undefined,false,false ion-modal,prop,showBackdrop,boolean,true,false,false ion-modal,prop,swipeToClose,boolean,false,false,false ion-modal,prop,trigger,string | undefined,undefined,false,false ion-modal,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise<boolean> ion-modal,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-modal,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-modal,method,present,present() => Promise<void> ion-modal,event,didDismiss,OverlayEventDetail<any>,true ion-modal,event,didPresent,void,true ion-modal,event,ionModalDidDismiss,OverlayEventDetail<any>,true ion-modal,event,ionModalDidPresent,void,true ion-modal,event,ionModalWillDismiss,OverlayEventDetail<any>,true ion-modal,event,ionModalWillPresent,void,true ion-modal,event,willDismiss,OverlayEventDetail<any>,true ion-modal,event,willPresent,void,true ion-modal,css-prop,--backdrop-opacity ion-modal,css-prop,--background ion-modal,css-prop,--border-color ion-modal,css-prop,--border-radius ion-modal,css-prop,--border-style ion-modal,css-prop,--border-width ion-modal,css-prop,--height ion-modal,css-prop,--max-height ion-modal,css-prop,--max-width ion-modal,css-prop,--min-height ion-modal,css-prop,--min-width ion-modal,css-prop,--width ion-modal,part,backdrop ion-modal,part,content ion-modal,part,handle ion-nav,shadow ion-nav,prop,animated,boolean,true,false,false ion-nav,prop,animation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-nav,prop,root,Function | HTMLElement | ViewController | null | string | undefined,undefined,false,false ion-nav,prop,rootParams,undefined | { [key: string]: any; },undefined,false,false ion-nav,prop,swipeGesture,boolean | undefined,undefined,false,false ion-nav,method,canGoBack,canGoBack(view?: ViewController | undefined) => Promise<boolean> ion-nav,method,getActive,getActive() => Promise<ViewController | undefined> ion-nav,method,getByIndex,getByIndex(index: number) => Promise<ViewController | undefined> ion-nav,method,getPrevious,getPrevious(view?: ViewController | undefined) => Promise<ViewController | undefined> ion-nav,method,insert,insert<T extends NavComponent>(insertIndex: number, component: T, componentProps?: ComponentProps<T> | null | undefined, opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,insertPages,insertPages(insertIndex: number, insertComponents: NavComponent[] | NavComponentWithProps[], opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,pop,pop(opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,popTo,popTo(indexOrViewCtrl: number | ViewController, opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,popToRoot,popToRoot(opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,push,push<T extends NavComponent>(component: T, componentProps?: ComponentProps<T> | null | undefined, opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,removeIndex,removeIndex(startIndex: number, removeCount?: number, opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,setPages,setPages(views: NavComponent[] | NavComponentWithProps[], opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,setRoot,setRoot<T extends NavComponent>(component: T, componentProps?: ComponentProps<T> | null | undefined, opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,event,ionNavDidChange,void,false ion-nav,event,ionNavWillChange,void,false ion-nav-link,none ion-nav-link,prop,component,Function | HTMLElement | ViewController | null | string | undefined,undefined,false,false ion-nav-link,prop,componentProps,undefined | { [key: string]: any; },undefined,false,false ion-nav-link,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-nav-link,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-note,shadow ion-note,prop,color,string | undefined,undefined,false,true ion-note,prop,mode,"ios" | "md",undefined,false,false ion-note,css-prop,--color ion-picker,scoped ion-picker,prop,animated,boolean,true,false,false ion-picker,prop,backdropDismiss,boolean,true,false,false ion-picker,prop,buttons,PickerButton[],[],false,false ion-picker,prop,columns,PickerColumn[],[],false,false ion-picker,prop,cssClass,string | string[] | undefined,undefined,false,false ion-picker,prop,duration,number,0,false,false ion-picker,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-picker,prop,htmlAttributes,PickerAttributes | undefined,undefined,false,false ion-picker,prop,keyboardClose,boolean,true,false,false ion-picker,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-picker,prop,mode,"ios" | "md",undefined,false,false ion-picker,prop,showBackdrop,boolean,true,false,false ion-picker,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise<boolean> ion-picker,method,getColumn,getColumn(name: string) => Promise<PickerColumn | undefined> ion-picker,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-picker,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-picker,method,present,present() => Promise<void> ion-picker,event,ionPickerDidDismiss,OverlayEventDetail<any>,true ion-picker,event,ionPickerDidPresent,void,true ion-picker,event,ionPickerWillDismiss,OverlayEventDetail<any>,true ion-picker,event,ionPickerWillPresent,void,true ion-picker,css-prop,--backdrop-opacity ion-picker,css-prop,--background ion-picker,css-prop,--background-rgb ion-picker,css-prop,--border-color ion-picker,css-prop,--border-radius ion-picker,css-prop,--border-style ion-picker,css-prop,--border-width ion-picker,css-prop,--height ion-picker,css-prop,--max-height ion-picker,css-prop,--max-width ion-picker,css-prop,--min-height ion-picker,css-prop,--min-width ion-picker,css-prop,--width ion-popover,shadow ion-popover,prop,alignment,"center" | "end" | "start" | undefined,undefined,false,false ion-popover,prop,animated,boolean,true,false,false ion-popover,prop,arrow,boolean,true,false,false ion-popover,prop,backdropDismiss,boolean,true,false,false ion-popover,prop,component,Function | HTMLElement | null | string | undefined,undefined,false,false ion-popover,prop,componentProps,undefined | { [key: string]: any; },undefined,false,false ion-popover,prop,dismissOnSelect,boolean,false,false,false ion-popover,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-popover,prop,event,any,undefined,false,false ion-popover,prop,htmlAttributes,PopoverAttributes | undefined,undefined,false,false ion-popover,prop,isOpen,boolean,false,false,false ion-popover,prop,keyboardClose,boolean,true,false,false ion-popover,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-popover,prop,mode,"ios" | "md",undefined,false,false ion-popover,prop,reference,"event" | "trigger",'trigger',false,false ion-popover,prop,showBackdrop,boolean,true,false,false ion-popover,prop,side,"bottom" | "end" | "left" | "right" | "start" | "top",'bottom',false,false ion-popover,prop,size,"auto" | "cover",'auto',false,false ion-popover,prop,translucent,boolean,false,false,false ion-popover,prop,trigger,string | undefined,undefined,false,false ion-popover,prop,triggerAction,"click" | "context-menu" | "hover",'click',false,false ion-popover,method,dismiss,dismiss(data?: any, role?: string | undefined, dismissParentPopover?: boolean) => Promise<boolean> ion-popover,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-popover,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-popover,method,present,present(event?: MouseEvent | TouchEvent | PointerEvent | CustomEvent<any> | undefined) => Promise<void> ion-popover,event,didDismiss,OverlayEventDetail<any>,true ion-popover,event,didPresent,void,true ion-popover,event,ionPopoverDidDismiss,OverlayEventDetail<any>,true ion-popover,event,ionPopoverDidPresent,void,true ion-popover,event,ionPopoverWillDismiss,OverlayEventDetail<any>,true ion-popover,event,ionPopoverWillPresent,void,true ion-popover,event,willDismiss,OverlayEventDetail<any>,true ion-popover,event,willPresent,void,true ion-popover,css-prop,--backdrop-opacity ion-popover,css-prop,--background ion-popover,css-prop,--box-shadow ion-popover,css-prop,--height ion-popover,css-prop,--max-height ion-popover,css-prop,--max-width ion-popover,css-prop,--min-height ion-popover,css-prop,--min-width ion-popover,css-prop,--offset-x ion-popover,css-prop,--offset-y ion-popover,css-prop,--width ion-popover,part,arrow ion-popover,part,backdrop ion-popover,part,content ion-progress-bar,shadow ion-progress-bar,prop,buffer,number,1,false,false ion-progress-bar,prop,color,string | undefined,undefined,false,true ion-progress-bar,prop,mode,"ios" | "md",undefined,false,false ion-progress-bar,prop,reversed,boolean,false,false,false ion-progress-bar,prop,type,"determinate" | "indeterminate",'determinate',false,false ion-progress-bar,prop,value,number,0,false,false ion-progress-bar,css-prop,--background ion-progress-bar,css-prop,--buffer-background ion-progress-bar,css-prop,--progress-background ion-progress-bar,part,progress ion-progress-bar,part,stream ion-progress-bar,part,track ion-radio,shadow ion-radio,prop,color,string | undefined,undefined,false,true ion-radio,prop,disabled,boolean,false,false,false ion-radio,prop,mode,"ios" | "md",undefined,false,false ion-radio,prop,name,string,this.inputId,false,false ion-radio,prop,value,any,undefined,false,false ion-radio,event,ionBlur,void,true ion-radio,event,ionFocus,void,true ion-radio,css-prop,--border-radius ion-radio,css-prop,--color ion-radio,css-prop,--color-checked ion-radio,css-prop,--inner-border-radius ion-radio,part,container ion-radio,part,mark ion-radio-group,none ion-radio-group,prop,allowEmptySelection,boolean,false,false,false ion-radio-group,prop,name,string,this.inputId,false,false ion-radio-group,prop,value,any,undefined,false,false ion-radio-group,event,ionChange,RadioGroupChangeEventDetail<any>,true ion-range,shadow ion-range,prop,color,string | undefined,undefined,false,true ion-range,prop,debounce,number,0,false,false ion-range,prop,disabled,boolean,false,false,false ion-range,prop,dualKnobs,boolean,false,false,false ion-range,prop,max,number,100,false,false ion-range,prop,min,number,0,false,false ion-range,prop,mode,"ios" | "md",undefined,false,false ion-range,prop,name,string,'',false,false ion-range,prop,pin,boolean,false,false,false ion-range,prop,pinFormatter,(value: number) => string | number,(value: number): number => Math.round(value),false,false ion-range,prop,snaps,boolean,false,false,false ion-range,prop,step,number,1,false,false ion-range,prop,ticks,boolean,true,false,false ion-range,prop,value,number | { lower: number; upper: number; },0,false,false ion-range,event,ionBlur,void,true ion-range,event,ionChange,RangeChangeEventDetail,true ion-range,event,ionFocus,void,true ion-range,css-prop,--bar-background ion-range,css-prop,--bar-background-active ion-range,css-prop,--bar-border-radius ion-range,css-prop,--bar-height ion-range,css-prop,--height ion-range,css-prop,--knob-background ion-range,css-prop,--knob-border-radius ion-range,css-prop,--knob-box-shadow ion-range,css-prop,--knob-size ion-range,css-prop,--pin-background ion-range,css-prop,--pin-color ion-range,part,bar ion-range,part,bar-active ion-range,part,knob ion-range,part,pin ion-range,part,tick ion-range,part,tick-active ion-refresher,none ion-refresher,prop,closeDuration,string,'280ms',false,false ion-refresher,prop,disabled,boolean,false,false,false ion-refresher,prop,pullFactor,number,1,false,false ion-refresher,prop,pullMax,number,this.pullMin + 60,false,false ion-refresher,prop,pullMin,number,60,false,false ion-refresher,prop,snapbackDuration,string,'280ms',false,false ion-refresher,method,cancel,cancel() => Promise<void> ion-refresher,method,complete,complete() => Promise<void> ion-refresher,method,getProgress,getProgress() => Promise<number> ion-refresher,event,ionPull,void,true ion-refresher,event,ionRefresh,RefresherEventDetail,true ion-refresher,event,ionStart,void,true ion-refresher-content,none ion-refresher-content,prop,pullingIcon,null | string | undefined,undefined,false,false ion-refresher-content,prop,pullingText,IonicSafeString | string | undefined,undefined,false,false ion-refresher-content,prop,refreshingSpinner,"bubbles" | "circles" | "circular" | "crescent" | "dots" | "lines" | "lines-sharp" | "lines-sharp-small" | "lines-small" | null | undefined,undefined,false,false ion-refresher-content,prop,refreshingText,IonicSafeString | string | undefined,undefined,false,false ion-reorder,shadow ion-reorder,part,icon ion-reorder-group,none ion-reorder-group,prop,disabled,boolean,true,false,false ion-reorder-group,method,complete,complete(listOrReorder?: boolean | any[] | undefined) => Promise<any> ion-reorder-group,event,ionItemReorder,ItemReorderEventDetail,true ion-ripple-effect,shadow ion-ripple-effect,prop,type,"bounded" | "unbounded",'bounded',false,false ion-ripple-effect,method,addRipple,addRipple(x: number, y: number) => Promise<() => void> ion-route,none ion-route,prop,beforeEnter,(() => NavigationHookResult | Promise<NavigationHookResult>) | undefined,undefined,false,false ion-route,prop,beforeLeave,(() => NavigationHookResult | Promise<NavigationHookResult>) | undefined,undefined,false,false ion-route,prop,component,string,undefined,true,false ion-route,prop,componentProps,undefined | { [key: string]: any; },undefined,false,false ion-route,prop,url,string,'',false,false ion-route,event,ionRouteDataChanged,any,true ion-route-redirect,none ion-route-redirect,prop,from,string,undefined,true,false ion-route-redirect,prop,to,null | string | undefined,undefined,true,false ion-route-redirect,event,ionRouteRedirectChanged,any,true ion-router,none ion-router,prop,root,string,'/',false,false ion-router,prop,useHash,boolean,true,false,false ion-router,method,back,back() => Promise<void> ion-router,method,push,push(path: string, direction?: RouterDirection, animation?: AnimationBuilder | undefined) => Promise<boolean> ion-router,event,ionRouteDidChange,RouterEventDetail,true ion-router,event,ionRouteWillChange,RouterEventDetail,true ion-router-link,shadow ion-router-link,prop,color,string | undefined,undefined,false,true ion-router-link,prop,href,string | undefined,undefined,false,false ion-router-link,prop,rel,string | undefined,undefined,false,false ion-router-link,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-router-link,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-router-link,prop,target,string | undefined,undefined,false,false ion-router-link,css-prop,--background ion-router-link,css-prop,--color ion-router-outlet,shadow ion-router-outlet,prop,animated,boolean,true,false,false ion-router-outlet,prop,animation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-router-outlet,prop,mode,"ios" | "md",getIonMode(this),false,false ion-row,shadow ion-searchbar,scoped ion-searchbar,prop,animated,boolean,false,false,false ion-searchbar,prop,autocomplete,"off" | "on" | "name" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo",'off',false,false ion-searchbar,prop,autocorrect,"off" | "on",'off',false,false ion-searchbar,prop,cancelButtonIcon,string,config.get('backButtonIcon', arrowBackSharp) as string,false,false ion-searchbar,prop,cancelButtonText,string,'Cancel',false,false ion-searchbar,prop,clearIcon,string | undefined,undefined,false,false ion-searchbar,prop,color,string | undefined,undefined,false,true ion-searchbar,prop,debounce,number,250,false,false ion-searchbar,prop,disabled,boolean,false,false,false ion-searchbar,prop,enterkeyhint,"done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined,undefined,false,false ion-searchbar,prop,inputmode,"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url" | undefined,undefined,false,false ion-searchbar,prop,mode,"ios" | "md",undefined,false,false ion-searchbar,prop,placeholder,string,'Search',false,false ion-searchbar,prop,searchIcon,string | undefined,undefined,false,false ion-searchbar,prop,showCancelButton,"always" | "focus" | "never",'never',false,false ion-searchbar,prop,showClearButton,"always" | "focus" | "never",'always',false,false ion-searchbar,prop,spellcheck,boolean,false,false,false ion-searchbar,prop,type,"email" | "number" | "password" | "search" | "tel" | "text" | "url",'search',false,false ion-searchbar,prop,value,null | string | undefined,'',false,false ion-searchbar,method,getInputElement,getInputElement() => Promise<HTMLInputElement> ion-searchbar,method,setFocus,setFocus() => Promise<void> ion-searchbar,event,ionBlur,void,true ion-searchbar,event,ionCancel,void,true ion-searchbar,event,ionChange,SearchbarChangeEventDetail,true ion-searchbar,event,ionClear,void,true ion-searchbar,event,ionFocus,void,true ion-searchbar,event,ionInput,KeyboardEvent,true ion-searchbar,css-prop,--background ion-searchbar,css-prop,--border-radius ion-searchbar,css-prop,--box-shadow ion-searchbar,css-prop,--cancel-button-color ion-searchbar,css-prop,--clear-button-color ion-searchbar,css-prop,--color ion-searchbar,css-prop,--icon-color ion-searchbar,css-prop,--placeholder-color ion-searchbar,css-prop,--placeholder-font-style ion-searchbar,css-prop,--placeholder-font-weight ion-searchbar,css-prop,--placeholder-opacity ion-segment,shadow ion-segment,prop,color,string | undefined,undefined,false,true ion-segment,prop,disabled,boolean,false,false,false ion-segment,prop,mode,"ios" | "md",undefined,false,false ion-segment,prop,scrollable,boolean,false,false,false ion-segment,prop,selectOnFocus,boolean,false,false,false ion-segment,prop,swipeGesture,boolean,true,false,false ion-segment,prop,value,null | string | undefined,undefined,false,false ion-segment,event,ionChange,SegmentChangeEventDetail,true ion-segment,css-prop,--background ion-segment-button,shadow ion-segment-button,prop,disabled,boolean,false,false,false ion-segment-button,prop,layout,"icon-bottom" | "icon-end" | "icon-hide" | "icon-start" | "icon-top" | "label-hide" | undefined,'icon-top',false,false ion-segment-button,prop,mode,"ios" | "md",undefined,false,false ion-segment-button,prop,type,"button" | "reset" | "submit",'button',false,false ion-segment-button,prop,value,string,'ion-sb-' + (ids++),false,false ion-segment-button,css-prop,--background ion-segment-button,css-prop,--background-checked ion-segment-button,css-prop,--background-focused ion-segment-button,css-prop,--background-focused-opacity ion-segment-button,css-prop,--background-hover ion-segment-button,css-prop,--background-hover-opacity ion-segment-button,css-prop,--border-color ion-segment-button,css-prop,--border-radius ion-segment-button,css-prop,--border-style ion-segment-button,css-prop,--border-width ion-segment-button,css-prop,--color ion-segment-button,css-prop,--color-checked ion-segment-button,css-prop,--color-focused ion-segment-button,css-prop,--color-hover ion-segment-button,css-prop,--indicator-box-shadow ion-segment-button,css-prop,--indicator-color ion-segment-button,css-prop,--indicator-height ion-segment-button,css-prop,--indicator-transform ion-segment-button,css-prop,--indicator-transition ion-segment-button,css-prop,--margin-bottom ion-segment-button,css-prop,--margin-end ion-segment-button,css-prop,--margin-start ion-segment-button,css-prop,--margin-top ion-segment-button,css-prop,--padding-bottom ion-segment-button,css-prop,--padding-end ion-segment-button,css-prop,--padding-start ion-segment-button,css-prop,--padding-top ion-segment-button,css-prop,--transition ion-segment-button,part,indicator ion-segment-button,part,indicator-background ion-segment-button,part,native ion-select,shadow ion-select,prop,cancelText,string,'Cancel',false,false ion-select,prop,compareWith,((currentValue: any, compareValue: any) => boolean) | null | string | undefined,undefined,false,false ion-select,prop,disabled,boolean,false,false,false ion-select,prop,interface,"action-sheet" | "alert" | "popover",'alert',false,false ion-select,prop,interfaceOptions,any,{},false,false ion-select,prop,mode,"ios" | "md",undefined,false,false ion-select,prop,multiple,boolean,false,false,false ion-select,prop,name,string,this.inputId,false,false ion-select,prop,okText,string,'OK',false,false ion-select,prop,placeholder,string | undefined,undefined,false,false ion-select,prop,selectedText,null | string | undefined,undefined,false,false ion-select,prop,value,any,undefined,false,false ion-select,method,open,open(event?: UIEvent | undefined) => Promise<any> ion-select,event,ionBlur,void,true ion-select,event,ionCancel,void,true ion-select,event,ionChange,SelectChangeEventDetail<any>,true ion-select,event,ionFocus,void,true ion-select,css-prop,--padding-bottom ion-select,css-prop,--padding-end ion-select,css-prop,--padding-start ion-select,css-prop,--padding-top ion-select,css-prop,--placeholder-color ion-select,css-prop,--placeholder-opacity ion-select,part,icon ion-select,part,placeholder ion-select,part,text ion-select-option,shadow ion-select-option,prop,disabled,boolean,false,false,false ion-select-option,prop,value,any,undefined,false,false ion-skeleton-text,shadow ion-skeleton-text,prop,animated,boolean,false,false,false ion-skeleton-text,css-prop,--background ion-skeleton-text,css-prop,--background-rgb ion-skeleton-text,css-prop,--border-radius ion-slide,none ion-slides,none ion-slides,prop,mode,"ios" | "md",undefined,false,false ion-slides,prop,options,any,{},false,false ion-slides,prop,pager,boolean,false,false,false ion-slides,prop,scrollbar,boolean,false,false,false ion-slides,method,getActiveIndex,getActiveIndex() => Promise<number> ion-slides,method,getPreviousIndex,getPreviousIndex() => Promise<number> ion-slides,method,getSwiper,getSwiper() => Promise<any> ion-slides,method,isBeginning,isBeginning() => Promise<boolean> ion-slides,method,isEnd,isEnd() => Promise<boolean> ion-slides,method,length,length() => Promise<number> ion-slides,method,lockSwipeToNext,lockSwipeToNext(lock: boolean) => Promise<void> ion-slides,method,lockSwipeToPrev,lockSwipeToPrev(lock: boolean) => Promise<void> ion-slides,method,lockSwipes,lockSwipes(lock: boolean) => Promise<void> ion-slides,method,slideNext,slideNext(speed?: number | undefined, runCallbacks?: boolean | undefined) => Promise<void> ion-slides,method,slidePrev,slidePrev(speed?: number | undefined, runCallbacks?: boolean | undefined) => Promise<void> ion-slides,method,slideTo,slideTo(index: number, speed?: number | undefined, runCallbacks?: boolean | undefined) => Promise<void> ion-slides,method,startAutoplay,startAutoplay() => Promise<void> ion-slides,method,stopAutoplay,stopAutoplay() => Promise<void> ion-slides,method,update,update() => Promise<void> ion-slides,method,updateAutoHeight,updateAutoHeight(speed?: number | undefined) => Promise<void> ion-slides,event,ionSlideDidChange,void,true ion-slides,event,ionSlideDoubleTap,void,true ion-slides,event,ionSlideDrag,void,true ion-slides,event,ionSlideNextEnd,void,true ion-slides,event,ionSlideNextStart,void,true ion-slides,event,ionSlidePrevEnd,void,true ion-slides,event,ionSlidePrevStart,void,true ion-slides,event,ionSlideReachEnd,void,true ion-slides,event,ionSlideReachStart,void,true ion-slides,event,ionSlidesDidLoad,void,true ion-slides,event,ionSlideTap,void,true ion-slides,event,ionSlideTouchEnd,void,true ion-slides,event,ionSlideTouchStart,void,true ion-slides,event,ionSlideTransitionEnd,void,true ion-slides,event,ionSlideTransitionStart,void,true ion-slides,event,ionSlideWillChange,void,true ion-slides,css-prop,--bullet-background ion-slides,css-prop,--bullet-background-active ion-slides,css-prop,--progress-bar-background ion-slides,css-prop,--progress-bar-background-active ion-slides,css-prop,--scroll-bar-background ion-slides,css-prop,--scroll-bar-background-active ion-spinner,shadow ion-spinner,prop,color,string | undefined,undefined,false,true ion-spinner,prop,duration,number | undefined,undefined,false,false ion-spinner,prop,name,"bubbles" | "circles" | "circular" | "crescent" | "dots" | "lines" | "lines-sharp" | "lines-sharp-small" | "lines-small" | undefined,undefined,false,false ion-spinner,prop,paused,boolean,false,false,false ion-spinner,css-prop,--color ion-split-pane,shadow ion-split-pane,prop,contentId,string | undefined,undefined,false,true ion-split-pane,prop,disabled,boolean,false,false,false ion-split-pane,prop,when,boolean | string,QUERY['lg'],false,false ion-split-pane,event,ionSplitPaneVisible,{ visible: boolean; },true ion-split-pane,css-prop,--border ion-split-pane,css-prop,--side-max-width ion-split-pane,css-prop,--side-min-width ion-split-pane,css-prop,--side-width ion-tab,shadow ion-tab,prop,component,Function | HTMLElement | null | string | undefined,undefined,false,false ion-tab,prop,tab,string,undefined,true,false ion-tab,method,setActive,setActive() => Promise<void> ion-tab-bar,shadow ion-tab-bar,prop,color,string | undefined,undefined,false,true ion-tab-bar,prop,mode,"ios" | "md",undefined,false,false ion-tab-bar,prop,selectedTab,string | undefined,undefined,false,false ion-tab-bar,prop,translucent,boolean,false,false,false ion-tab-bar,css-prop,--background ion-tab-bar,css-prop,--border ion-tab-bar,css-prop,--color ion-tab-button,shadow ion-tab-button,prop,disabled,boolean,false,false,false ion-tab-button,prop,download,string | undefined,undefined,false,false ion-tab-button,prop,href,string | undefined,undefined,false,false ion-tab-button,prop,layout,"icon-bottom" | "icon-end" | "icon-hide" | "icon-start" | "icon-top" | "label-hide" | undefined,undefined,false,false ion-tab-button,prop,mode,"ios" | "md",undefined,false,false ion-tab-button,prop,rel,string | undefined,undefined,false,false ion-tab-button,prop,selected,boolean,false,false,false ion-tab-button,prop,tab,string | undefined,undefined,false,false ion-tab-button,prop,target,string | undefined,undefined,false,false ion-tab-button,css-prop,--background ion-tab-button,css-prop,--background-focused ion-tab-button,css-prop,--background-focused-opacity ion-tab-button,css-prop,--color ion-tab-button,css-prop,--color-focused ion-tab-button,css-prop,--color-selected ion-tab-button,css-prop,--padding-bottom ion-tab-button,css-prop,--padding-end ion-tab-button,css-prop,--padding-start ion-tab-button,css-prop,--padding-top ion-tab-button,css-prop,--ripple-color ion-tab-button,part,native ion-tabs,shadow ion-tabs,method,getSelected,getSelected() => Promise<string | undefined> ion-tabs,method,getTab,getTab(tab: string | HTMLIonTabElement) => Promise<HTMLIonTabElement | undefined> ion-tabs,method,select,select(tab: string | HTMLIonTabElement) => Promise<boolean> ion-tabs,event,ionTabsDidChange,{ tab: string; },false ion-tabs,event,ionTabsWillChange,{ tab: string; },false ion-text,shadow ion-text,prop,color,string | undefined,undefined,false,true ion-text,prop,mode,"ios" | "md",undefined,false,false ion-textarea,scoped ion-textarea,prop,autoGrow,boolean,false,false,false ion-textarea,prop,autocapitalize,string,'none',false,false ion-textarea,prop,autofocus,boolean,false,false,false ion-textarea,prop,clearOnEdit,boolean,false,false,false ion-textarea,prop,color,string | undefined,undefined,false,true ion-textarea,prop,cols,number | undefined,undefined,false,false ion-textarea,prop,debounce,number,0,false,false ion-textarea,prop,disabled,boolean,false,false,false ion-textarea,prop,enterkeyhint,"done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined,undefined,false,false ion-textarea,prop,inputmode,"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url" | undefined,undefined,false,false ion-textarea,prop,maxlength,number | undefined,undefined,false,false ion-textarea,prop,minlength,number | undefined,undefined,false,false ion-textarea,prop,mode,"ios" | "md",undefined,false,false ion-textarea,prop,name,string,this.inputId,false,false ion-textarea,prop,placeholder,string | undefined,undefined,false,false ion-textarea,prop,readonly,boolean,false,false,false ion-textarea,prop,required,boolean,false,false,false ion-textarea,prop,rows,number | undefined,undefined,false,false ion-textarea,prop,spellcheck,boolean,false,false,false ion-textarea,prop,value,null | string | undefined,'',false,false ion-textarea,prop,wrap,"hard" | "off" | "soft" | undefined,undefined,false,false ion-textarea,method,getInputElement,getInputElement() => Promise<HTMLTextAreaElement> ion-textarea,method,setFocus,setFocus() => Promise<void> ion-textarea,event,ionBlur,FocusEvent,true ion-textarea,event,ionChange,TextareaChangeEventDetail,true ion-textarea,event,ionFocus,FocusEvent,true ion-textarea,event,ionInput,InputEvent,true ion-textarea,css-prop,--background ion-textarea,css-prop,--border-radius ion-textarea,css-prop,--color ion-textarea,css-prop,--padding-bottom ion-textarea,css-prop,--padding-end ion-textarea,css-prop,--padding-start ion-textarea,css-prop,--padding-top ion-textarea,css-prop,--placeholder-color ion-textarea,css-prop,--placeholder-font-style ion-textarea,css-prop,--placeholder-font-weight ion-textarea,css-prop,--placeholder-opacity ion-thumbnail,shadow ion-thumbnail,css-prop,--border-radius ion-thumbnail,css-prop,--size ion-title,shadow ion-title,prop,color,string | undefined,undefined,false,true ion-title,prop,size,"large" | "small" | undefined,undefined,false,false ion-title,css-prop,--color ion-toast,shadow ion-toast,prop,animated,boolean,true,false,false ion-toast,prop,buttons,(string | ToastButton)[] | undefined,undefined,false,false ion-toast,prop,color,string | undefined,undefined,false,true ion-toast,prop,cssClass,string | string[] | undefined,undefined,false,false ion-toast,prop,duration,number,0,false,false ion-toast,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-toast,prop,header,string | undefined,undefined,false,false ion-toast,prop,htmlAttributes,ToastAttributes | undefined,undefined,false,false ion-toast,prop,icon,string | undefined,undefined,false,false ion-toast,prop,keyboardClose,boolean,false,false,false ion-toast,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-toast,prop,message,IonicSafeString | string | undefined,undefined,false,false ion-toast,prop,mode,"ios" | "md",undefined,false,false ion-toast,prop,position,"bottom" | "middle" | "top",'bottom',false,false ion-toast,prop,translucent,boolean,false,false,false ion-toast,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise<boolean> ion-toast,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-toast,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-toast,method,present,present() => Promise<void> ion-toast,event,ionToastDidDismiss,OverlayEventDetail<any>,true ion-toast,event,ionToastDidPresent,void,true ion-toast,event,ionToastWillDismiss,OverlayEventDetail<any>,true ion-toast,event,ionToastWillPresent,void,true ion-toast,css-prop,--background ion-toast,css-prop,--border-color ion-toast,css-prop,--border-radius ion-toast,css-prop,--border-style ion-toast,css-prop,--border-width ion-toast,css-prop,--box-shadow ion-toast,css-prop,--button-color ion-toast,css-prop,--color ion-toast,css-prop,--end ion-toast,css-prop,--height ion-toast,css-prop,--max-height ion-toast,css-prop,--max-width ion-toast,css-prop,--min-height ion-toast,css-prop,--min-width ion-toast,css-prop,--start ion-toast,css-prop,--white-space ion-toast,css-prop,--width ion-toast,part,button ion-toast,part,container ion-toast,part,header ion-toast,part,icon ion-toast,part,message ion-toggle,shadow ion-toggle,prop,checked,boolean,false,false,false ion-toggle,prop,color,string | undefined,undefined,false,true ion-toggle,prop,disabled,boolean,false,false,false ion-toggle,prop,mode,"ios" | "md",undefined,false,false ion-toggle,prop,name,string,this.inputId,false,false ion-toggle,prop,value,null | string | undefined,'on',false,false ion-toggle,event,ionBlur,void,true ion-toggle,event,ionChange,ToggleChangeEventDetail<any>,true ion-toggle,event,ionFocus,void,true ion-toggle,css-prop,--background ion-toggle,css-prop,--background-checked ion-toggle,css-prop,--border-radius ion-toggle,css-prop,--handle-background ion-toggle,css-prop,--handle-background-checked ion-toggle,css-prop,--handle-border-radius ion-toggle,css-prop,--handle-box-shadow ion-toggle,css-prop,--handle-height ion-toggle,css-prop,--handle-max-height ion-toggle,css-prop,--handle-spacing ion-toggle,css-prop,--handle-transition ion-toggle,css-prop,--handle-width ion-toggle,part,handle ion-toggle,part,track ion-toolbar,shadow ion-toolbar,prop,color,string | undefined,undefined,false,true ion-toolbar,prop,mode,"ios" | "md",undefined,false,false ion-toolbar,css-prop,--background ion-toolbar,css-prop,--border-color ion-toolbar,css-prop,--border-style ion-toolbar,css-prop,--border-width ion-toolbar,css-prop,--color ion-toolbar,css-prop,--min-height ion-toolbar,css-prop,--opacity ion-toolbar,css-prop,--padding-bottom ion-toolbar,css-prop,--padding-end ion-toolbar,css-prop,--padding-start ion-toolbar,css-prop,--padding-top ion-virtual-scroll,none ion-virtual-scroll,prop,approxFooterHeight,number,30,false,false ion-virtual-scroll,prop,approxHeaderHeight,number,30,false,false ion-virtual-scroll,prop,approxItemHeight,number,45,false,false ion-virtual-scroll,prop,footerFn,((item: any, index: number, items: any[]) => string | null | undefined) | undefined,undefined,false,false ion-virtual-scroll,prop,footerHeight,((item: any, index: number) => number) | undefined,undefined,false,false ion-virtual-scroll,prop,headerFn,((item: any, index: number, items: any[]) => string | null | undefined) | undefined,undefined,false,false ion-virtual-scroll,prop,headerHeight,((item: any, index: number) => number) | undefined,undefined,false,false ion-virtual-scroll,prop,itemHeight,((item: any, index: number) => number) | undefined,undefined,false,false ion-virtual-scroll,prop,items,any[] | undefined,undefined,false,false ion-virtual-scroll,prop,nodeRender,((el: HTMLElement | null, cell: Cell, domIndex: number) => HTMLElement) | undefined,undefined,false,false ion-virtual-scroll,prop,renderFooter,((item: any, index: number) => any) | undefined,undefined,false,false ion-virtual-scroll,prop,renderHeader,((item: any, index: number) => any) | undefined,undefined,false,false ion-virtual-scroll,prop,renderItem,((item: any, index: number) => any) | undefined,undefined,false,false ion-virtual-scroll,method,checkEnd,checkEnd() => Promise<void> ion-virtual-scroll,method,checkRange,checkRange(offset: number, len?: number) => Promise<void> ion-virtual-scroll,method,positionForItem,positionForItem(index: number) => Promise<number>
core/api.txt
1
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00020674570987466723, 0.00016955079627223313, 0.00016178643272724003, 0.00016981376393232495, 0.000004057052592543187 ]
{ "id": 3, "code_window": [ " /**\n", " * Emitted when the value has changed.\n", " */\n", " \"onIonChange\"?: (event: CustomEvent<SelectChangeEventDetail>) => void;\n", " /**\n", " * Emitted when the select has focus.\n", " */\n", " \"onIonFocus\"?: (event: CustomEvent<void>) => void;\n", " /**\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " /**\n", " * Emitted when the overlay is dismissed.\n", " */\n", " \"onIonDismiss\"?: (event: CustomEvent<void>) => void;\n" ], "file_path": "core/src/components.d.ts", "type": "add", "edit_start_line_idx": 1000 }
export const watchForOptions = <T extends HTMLElement>(containerEl: HTMLElement, tagName: string, onChange: (el: T | undefined) => void) => { /* tslint:disable-next-line */ if (typeof MutationObserver === 'undefined') { return; } const mutation = new MutationObserver(mutationList => { onChange(getSelectedOption<T>(mutationList, tagName)); }); mutation.observe(containerEl, { childList: true, subtree: true }); return mutation; }; const getSelectedOption = <T extends HTMLElement>(mutationList: MutationRecord[], tagName: string): T | undefined => { let newOption: HTMLElement | undefined; mutationList.forEach(mut => { // tslint:disable-next-line: prefer-for-of for (let i = 0; i < mut.addedNodes.length; i++) { newOption = findCheckedOption(mut.addedNodes[i], tagName) || newOption; } }); return newOption as any; }; export const findCheckedOption = (el: any, tagName: string) => { if (el.nodeType !== 1) { return undefined; } const options: HTMLElement[] = (el.tagName === tagName.toUpperCase()) ? [el] : Array.from(el.querySelectorAll(tagName)); return options.find((o: any) => o.value === el.value); };
core/src/utils/watch-options.ts
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017108896281570196, 0.00017005170229822397, 0.00016814839909784496, 0.00017048470908775926, 0.0000011807615010184236 ]
{ "id": 3, "code_window": [ " /**\n", " * Emitted when the value has changed.\n", " */\n", " \"onIonChange\"?: (event: CustomEvent<SelectChangeEventDetail>) => void;\n", " /**\n", " * Emitted when the select has focus.\n", " */\n", " \"onIonFocus\"?: (event: CustomEvent<void>) => void;\n", " /**\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " /**\n", " * Emitted when the overlay is dismissed.\n", " */\n", " \"onIonDismiss\"?: (event: CustomEvent<void>) => void;\n" ], "file_path": "core/src/components.d.ts", "type": "add", "edit_start_line_idx": 1000 }
@import "../../themes/ionic.globals"; // Thumbnail // -------------------------------------------------- :host { /** * @prop --border-radius: Border radius of the thumbnail * @prop --size: Size of the thumbnail */ --size: 48px; --border-radius: 0; @include border-radius(var(--border-radius)); display: block; width: var(--size); height: var(--size); } ::slotted(ion-img), ::slotted(img) { @include border-radius(var(--border-radius)); width: 100%; height: 100%; object-fit: cover; overflow: hidden; }
core/src/components/thumbnail/thumbnail.scss
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017598217527847737, 0.00017469230806455016, 0.0001720648433547467, 0.00017536107043270022, 0.0000015465213891729945 ]
{ "id": 3, "code_window": [ " /**\n", " * Emitted when the value has changed.\n", " */\n", " \"onIonChange\"?: (event: CustomEvent<SelectChangeEventDetail>) => void;\n", " /**\n", " * Emitted when the select has focus.\n", " */\n", " \"onIonFocus\"?: (event: CustomEvent<void>) => void;\n", " /**\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " /**\n", " * Emitted when the overlay is dismissed.\n", " */\n", " \"onIonDismiss\"?: (event: CustomEvent<void>) => void;\n" ], "file_path": "core/src/components.d.ts", "type": "add", "edit_start_line_idx": 1000 }
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Alert - Translucent</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link href="../../../../../css/ionic.bundle.css" rel="stylesheet"> <link href="../../../../../scripts/testing/styles.css" rel="stylesheet"> <script src="../../../../../scripts/testing/scripts.js"></script> <script nomodule src="../../../../../dist/ionic/ionic.js"></script> <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script></head> <script type="module"> import { alertController } from '../../../../dist/ionic/index.esm.js'; window.alertController = alertController; </script> <body> <ion-app> <ion-header> <ion-toolbar> <ion-title>Alert - Translucent</ion-title> </ion-toolbar> </ion-header> <ion-content class="ion-padding"> <ion-button expand="block" onclick="presentAlert()">Alert</ion-button> <ion-button expand="block" color="secondary" onclick="presentAlertLongMessage()">Alert Long Message</ion-button> <ion-button expand="block" color="danger" onclick="presentAlertMultipleButtons()">Multiple Buttons (>2)</ion-button> <ion-button expand="block" color="light" onclick="presentAlertNoMessage()">Alert No Message</ion-button> <ion-grid> <ion-row> <ion-col size="4"><f class="red"></f></ion-col> <ion-col size="4"><f class="green"></f></ion-col> <ion-col size="4"><f class="blue"></f></ion-col> <ion-col size="4"><f class="yellow"></f></ion-col> <ion-col size="4"><f class="pink"></f></ion-col> <ion-col size="4"><f class="purple"></f></ion-col> <ion-col size="4"><f class="black"></f></ion-col> <ion-col size="4"><f class="fuchsia"></f></ion-col> <ion-col size="4"><f class="orange"></f></ion-col> </ion-row> </ion-grid> <ion-button expand="block" color="dark" onclick="presentAlertConfirm()">Confirm</ion-button> <ion-button expand="block" color="primary" onclick="presentAlertPrompt()">Prompt</ion-button> <ion-button expand="block" color="secondary" onclick="presentAlertRadio()">Radio</ion-button> <ion-button expand="block" color="danger" onclick="presentAlertCheckbox()">Checkbox</ion-button> </ion-content> </ion-app> <script> async function openAlert(opts) { const alert = await alertController.create(opts); await alert.present(); } function presentAlert() { openAlert({ header: 'Alert', subHeader: 'Subtitle', message: 'This is an alert message.', buttons: ['OK'], translucent: true }); } function presentAlertLongMessage() { openAlert({ header: 'Alert', message: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum hendrerit diam lorem, a faucibus turpis sagittis eu. In finibus augue in dui varius convallis. Donec vulputate nibh gravida odio vulputate commodo. Suspendisse imperdiet consequat egestas. Nulla feugiat consequat urna eu tincidunt. Cras nec blandit turpis, eu auctor nunc. Pellentesque finibus, magna eu vestibulum imperdiet, arcu ex lacinia massa, eget volutpat quam leo a orci. Etiam mauris est, elementum at feugiat at, dictum in sapien. Mauris efficitur eros sodales convallis egestas. Phasellus eu faucibus nisl. In eu diam vitae libero egestas lacinia. Integer sed convallis metus, nec commodo felis. Duis libero augue, ornare at tempus non, posuere vel augue. Cras mattis dui at tristique aliquam. Phasellus fermentum nibh ligula, porta hendrerit ligula elementum eu. Suspendisse sollicitudin enim at libero iaculis pulvinar. Donec ac massa id purus laoreet rutrum quis eu urna. Mauris luctus erat vel magna porttitor, vel varius erat rhoncus. Donec eu turpis vestibulum, feugiat urna id, gravida mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer at lobortis tortor. Nam ultrices volutpat elit, sed pharetra nulla suscipit at. Nunc eu accumsan eros, id auctor libero. Suspendisse potenti. Nam vitae dapibus metus. Maecenas nisi dui, sagittis et condimentum eu, bibendum vel eros. Vivamus malesuada, tortor in accumsan iaculis, urna velit consectetur ante, nec semper sem diam a diam. In et semper ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus blandit, velit vel porttitor euismod, neque risus blandit nulla, non laoreet libero dolor et odio. Nulla enim risus, feugiat eu urna sed, ultrices semper felis. Sed blandit mi diam. Nunc quis mi ligula. Pellentesque a elit eu orci volutpat egestas. Aenean fermentum eleifend quam, ut tincidunt eros tristique et. Nam dapibus tincidunt ligula, id faucibus felis sodales quis. Donec tincidunt lectus ipsum, ac semper tellus cursus ac. Vestibulum nec dui a lectus accumsan vestibulum quis et velit. Aliquam finibus justo et odio euismod, viverra condimentum eros tristique. Sed eget luctus risus. Pellentesque lorem magna, dictum non congue sodales, laoreet eget quam. In sagittis vulputate dolor a ultricies. Donec viverra leo sed ex maximus, in finibus elit gravida. Aliquam posuere vulputate mi. Suspendisse potenti. Nunc consectetur congue arcu, at pharetra dui varius non. Etiam vestibulum congue felis, id ullamcorper neque convallis ultrices. Aenean congue, diam a iaculis mollis, nisl eros maximus arcu, nec hendrerit purus felis porta diam. Nullam vitae ultrices dui, ac dictum sapien. Phasellus eu magna luctus, varius urna id, molestie quam. Nulla in semper tellus. Curabitur lacinia tellus sit amet lacinia dapibus. Sed id condimentum tellus, nec aliquam sapien. Vivamus luctus at ante a tincidunt.', buttons: ['Cancel', 'OK'], translucent: true }); } function presentAlertMultipleButtons() { openAlert({ header: 'Alert', subHeader: 'Subtitle', message: 'This is an alert message.', buttons: ['Cancel', 'Open Modal', 'Delete'], translucent: true }); } function presentAlertNoMessage() { openAlert({ header: 'Alert', buttons: ['OK'], translucent: true }); } function presentAlertConfirm() { openAlert({ header: 'Confirm!', message: 'Message <strong>text</strong>!!!', buttons: [ { text: 'Cancel', role: 'cancel', cssClass: 'secondary', handler: (blah) => { console.log('Confirm Cancel: blah'); } }, { text: 'Okay', handler: () => { console.log('Confirm Okay') } } ], translucent: true }); } function presentAlertPrompt() { openAlert({ header: 'Prompt!', inputs: [ { placeholder: 'Placeholder 1' }, { name: 'name2', id: 'name2-id', value: 'hello', placeholder: 'Placeholder 2' }, { name: 'name3', value: 'http://ionicframework.com', type: 'url', placeholder: 'Favorite site ever' }, // input date with min & max { name: 'name4', type: 'date', min: '2017-03-01', max: '2018-01-12' }, // input date without min nor max { name: 'name5', type: 'date' }, { name: 'name6', type: 'number', min: -5, max: 10 }, { name: 'name7', type: 'number' } ], buttons: [ { text: 'Cancel', role: 'cancel', cssClass: 'secondary', id: 'cancel-id', handler: () => { console.log('Confirm Cancel') } }, { text: 'Ok', handler: () => { console.log('Confirm Ok') } } ], translucent: true }); } function presentAlertRadio() { openAlert({ header: 'Radio', inputs: [ { type: 'radio', label: 'Radio 1', value: 'value1', checked: true }, { type: 'radio', label: 'Radio 2', value: 'value2' }, { type: 'radio', label: 'Radio 3', value: 'value3' }, { type: 'radio', label: 'Radio 4', value: 'value4' }, { type: 'radio', label: 'Radio 5', value: 'value5' }, { type: 'radio', label: 'Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 ', value: 'value6' } ], buttons: [ { text: 'Cancel', role: 'cancel', cssClass: 'secondary', handler: () => { console.log('Confirm Cancel') } }, { text: 'Ok', handler: () => { console.log('Confirm Ok') } } ], translucent: true }); } function presentAlertCheckbox() { openAlert({ header: 'Checkbox', inputs: [ { type: 'checkbox', label: 'Checkbox 1', value: 'value1', checked: true }, { type: 'checkbox', label: 'Checkbox 2', value: 'value2' }, { type: 'checkbox', label: 'Checkbox 3', value: 'value3' }, { type: 'checkbox', label: 'Checkbox 4', value: 'value4' }, { type: 'checkbox', label: 'Checkbox 5', value: 'value5' }, { type: 'checkbox', label: 'Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6', value: 'value6' } ], buttons: [ { text: 'Cancel', role: 'cancel', cssClass: 'secondary', handler: () => { console.log('Confirm Cancel') } }, { text: 'Ok', handler: () => { console.log('Confirm Ok') } } ], translucent: true }); } </script> <style> f { display: block; width: 100%; height: 50px; } .red { background-color: #ea445a; } .green { background-color: #76d672; } .blue { background-color: #3478f6; } .yellow { background-color: #ffff80; } .pink { background-color: #ff6b86; } .purple { background-color: #7e34f6; } .black { background-color: #000; } .fuchsia { background-color: #cc00ff; } .orange { background-color: #f69234; } </style> </body> </html>
core/src/components/alert/test/translucent/index.html
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017899398517329246, 0.00017076166113838553, 0.00016690212942194194, 0.00017037964425981045, 0.0000023852371668908745 ]
{ "id": 4, "code_window": [ "\n", "\n", "## Events\n", "\n", "| Event | Description | Type |\n", "| ----------- | ---------------------------------------- | ------------------------------------------- |\n", "| `ionBlur` | Emitted when the select loses focus. | `CustomEvent<void>` |\n", "| `ionCancel` | Emitted when the selection is cancelled. | `CustomEvent<void>` |\n", "| `ionChange` | Emitted when the value has changed. | `CustomEvent<SelectChangeEventDetail<any>>` |\n", "| `ionFocus` | Emitted when the select has focus. | `CustomEvent<void>` |\n", "\n", "\n", "## Methods\n", "\n", "### `open(event?: UIEvent | undefined) => Promise<any>`\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "| Event | Description | Type |\n", "| ------------ | ---------------------------------------- | ------------------------------------------- |\n", "| `ionBlur` | Emitted when the select loses focus. | `CustomEvent<void>` |\n", "| `ionCancel` | Emitted when the selection is cancelled. | `CustomEvent<void>` |\n", "| `ionChange` | Emitted when the value has changed. | `CustomEvent<SelectChangeEventDetail<any>>` |\n", "| `ionDismiss` | Emitted when the overlay is dismissed. | `CustomEvent<void>` |\n", "| `ionFocus` | Emitted when the select has focus. | `CustomEvent<void>` |\n" ], "file_path": "core/src/components/select/readme.md", "type": "replace", "edit_start_line_idx": 1000 }
import { newE2EPage } from '@stencil/core/testing'; test('select: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true' }); const compares = []; compares.push(await page.compareScreenshot()); // Gender Alert Select let select = await page.find('#gender'); await select.click(); let alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open gender single select')); await alert.callMethod('dismiss'); // Skittles Action Sheet Select select = await page.find('#skittles'); await select.click(); let actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open skittles action sheet select')); await actionSheet.callMethod('dismiss'); // Custom Alert Select select = await page.find('#customAlertSelect'); await select.click(); alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom alert select')); await alert.callMethod('dismiss'); // Custom Popover Select select = await page.find('#customPopoverSelect'); await select.click(); let popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom popover select')); // select has no value, so first option should be focused by default const popoverOption1 = await popover.find('.select-interface-option:first-child'); expect(popoverOption1).toHaveClass('ion-focused'); let popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); await popoverOption2.click(); await page.waitForTimeout(500); await select.click(); popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); expect(popoverOption2).toHaveClass('ion-focused'); await popover.callMethod('dismiss'); // Custom Action Sheet Select select = await page.find('#customActionSheetSelect'); await select.click(); actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom action sheet select')); await actionSheet.callMethod('dismiss'); for (const compare of compares) { expect(compare).toMatchScreenshot(); } }); test('select:rtl: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true&rtl=true' }); const compares = []; compares.push(await page.compareScreenshot()); for (const compare of compares) { expect(compare).toMatchScreenshot(); } });
core/src/components/select/test/basic/e2e.ts
1
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00019211061589885503, 0.00017153524095192552, 0.00016309463535435498, 0.00016910185513552278, 0.00000772838120610686 ]
{ "id": 4, "code_window": [ "\n", "\n", "## Events\n", "\n", "| Event | Description | Type |\n", "| ----------- | ---------------------------------------- | ------------------------------------------- |\n", "| `ionBlur` | Emitted when the select loses focus. | `CustomEvent<void>` |\n", "| `ionCancel` | Emitted when the selection is cancelled. | `CustomEvent<void>` |\n", "| `ionChange` | Emitted when the value has changed. | `CustomEvent<SelectChangeEventDetail<any>>` |\n", "| `ionFocus` | Emitted when the select has focus. | `CustomEvent<void>` |\n", "\n", "\n", "## Methods\n", "\n", "### `open(event?: UIEvent | undefined) => Promise<any>`\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "| Event | Description | Type |\n", "| ------------ | ---------------------------------------- | ------------------------------------------- |\n", "| `ionBlur` | Emitted when the select loses focus. | `CustomEvent<void>` |\n", "| `ionCancel` | Emitted when the selection is cancelled. | `CustomEvent<void>` |\n", "| `ionChange` | Emitted when the value has changed. | `CustomEvent<SelectChangeEventDetail<any>>` |\n", "| `ionDismiss` | Emitted when the overlay is dismissed. | `CustomEvent<void>` |\n", "| `ionFocus` | Emitted when the select has focus. | `CustomEvent<void>` |\n" ], "file_path": "core/src/components/select/readme.md", "type": "replace", "edit_start_line_idx": 1000 }
{ "name": "test-app", "integrations": {}, "type": "vue" }
packages/vue/test-app/ionic.config.json
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00016565844998694956, 0.00016565844998694956, 0.00016565844998694956, 0.00016565844998694956, 0 ]
{ "id": 4, "code_window": [ "\n", "\n", "## Events\n", "\n", "| Event | Description | Type |\n", "| ----------- | ---------------------------------------- | ------------------------------------------- |\n", "| `ionBlur` | Emitted when the select loses focus. | `CustomEvent<void>` |\n", "| `ionCancel` | Emitted when the selection is cancelled. | `CustomEvent<void>` |\n", "| `ionChange` | Emitted when the value has changed. | `CustomEvent<SelectChangeEventDetail<any>>` |\n", "| `ionFocus` | Emitted when the select has focus. | `CustomEvent<void>` |\n", "\n", "\n", "## Methods\n", "\n", "### `open(event?: UIEvent | undefined) => Promise<any>`\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "| Event | Description | Type |\n", "| ------------ | ---------------------------------------- | ------------------------------------------- |\n", "| `ionBlur` | Emitted when the select loses focus. | `CustomEvent<void>` |\n", "| `ionCancel` | Emitted when the selection is cancelled. | `CustomEvent<void>` |\n", "| `ionChange` | Emitted when the value has changed. | `CustomEvent<SelectChangeEventDetail<any>>` |\n", "| `ionDismiss` | Emitted when the overlay is dismissed. | `CustomEvent<void>` |\n", "| `ionFocus` | Emitted when the select has focus. | `CustomEvent<void>` |\n" ], "file_path": "core/src/components/select/readme.md", "type": "replace", "edit_start_line_idx": 1000 }
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Item - CSS Variables</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link href="../../../../../css/ionic.bundle.css" rel="stylesheet"> <link href="../../../../../scripts/testing/styles.css" rel="stylesheet"> <script src="../../../../../scripts/testing/scripts.js"></script> <script nomodule src="../../../../../dist/ionic/ionic.js"></script> <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script> </head> <style> ion-item { --padding-top: 20px; --background: #eee; } </style> <body> <ion-app> <ion-header> <ion-toolbar> <ion-title>Item CSS variables</ion-title> </ion-toolbar> </ion-header> <ion-content class="ion-padding-vertical"> <ion-list class="basic"> <ion-item> <ion-label>Item 1</ion-label> </ion-item> <ion-item> <ion-label>Item 2</ion-label> </ion-item> <ion-item> <ion-label>Item 3</ion-label> </ion-item> </ion-list> </ion-content> </ion-app> </body> </html>
core/src/components/item/test/css-variables/index.html
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0001701792934909463, 0.00016571888409089297, 0.00016360629524569958, 0.00016468278772663325, 0.000002285098616994219 ]
{ "id": 4, "code_window": [ "\n", "\n", "## Events\n", "\n", "| Event | Description | Type |\n", "| ----------- | ---------------------------------------- | ------------------------------------------- |\n", "| `ionBlur` | Emitted when the select loses focus. | `CustomEvent<void>` |\n", "| `ionCancel` | Emitted when the selection is cancelled. | `CustomEvent<void>` |\n", "| `ionChange` | Emitted when the value has changed. | `CustomEvent<SelectChangeEventDetail<any>>` |\n", "| `ionFocus` | Emitted when the select has focus. | `CustomEvent<void>` |\n", "\n", "\n", "## Methods\n", "\n", "### `open(event?: UIEvent | undefined) => Promise<any>`\n" ], "labels": [ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ "| Event | Description | Type |\n", "| ------------ | ---------------------------------------- | ------------------------------------------- |\n", "| `ionBlur` | Emitted when the select loses focus. | `CustomEvent<void>` |\n", "| `ionCancel` | Emitted when the selection is cancelled. | `CustomEvent<void>` |\n", "| `ionChange` | Emitted when the value has changed. | `CustomEvent<SelectChangeEventDetail<any>>` |\n", "| `ionDismiss` | Emitted when the overlay is dismissed. | `CustomEvent<void>` |\n", "| `ionFocus` | Emitted when the select has focus. | `CustomEvent<void>` |\n" ], "file_path": "core/src/components/select/readme.md", "type": "replace", "edit_start_line_idx": 1000 }
@import "./item"; @import "./item.md.vars"; @import "../label/label.md.vars"; // Material Design Item // -------------------------------------------------- :host { --min-height: #{$item-md-min-height}; --background: #{$item-md-background}; --background-activated: transparent; --background-focused: currentColor; --background-hover: currentColor; --background-activated-opacity: 0; --background-focused-opacity: .12; --background-hover-opacity: .04; --border-color: #{$item-md-border-bottom-color}; --color: #{$item-md-color}; --transition: opacity 15ms linear, background-color 15ms linear; --padding-start: #{$item-md-padding-start}; --inner-padding-end: #{$item-md-padding-end}; --inner-border-width: #{0 0 $item-md-border-bottom-width 0}; --highlight-height: 1px; --highlight-color-focused: #{$item-md-input-highlight-color}; --highlight-color-valid: #{$item-md-input-highlight-color-valid}; --highlight-color-invalid: #{$item-md-input-highlight-color-invalid}; font-size: $item-md-font-size; font-weight: normal; text-transform: none; } :host(.item-fill-outline) { --highlight-height: 2px; } // Item Fill: None // -------------------------------------------------- :host(.item-fill-none.item-interactive.ion-focus) .item-highlight, :host(.item-fill-none.item-interactive.item-has-focus) .item-highlight, :host(.item-fill-none.item-interactive.ion-touched.ion-invalid) .item-highlight { transform: scaleX(1); border-width: 0 0 var(--full-highlight-height) 0; border-style: var(--border-style); border-color: var(--highlight-background); } :host(.item-fill-none.item-interactive.ion-focus) .item-native, :host(.item-fill-none.item-interactive.item-has-focus) .item-native, :host(.item-fill-none.item-interactive.ion-touched.ion-invalid) .item-native { border-bottom-color: var(--highlight-background); } // Item Fill: Outline // -------------------------------------------------- :host(.item-fill-outline.item-interactive.ion-focus) .item-highlight, :host(.item-fill-outline.item-interactive.item-has-focus) .item-highlight { transform: scaleX(1); } :host(.item-fill-outline.item-interactive.ion-focus) .item-highlight, :host(.item-fill-outline.item-interactive.item-has-focus) .item-highlight, :host(.item-fill-outline.item-interactive.ion-touched.ion-invalid) .item-highlight { border-width: var(--full-highlight-height); border-style: var(--border-style); border-color: var(--highlight-background); } :host(.item-fill-outline.item-interactive.ion-touched.ion-invalid) .item-native { border-color: var(--highlight-background); } // Item Fill: Solid // -------------------------------------------------- :host(.item-fill-solid.item-interactive.ion-focus) .item-highlight, :host(.item-fill-solid.item-interactive.item-has-focus) .item-highlight, :host(.item-fill-solid.item-interactive.ion-touched.ion-invalid) .item-highlight { transform: scaleX(1); border-width: 0 0 var(--full-highlight-height) 0; border-style: var(--border-style); border-color: var(--highlight-background); } :host(.item-fill-solid.item-interactive.ion-focus) .item-native, :host(.item-fill-solid.item-interactive.item-has-focus) .item-native, :host(.item-fill-solid.item-interactive.ion-touched.ion-invalid) .item-native { border-bottom-color: var(--highlight-background); } // Material Design Item: States // -------------------------------------------------- :host(.ion-color.ion-activated) .item-native { &::after { background: transparent; } } :host(.item-has-focus) .item-native { caret-color: var(--highlight-color-focused); } // Material Design Item Lines // -------------------------------------------------- // Default input items have a full border :host(.item-interactive) { --border-width: #{0 0 $item-md-border-bottom-width 0}; --inner-border-width: 0; --show-full-highlight: 1; --show-inset-highlight: 0; } // Full lines - apply the border to the item // Inset lines - apply the border to the item inner :host(.item-lines-full) { --border-width: #{0 0 $item-md-border-bottom-width 0}; --show-full-highlight: 1; --show-inset-highlight: 0; } :host(.item-lines-inset) { --inner-border-width: #{0 0 $item-md-border-bottom-width 0}; --show-full-highlight: 0; --show-inset-highlight: 1; } // Full lines - remove the border from the item inner (inset list items) // Inset lines - remove the border on the item (full list items) // No lines - remove the border on both (full / inset list items) :host(.item-lines-inset), :host(.item-lines-none) { --border-width: 0; --show-full-highlight: 0; } :host(.item-lines-full), :host(.item-lines-none) { --inner-border-width: 0; --show-inset-highlight: 0; } /** * When `fill="outline"`, reposition the highlight element to cover everything but the `.item-bottom` */ :host(.item-fill-outline) .item-highlight { --position-offset: calc(-1 * var(--border-width)); @include position(var(--position-offset), null, null, var(--position-offset)); width: calc(100% + 2 * var(--border-width)); height: calc(100% + 2 * var(--border-width)); transition: none; } :host(.item-fill-outline.ion-focused) .item-native, :host(.item-fill-outline.item-has-focus) .item-native { border-color: transparent; } // Material Design Multi-line Item // -------------------------------------------------- // TODO this works if manually adding the class / should it work with prop? // Multi-line items should align the slotted content at the top :host(.item-multi-line) ::slotted([slot="start"]), :host(.item-multi-line) ::slotted([slot="end"]) { @include margin($item-md-multi-line-slot-margin-top, $item-md-multi-line-slot-margin-end, $item-md-multi-line-slot-margin-bottom, $item-md-multi-line-slot-margin-start); align-self: flex-start; } // Material Design Item Slots // -------------------------------------------------- ::slotted([slot="start"]) { @include margin-horizontal($item-md-start-slot-margin-start, $item-md-start-slot-margin-end); } ::slotted([slot="end"]) { @include margin-horizontal($item-md-end-slot-margin-start, $item-md-end-slot-margin-end); } :host(.item-fill-solid) ::slotted([slot="start"]), :host(.item-fill-solid) ::slotted([slot="end"]), :host(.item-fill-outline) ::slotted([slot="start"]), :host(.item-fill-outline) ::slotted([slot="end"]) { align-self: center; } // Material Design Slotted Icon // -------------------------------------------------- ::slotted(ion-icon) { color: $item-md-icon-slot-color; font-size: $item-md-icon-slot-font-size; } :host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) ::slotted(ion-icon) { color: current-color(contrast); } ::slotted(ion-icon[slot]) { @include margin($item-md-icon-slot-margin-top, $item-md-icon-slot-margin-end, $item-md-icon-slot-margin-bottom, $item-md-icon-slot-margin-start); } ::slotted(ion-icon[slot="start"]) { @include margin-horizontal($item-md-icon-start-slot-margin-start, $item-md-icon-start-slot-margin-end); } ::slotted(ion-icon[slot="end"]) { @include margin-horizontal($item-md-icon-end-slot-margin-start, $item-md-icon-end-slot-margin-end); } :host(.item-fill-solid) ::slotted(ion-icon[slot="start"]), :host(.item-fill-outline) ::slotted(ion-icon[slot="start"]) { @include margin-horizontal($item-md-icon-start-slot-margin-start, $item-md-input-icon-start-slot-margin-end); } // Material Design Slotted Toggle // -------------------------------------------------- ::slotted(ion-toggle[slot="start"]), ::slotted(ion-toggle[slot="end"]) { @include margin(0); } // Material Design Slotted Note // -------------------------------------------------- ::slotted(ion-note) { @include margin(0); align-self: flex-start; font-size: $item-md-note-slot-font-size; } ::slotted(ion-note[slot]:not([slot="helper"]):not([slot="error"])) { @include padding($item-md-note-slot-padding-top, $item-md-note-slot-padding-end, $item-md-note-slot-padding-bottom, $item-md-note-slot-padding-start); } ::slotted(ion-note[slot="start"]) { @include padding-horizontal($item-md-note-start-slot-padding-start, $item-md-note-start-slot-padding-end); } ::slotted(ion-note[slot="end"]) { @include padding-horizontal($item-md-note-end-slot-padding-start, $item-md-note-end-slot-padding-end); } // Material Design Item Avatar // -------------------------------------------------- ::slotted(ion-avatar) { width: $item-md-avatar-width; height: $item-md-avatar-height; } // Material Design Item Thumbnail // -------------------------------------------------- ::slotted(ion-thumbnail) { width: $item-md-thumbnail-width; height: $item-md-thumbnail-height; } // Material Design Item Avatar/Thumbnail // -------------------------------------------------- ::slotted(ion-avatar), ::slotted(ion-thumbnail) { @include margin($item-md-media-slot-margin-top, $item-md-media-slot-margin-end, $item-md-media-slot-margin-bottom, $item-md-media-slot-margin-start); } ::slotted(ion-avatar[slot="start"]), ::slotted(ion-thumbnail[slot="start"]) { @include margin-horizontal($item-md-media-start-slot-margin-start, $item-md-media-start-slot-margin-end); } ::slotted(ion-avatar[slot="end"]), ::slotted(ion-thumbnail[slot="end"]) { @include margin-horizontal($item-md-media-end-slot-margin-start, $item-md-media-end-slot-margin-end); } // Material Design Slotted Label // -------------------------------------------------- ::slotted(ion-label) { @include margin($item-md-label-margin-top, $item-md-label-margin-end, $item-md-label-margin-bottom, $item-md-label-margin-start); } // Material Design Floating/Stacked Label // -------------------------------------------------- :host(.item-label-stacked) ::slotted([slot="end"]), :host(.item-label-floating) ::slotted([slot="end"]) { @include margin($item-md-label-slot-end-margin-top, $item-md-label-slot-end-margin-end, $item-md-label-slot-end-margin-bottom, $item-md-label-slot-end-margin-start); } // Material Design Fixed Labels // -------------------------------------------------- :host(.item-label-fixed) ::slotted(ion-select), :host(.item-label-fixed) ::slotted(ion-datetime) { --padding-start: 8px; } // Material Design Toggle/Radio Item // -------------------------------------------------- :host(.item-toggle) ::slotted(ion-label), :host(.item-radio) ::slotted(ion-label) { @include margin-horizontal(0, null); } // Material Design Item Button // -------------------------------------------------- ::slotted(.button-small) { --padding-top: 0; --padding-bottom: 0; --padding-start: .6em; --padding-end: .6em; height: 25px; font-size: 12px; } // Material Design Radio Item Label: Checked // ----------------------------------------- // .item-radio-checked.item-md ion-label { // color: $radio-md-color-on; // } // Material Design Stacked & Floating Inputs // -------------------------------------------------- :host(.item-label-floating), :host(.item-label-stacked) { --min-height: 55px; } // TODO: refactor, ion-item and ion-textarea have the same CSS :host(.item-label-stacked) ::slotted(ion-select), :host(.item-label-floating) ::slotted(ion-select) { --padding-top: 8px; --padding-bottom: 8px; --padding-start: 0; } :host(.ion-focused:not(.ion-color)) ::slotted(.label-stacked), :host(.ion-focused:not(.ion-color)) ::slotted(.label-floating), :host(.item-has-focus:not(.ion-color)) ::slotted(.label-stacked), :host(.item-has-focus:not(.ion-color)) ::slotted(.label-floating) { color: $label-md-text-color-focused; } // Material Design Inputs: Highlight Color // -------------------------------------------------- :host(.ion-color) { --highlight-color-focused: #{current-color(contrast)}; } :host(.item-label-color) { --highlight-color-focused: #{current-color(base)}; } :host(.item-fill-solid.ion-color), :host(.item-fill-outline.ion-color) { --highlight-color-focused: #{current-color(base)}; } // Material Design Item: Fill Solid // -------------------------------------------------- :host(.item-fill-solid) { --background: #{$item-md-input-fill-solid-background-color}; --background-hover: #{$item-md-input-fill-solid-background-color-hover}; --background-focused: #{$item-md-input-fill-solid-background-color-focus}; --border-width: 0 0 #{$item-md-border-bottom-width} 0; --inner-border-width: 0; @include border-radius(4px, 4px, 0, 0); } :host(.item-fill-solid) .item-native { --border-color: #{$item-md-input-fill-border-color}; } :host(.item-fill-solid.ion-focused) .item-native, :host(.item-fill-solid.item-has-focus) .item-native { --background: var(--background-focused); } :host(.item-fill-solid.item-shape-round) { @include border-radius(16px, 16px, 0, 0); } @media (any-hover: hover) { :host(.item-fill-solid:hover) .item-native { --background: var(--background-hover); --border-color: #{$item-md-input-fill-border-color-hover}; } } // Material Design Item: Fill Outline // -------------------------------------------------- :host(.item-fill-outline) { --ripple-color: transparent; --background-focused: transparent; --background-hover: transparent; --border-color: #{$item-md-input-fill-border-color}; --border-width: #{$item-md-border-bottom-width}; border: none; overflow: visible; } :host(.item-fill-outline) .item-native { --native-padding-left: 16px; @include border-radius(4px); } :host(.item-fill-outline.item-shape-round) .item-native { --inner-padding-start: 16px; @include border-radius(28px); } :host(.item-fill-outline.item-shape-round) .item-bottom { @include padding-horizontal(32px, null); } :host(.item-fill-outline.item-label-floating.ion-focused) .item-native ::slotted(ion-input:not(:first-child)), :host(.item-fill-outline.item-label-floating.ion-focused) .item-native ::slotted(ion-textarea:not(:first-child)), :host(.item-fill-outline.item-label-floating.item-has-focus) .item-native ::slotted(ion-input:not(:first-child)), :host(.item-fill-outline.item-label-floating.item-has-focus) .item-native ::slotted(ion-textarea:not(:first-child)), :host(.item-fill-outline.item-label-floating.item-has-value) .item-native ::slotted(ion-input:not(:first-child)), :host(.item-fill-outline.item-label-floating.item-has-value) .item-native ::slotted(ion-textarea:not(:first-child)) { transform: translateY(-14px); } @media (any-hover: hover) { :host(.item-fill-outline:hover) .item-native { --border-color: #{$item-md-input-fill-border-color-hover}; } } // Material Design Text Field Character Counter // -------------------------------------------------- .item-counter { color: #{$item-md-input-counter-color}; letter-spacing: #{$item-md-input-counter-letter-spacing}; }
core/src/components/item/item.md.scss
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0001739818835631013, 0.0001675585372140631, 0.0001600603573024273, 0.00016724399756640196, 0.0000029334480586840073 ]
{ "id": 5, "code_window": [ " */\n", " @Event() ionCancel!: EventEmitter<void>;\n", "\n", " /**\n", " * Emitted when the select has focus.\n", " */\n", " @Event() ionFocus!: EventEmitter<void>;\n", "\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " /**\n", " * Emitted when the overlay is dismissed.\n", " */\n", " @Event() ionDismiss!: EventEmitter<void>;\n", "\n" ], "file_path": "core/src/components/select/select.tsx", "type": "add", "edit_start_line_idx": 109 }
import { newE2EPage } from '@stencil/core/testing'; test('select: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true' }); const compares = []; compares.push(await page.compareScreenshot()); // Gender Alert Select let select = await page.find('#gender'); await select.click(); let alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open gender single select')); await alert.callMethod('dismiss'); // Skittles Action Sheet Select select = await page.find('#skittles'); await select.click(); let actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open skittles action sheet select')); await actionSheet.callMethod('dismiss'); // Custom Alert Select select = await page.find('#customAlertSelect'); await select.click(); alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom alert select')); await alert.callMethod('dismiss'); // Custom Popover Select select = await page.find('#customPopoverSelect'); await select.click(); let popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom popover select')); // select has no value, so first option should be focused by default const popoverOption1 = await popover.find('.select-interface-option:first-child'); expect(popoverOption1).toHaveClass('ion-focused'); let popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); await popoverOption2.click(); await page.waitForTimeout(500); await select.click(); popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); expect(popoverOption2).toHaveClass('ion-focused'); await popover.callMethod('dismiss'); // Custom Action Sheet Select select = await page.find('#customActionSheetSelect'); await select.click(); actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom action sheet select')); await actionSheet.callMethod('dismiss'); for (const compare of compares) { expect(compare).toMatchScreenshot(); } }); test('select:rtl: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true&rtl=true' }); const compares = []; compares.push(await page.compareScreenshot()); for (const compare of compares) { expect(compare).toMatchScreenshot(); } });
core/src/components/select/test/basic/e2e.ts
1
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00019108972628600895, 0.00017340079648420215, 0.0001658746914472431, 0.00017076935910154134, 0.000007150446890591411 ]
{ "id": 5, "code_window": [ " */\n", " @Event() ionCancel!: EventEmitter<void>;\n", "\n", " /**\n", " * Emitted when the select has focus.\n", " */\n", " @Event() ionFocus!: EventEmitter<void>;\n", "\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " /**\n", " * Emitted when the overlay is dismissed.\n", " */\n", " @Event() ionDismiss!: EventEmitter<void>;\n", "\n" ], "file_path": "core/src/components/select/select.tsx", "type": "add", "edit_start_line_idx": 109 }
import React from 'react'; import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar, withIonLifeCycle, IonButtons, IonMenuButton, IonButton, } from '@ionic/react'; import './Tab3.css'; class Tab3 extends React.Component { componentDidMount() { console.log('Tab3 mount'); } componentWillUnmount() { console.log('Tab3 unmount'); } ionViewWillEnter() { console.log('IVWE Tab3'); } // ionViewWillLeave() { // console.log('IVWL Tab3'); // } // ionViewDidEnter() { // console.log('IVDE Tab3'); // } // ionViewDidLeave() { // console.log('IVDL Tab3'); // } render() { return ( <IonPage data-pageid="tab3-page"> <IonHeader> <IonToolbar> <IonButtons slot="start"> <IonMenuButton /> </IonButtons> <IonTitle>Tab 3</IonTitle> </IonToolbar> </IonHeader> <IonContent> <IonButton routerLink="/routing/otherpage">Go to Other Page</IonButton> </IonContent> </IonPage> ); } } export default withIonLifeCycle(Tab3);
packages/react-router/test-app/src/pages/routing/Tab3.tsx
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017472617037128657, 0.00017014316108543426, 0.00016716890968382359, 0.00017023089458234608, 0.000002570891638242756 ]
{ "id": 5, "code_window": [ " */\n", " @Event() ionCancel!: EventEmitter<void>;\n", "\n", " /**\n", " * Emitted when the select has focus.\n", " */\n", " @Event() ionFocus!: EventEmitter<void>;\n", "\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " /**\n", " * Emitted when the overlay is dismissed.\n", " */\n", " @Event() ionDismiss!: EventEmitter<void>;\n", "\n" ], "file_path": "core/src/components/select/select.tsx", "type": "add", "edit_start_line_idx": 109 }
import { newE2EPage } from '@stencil/core/testing'; test('tabs: basic', async () => { const page = await newE2EPage({ url: '/src/components/tabs/test/basic?ionic:_testing=true' }); let compare = await page.compareScreenshot(); expect(compare).toMatchScreenshot(); const button2 = await page.find('.e2eTabTwoButton'); await button2.click(); compare = await page.compareScreenshot(`tab two`); expect(compare).toMatchScreenshot(); const button3 = await page.find('.e2eTabThreeButton'); await button3.click(); compare = await page.compareScreenshot(`tab three, disabled`); expect(compare).toMatchScreenshot(); const button4 = await page.find('.e2eTabFourButton'); await button4.click(); compare = await page.compareScreenshot(`tab four`); expect(compare).toMatchScreenshot(); });
core/src/components/tabs/test/basic/e2e.ts
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0001790655223885551, 0.00017810752615332603, 0.00017673501861281693, 0.00017852203745860606, 9.95548930404766e-7 ]
{ "id": 5, "code_window": [ " */\n", " @Event() ionCancel!: EventEmitter<void>;\n", "\n", " /**\n", " * Emitted when the select has focus.\n", " */\n", " @Event() ionFocus!: EventEmitter<void>;\n", "\n" ], "labels": [ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " /**\n", " * Emitted when the overlay is dismissed.\n", " */\n", " @Event() ionDismiss!: EventEmitter<void>;\n", "\n" ], "file_path": "core/src/components/select/select.tsx", "type": "add", "edit_start_line_idx": 109 }
import { Component } from '@angular/core'; @Component({ selector: 'app-nested-outlet', templateUrl: './nested-outlet.component.html', }) export class NestedOutletComponent { }
angular/test/test-app/src/app/nested-outlet/nested-outlet.component.ts
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017179334827233106, 0.00017179334827233106, 0.00017179334827233106, 0.00017179334827233106, 0 ]
{ "id": 6, "code_window": [ " const overlay = this.overlay = await this.createOverlay(event);\n", " this.isExpanded = true;\n", " overlay.onDidDismiss().then(() => {\n", " this.overlay = undefined;\n", " this.isExpanded = false;\n", " this.setFocus();\n", " });\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " this.ionDismiss.emit();\n" ], "file_path": "core/src/components/select/select.tsx", "type": "add", "edit_start_line_idx": 178 }
import { newE2EPage } from '@stencil/core/testing'; test('select: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true' }); const compares = []; compares.push(await page.compareScreenshot()); // Gender Alert Select let select = await page.find('#gender'); await select.click(); let alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open gender single select')); await alert.callMethod('dismiss'); // Skittles Action Sheet Select select = await page.find('#skittles'); await select.click(); let actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open skittles action sheet select')); await actionSheet.callMethod('dismiss'); // Custom Alert Select select = await page.find('#customAlertSelect'); await select.click(); alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom alert select')); await alert.callMethod('dismiss'); // Custom Popover Select select = await page.find('#customPopoverSelect'); await select.click(); let popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom popover select')); // select has no value, so first option should be focused by default const popoverOption1 = await popover.find('.select-interface-option:first-child'); expect(popoverOption1).toHaveClass('ion-focused'); let popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); await popoverOption2.click(); await page.waitForTimeout(500); await select.click(); popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); expect(popoverOption2).toHaveClass('ion-focused'); await popover.callMethod('dismiss'); // Custom Action Sheet Select select = await page.find('#customActionSheetSelect'); await select.click(); actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom action sheet select')); await actionSheet.callMethod('dismiss'); for (const compare of compares) { expect(compare).toMatchScreenshot(); } }); test('select:rtl: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true&rtl=true' }); const compares = []; compares.push(await page.compareScreenshot()); for (const compare of compares) { expect(compare).toMatchScreenshot(); } });
core/src/components/select/test/basic/e2e.ts
1
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00030942351440899074, 0.00022442490444518626, 0.0001712066150503233, 0.0001779040030669421, 0.000054922598792472854 ]
{ "id": 6, "code_window": [ " const overlay = this.overlay = await this.createOverlay(event);\n", " this.isExpanded = true;\n", " overlay.onDidDismiss().then(() => {\n", " this.overlay = undefined;\n", " this.isExpanded = false;\n", " this.setFocus();\n", " });\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " this.ionDismiss.emit();\n" ], "file_path": "core/src/components/select/select.tsx", "type": "add", "edit_start_line_idx": 178 }
@import "../../themes/ionic.globals"; // Menu Button // -------------------------------------------------- :host { /** * @prop --border-radius: Border radius of the menu button * * @prop --background: Background of the menu button * @prop --background-hover: Background of the menu button on hover * @prop --background-hover-opacity: Opacity of the background on hover * @prop --background-focused: Background of the menu button when focused with the tab key * @prop --background-focused-opacity: Opacity of the menu button background when focused with the tab key * * @prop --color: Color of the menu button * @prop --color-hover: Color of the menu button on hover * @prop --color-focused: Color of the menu button when focused with the tab key * * @prop --padding-top: Top padding of the button * @prop --padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of the button * @prop --padding-bottom: Bottom padding of the button * @prop --padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of the button */ --background: transparent; --color-focused: currentColor; --border-radius: initial; --padding-top: 0; --padding-bottom: 0; color: var(--color); text-align: center; text-decoration: none; text-overflow: ellipsis; text-transform: none; white-space: nowrap; font-kerning: none; } .button-native { @include border-radius(var(--border-radius)); @include text-inherit(); @include margin(0); @include padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start)); @include font-smoothing(); display: flex; position: relative; flex-flow: row nowrap; flex-shrink: 0; align-items: center; justify-content: center; width: 100%; height: 100%; border: 0; outline: none; background: var(--background); line-height: 1; cursor: pointer; overflow: hidden; user-select: none; z-index: 0; appearance: none; } .button-inner { display: flex; position: relative; flex-flow: row nowrap; flex-shrink: 0; align-items: center; justify-content: center; width: 100%; height: 100%; z-index: 1; } ion-icon { @include margin(0); @include padding(0); pointer-events: none; } // Menu Button: Hidden // -------------------------------------------------- :host(.menu-button-hidden) { display: none; } // Menu Button: Disabled // -------------------------------------------------- :host(.menu-button-disabled) { cursor: default; opacity: .5; pointer-events: none; } // Menu Button: Focused // -------------------------------------------------- :host(.ion-focused) .button-native { color: var(--color-focused); &::after { background: var(--background-focused); opacity: var(--background-focused-opacity); } } // Menu Button: Hover // -------------------------------------------------- .button-native::after { @include button-state(); } @media (any-hover: hover) { :host(:hover) .button-native { color: var(--color-hover); &::after { background: var(--background-hover); opacity: var(--background-hover-opacity, 0); } } } // Menu Button with Color // -------------------------------------------------- :host(.ion-color) .button-native { color: current-color(base); } // Menu Button in Toolbar: Global Theming // -------------------------------------------------- :host(.in-toolbar:not(.in-toolbar-color)) { color: #{var(--ion-toolbar-color, var(--color))}; }
core/src/components/menu-button/menu-button.scss
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017671815294306725, 0.000173081032698974, 0.00016366572526749223, 0.0001738314749673009, 0.000003343539447087096 ]
{ "id": 6, "code_window": [ " const overlay = this.overlay = await this.createOverlay(event);\n", " this.isExpanded = true;\n", " overlay.onDidDismiss().then(() => {\n", " this.overlay = undefined;\n", " this.isExpanded = false;\n", " this.setFocus();\n", " });\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " this.ionDismiss.emit();\n" ], "file_path": "core/src/components/select/select.tsx", "type": "add", "edit_start_line_idx": 178 }
```html <!-- Default Spinner --> <ion-spinner></ion-spinner> <!-- Lines --> <ion-spinner name="lines"></ion-spinner> <!-- Lines Small --> <ion-spinner name="lines-small"></ion-spinner> <!-- Dots --> <ion-spinner name="dots"></ion-spinner> <!-- Bubbles --> <ion-spinner name="bubbles"></ion-spinner> <!-- Circles --> <ion-spinner name="circles"></ion-spinner> <!-- Crescent --> <ion-spinner name="crescent"></ion-spinner> <!-- Paused Default Spinner --> <ion-spinner paused></ion-spinner> ```
core/src/components/spinner/usage/javascript.md
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017392646986991167, 0.00017365482926834375, 0.00017329856927972287, 0.00017373949231114239, 2.632347673170443e-7 ]
{ "id": 6, "code_window": [ " const overlay = this.overlay = await this.createOverlay(event);\n", " this.isExpanded = true;\n", " overlay.onDidDismiss().then(() => {\n", " this.overlay = undefined;\n", " this.isExpanded = false;\n", " this.setFocus();\n", " });\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " this.ionDismiss.emit();\n" ], "file_path": "core/src/components/select/select.tsx", "type": "add", "edit_start_line_idx": 178 }
```html <template> <!-- Default --> <ion-badge>99</ion-badge> <!-- Colors --> <ion-badge color="primary">11</ion-badge> <ion-badge color="secondary">22</ion-badge> <ion-badge color="tertiary">33</ion-badge> <ion-badge color="success">44</ion-badge> <ion-badge color="warning">55</ion-badge> <ion-badge color="danger">66</ion-badge> <ion-badge color="light">77</ion-badge> <ion-badge color="medium">88</ion-badge> <ion-badge color="dark">99</ion-badge> <!-- Item with badge on left and right --> <ion-item> <ion-badge slot="start">11</ion-badge> <ion-label>My Item</ion-label> <ion-badge slot="end">22</ion-badge> </ion-item> </template> <script> import { IonBadge, IonItem, IonLabel } from '@ionic/vue'; import { defineComponent } from 'vue'; export default defineComponent({ components: { IonBadge, IonItem, IonLabel } }); </script> ```
core/src/components/badge/usage/vue.md
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0001769007503753528, 0.00017575542733538896, 0.00017449475126340985, 0.00017581309657543898, 0.000001145518808698398 ]
{ "id": 7, "code_window": [ " const compares = [];\n", " compares.push(await page.compareScreenshot());\n", "\n", " // Gender Alert Select\n", " let select = await page.find('#gender');\n", " await select.click();\n", "\n", " let alert = await page.find('ion-alert');\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "\n", " // add an event spy to the select\n", " const ionDismiss = await select.spyOnEvent('ionDismiss');\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 12 }
ion-accordion,shadow ion-accordion,prop,disabled,boolean,false,false,false ion-accordion,prop,mode,"ios" | "md",undefined,false,false ion-accordion,prop,readonly,boolean,false,false,false ion-accordion,prop,toggleIcon,string,chevronDown,false,false ion-accordion,prop,toggleIconSlot,"end" | "start",'end',false,false ion-accordion,prop,value,string,`ion-accordion-${accordionIds++}`,false,false ion-accordion,part,content ion-accordion,part,expanded ion-accordion,part,header ion-accordion-group,shadow ion-accordion-group,prop,animated,boolean,true,false,false ion-accordion-group,prop,disabled,boolean,false,false,false ion-accordion-group,prop,expand,"compact" | "inset",'compact',false,false ion-accordion-group,prop,mode,"ios" | "md",undefined,false,false ion-accordion-group,prop,multiple,boolean | undefined,undefined,false,false ion-accordion-group,prop,readonly,boolean,false,false,false ion-accordion-group,prop,value,null | string | string[] | undefined,undefined,false,false ion-accordion-group,event,ionChange,AccordionGroupChangeEventDetail<any>,true ion-action-sheet,scoped ion-action-sheet,prop,animated,boolean,true,false,false ion-action-sheet,prop,backdropDismiss,boolean,true,false,false ion-action-sheet,prop,buttons,(string | ActionSheetButton<any>)[],[],false,false ion-action-sheet,prop,cssClass,string | string[] | undefined,undefined,false,false ion-action-sheet,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-action-sheet,prop,header,string | undefined,undefined,false,false ion-action-sheet,prop,htmlAttributes,ActionSheetAttributes | undefined,undefined,false,false ion-action-sheet,prop,keyboardClose,boolean,true,false,false ion-action-sheet,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-action-sheet,prop,mode,"ios" | "md",undefined,false,false ion-action-sheet,prop,subHeader,string | undefined,undefined,false,false ion-action-sheet,prop,translucent,boolean,false,false,false ion-action-sheet,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise<boolean> ion-action-sheet,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-action-sheet,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-action-sheet,method,present,present() => Promise<void> ion-action-sheet,event,ionActionSheetDidDismiss,OverlayEventDetail<any>,true ion-action-sheet,event,ionActionSheetDidPresent,void,true ion-action-sheet,event,ionActionSheetWillDismiss,OverlayEventDetail<any>,true ion-action-sheet,event,ionActionSheetWillPresent,void,true ion-action-sheet,css-prop,--backdrop-opacity ion-action-sheet,css-prop,--background ion-action-sheet,css-prop,--button-background ion-action-sheet,css-prop,--button-background-activated ion-action-sheet,css-prop,--button-background-activated-opacity ion-action-sheet,css-prop,--button-background-focused ion-action-sheet,css-prop,--button-background-focused-opacity ion-action-sheet,css-prop,--button-background-hover ion-action-sheet,css-prop,--button-background-hover-opacity ion-action-sheet,css-prop,--button-background-selected ion-action-sheet,css-prop,--button-background-selected-opacity ion-action-sheet,css-prop,--button-color ion-action-sheet,css-prop,--button-color-activated ion-action-sheet,css-prop,--button-color-focused ion-action-sheet,css-prop,--button-color-hover ion-action-sheet,css-prop,--button-color-selected ion-action-sheet,css-prop,--color ion-action-sheet,css-prop,--height ion-action-sheet,css-prop,--max-height ion-action-sheet,css-prop,--max-width ion-action-sheet,css-prop,--min-height ion-action-sheet,css-prop,--min-width ion-action-sheet,css-prop,--width ion-alert,scoped ion-alert,prop,animated,boolean,true,false,false ion-alert,prop,backdropDismiss,boolean,true,false,false ion-alert,prop,buttons,(string | AlertButton)[],[],false,false ion-alert,prop,cssClass,string | string[] | undefined,undefined,false,false ion-alert,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-alert,prop,header,string | undefined,undefined,false,false ion-alert,prop,htmlAttributes,AlertAttributes | undefined,undefined,false,false ion-alert,prop,inputs,AlertInput[],[],false,false ion-alert,prop,keyboardClose,boolean,true,false,false ion-alert,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-alert,prop,message,IonicSafeString | string | undefined,undefined,false,false ion-alert,prop,mode,"ios" | "md",undefined,false,false ion-alert,prop,subHeader,string | undefined,undefined,false,false ion-alert,prop,translucent,boolean,false,false,false ion-alert,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise<boolean> ion-alert,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-alert,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-alert,method,present,present() => Promise<void> ion-alert,event,ionAlertDidDismiss,OverlayEventDetail<any>,true ion-alert,event,ionAlertDidPresent,void,true ion-alert,event,ionAlertWillDismiss,OverlayEventDetail<any>,true ion-alert,event,ionAlertWillPresent,void,true ion-alert,css-prop,--backdrop-opacity ion-alert,css-prop,--background ion-alert,css-prop,--height ion-alert,css-prop,--max-height ion-alert,css-prop,--max-width ion-alert,css-prop,--min-height ion-alert,css-prop,--min-width ion-alert,css-prop,--width ion-app,none ion-avatar,shadow ion-avatar,css-prop,--border-radius ion-back-button,shadow ion-back-button,prop,color,string | undefined,undefined,false,true ion-back-button,prop,defaultHref,string | undefined,undefined,false,false ion-back-button,prop,disabled,boolean,false,false,true ion-back-button,prop,icon,null | string | undefined,undefined,false,false ion-back-button,prop,mode,"ios" | "md",undefined,false,false ion-back-button,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-back-button,prop,text,null | string | undefined,undefined,false,false ion-back-button,prop,type,"button" | "reset" | "submit",'button',false,false ion-back-button,css-prop,--background ion-back-button,css-prop,--background-focused ion-back-button,css-prop,--background-focused-opacity ion-back-button,css-prop,--background-hover ion-back-button,css-prop,--background-hover-opacity ion-back-button,css-prop,--border-radius ion-back-button,css-prop,--color ion-back-button,css-prop,--color-focused ion-back-button,css-prop,--color-hover ion-back-button,css-prop,--icon-font-size ion-back-button,css-prop,--icon-font-weight ion-back-button,css-prop,--icon-margin-bottom ion-back-button,css-prop,--icon-margin-end ion-back-button,css-prop,--icon-margin-start ion-back-button,css-prop,--icon-margin-top ion-back-button,css-prop,--icon-padding-bottom ion-back-button,css-prop,--icon-padding-end ion-back-button,css-prop,--icon-padding-start ion-back-button,css-prop,--icon-padding-top ion-back-button,css-prop,--margin-bottom ion-back-button,css-prop,--margin-end ion-back-button,css-prop,--margin-start ion-back-button,css-prop,--margin-top ion-back-button,css-prop,--min-height ion-back-button,css-prop,--min-width ion-back-button,css-prop,--opacity ion-back-button,css-prop,--padding-bottom ion-back-button,css-prop,--padding-end ion-back-button,css-prop,--padding-start ion-back-button,css-prop,--padding-top ion-back-button,css-prop,--ripple-color ion-back-button,css-prop,--transition ion-back-button,part,icon ion-back-button,part,native ion-back-button,part,text ion-backdrop,shadow ion-backdrop,prop,stopPropagation,boolean,true,false,false ion-backdrop,prop,tappable,boolean,true,false,false ion-backdrop,prop,visible,boolean,true,false,false ion-backdrop,event,ionBackdropTap,void,true ion-badge,shadow ion-badge,prop,color,string | undefined,undefined,false,true ion-badge,prop,mode,"ios" | "md",undefined,false,false ion-badge,css-prop,--background ion-badge,css-prop,--color ion-badge,css-prop,--padding-bottom ion-badge,css-prop,--padding-end ion-badge,css-prop,--padding-start ion-badge,css-prop,--padding-top ion-breadcrumb,shadow ion-breadcrumb,prop,active,boolean,false,false,false ion-breadcrumb,prop,color,string | undefined,undefined,false,false ion-breadcrumb,prop,disabled,boolean,false,false,false ion-breadcrumb,prop,download,string | undefined,undefined,false,false ion-breadcrumb,prop,href,string | undefined,undefined,false,false ion-breadcrumb,prop,mode,"ios" | "md",undefined,false,false ion-breadcrumb,prop,rel,string | undefined,undefined,false,false ion-breadcrumb,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-breadcrumb,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-breadcrumb,prop,separator,boolean | undefined,undefined,false,false ion-breadcrumb,prop,target,string | undefined,undefined,false,false ion-breadcrumb,event,ionBlur,void,true ion-breadcrumb,event,ionFocus,void,true ion-breadcrumb,css-prop,--background-focused ion-breadcrumb,css-prop,--color ion-breadcrumb,css-prop,--color-active ion-breadcrumb,css-prop,--color-focused ion-breadcrumb,css-prop,--color-hover ion-breadcrumb,part,collapsed-indicator ion-breadcrumb,part,native ion-breadcrumb,part,separator ion-breadcrumbs,shadow ion-breadcrumbs,prop,color,string | undefined,undefined,false,false ion-breadcrumbs,prop,itemsAfterCollapse,number,1,false,false ion-breadcrumbs,prop,itemsBeforeCollapse,number,1,false,false ion-breadcrumbs,prop,maxItems,number | undefined,undefined,false,false ion-breadcrumbs,prop,mode,"ios" | "md",undefined,false,false ion-breadcrumbs,event,ionCollapsedClick,BreadcrumbCollapsedClickEventDetail,true ion-breadcrumbs,css-prop,--background ion-breadcrumbs,css-prop,--color ion-button,shadow ion-button,prop,buttonType,string,'button',false,false ion-button,prop,color,string | undefined,undefined,false,true ion-button,prop,disabled,boolean,false,false,true ion-button,prop,download,string | undefined,undefined,false,false ion-button,prop,expand,"block" | "full" | undefined,undefined,false,true ion-button,prop,fill,"clear" | "default" | "outline" | "solid" | undefined,undefined,false,true ion-button,prop,href,string | undefined,undefined,false,false ion-button,prop,mode,"ios" | "md",undefined,false,false ion-button,prop,rel,string | undefined,undefined,false,false ion-button,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-button,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-button,prop,shape,"round" | undefined,undefined,false,true ion-button,prop,size,"default" | "large" | "small" | undefined,undefined,false,true ion-button,prop,strong,boolean,false,false,false ion-button,prop,target,string | undefined,undefined,false,false ion-button,prop,type,"button" | "reset" | "submit",'button',false,false ion-button,event,ionBlur,void,true ion-button,event,ionFocus,void,true ion-button,css-prop,--background ion-button,css-prop,--background-activated ion-button,css-prop,--background-activated-opacity ion-button,css-prop,--background-focused ion-button,css-prop,--background-focused-opacity ion-button,css-prop,--background-hover ion-button,css-prop,--background-hover-opacity ion-button,css-prop,--border-color ion-button,css-prop,--border-radius ion-button,css-prop,--border-style ion-button,css-prop,--border-width ion-button,css-prop,--box-shadow ion-button,css-prop,--color ion-button,css-prop,--color-activated ion-button,css-prop,--color-focused ion-button,css-prop,--color-hover ion-button,css-prop,--opacity ion-button,css-prop,--padding-bottom ion-button,css-prop,--padding-end ion-button,css-prop,--padding-start ion-button,css-prop,--padding-top ion-button,css-prop,--ripple-color ion-button,css-prop,--transition ion-button,part,native ion-buttons,scoped ion-buttons,prop,collapse,boolean,false,false,false ion-card,shadow ion-card,prop,button,boolean,false,false,false ion-card,prop,color,string | undefined,undefined,false,true ion-card,prop,disabled,boolean,false,false,false ion-card,prop,download,string | undefined,undefined,false,false ion-card,prop,href,string | undefined,undefined,false,false ion-card,prop,mode,"ios" | "md",undefined,false,false ion-card,prop,rel,string | undefined,undefined,false,false ion-card,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-card,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-card,prop,target,string | undefined,undefined,false,false ion-card,prop,type,"button" | "reset" | "submit",'button',false,false ion-card,css-prop,--background ion-card,css-prop,--color ion-card,part,native ion-card-content,none ion-card-content,prop,mode,"ios" | "md",undefined,false,false ion-card-header,shadow ion-card-header,prop,color,string | undefined,undefined,false,true ion-card-header,prop,mode,"ios" | "md",undefined,false,false ion-card-header,prop,translucent,boolean,false,false,false ion-card-subtitle,shadow ion-card-subtitle,prop,color,string | undefined,undefined,false,true ion-card-subtitle,prop,mode,"ios" | "md",undefined,false,false ion-card-subtitle,css-prop,--color ion-card-title,shadow ion-card-title,prop,color,string | undefined,undefined,false,true ion-card-title,prop,mode,"ios" | "md",undefined,false,false ion-card-title,css-prop,--color ion-checkbox,shadow ion-checkbox,prop,checked,boolean,false,false,false ion-checkbox,prop,color,string | undefined,undefined,false,true ion-checkbox,prop,disabled,boolean,false,false,false ion-checkbox,prop,indeterminate,boolean,false,false,false ion-checkbox,prop,mode,"ios" | "md",undefined,false,false ion-checkbox,prop,name,string,this.inputId,false,false ion-checkbox,prop,value,any,'on',false,false ion-checkbox,event,ionBlur,void,true ion-checkbox,event,ionChange,CheckboxChangeEventDetail<any>,true ion-checkbox,event,ionFocus,void,true ion-checkbox,css-prop,--background ion-checkbox,css-prop,--background-checked ion-checkbox,css-prop,--border-color ion-checkbox,css-prop,--border-color-checked ion-checkbox,css-prop,--border-radius ion-checkbox,css-prop,--border-style ion-checkbox,css-prop,--border-width ion-checkbox,css-prop,--checkmark-color ion-checkbox,css-prop,--checkmark-width ion-checkbox,css-prop,--size ion-checkbox,css-prop,--transition ion-checkbox,part,container ion-checkbox,part,mark ion-chip,shadow ion-chip,prop,color,string | undefined,undefined,false,true ion-chip,prop,disabled,boolean,false,false,false ion-chip,prop,mode,"ios" | "md",undefined,false,false ion-chip,prop,outline,boolean,false,false,false ion-chip,css-prop,--background ion-chip,css-prop,--color ion-col,shadow ion-col,prop,offset,string | undefined,undefined,false,false ion-col,prop,offsetLg,string | undefined,undefined,false,false ion-col,prop,offsetMd,string | undefined,undefined,false,false ion-col,prop,offsetSm,string | undefined,undefined,false,false ion-col,prop,offsetXl,string | undefined,undefined,false,false ion-col,prop,offsetXs,string | undefined,undefined,false,false ion-col,prop,pull,string | undefined,undefined,false,false ion-col,prop,pullLg,string | undefined,undefined,false,false ion-col,prop,pullMd,string | undefined,undefined,false,false ion-col,prop,pullSm,string | undefined,undefined,false,false ion-col,prop,pullXl,string | undefined,undefined,false,false ion-col,prop,pullXs,string | undefined,undefined,false,false ion-col,prop,push,string | undefined,undefined,false,false ion-col,prop,pushLg,string | undefined,undefined,false,false ion-col,prop,pushMd,string | undefined,undefined,false,false ion-col,prop,pushSm,string | undefined,undefined,false,false ion-col,prop,pushXl,string | undefined,undefined,false,false ion-col,prop,pushXs,string | undefined,undefined,false,false ion-col,prop,size,string | undefined,undefined,false,false ion-col,prop,sizeLg,string | undefined,undefined,false,false ion-col,prop,sizeMd,string | undefined,undefined,false,false ion-col,prop,sizeSm,string | undefined,undefined,false,false ion-col,prop,sizeXl,string | undefined,undefined,false,false ion-col,prop,sizeXs,string | undefined,undefined,false,false ion-col,css-prop,--ion-grid-column-padding ion-col,css-prop,--ion-grid-column-padding-lg ion-col,css-prop,--ion-grid-column-padding-md ion-col,css-prop,--ion-grid-column-padding-sm ion-col,css-prop,--ion-grid-column-padding-xl ion-col,css-prop,--ion-grid-column-padding-xs ion-col,css-prop,--ion-grid-columns ion-content,shadow ion-content,prop,color,string | undefined,undefined,false,true ion-content,prop,forceOverscroll,boolean | undefined,undefined,false,false ion-content,prop,fullscreen,boolean,false,false,false ion-content,prop,scrollEvents,boolean,false,false,false ion-content,prop,scrollX,boolean,false,false,false ion-content,prop,scrollY,boolean,true,false,false ion-content,method,getScrollElement,getScrollElement() => Promise<HTMLElement> ion-content,method,scrollByPoint,scrollByPoint(x: number, y: number, duration: number) => Promise<void> ion-content,method,scrollToBottom,scrollToBottom(duration?: number) => Promise<void> ion-content,method,scrollToPoint,scrollToPoint(x: number | undefined | null, y: number | undefined | null, duration?: number) => Promise<void> ion-content,method,scrollToTop,scrollToTop(duration?: number) => Promise<void> ion-content,event,ionScroll,ScrollDetail,true ion-content,event,ionScrollEnd,ScrollBaseDetail,true ion-content,event,ionScrollStart,ScrollBaseDetail,true ion-content,css-prop,--background ion-content,css-prop,--color ion-content,css-prop,--keyboard-offset ion-content,css-prop,--offset-bottom ion-content,css-prop,--offset-top ion-content,css-prop,--padding-bottom ion-content,css-prop,--padding-end ion-content,css-prop,--padding-start ion-content,css-prop,--padding-top ion-content,part,background ion-content,part,scroll ion-datetime,shadow ion-datetime,prop,cancelText,string,'Cancel',false,false ion-datetime,prop,clearText,string,'Clear',false,false ion-datetime,prop,color,string | undefined,'primary',false,false ion-datetime,prop,dayValues,number | number[] | string | undefined,undefined,false,false ion-datetime,prop,disabled,boolean,false,false,false ion-datetime,prop,doneText,string,'Done',false,false ion-datetime,prop,firstDayOfWeek,number,0,false,false ion-datetime,prop,hourCycle,"h12" | "h23" | undefined,undefined,false,false ion-datetime,prop,hourValues,number | number[] | string | undefined,undefined,false,false ion-datetime,prop,locale,string,'default',false,false ion-datetime,prop,max,string | undefined,undefined,false,false ion-datetime,prop,min,string | undefined,undefined,false,false ion-datetime,prop,minuteValues,number | number[] | string | undefined,undefined,false,false ion-datetime,prop,mode,"ios" | "md",undefined,false,false ion-datetime,prop,monthValues,number | number[] | string | undefined,undefined,false,false ion-datetime,prop,name,string,this.inputId,false,false ion-datetime,prop,presentation,"date" | "date-time" | "month" | "month-year" | "time" | "time-date" | "year",'date-time',false,false ion-datetime,prop,readonly,boolean,false,false,false ion-datetime,prop,showClearButton,boolean,false,false,false ion-datetime,prop,showDefaultButtons,boolean,false,false,false ion-datetime,prop,showDefaultTimeLabel,boolean,true,false,false ion-datetime,prop,showDefaultTitle,boolean,false,false,false ion-datetime,prop,size,"cover" | "fixed",'fixed',false,false ion-datetime,prop,value,null | string | undefined,undefined,false,false ion-datetime,prop,yearValues,number | number[] | string | undefined,undefined,false,false ion-datetime,method,cancel,cancel(closeOverlay?: boolean) => Promise<void> ion-datetime,method,confirm,confirm(closeOverlay?: boolean) => Promise<void> ion-datetime,method,reset,reset(startDate?: string | undefined) => Promise<void> ion-datetime,event,ionBlur,void,true ion-datetime,event,ionCancel,void,true ion-datetime,event,ionChange,DatetimeChangeEventDetail,true ion-datetime,event,ionFocus,void,true ion-datetime,css-prop,--background ion-datetime,css-prop,--background-rgb ion-datetime,css-prop,--title-color ion-fab,shadow ion-fab,prop,activated,boolean,false,false,false ion-fab,prop,edge,boolean,false,false,false ion-fab,prop,horizontal,"center" | "end" | "start" | undefined,undefined,false,false ion-fab,prop,vertical,"bottom" | "center" | "top" | undefined,undefined,false,false ion-fab,method,close,close() => Promise<void> ion-fab-button,shadow ion-fab-button,prop,activated,boolean,false,false,false ion-fab-button,prop,closeIcon,string,close,false,false ion-fab-button,prop,color,string | undefined,undefined,false,true ion-fab-button,prop,disabled,boolean,false,false,false ion-fab-button,prop,download,string | undefined,undefined,false,false ion-fab-button,prop,href,string | undefined,undefined,false,false ion-fab-button,prop,mode,"ios" | "md",undefined,false,false ion-fab-button,prop,rel,string | undefined,undefined,false,false ion-fab-button,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-fab-button,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-fab-button,prop,show,boolean,false,false,false ion-fab-button,prop,size,"small" | undefined,undefined,false,false ion-fab-button,prop,target,string | undefined,undefined,false,false ion-fab-button,prop,translucent,boolean,false,false,false ion-fab-button,prop,type,"button" | "reset" | "submit",'button',false,false ion-fab-button,event,ionBlur,void,true ion-fab-button,event,ionFocus,void,true ion-fab-button,css-prop,--background ion-fab-button,css-prop,--background-activated ion-fab-button,css-prop,--background-activated-opacity ion-fab-button,css-prop,--background-focused ion-fab-button,css-prop,--background-focused-opacity ion-fab-button,css-prop,--background-hover ion-fab-button,css-prop,--background-hover-opacity ion-fab-button,css-prop,--border-color ion-fab-button,css-prop,--border-radius ion-fab-button,css-prop,--border-style ion-fab-button,css-prop,--border-width ion-fab-button,css-prop,--box-shadow ion-fab-button,css-prop,--close-icon-font-size ion-fab-button,css-prop,--color ion-fab-button,css-prop,--color-activated ion-fab-button,css-prop,--color-focused ion-fab-button,css-prop,--color-hover ion-fab-button,css-prop,--padding-bottom ion-fab-button,css-prop,--padding-end ion-fab-button,css-prop,--padding-start ion-fab-button,css-prop,--padding-top ion-fab-button,css-prop,--ripple-color ion-fab-button,css-prop,--transition ion-fab-button,part,close-icon ion-fab-button,part,native ion-fab-list,shadow ion-fab-list,prop,activated,boolean,false,false,false ion-fab-list,prop,side,"bottom" | "end" | "start" | "top",'bottom',false,false ion-footer,none ion-footer,prop,collapse,"fade" | undefined,undefined,false,false ion-footer,prop,mode,"ios" | "md",undefined,false,false ion-footer,prop,translucent,boolean,false,false,false ion-grid,shadow ion-grid,prop,fixed,boolean,false,false,false ion-grid,css-prop,--ion-grid-padding ion-grid,css-prop,--ion-grid-padding-lg ion-grid,css-prop,--ion-grid-padding-md ion-grid,css-prop,--ion-grid-padding-sm ion-grid,css-prop,--ion-grid-padding-xl ion-grid,css-prop,--ion-grid-padding-xs ion-grid,css-prop,--ion-grid-width ion-grid,css-prop,--ion-grid-width-lg ion-grid,css-prop,--ion-grid-width-md ion-grid,css-prop,--ion-grid-width-sm ion-grid,css-prop,--ion-grid-width-xl ion-grid,css-prop,--ion-grid-width-xs ion-header,none ion-header,prop,collapse,"condense" | "fade" | undefined,undefined,false,false ion-header,prop,mode,"ios" | "md",undefined,false,false ion-header,prop,translucent,boolean,false,false,false ion-img,shadow ion-img,prop,alt,string | undefined,undefined,false,false ion-img,prop,src,string | undefined,undefined,false,false ion-img,event,ionError,void,true ion-img,event,ionImgDidLoad,void,true ion-img,event,ionImgWillLoad,void,true ion-img,part,image ion-infinite-scroll,none ion-infinite-scroll,prop,disabled,boolean,false,false,false ion-infinite-scroll,prop,position,"bottom" | "top",'bottom',false,false ion-infinite-scroll,prop,threshold,string,'15%',false,false ion-infinite-scroll,method,complete,complete() => Promise<void> ion-infinite-scroll,event,ionInfinite,void,true ion-infinite-scroll-content,none ion-infinite-scroll-content,prop,loadingSpinner,"bubbles" | "circles" | "circular" | "crescent" | "dots" | "lines" | "lines-sharp" | "lines-sharp-small" | "lines-small" | null | undefined,undefined,false,false ion-infinite-scroll-content,prop,loadingText,IonicSafeString | string | undefined,undefined,false,false ion-input,scoped ion-input,prop,accept,string | undefined,undefined,false,false ion-input,prop,autocapitalize,string,'off',false,false ion-input,prop,autocomplete,"off" | "on" | "name" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo",'off',false,false ion-input,prop,autocorrect,"off" | "on",'off',false,false ion-input,prop,autofocus,boolean,false,false,false ion-input,prop,clearInput,boolean,false,false,false ion-input,prop,clearOnEdit,boolean | undefined,undefined,false,false ion-input,prop,color,string | undefined,undefined,false,true ion-input,prop,debounce,number,0,false,false ion-input,prop,disabled,boolean,false,false,false ion-input,prop,enterkeyhint,"done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined,undefined,false,false ion-input,prop,inputmode,"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url" | undefined,undefined,false,false ion-input,prop,max,number | string | undefined,undefined,false,false ion-input,prop,maxlength,number | undefined,undefined,false,false ion-input,prop,min,number | string | undefined,undefined,false,false ion-input,prop,minlength,number | undefined,undefined,false,false ion-input,prop,mode,"ios" | "md",undefined,false,false ion-input,prop,multiple,boolean | undefined,undefined,false,false ion-input,prop,name,string,this.inputId,false,false ion-input,prop,pattern,string | undefined,undefined,false,false ion-input,prop,placeholder,string | undefined,undefined,false,false ion-input,prop,readonly,boolean,false,false,false ion-input,prop,required,boolean,false,false,false ion-input,prop,size,number | undefined,undefined,false,false ion-input,prop,spellcheck,boolean,false,false,false ion-input,prop,step,string | undefined,undefined,false,false ion-input,prop,type,"date" | "datetime-local" | "email" | "month" | "number" | "password" | "search" | "tel" | "text" | "time" | "url" | "week",'text',false,false ion-input,prop,value,null | number | string | undefined,'',false,false ion-input,method,getInputElement,getInputElement() => Promise<HTMLInputElement> ion-input,method,setFocus,setFocus() => Promise<void> ion-input,event,ionBlur,FocusEvent,true ion-input,event,ionChange,InputChangeEventDetail,true ion-input,event,ionFocus,FocusEvent,true ion-input,event,ionInput,InputEvent,true ion-input,css-prop,--background ion-input,css-prop,--color ion-input,css-prop,--padding-bottom ion-input,css-prop,--padding-end ion-input,css-prop,--padding-start ion-input,css-prop,--padding-top ion-input,css-prop,--placeholder-color ion-input,css-prop,--placeholder-font-style ion-input,css-prop,--placeholder-font-weight ion-input,css-prop,--placeholder-opacity ion-item,shadow ion-item,prop,button,boolean,false,false,false ion-item,prop,color,string | undefined,undefined,false,true ion-item,prop,counter,boolean,false,false,false ion-item,prop,detail,boolean | undefined,undefined,false,false ion-item,prop,detailIcon,string,chevronForward,false,false ion-item,prop,disabled,boolean,false,false,false ion-item,prop,download,string | undefined,undefined,false,false ion-item,prop,fill,"outline" | "solid" | undefined,undefined,false,false ion-item,prop,href,string | undefined,undefined,false,false ion-item,prop,lines,"full" | "inset" | "none" | undefined,undefined,false,false ion-item,prop,mode,"ios" | "md",undefined,false,false ion-item,prop,rel,string | undefined,undefined,false,false ion-item,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-item,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-item,prop,shape,"round" | undefined,undefined,false,false ion-item,prop,target,string | undefined,undefined,false,false ion-item,prop,type,"button" | "reset" | "submit",'button',false,false ion-item,css-prop,--background ion-item,css-prop,--background-activated ion-item,css-prop,--background-activated-opacity ion-item,css-prop,--background-focused ion-item,css-prop,--background-focused-opacity ion-item,css-prop,--background-hover ion-item,css-prop,--background-hover-opacity ion-item,css-prop,--border-color ion-item,css-prop,--border-radius ion-item,css-prop,--border-style ion-item,css-prop,--border-width ion-item,css-prop,--color ion-item,css-prop,--color-activated ion-item,css-prop,--color-focused ion-item,css-prop,--color-hover ion-item,css-prop,--detail-icon-color ion-item,css-prop,--detail-icon-font-size ion-item,css-prop,--detail-icon-opacity ion-item,css-prop,--highlight-color-focused ion-item,css-prop,--highlight-color-invalid ion-item,css-prop,--highlight-color-valid ion-item,css-prop,--highlight-height ion-item,css-prop,--inner-border-width ion-item,css-prop,--inner-box-shadow ion-item,css-prop,--inner-padding-bottom ion-item,css-prop,--inner-padding-end ion-item,css-prop,--inner-padding-start ion-item,css-prop,--inner-padding-top ion-item,css-prop,--min-height ion-item,css-prop,--padding-bottom ion-item,css-prop,--padding-end ion-item,css-prop,--padding-start ion-item,css-prop,--padding-top ion-item,css-prop,--ripple-color ion-item,css-prop,--transition ion-item,part,detail-icon ion-item,part,native ion-item-divider,shadow ion-item-divider,prop,color,string | undefined,undefined,false,true ion-item-divider,prop,mode,"ios" | "md",undefined,false,false ion-item-divider,prop,sticky,boolean,false,false,false ion-item-divider,css-prop,--background ion-item-divider,css-prop,--color ion-item-divider,css-prop,--inner-padding-bottom ion-item-divider,css-prop,--inner-padding-end ion-item-divider,css-prop,--inner-padding-start ion-item-divider,css-prop,--inner-padding-top ion-item-divider,css-prop,--padding-bottom ion-item-divider,css-prop,--padding-end ion-item-divider,css-prop,--padding-start ion-item-divider,css-prop,--padding-top ion-item-group,none ion-item-option,shadow ion-item-option,prop,color,string | undefined,undefined,false,true ion-item-option,prop,disabled,boolean,false,false,false ion-item-option,prop,download,string | undefined,undefined,false,false ion-item-option,prop,expandable,boolean,false,false,false ion-item-option,prop,href,string | undefined,undefined,false,false ion-item-option,prop,mode,"ios" | "md",undefined,false,false ion-item-option,prop,rel,string | undefined,undefined,false,false ion-item-option,prop,target,string | undefined,undefined,false,false ion-item-option,prop,type,"button" | "reset" | "submit",'button',false,false ion-item-option,css-prop,--background ion-item-option,css-prop,--color ion-item-option,part,native ion-item-options,none ion-item-options,prop,side,"end" | "start",'end',false,false ion-item-options,event,ionSwipe,any,true ion-item-sliding,none ion-item-sliding,prop,disabled,boolean,false,false,false ion-item-sliding,method,close,close() => Promise<void> ion-item-sliding,method,closeOpened,closeOpened() => Promise<boolean> ion-item-sliding,method,getOpenAmount,getOpenAmount() => Promise<number> ion-item-sliding,method,getSlidingRatio,getSlidingRatio() => Promise<number> ion-item-sliding,method,open,open(side: Side | undefined) => Promise<void> ion-item-sliding,event,ionDrag,any,true ion-label,scoped ion-label,prop,color,string | undefined,undefined,false,true ion-label,prop,mode,"ios" | "md",undefined,false,false ion-label,prop,position,"fixed" | "floating" | "stacked" | undefined,undefined,false,false ion-label,css-prop,--color ion-list,none ion-list,prop,inset,boolean,false,false,false ion-list,prop,lines,"full" | "inset" | "none" | undefined,undefined,false,false ion-list,prop,mode,"ios" | "md",undefined,false,false ion-list,method,closeSlidingItems,closeSlidingItems() => Promise<boolean> ion-list-header,shadow ion-list-header,prop,color,string | undefined,undefined,false,true ion-list-header,prop,lines,"full" | "inset" | "none" | undefined,undefined,false,false ion-list-header,prop,mode,"ios" | "md",undefined,false,false ion-list-header,css-prop,--background ion-list-header,css-prop,--border-color ion-list-header,css-prop,--border-style ion-list-header,css-prop,--border-width ion-list-header,css-prop,--color ion-list-header,css-prop,--inner-border-width ion-loading,scoped ion-loading,prop,animated,boolean,true,false,false ion-loading,prop,backdropDismiss,boolean,false,false,false ion-loading,prop,cssClass,string | string[] | undefined,undefined,false,false ion-loading,prop,duration,number,0,false,false ion-loading,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-loading,prop,htmlAttributes,LoadingAttributes | undefined,undefined,false,false ion-loading,prop,keyboardClose,boolean,true,false,false ion-loading,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-loading,prop,message,IonicSafeString | string | undefined,undefined,false,false ion-loading,prop,mode,"ios" | "md",undefined,false,false ion-loading,prop,showBackdrop,boolean,true,false,false ion-loading,prop,spinner,"bubbles" | "circles" | "circular" | "crescent" | "dots" | "lines" | "lines-sharp" | "lines-sharp-small" | "lines-small" | null | undefined,undefined,false,false ion-loading,prop,translucent,boolean,false,false,false ion-loading,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise<boolean> ion-loading,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-loading,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-loading,method,present,present() => Promise<void> ion-loading,event,ionLoadingDidDismiss,OverlayEventDetail<any>,true ion-loading,event,ionLoadingDidPresent,void,true ion-loading,event,ionLoadingWillDismiss,OverlayEventDetail<any>,true ion-loading,event,ionLoadingWillPresent,void,true ion-loading,css-prop,--backdrop-opacity ion-loading,css-prop,--background ion-loading,css-prop,--height ion-loading,css-prop,--max-height ion-loading,css-prop,--max-width ion-loading,css-prop,--min-height ion-loading,css-prop,--min-width ion-loading,css-prop,--spinner-color ion-loading,css-prop,--width ion-menu,shadow ion-menu,prop,contentId,string | undefined,undefined,false,true ion-menu,prop,disabled,boolean,false,false,false ion-menu,prop,maxEdgeStart,number,50,false,false ion-menu,prop,menuId,string | undefined,undefined,false,true ion-menu,prop,side,"end" | "start",'start',false,true ion-menu,prop,swipeGesture,boolean,true,false,false ion-menu,prop,type,string | undefined,undefined,false,false ion-menu,method,close,close(animated?: boolean) => Promise<boolean> ion-menu,method,isActive,isActive() => Promise<boolean> ion-menu,method,isOpen,isOpen() => Promise<boolean> ion-menu,method,open,open(animated?: boolean) => Promise<boolean> ion-menu,method,setOpen,setOpen(shouldOpen: boolean, animated?: boolean) => Promise<boolean> ion-menu,method,toggle,toggle(animated?: boolean) => Promise<boolean> ion-menu,event,ionDidClose,void,true ion-menu,event,ionDidOpen,void,true ion-menu,event,ionWillClose,void,true ion-menu,event,ionWillOpen,void,true ion-menu,css-prop,--background ion-menu,css-prop,--height ion-menu,css-prop,--max-height ion-menu,css-prop,--max-width ion-menu,css-prop,--min-height ion-menu,css-prop,--min-width ion-menu,css-prop,--width ion-menu,part,backdrop ion-menu,part,container ion-menu-button,shadow ion-menu-button,prop,autoHide,boolean,true,false,false ion-menu-button,prop,color,string | undefined,undefined,false,true ion-menu-button,prop,disabled,boolean,false,false,false ion-menu-button,prop,menu,string | undefined,undefined,false,false ion-menu-button,prop,mode,"ios" | "md",undefined,false,false ion-menu-button,prop,type,"button" | "reset" | "submit",'button',false,false ion-menu-button,css-prop,--background ion-menu-button,css-prop,--background-focused ion-menu-button,css-prop,--background-focused-opacity ion-menu-button,css-prop,--background-hover ion-menu-button,css-prop,--background-hover-opacity ion-menu-button,css-prop,--border-radius ion-menu-button,css-prop,--color ion-menu-button,css-prop,--color-focused ion-menu-button,css-prop,--color-hover ion-menu-button,css-prop,--padding-bottom ion-menu-button,css-prop,--padding-end ion-menu-button,css-prop,--padding-start ion-menu-button,css-prop,--padding-top ion-menu-button,part,icon ion-menu-button,part,native ion-menu-toggle,shadow ion-menu-toggle,prop,autoHide,boolean,true,false,false ion-menu-toggle,prop,menu,string | undefined,undefined,false,false ion-modal,shadow ion-modal,prop,animated,boolean,true,false,false ion-modal,prop,backdropBreakpoint,number,0,false,false ion-modal,prop,backdropDismiss,boolean,true,false,false ion-modal,prop,breakpoints,number[] | undefined,undefined,false,false ion-modal,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-modal,prop,handle,boolean | undefined,undefined,false,false ion-modal,prop,htmlAttributes,ModalAttributes | undefined,undefined,false,false ion-modal,prop,initialBreakpoint,number | undefined,undefined,false,false ion-modal,prop,isOpen,boolean,false,false,false ion-modal,prop,keyboardClose,boolean,true,false,false ion-modal,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-modal,prop,mode,"ios" | "md",undefined,false,false ion-modal,prop,presentingElement,HTMLElement | undefined,undefined,false,false ion-modal,prop,showBackdrop,boolean,true,false,false ion-modal,prop,swipeToClose,boolean,false,false,false ion-modal,prop,trigger,string | undefined,undefined,false,false ion-modal,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise<boolean> ion-modal,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-modal,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-modal,method,present,present() => Promise<void> ion-modal,event,didDismiss,OverlayEventDetail<any>,true ion-modal,event,didPresent,void,true ion-modal,event,ionModalDidDismiss,OverlayEventDetail<any>,true ion-modal,event,ionModalDidPresent,void,true ion-modal,event,ionModalWillDismiss,OverlayEventDetail<any>,true ion-modal,event,ionModalWillPresent,void,true ion-modal,event,willDismiss,OverlayEventDetail<any>,true ion-modal,event,willPresent,void,true ion-modal,css-prop,--backdrop-opacity ion-modal,css-prop,--background ion-modal,css-prop,--border-color ion-modal,css-prop,--border-radius ion-modal,css-prop,--border-style ion-modal,css-prop,--border-width ion-modal,css-prop,--height ion-modal,css-prop,--max-height ion-modal,css-prop,--max-width ion-modal,css-prop,--min-height ion-modal,css-prop,--min-width ion-modal,css-prop,--width ion-modal,part,backdrop ion-modal,part,content ion-modal,part,handle ion-nav,shadow ion-nav,prop,animated,boolean,true,false,false ion-nav,prop,animation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-nav,prop,root,Function | HTMLElement | ViewController | null | string | undefined,undefined,false,false ion-nav,prop,rootParams,undefined | { [key: string]: any; },undefined,false,false ion-nav,prop,swipeGesture,boolean | undefined,undefined,false,false ion-nav,method,canGoBack,canGoBack(view?: ViewController | undefined) => Promise<boolean> ion-nav,method,getActive,getActive() => Promise<ViewController | undefined> ion-nav,method,getByIndex,getByIndex(index: number) => Promise<ViewController | undefined> ion-nav,method,getPrevious,getPrevious(view?: ViewController | undefined) => Promise<ViewController | undefined> ion-nav,method,insert,insert<T extends NavComponent>(insertIndex: number, component: T, componentProps?: ComponentProps<T> | null | undefined, opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,insertPages,insertPages(insertIndex: number, insertComponents: NavComponent[] | NavComponentWithProps[], opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,pop,pop(opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,popTo,popTo(indexOrViewCtrl: number | ViewController, opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,popToRoot,popToRoot(opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,push,push<T extends NavComponent>(component: T, componentProps?: ComponentProps<T> | null | undefined, opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,removeIndex,removeIndex(startIndex: number, removeCount?: number, opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,setPages,setPages(views: NavComponent[] | NavComponentWithProps[], opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,method,setRoot,setRoot<T extends NavComponent>(component: T, componentProps?: ComponentProps<T> | null | undefined, opts?: NavOptions | null | undefined, done?: TransitionDoneFn | undefined) => Promise<boolean> ion-nav,event,ionNavDidChange,void,false ion-nav,event,ionNavWillChange,void,false ion-nav-link,none ion-nav-link,prop,component,Function | HTMLElement | ViewController | null | string | undefined,undefined,false,false ion-nav-link,prop,componentProps,undefined | { [key: string]: any; },undefined,false,false ion-nav-link,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-nav-link,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-note,shadow ion-note,prop,color,string | undefined,undefined,false,true ion-note,prop,mode,"ios" | "md",undefined,false,false ion-note,css-prop,--color ion-picker,scoped ion-picker,prop,animated,boolean,true,false,false ion-picker,prop,backdropDismiss,boolean,true,false,false ion-picker,prop,buttons,PickerButton[],[],false,false ion-picker,prop,columns,PickerColumn[],[],false,false ion-picker,prop,cssClass,string | string[] | undefined,undefined,false,false ion-picker,prop,duration,number,0,false,false ion-picker,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-picker,prop,htmlAttributes,PickerAttributes | undefined,undefined,false,false ion-picker,prop,keyboardClose,boolean,true,false,false ion-picker,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-picker,prop,mode,"ios" | "md",undefined,false,false ion-picker,prop,showBackdrop,boolean,true,false,false ion-picker,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise<boolean> ion-picker,method,getColumn,getColumn(name: string) => Promise<PickerColumn | undefined> ion-picker,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-picker,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-picker,method,present,present() => Promise<void> ion-picker,event,ionPickerDidDismiss,OverlayEventDetail<any>,true ion-picker,event,ionPickerDidPresent,void,true ion-picker,event,ionPickerWillDismiss,OverlayEventDetail<any>,true ion-picker,event,ionPickerWillPresent,void,true ion-picker,css-prop,--backdrop-opacity ion-picker,css-prop,--background ion-picker,css-prop,--background-rgb ion-picker,css-prop,--border-color ion-picker,css-prop,--border-radius ion-picker,css-prop,--border-style ion-picker,css-prop,--border-width ion-picker,css-prop,--height ion-picker,css-prop,--max-height ion-picker,css-prop,--max-width ion-picker,css-prop,--min-height ion-picker,css-prop,--min-width ion-picker,css-prop,--width ion-popover,shadow ion-popover,prop,alignment,"center" | "end" | "start" | undefined,undefined,false,false ion-popover,prop,animated,boolean,true,false,false ion-popover,prop,arrow,boolean,true,false,false ion-popover,prop,backdropDismiss,boolean,true,false,false ion-popover,prop,component,Function | HTMLElement | null | string | undefined,undefined,false,false ion-popover,prop,componentProps,undefined | { [key: string]: any; },undefined,false,false ion-popover,prop,dismissOnSelect,boolean,false,false,false ion-popover,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-popover,prop,event,any,undefined,false,false ion-popover,prop,htmlAttributes,PopoverAttributes | undefined,undefined,false,false ion-popover,prop,isOpen,boolean,false,false,false ion-popover,prop,keyboardClose,boolean,true,false,false ion-popover,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-popover,prop,mode,"ios" | "md",undefined,false,false ion-popover,prop,reference,"event" | "trigger",'trigger',false,false ion-popover,prop,showBackdrop,boolean,true,false,false ion-popover,prop,side,"bottom" | "end" | "left" | "right" | "start" | "top",'bottom',false,false ion-popover,prop,size,"auto" | "cover",'auto',false,false ion-popover,prop,translucent,boolean,false,false,false ion-popover,prop,trigger,string | undefined,undefined,false,false ion-popover,prop,triggerAction,"click" | "context-menu" | "hover",'click',false,false ion-popover,method,dismiss,dismiss(data?: any, role?: string | undefined, dismissParentPopover?: boolean) => Promise<boolean> ion-popover,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-popover,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-popover,method,present,present(event?: MouseEvent | TouchEvent | PointerEvent | CustomEvent<any> | undefined) => Promise<void> ion-popover,event,didDismiss,OverlayEventDetail<any>,true ion-popover,event,didPresent,void,true ion-popover,event,ionPopoverDidDismiss,OverlayEventDetail<any>,true ion-popover,event,ionPopoverDidPresent,void,true ion-popover,event,ionPopoverWillDismiss,OverlayEventDetail<any>,true ion-popover,event,ionPopoverWillPresent,void,true ion-popover,event,willDismiss,OverlayEventDetail<any>,true ion-popover,event,willPresent,void,true ion-popover,css-prop,--backdrop-opacity ion-popover,css-prop,--background ion-popover,css-prop,--box-shadow ion-popover,css-prop,--height ion-popover,css-prop,--max-height ion-popover,css-prop,--max-width ion-popover,css-prop,--min-height ion-popover,css-prop,--min-width ion-popover,css-prop,--offset-x ion-popover,css-prop,--offset-y ion-popover,css-prop,--width ion-popover,part,arrow ion-popover,part,backdrop ion-popover,part,content ion-progress-bar,shadow ion-progress-bar,prop,buffer,number,1,false,false ion-progress-bar,prop,color,string | undefined,undefined,false,true ion-progress-bar,prop,mode,"ios" | "md",undefined,false,false ion-progress-bar,prop,reversed,boolean,false,false,false ion-progress-bar,prop,type,"determinate" | "indeterminate",'determinate',false,false ion-progress-bar,prop,value,number,0,false,false ion-progress-bar,css-prop,--background ion-progress-bar,css-prop,--buffer-background ion-progress-bar,css-prop,--progress-background ion-progress-bar,part,progress ion-progress-bar,part,stream ion-progress-bar,part,track ion-radio,shadow ion-radio,prop,color,string | undefined,undefined,false,true ion-radio,prop,disabled,boolean,false,false,false ion-radio,prop,mode,"ios" | "md",undefined,false,false ion-radio,prop,name,string,this.inputId,false,false ion-radio,prop,value,any,undefined,false,false ion-radio,event,ionBlur,void,true ion-radio,event,ionFocus,void,true ion-radio,css-prop,--border-radius ion-radio,css-prop,--color ion-radio,css-prop,--color-checked ion-radio,css-prop,--inner-border-radius ion-radio,part,container ion-radio,part,mark ion-radio-group,none ion-radio-group,prop,allowEmptySelection,boolean,false,false,false ion-radio-group,prop,name,string,this.inputId,false,false ion-radio-group,prop,value,any,undefined,false,false ion-radio-group,event,ionChange,RadioGroupChangeEventDetail<any>,true ion-range,shadow ion-range,prop,color,string | undefined,undefined,false,true ion-range,prop,debounce,number,0,false,false ion-range,prop,disabled,boolean,false,false,false ion-range,prop,dualKnobs,boolean,false,false,false ion-range,prop,max,number,100,false,false ion-range,prop,min,number,0,false,false ion-range,prop,mode,"ios" | "md",undefined,false,false ion-range,prop,name,string,'',false,false ion-range,prop,pin,boolean,false,false,false ion-range,prop,pinFormatter,(value: number) => string | number,(value: number): number => Math.round(value),false,false ion-range,prop,snaps,boolean,false,false,false ion-range,prop,step,number,1,false,false ion-range,prop,ticks,boolean,true,false,false ion-range,prop,value,number | { lower: number; upper: number; },0,false,false ion-range,event,ionBlur,void,true ion-range,event,ionChange,RangeChangeEventDetail,true ion-range,event,ionFocus,void,true ion-range,css-prop,--bar-background ion-range,css-prop,--bar-background-active ion-range,css-prop,--bar-border-radius ion-range,css-prop,--bar-height ion-range,css-prop,--height ion-range,css-prop,--knob-background ion-range,css-prop,--knob-border-radius ion-range,css-prop,--knob-box-shadow ion-range,css-prop,--knob-size ion-range,css-prop,--pin-background ion-range,css-prop,--pin-color ion-range,part,bar ion-range,part,bar-active ion-range,part,knob ion-range,part,pin ion-range,part,tick ion-range,part,tick-active ion-refresher,none ion-refresher,prop,closeDuration,string,'280ms',false,false ion-refresher,prop,disabled,boolean,false,false,false ion-refresher,prop,pullFactor,number,1,false,false ion-refresher,prop,pullMax,number,this.pullMin + 60,false,false ion-refresher,prop,pullMin,number,60,false,false ion-refresher,prop,snapbackDuration,string,'280ms',false,false ion-refresher,method,cancel,cancel() => Promise<void> ion-refresher,method,complete,complete() => Promise<void> ion-refresher,method,getProgress,getProgress() => Promise<number> ion-refresher,event,ionPull,void,true ion-refresher,event,ionRefresh,RefresherEventDetail,true ion-refresher,event,ionStart,void,true ion-refresher-content,none ion-refresher-content,prop,pullingIcon,null | string | undefined,undefined,false,false ion-refresher-content,prop,pullingText,IonicSafeString | string | undefined,undefined,false,false ion-refresher-content,prop,refreshingSpinner,"bubbles" | "circles" | "circular" | "crescent" | "dots" | "lines" | "lines-sharp" | "lines-sharp-small" | "lines-small" | null | undefined,undefined,false,false ion-refresher-content,prop,refreshingText,IonicSafeString | string | undefined,undefined,false,false ion-reorder,shadow ion-reorder,part,icon ion-reorder-group,none ion-reorder-group,prop,disabled,boolean,true,false,false ion-reorder-group,method,complete,complete(listOrReorder?: boolean | any[] | undefined) => Promise<any> ion-reorder-group,event,ionItemReorder,ItemReorderEventDetail,true ion-ripple-effect,shadow ion-ripple-effect,prop,type,"bounded" | "unbounded",'bounded',false,false ion-ripple-effect,method,addRipple,addRipple(x: number, y: number) => Promise<() => void> ion-route,none ion-route,prop,beforeEnter,(() => NavigationHookResult | Promise<NavigationHookResult>) | undefined,undefined,false,false ion-route,prop,beforeLeave,(() => NavigationHookResult | Promise<NavigationHookResult>) | undefined,undefined,false,false ion-route,prop,component,string,undefined,true,false ion-route,prop,componentProps,undefined | { [key: string]: any; },undefined,false,false ion-route,prop,url,string,'',false,false ion-route,event,ionRouteDataChanged,any,true ion-route-redirect,none ion-route-redirect,prop,from,string,undefined,true,false ion-route-redirect,prop,to,null | string | undefined,undefined,true,false ion-route-redirect,event,ionRouteRedirectChanged,any,true ion-router,none ion-router,prop,root,string,'/',false,false ion-router,prop,useHash,boolean,true,false,false ion-router,method,back,back() => Promise<void> ion-router,method,push,push(path: string, direction?: RouterDirection, animation?: AnimationBuilder | undefined) => Promise<boolean> ion-router,event,ionRouteDidChange,RouterEventDetail,true ion-router,event,ionRouteWillChange,RouterEventDetail,true ion-router-link,shadow ion-router-link,prop,color,string | undefined,undefined,false,true ion-router-link,prop,href,string | undefined,undefined,false,false ion-router-link,prop,rel,string | undefined,undefined,false,false ion-router-link,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-router-link,prop,routerDirection,"back" | "forward" | "root",'forward',false,false ion-router-link,prop,target,string | undefined,undefined,false,false ion-router-link,css-prop,--background ion-router-link,css-prop,--color ion-router-outlet,shadow ion-router-outlet,prop,animated,boolean,true,false,false ion-router-outlet,prop,animation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-router-outlet,prop,mode,"ios" | "md",getIonMode(this),false,false ion-row,shadow ion-searchbar,scoped ion-searchbar,prop,animated,boolean,false,false,false ion-searchbar,prop,autocomplete,"off" | "on" | "name" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo",'off',false,false ion-searchbar,prop,autocorrect,"off" | "on",'off',false,false ion-searchbar,prop,cancelButtonIcon,string,config.get('backButtonIcon', arrowBackSharp) as string,false,false ion-searchbar,prop,cancelButtonText,string,'Cancel',false,false ion-searchbar,prop,clearIcon,string | undefined,undefined,false,false ion-searchbar,prop,color,string | undefined,undefined,false,true ion-searchbar,prop,debounce,number,250,false,false ion-searchbar,prop,disabled,boolean,false,false,false ion-searchbar,prop,enterkeyhint,"done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined,undefined,false,false ion-searchbar,prop,inputmode,"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url" | undefined,undefined,false,false ion-searchbar,prop,mode,"ios" | "md",undefined,false,false ion-searchbar,prop,placeholder,string,'Search',false,false ion-searchbar,prop,searchIcon,string | undefined,undefined,false,false ion-searchbar,prop,showCancelButton,"always" | "focus" | "never",'never',false,false ion-searchbar,prop,showClearButton,"always" | "focus" | "never",'always',false,false ion-searchbar,prop,spellcheck,boolean,false,false,false ion-searchbar,prop,type,"email" | "number" | "password" | "search" | "tel" | "text" | "url",'search',false,false ion-searchbar,prop,value,null | string | undefined,'',false,false ion-searchbar,method,getInputElement,getInputElement() => Promise<HTMLInputElement> ion-searchbar,method,setFocus,setFocus() => Promise<void> ion-searchbar,event,ionBlur,void,true ion-searchbar,event,ionCancel,void,true ion-searchbar,event,ionChange,SearchbarChangeEventDetail,true ion-searchbar,event,ionClear,void,true ion-searchbar,event,ionFocus,void,true ion-searchbar,event,ionInput,KeyboardEvent,true ion-searchbar,css-prop,--background ion-searchbar,css-prop,--border-radius ion-searchbar,css-prop,--box-shadow ion-searchbar,css-prop,--cancel-button-color ion-searchbar,css-prop,--clear-button-color ion-searchbar,css-prop,--color ion-searchbar,css-prop,--icon-color ion-searchbar,css-prop,--placeholder-color ion-searchbar,css-prop,--placeholder-font-style ion-searchbar,css-prop,--placeholder-font-weight ion-searchbar,css-prop,--placeholder-opacity ion-segment,shadow ion-segment,prop,color,string | undefined,undefined,false,true ion-segment,prop,disabled,boolean,false,false,false ion-segment,prop,mode,"ios" | "md",undefined,false,false ion-segment,prop,scrollable,boolean,false,false,false ion-segment,prop,selectOnFocus,boolean,false,false,false ion-segment,prop,swipeGesture,boolean,true,false,false ion-segment,prop,value,null | string | undefined,undefined,false,false ion-segment,event,ionChange,SegmentChangeEventDetail,true ion-segment,css-prop,--background ion-segment-button,shadow ion-segment-button,prop,disabled,boolean,false,false,false ion-segment-button,prop,layout,"icon-bottom" | "icon-end" | "icon-hide" | "icon-start" | "icon-top" | "label-hide" | undefined,'icon-top',false,false ion-segment-button,prop,mode,"ios" | "md",undefined,false,false ion-segment-button,prop,type,"button" | "reset" | "submit",'button',false,false ion-segment-button,prop,value,string,'ion-sb-' + (ids++),false,false ion-segment-button,css-prop,--background ion-segment-button,css-prop,--background-checked ion-segment-button,css-prop,--background-focused ion-segment-button,css-prop,--background-focused-opacity ion-segment-button,css-prop,--background-hover ion-segment-button,css-prop,--background-hover-opacity ion-segment-button,css-prop,--border-color ion-segment-button,css-prop,--border-radius ion-segment-button,css-prop,--border-style ion-segment-button,css-prop,--border-width ion-segment-button,css-prop,--color ion-segment-button,css-prop,--color-checked ion-segment-button,css-prop,--color-focused ion-segment-button,css-prop,--color-hover ion-segment-button,css-prop,--indicator-box-shadow ion-segment-button,css-prop,--indicator-color ion-segment-button,css-prop,--indicator-height ion-segment-button,css-prop,--indicator-transform ion-segment-button,css-prop,--indicator-transition ion-segment-button,css-prop,--margin-bottom ion-segment-button,css-prop,--margin-end ion-segment-button,css-prop,--margin-start ion-segment-button,css-prop,--margin-top ion-segment-button,css-prop,--padding-bottom ion-segment-button,css-prop,--padding-end ion-segment-button,css-prop,--padding-start ion-segment-button,css-prop,--padding-top ion-segment-button,css-prop,--transition ion-segment-button,part,indicator ion-segment-button,part,indicator-background ion-segment-button,part,native ion-select,shadow ion-select,prop,cancelText,string,'Cancel',false,false ion-select,prop,compareWith,((currentValue: any, compareValue: any) => boolean) | null | string | undefined,undefined,false,false ion-select,prop,disabled,boolean,false,false,false ion-select,prop,interface,"action-sheet" | "alert" | "popover",'alert',false,false ion-select,prop,interfaceOptions,any,{},false,false ion-select,prop,mode,"ios" | "md",undefined,false,false ion-select,prop,multiple,boolean,false,false,false ion-select,prop,name,string,this.inputId,false,false ion-select,prop,okText,string,'OK',false,false ion-select,prop,placeholder,string | undefined,undefined,false,false ion-select,prop,selectedText,null | string | undefined,undefined,false,false ion-select,prop,value,any,undefined,false,false ion-select,method,open,open(event?: UIEvent | undefined) => Promise<any> ion-select,event,ionBlur,void,true ion-select,event,ionCancel,void,true ion-select,event,ionChange,SelectChangeEventDetail<any>,true ion-select,event,ionFocus,void,true ion-select,css-prop,--padding-bottom ion-select,css-prop,--padding-end ion-select,css-prop,--padding-start ion-select,css-prop,--padding-top ion-select,css-prop,--placeholder-color ion-select,css-prop,--placeholder-opacity ion-select,part,icon ion-select,part,placeholder ion-select,part,text ion-select-option,shadow ion-select-option,prop,disabled,boolean,false,false,false ion-select-option,prop,value,any,undefined,false,false ion-skeleton-text,shadow ion-skeleton-text,prop,animated,boolean,false,false,false ion-skeleton-text,css-prop,--background ion-skeleton-text,css-prop,--background-rgb ion-skeleton-text,css-prop,--border-radius ion-slide,none ion-slides,none ion-slides,prop,mode,"ios" | "md",undefined,false,false ion-slides,prop,options,any,{},false,false ion-slides,prop,pager,boolean,false,false,false ion-slides,prop,scrollbar,boolean,false,false,false ion-slides,method,getActiveIndex,getActiveIndex() => Promise<number> ion-slides,method,getPreviousIndex,getPreviousIndex() => Promise<number> ion-slides,method,getSwiper,getSwiper() => Promise<any> ion-slides,method,isBeginning,isBeginning() => Promise<boolean> ion-slides,method,isEnd,isEnd() => Promise<boolean> ion-slides,method,length,length() => Promise<number> ion-slides,method,lockSwipeToNext,lockSwipeToNext(lock: boolean) => Promise<void> ion-slides,method,lockSwipeToPrev,lockSwipeToPrev(lock: boolean) => Promise<void> ion-slides,method,lockSwipes,lockSwipes(lock: boolean) => Promise<void> ion-slides,method,slideNext,slideNext(speed?: number | undefined, runCallbacks?: boolean | undefined) => Promise<void> ion-slides,method,slidePrev,slidePrev(speed?: number | undefined, runCallbacks?: boolean | undefined) => Promise<void> ion-slides,method,slideTo,slideTo(index: number, speed?: number | undefined, runCallbacks?: boolean | undefined) => Promise<void> ion-slides,method,startAutoplay,startAutoplay() => Promise<void> ion-slides,method,stopAutoplay,stopAutoplay() => Promise<void> ion-slides,method,update,update() => Promise<void> ion-slides,method,updateAutoHeight,updateAutoHeight(speed?: number | undefined) => Promise<void> ion-slides,event,ionSlideDidChange,void,true ion-slides,event,ionSlideDoubleTap,void,true ion-slides,event,ionSlideDrag,void,true ion-slides,event,ionSlideNextEnd,void,true ion-slides,event,ionSlideNextStart,void,true ion-slides,event,ionSlidePrevEnd,void,true ion-slides,event,ionSlidePrevStart,void,true ion-slides,event,ionSlideReachEnd,void,true ion-slides,event,ionSlideReachStart,void,true ion-slides,event,ionSlidesDidLoad,void,true ion-slides,event,ionSlideTap,void,true ion-slides,event,ionSlideTouchEnd,void,true ion-slides,event,ionSlideTouchStart,void,true ion-slides,event,ionSlideTransitionEnd,void,true ion-slides,event,ionSlideTransitionStart,void,true ion-slides,event,ionSlideWillChange,void,true ion-slides,css-prop,--bullet-background ion-slides,css-prop,--bullet-background-active ion-slides,css-prop,--progress-bar-background ion-slides,css-prop,--progress-bar-background-active ion-slides,css-prop,--scroll-bar-background ion-slides,css-prop,--scroll-bar-background-active ion-spinner,shadow ion-spinner,prop,color,string | undefined,undefined,false,true ion-spinner,prop,duration,number | undefined,undefined,false,false ion-spinner,prop,name,"bubbles" | "circles" | "circular" | "crescent" | "dots" | "lines" | "lines-sharp" | "lines-sharp-small" | "lines-small" | undefined,undefined,false,false ion-spinner,prop,paused,boolean,false,false,false ion-spinner,css-prop,--color ion-split-pane,shadow ion-split-pane,prop,contentId,string | undefined,undefined,false,true ion-split-pane,prop,disabled,boolean,false,false,false ion-split-pane,prop,when,boolean | string,QUERY['lg'],false,false ion-split-pane,event,ionSplitPaneVisible,{ visible: boolean; },true ion-split-pane,css-prop,--border ion-split-pane,css-prop,--side-max-width ion-split-pane,css-prop,--side-min-width ion-split-pane,css-prop,--side-width ion-tab,shadow ion-tab,prop,component,Function | HTMLElement | null | string | undefined,undefined,false,false ion-tab,prop,tab,string,undefined,true,false ion-tab,method,setActive,setActive() => Promise<void> ion-tab-bar,shadow ion-tab-bar,prop,color,string | undefined,undefined,false,true ion-tab-bar,prop,mode,"ios" | "md",undefined,false,false ion-tab-bar,prop,selectedTab,string | undefined,undefined,false,false ion-tab-bar,prop,translucent,boolean,false,false,false ion-tab-bar,css-prop,--background ion-tab-bar,css-prop,--border ion-tab-bar,css-prop,--color ion-tab-button,shadow ion-tab-button,prop,disabled,boolean,false,false,false ion-tab-button,prop,download,string | undefined,undefined,false,false ion-tab-button,prop,href,string | undefined,undefined,false,false ion-tab-button,prop,layout,"icon-bottom" | "icon-end" | "icon-hide" | "icon-start" | "icon-top" | "label-hide" | undefined,undefined,false,false ion-tab-button,prop,mode,"ios" | "md",undefined,false,false ion-tab-button,prop,rel,string | undefined,undefined,false,false ion-tab-button,prop,selected,boolean,false,false,false ion-tab-button,prop,tab,string | undefined,undefined,false,false ion-tab-button,prop,target,string | undefined,undefined,false,false ion-tab-button,css-prop,--background ion-tab-button,css-prop,--background-focused ion-tab-button,css-prop,--background-focused-opacity ion-tab-button,css-prop,--color ion-tab-button,css-prop,--color-focused ion-tab-button,css-prop,--color-selected ion-tab-button,css-prop,--padding-bottom ion-tab-button,css-prop,--padding-end ion-tab-button,css-prop,--padding-start ion-tab-button,css-prop,--padding-top ion-tab-button,css-prop,--ripple-color ion-tab-button,part,native ion-tabs,shadow ion-tabs,method,getSelected,getSelected() => Promise<string | undefined> ion-tabs,method,getTab,getTab(tab: string | HTMLIonTabElement) => Promise<HTMLIonTabElement | undefined> ion-tabs,method,select,select(tab: string | HTMLIonTabElement) => Promise<boolean> ion-tabs,event,ionTabsDidChange,{ tab: string; },false ion-tabs,event,ionTabsWillChange,{ tab: string; },false ion-text,shadow ion-text,prop,color,string | undefined,undefined,false,true ion-text,prop,mode,"ios" | "md",undefined,false,false ion-textarea,scoped ion-textarea,prop,autoGrow,boolean,false,false,false ion-textarea,prop,autocapitalize,string,'none',false,false ion-textarea,prop,autofocus,boolean,false,false,false ion-textarea,prop,clearOnEdit,boolean,false,false,false ion-textarea,prop,color,string | undefined,undefined,false,true ion-textarea,prop,cols,number | undefined,undefined,false,false ion-textarea,prop,debounce,number,0,false,false ion-textarea,prop,disabled,boolean,false,false,false ion-textarea,prop,enterkeyhint,"done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined,undefined,false,false ion-textarea,prop,inputmode,"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url" | undefined,undefined,false,false ion-textarea,prop,maxlength,number | undefined,undefined,false,false ion-textarea,prop,minlength,number | undefined,undefined,false,false ion-textarea,prop,mode,"ios" | "md",undefined,false,false ion-textarea,prop,name,string,this.inputId,false,false ion-textarea,prop,placeholder,string | undefined,undefined,false,false ion-textarea,prop,readonly,boolean,false,false,false ion-textarea,prop,required,boolean,false,false,false ion-textarea,prop,rows,number | undefined,undefined,false,false ion-textarea,prop,spellcheck,boolean,false,false,false ion-textarea,prop,value,null | string | undefined,'',false,false ion-textarea,prop,wrap,"hard" | "off" | "soft" | undefined,undefined,false,false ion-textarea,method,getInputElement,getInputElement() => Promise<HTMLTextAreaElement> ion-textarea,method,setFocus,setFocus() => Promise<void> ion-textarea,event,ionBlur,FocusEvent,true ion-textarea,event,ionChange,TextareaChangeEventDetail,true ion-textarea,event,ionFocus,FocusEvent,true ion-textarea,event,ionInput,InputEvent,true ion-textarea,css-prop,--background ion-textarea,css-prop,--border-radius ion-textarea,css-prop,--color ion-textarea,css-prop,--padding-bottom ion-textarea,css-prop,--padding-end ion-textarea,css-prop,--padding-start ion-textarea,css-prop,--padding-top ion-textarea,css-prop,--placeholder-color ion-textarea,css-prop,--placeholder-font-style ion-textarea,css-prop,--placeholder-font-weight ion-textarea,css-prop,--placeholder-opacity ion-thumbnail,shadow ion-thumbnail,css-prop,--border-radius ion-thumbnail,css-prop,--size ion-title,shadow ion-title,prop,color,string | undefined,undefined,false,true ion-title,prop,size,"large" | "small" | undefined,undefined,false,false ion-title,css-prop,--color ion-toast,shadow ion-toast,prop,animated,boolean,true,false,false ion-toast,prop,buttons,(string | ToastButton)[] | undefined,undefined,false,false ion-toast,prop,color,string | undefined,undefined,false,true ion-toast,prop,cssClass,string | string[] | undefined,undefined,false,false ion-toast,prop,duration,number,0,false,false ion-toast,prop,enterAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-toast,prop,header,string | undefined,undefined,false,false ion-toast,prop,htmlAttributes,ToastAttributes | undefined,undefined,false,false ion-toast,prop,icon,string | undefined,undefined,false,false ion-toast,prop,keyboardClose,boolean,false,false,false ion-toast,prop,leaveAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false ion-toast,prop,message,IonicSafeString | string | undefined,undefined,false,false ion-toast,prop,mode,"ios" | "md",undefined,false,false ion-toast,prop,position,"bottom" | "middle" | "top",'bottom',false,false ion-toast,prop,translucent,boolean,false,false,false ion-toast,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise<boolean> ion-toast,method,onDidDismiss,onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-toast,method,onWillDismiss,onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>> ion-toast,method,present,present() => Promise<void> ion-toast,event,ionToastDidDismiss,OverlayEventDetail<any>,true ion-toast,event,ionToastDidPresent,void,true ion-toast,event,ionToastWillDismiss,OverlayEventDetail<any>,true ion-toast,event,ionToastWillPresent,void,true ion-toast,css-prop,--background ion-toast,css-prop,--border-color ion-toast,css-prop,--border-radius ion-toast,css-prop,--border-style ion-toast,css-prop,--border-width ion-toast,css-prop,--box-shadow ion-toast,css-prop,--button-color ion-toast,css-prop,--color ion-toast,css-prop,--end ion-toast,css-prop,--height ion-toast,css-prop,--max-height ion-toast,css-prop,--max-width ion-toast,css-prop,--min-height ion-toast,css-prop,--min-width ion-toast,css-prop,--start ion-toast,css-prop,--white-space ion-toast,css-prop,--width ion-toast,part,button ion-toast,part,container ion-toast,part,header ion-toast,part,icon ion-toast,part,message ion-toggle,shadow ion-toggle,prop,checked,boolean,false,false,false ion-toggle,prop,color,string | undefined,undefined,false,true ion-toggle,prop,disabled,boolean,false,false,false ion-toggle,prop,mode,"ios" | "md",undefined,false,false ion-toggle,prop,name,string,this.inputId,false,false ion-toggle,prop,value,null | string | undefined,'on',false,false ion-toggle,event,ionBlur,void,true ion-toggle,event,ionChange,ToggleChangeEventDetail<any>,true ion-toggle,event,ionFocus,void,true ion-toggle,css-prop,--background ion-toggle,css-prop,--background-checked ion-toggle,css-prop,--border-radius ion-toggle,css-prop,--handle-background ion-toggle,css-prop,--handle-background-checked ion-toggle,css-prop,--handle-border-radius ion-toggle,css-prop,--handle-box-shadow ion-toggle,css-prop,--handle-height ion-toggle,css-prop,--handle-max-height ion-toggle,css-prop,--handle-spacing ion-toggle,css-prop,--handle-transition ion-toggle,css-prop,--handle-width ion-toggle,part,handle ion-toggle,part,track ion-toolbar,shadow ion-toolbar,prop,color,string | undefined,undefined,false,true ion-toolbar,prop,mode,"ios" | "md",undefined,false,false ion-toolbar,css-prop,--background ion-toolbar,css-prop,--border-color ion-toolbar,css-prop,--border-style ion-toolbar,css-prop,--border-width ion-toolbar,css-prop,--color ion-toolbar,css-prop,--min-height ion-toolbar,css-prop,--opacity ion-toolbar,css-prop,--padding-bottom ion-toolbar,css-prop,--padding-end ion-toolbar,css-prop,--padding-start ion-toolbar,css-prop,--padding-top ion-virtual-scroll,none ion-virtual-scroll,prop,approxFooterHeight,number,30,false,false ion-virtual-scroll,prop,approxHeaderHeight,number,30,false,false ion-virtual-scroll,prop,approxItemHeight,number,45,false,false ion-virtual-scroll,prop,footerFn,((item: any, index: number, items: any[]) => string | null | undefined) | undefined,undefined,false,false ion-virtual-scroll,prop,footerHeight,((item: any, index: number) => number) | undefined,undefined,false,false ion-virtual-scroll,prop,headerFn,((item: any, index: number, items: any[]) => string | null | undefined) | undefined,undefined,false,false ion-virtual-scroll,prop,headerHeight,((item: any, index: number) => number) | undefined,undefined,false,false ion-virtual-scroll,prop,itemHeight,((item: any, index: number) => number) | undefined,undefined,false,false ion-virtual-scroll,prop,items,any[] | undefined,undefined,false,false ion-virtual-scroll,prop,nodeRender,((el: HTMLElement | null, cell: Cell, domIndex: number) => HTMLElement) | undefined,undefined,false,false ion-virtual-scroll,prop,renderFooter,((item: any, index: number) => any) | undefined,undefined,false,false ion-virtual-scroll,prop,renderHeader,((item: any, index: number) => any) | undefined,undefined,false,false ion-virtual-scroll,prop,renderItem,((item: any, index: number) => any) | undefined,undefined,false,false ion-virtual-scroll,method,checkEnd,checkEnd() => Promise<void> ion-virtual-scroll,method,checkRange,checkRange(offset: number, len?: number) => Promise<void> ion-virtual-scroll,method,positionForItem,positionForItem(index: number) => Promise<number>
core/api.txt
1
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0562768429517746, 0.0006934365374036133, 0.0001616795634618029, 0.00019838301523122936, 0.004625928588211536 ]
{ "id": 7, "code_window": [ " const compares = [];\n", " compares.push(await page.compareScreenshot());\n", "\n", " // Gender Alert Select\n", " let select = await page.find('#gender');\n", " await select.click();\n", "\n", " let alert = await page.find('ion-alert');\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "\n", " // add an event spy to the select\n", " const ionDismiss = await select.spyOnEvent('ionDismiss');\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 12 }
import { newE2EPage } from '@stencil/core/testing'; it('select: label', async () => { const page = await newE2EPage({ url: '/src/components/select/test/label?ionic:_testing=true' }); const compare = await page.compareScreenshot(); expect(compare).toMatchScreenshot(); });
core/src/components/select/test/label/e2e.ts
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0046037426218390465, 0.0023894463665783405, 0.0001751500240061432, 0.0023894463665783405, 0.002214296255260706 ]
{ "id": 7, "code_window": [ " const compares = [];\n", " compares.push(await page.compareScreenshot());\n", "\n", " // Gender Alert Select\n", " let select = await page.find('#gender');\n", " await select.click();\n", "\n", " let alert = await page.find('ion-alert');\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "\n", " // add an event spy to the select\n", " const ionDismiss = await select.spyOnEvent('ionDismiss');\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 12 }
{ "compilerOptions": { "strict": true, "alwaysStrict": true, "allowSyntheticDefaultImports": true, "allowUnreachableCode": false, "declaration": true, "experimentalDecorators": true, "forceConsistentCasingInFileNames": true, "assumeChangesOnlyAffectDirectDependencies": true, "jsx": "react", "jsxFactory": "h", "lib": [ "dom", "es2017" ], "module": "esnext", "moduleResolution": "node", "noImplicitAny": true, "noImplicitReturns": true, "noUnusedLocals": true, "noUnusedParameters": true, "outDir": ".tmp", "pretty": true, "removeComments": false, "target": "es2017", "baseUrl": ".", "paths": { "@utils/test": ["src/utils/test/utils"] } }, "include": [ "src", ], "exclude": [ "node_modules", "**/test" ] }
core/tsconfig.json
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017576820391695946, 0.000174213811988011, 0.00017243027104996145, 0.00017432837921660393, 0.0000012522020824690117 ]
{ "id": 7, "code_window": [ " const compares = [];\n", " compares.push(await page.compareScreenshot());\n", "\n", " // Gender Alert Select\n", " let select = await page.find('#gender');\n", " await select.click();\n", "\n", " let alert = await page.find('ion-alert');\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ "\n", " // add an event spy to the select\n", " const ionDismiss = await select.spyOnEvent('ionDismiss');\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 12 }
# ion-split-pane A split pane is useful when creating multi-view layouts. It allows UI elements, like menus, to be displayed as the viewport width increases. If the device's screen width is below a certain size, the split pane will collapse and the menu will be hidden. This is ideal for creating an app that will be served in a browser and deployed through the app store to phones and tablets. ## Setting Breakpoints By default, the split pane will expand when the screen is larger than 992px. To customize this, pass a breakpoint in the `when` property. The `when` property can accept a boolean value, any valid media query, or one of Ionic's predefined sizes. ```html <!-- can be "xs", "sm", "md", "lg", or "xl" --> <ion-split-pane when="md"></ion-split-pane> <!-- can be any valid media query https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries --> <ion-split-pane when="(min-width: 40px)"></ion-split-pane> ``` | Size | Value | Description | |------|-----------------------|-----------------------------------------------------------------------| | `xs` | `(min-width: 0px)` | Show the split-pane when the min-width is 0px (meaning, always) | | `sm` | `(min-width: 576px)` | Show the split-pane when the min-width is 576px | | `md` | `(min-width: 768px)` | Show the split-pane when the min-width is 768px | | `lg` | `(min-width: 992px)` | Show the split-pane when the min-width is 992px (default break point) | | `xl` | `(min-width: 1200px)` | Show the split-pane when the min-width is 1200px | <!-- Auto Generated Below --> ## Usage ### Angular ```html <ion-split-pane contentId="main"> <!-- the side menu --> <ion-menu contentId="main"> <ion-header> <ion-toolbar> <ion-title>Menu</ion-title> </ion-toolbar> </ion-header> </ion-menu> <!-- the main content --> <ion-router-outlet id="main"></ion-router-outlet> </ion-split-pane> ``` ### Javascript ```html <ion-split-pane content-id="main"> <!-- the side menu --> <ion-menu content-id="main"> <ion-header> <ion-toolbar> <ion-title>Menu</ion-title> </ion-toolbar> </ion-header> </ion-menu> <!-- the main content --> <ion-content id="main"> <h1>Hello</h1> </ion-content> </ion-split-pane> ``` ### React ```tsx import React from 'react'; import { IonSplitPane, IonMenu, IonHeader, IonToolbar, IonTitle, IonRouterOutlet, IonContent, IonPage } from '@ionic/react'; export const SplitPlaneExample: React.SFC<{}> = () => ( <IonContent> <IonSplitPane contentId="main"> {/*-- the side menu --*/} <IonMenu contentId="main"> <IonHeader> <IonToolbar> <IonTitle>Menu</IonTitle> </IonToolbar> </IonHeader> </IonMenu> {/*-- the main content --*/} <IonPage id="main"/> </IonSplitPane> </IonContent> ); ``` ### Stencil ```tsx import { Component, h } from '@stencil/core'; @Component({ tag: 'split-pane-example', styleUrl: 'split-pane-example.css' }) export class SplitPaneExample { render() { return [ <ion-split-pane content-id="main"> {/* the side menu */} <ion-menu content-id="main"> <ion-header> <ion-toolbar> <ion-title>Menu</ion-title> </ion-toolbar> </ion-header> </ion-menu> {/* the main content */} <ion-router-outlet id="main"></ion-router-outlet> </ion-split-pane> ]; } } ``` ### Vue ```html <template> <ion-split-pane content-id="main"> <!-- the side menu --> <ion-menu content-id="main"> <ion-header> <ion-toolbar> <ion-title>Menu</ion-title> </ion-toolbar> </ion-header> </ion-menu> <!-- the main content --> <ion-router-outlet id="main"></ion-router-outlet> </ion-split-pane> </template> <script> import { IonHeader, IonMenu, IonRouterOutlet, IonSplitPane, IonTitle, IonToolbar } from '@ionic/vue'; import { defineComponent } from 'vue'; export default defineComponent({ components: { IonHeader, IonMenu, IonRouterOutlet, IonSplitPane, IonTitle, IonToolbar } }); </script> ``` ## Properties | Property | Attribute | Description | Type | Default | | ----------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------- | | `contentId` | `content-id` | The `id` of the main content. When using a router this is typically `ion-router-outlet`. When not using a router, this is typically your main view's `ion-content`. This is not the id of the `ion-content` inside of your `ion-menu`. | `string \| undefined` | `undefined` | | `disabled` | `disabled` | If `true`, the split pane will be hidden. | `boolean` | `false` | | `when` | `when` | When the split-pane should be shown. Can be a CSS media query expression, or a shortcut expression. Can also be a boolean expression. | `boolean \| string` | `QUERY['lg']` | ## Events | Event | Description | Type | | --------------------- | ------------------------------------------------------------------ | ------------------------------------ | | `ionSplitPaneVisible` | Expression to be called when the split-pane visibility has changed | `CustomEvent<{ visible: boolean; }>` | ## CSS Custom Properties | Name | Description | | ------------------ | ---------------------------------------------------------------------------- | | `--border` | Border between panes | | `--side-max-width` | Maximum width of the side pane. Does not apply when split pane is collapsed. | | `--side-min-width` | Minimum width of the side pane. Does not apply when split pane is collapsed. | | `--side-width` | Width of the side pane. Does not apply when split pane is collapsed. | ---------------------------------------------- *Built with [StencilJS](https://stenciljs.com/)*
core/src/components/split-pane/readme.md
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0004672414215747267, 0.00020749033137690276, 0.00016572180902585387, 0.00017443514661863446, 0.00007767406350467354 ]
{ "id": 8, "code_window": [ " compares.push(await page.compareScreenshot('should open gender single select'));\n", "\n", " await alert.callMethod('dismiss');\n", "\n", " // Skittles Action Sheet Select\n", " select = await page.find('#skittles');\n", " await select.click();\n", "\n", " let actionSheet = await page.find('ion-action-sheet');\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " expect(ionDismiss).toHaveReceivedEvent();\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 22 }
import { newE2EPage } from '@stencil/core/testing'; test('select: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true' }); const compares = []; compares.push(await page.compareScreenshot()); // Gender Alert Select let select = await page.find('#gender'); await select.click(); let alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open gender single select')); await alert.callMethod('dismiss'); // Skittles Action Sheet Select select = await page.find('#skittles'); await select.click(); let actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open skittles action sheet select')); await actionSheet.callMethod('dismiss'); // Custom Alert Select select = await page.find('#customAlertSelect'); await select.click(); alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom alert select')); await alert.callMethod('dismiss'); // Custom Popover Select select = await page.find('#customPopoverSelect'); await select.click(); let popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom popover select')); // select has no value, so first option should be focused by default const popoverOption1 = await popover.find('.select-interface-option:first-child'); expect(popoverOption1).toHaveClass('ion-focused'); let popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); await popoverOption2.click(); await page.waitForTimeout(500); await select.click(); popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); expect(popoverOption2).toHaveClass('ion-focused'); await popover.callMethod('dismiss'); // Custom Action Sheet Select select = await page.find('#customActionSheetSelect'); await select.click(); actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom action sheet select')); await actionSheet.callMethod('dismiss'); for (const compare of compares) { expect(compare).toMatchScreenshot(); } }); test('select:rtl: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true&rtl=true' }); const compares = []; compares.push(await page.compareScreenshot()); for (const compare of compares) { expect(compare).toMatchScreenshot(); } });
core/src/components/select/test/basic/e2e.ts
1
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.9987762570381165, 0.5534501075744629, 0.00018022413132712245, 0.8725811839103699, 0.4678139388561249 ]
{ "id": 8, "code_window": [ " compares.push(await page.compareScreenshot('should open gender single select'));\n", "\n", " await alert.callMethod('dismiss');\n", "\n", " // Skittles Action Sheet Select\n", " select = await page.find('#skittles');\n", " await select.click();\n", "\n", " let actionSheet = await page.find('ion-action-sheet');\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " expect(ionDismiss).toHaveReceivedEvent();\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 22 }
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Picker - a11y</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"> <link href="../../../../../css/ionic.bundle.css" rel="stylesheet"> <link href="../../../../../scripts/testing/styles.css" rel="stylesheet"> <script src="../../../../../scripts/testing/scripts.js"></script> <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script> </head> <body> <ion-app> <ion-content> <h1>Picker - a11y</h1> <ion-picker-internal> <ion-picker-column-internal color="tertiary" value="3"></ion-picker-column-internal> </ion-picker-internal> </ion-content> <script> const column = document.querySelector('ion-picker-column-internal'); column.items = [ { text: 'First', value: '1' }, { text: 'Second', value: '2' }, { text: 'Third', value: '3' }, { text: 'Fourth', value: '4' }, { text: 'Fifth', value: '5' }, { text: 'Sixth', value: '6' }, { text: 'Seventh', value: '7' }, ] </script> </ion-app> </body> </html>
core/src/components/picker-internal/test/a11y/index.html
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0001701022410998121, 0.00016727606998756528, 0.00016326671175193042, 0.0001678676635492593, 0.000002507135604901123 ]
{ "id": 8, "code_window": [ " compares.push(await page.compareScreenshot('should open gender single select'));\n", "\n", " await alert.callMethod('dismiss');\n", "\n", " // Skittles Action Sheet Select\n", " select = await page.find('#skittles');\n", " await select.click();\n", "\n", " let actionSheet = await page.find('ion-action-sheet');\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " expect(ionDismiss).toHaveReceivedEvent();\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 22 }
// Core CSS, always required @import "./core"; // Global CSS: blocks scrolling, sets box-sizing @import "./global.bundle"; // CSS Utils @import "./utils.bundle";
core/src/css/ionic.bundle.scss
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017395550094079226, 0.00017395550094079226, 0.00017395550094079226, 0.00017395550094079226, 0 ]
{ "id": 8, "code_window": [ " compares.push(await page.compareScreenshot('should open gender single select'));\n", "\n", " await alert.callMethod('dismiss');\n", "\n", " // Skittles Action Sheet Select\n", " select = await page.find('#skittles');\n", " await select.click();\n", "\n", " let actionSheet = await page.find('ion-action-sheet');\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " expect(ionDismiss).toHaveReceivedEvent();\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 22 }
# ion-action-sheet An Action Sheet is a dialog that displays a set of options. It appears on top of the app's content, and must be manually dismissed by the user before they can resume interaction with the app. Destructive options are made obvious in `ios` mode. There are multiple ways to dismiss the action sheet, including tapping the backdrop or hitting the escape key on desktop. ## Buttons A button's `role` property can either be `destructive` or `cancel`. Buttons without a role property will have the default look for the platform. Buttons with the `cancel` role will always load as the bottom button, no matter where they are in the array. All other buttons will be displayed in the order they have been added to the `buttons` array. Note: We recommend that `destructive` buttons are always the first button in the array, making them the top button. Additionally, if the action sheet is dismissed by tapping the backdrop, then it will fire the handler from the button with the cancel role. A button can also be passed data via the `data` property on `ActionSheetButton`. This will populate the `data` field in the return value of the `onDidDismiss` method. ## Customization Action Sheet uses scoped encapsulation, which means it will automatically scope its CSS by appending each of the styles with an additional class at runtime. Overriding scoped selectors in CSS requires a [higher specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity) selector. We recommend passing a custom class to `cssClass` in the `create` method and using that to add custom styles to the host and inner elements. This property can also accept multiple classes separated by spaces. View the [Usage](#usage) section for an example of how to pass a class using `cssClass`. ```css /* DOES NOT WORK - not specific enough */ .action-sheet-group { background: #e5e5e5; } /* Works - pass "my-custom-class" in cssClass to increase specificity */ .my-custom-class .action-sheet-group { background: #e5e5e5; } ``` Any of the defined [CSS Custom Properties](#css-custom-properties) can be used to style the Action Sheet without needing to target individual elements: ```css .my-custom-class { --background: #e5e5e5; } ``` > If you are building an Ionic Angular app, the styles need to be added to a global stylesheet file. Read [Style Placement](#style-placement) in the Angular section below for more information. ## Interfaces ### ActionSheetButton ```typescript interface ActionSheetButton<T = any> { text?: string; role?: 'cancel' | 'destructive' | 'selected' | string; icon?: string; cssClass?: string | string[]; handler?: () => boolean | void | Promise<boolean | void>; data?: T; } ``` ### ActionSheetOptions ```typescript interface ActionSheetOptions { header?: string; subHeader?: string; cssClass?: string | string[]; buttons: (ActionSheetButton | string)[]; backdropDismiss?: boolean; translucent?: boolean; animated?: boolean; mode?: Mode; keyboardClose?: boolean; id?: string; htmlAttributes?: ActionSheetAttributes; enterAnimation?: AnimationBuilder; leaveAnimation?: AnimationBuilder; } ``` ### ActionSheetAttributes ```typescript interface ActionSheetAttributes extends JSXBase.HTMLAttributes<HTMLElement> {} ``` <!-- Auto Generated Below --> ## Usage ### Angular ```typescript import { Component } from '@angular/core'; import { ActionSheetController } from '@ionic/angular'; @Component({ selector: 'action-sheet-example', templateUrl: 'action-sheet-example.html', styleUrls: ['./action-sheet-example.css'], }) export class ActionSheetExample { constructor(public actionSheetController: ActionSheetController) {} async presentActionSheet() { const actionSheet = await this.actionSheetController.create({ header: 'Albums', cssClass: 'my-custom-class', buttons: [{ text: 'Delete', role: 'destructive', icon: 'trash', id: 'delete-button', data: { type: 'delete' }, handler: () => { console.log('Delete clicked'); } }, { text: 'Share', icon: 'share', data: 10, handler: () => { console.log('Share clicked'); } }, { text: 'Play (open modal)', icon: 'caret-forward-circle', data: 'Data value', handler: () => { console.log('Play clicked'); } }, { text: 'Favorite', icon: 'heart', handler: () => { console.log('Favorite clicked'); } }, { text: 'Cancel', icon: 'close', role: 'cancel', handler: () => { console.log('Cancel clicked'); } }] }); await actionSheet.present(); const { role, data } = await actionSheet.onDidDismiss(); console.log('onDidDismiss resolved with role and data', role, data); } } ``` ### Style Placement In Angular, the CSS of a specific page is scoped only to elements of that page. Even though the Action Sheet can be presented from within a page, the `ion-action-sheet` element is appended outside of the current page. This means that any custom styles need to go in a global stylesheet file. In an Ionic Angular starter this can be the `src/global.scss` file or you can register a new global style file by [adding to the `styles` build option in `angular.json`](https://angular.io/guide/workspace-config#style-script-config). ### Javascript ```javascript async function presentActionSheet() { const actionSheet = document.createElement('ion-action-sheet'); actionSheet.header = 'Albums'; actionSheet.cssClass = 'my-custom-class'; actionSheet.buttons = [{ text: 'Delete', role: 'destructive', icon: 'trash', id: 'delete-button', data: { type: 'delete' }, handler: () => { console.log('Delete clicked'); } }, { text: 'Share', icon: 'share', data: 10, handler: () => { console.log('Share clicked'); } }, { text: 'Play (open modal)', icon: 'caret-forward-circle', data: 'Data value', handler: () => { console.log('Play clicked'); } }, { text: 'Favorite', icon: 'heart', handler: () => { console.log('Favorite clicked'); } }, { text: 'Cancel', icon: 'close', role: 'cancel', handler: () => { console.log('Cancel clicked'); } }]; document.body.appendChild(actionSheet); await actionSheet.present(); const { role, data } = await actionSheet.onDidDismiss(); console.log('onDidDismiss resolved with role and data', role, data); } ``` ### React ```tsx /* Using with useIonActionSheet Hook */ import React from 'react'; import { IonButton, IonContent, IonPage, useIonActionSheet, } from '@ionic/react'; const ActionSheetExample: React.FC = () => { const [present, dismiss] = useIonActionSheet(); return ( <IonPage> <IonContent> <IonButton expand="block" onClick={() => present({ buttons: [{ text: 'Ok' }, { text: 'Cancel' }], header: 'Action Sheet' }) } > Show ActionSheet </IonButton> <IonButton expand="block" onClick={() => present([{ text: 'Ok' }, { text: 'Cancel' }], 'Action Sheet') } > Show ActionSheet using params </IonButton> <IonButton expand="block" onClick={() => { present([{ text: 'Ok' }, { text: 'Cancel' }], 'Action Sheet'); setTimeout(dismiss, 3000); }} > Show ActionSheet, hide after 3 seconds </IonButton> </IonContent> </IonPage> ); }; ``` ```tsx /* Using with IonActionSheet Component */ import React, { useState } from 'react'; import { IonActionSheet, IonContent, IonButton } from '@ionic/react'; import { trash, share, caretForwardCircle, heart, close } from 'ionicons/icons'; export const ActionSheetExample: React.FC = () => { const [showActionSheet, setShowActionSheet] = useState(false); return ( <IonContent> <IonButton onClick={() => setShowActionSheet(true)} expand="block"> Show Action Sheet </IonButton> <IonActionSheet isOpen={showActionSheet} onDidDismiss={() => setShowActionSheet(false)} cssClass='my-custom-class' buttons={[{ text: 'Delete', role: 'destructive', icon: trash, id: 'delete-button', data: { type: 'delete' }, handler: () => { console.log('Delete clicked'); } }, { text: 'Share', icon: share, data: 10, handler: () => { console.log('Share clicked'); } }, { text: 'Play (open modal)', icon: caretForwardCircle, data: 'Data value', handler: () => { console.log('Play clicked'); } }, { text: 'Favorite', icon: heart, handler: () => { console.log('Favorite clicked'); } }, { text: 'Cancel', icon: close, role: 'cancel', handler: () => { console.log('Cancel clicked'); } }]} > </IonActionSheet> </IonContent> ); } ``` ### Stencil ```tsx import { Component, h } from '@stencil/core'; import { actionSheetController } from '@ionic/core'; @Component({ tag: 'action-sheet-example', styleUrl: 'action-sheet-example.css' }) export class ActionSheetExample { async presentActionSheet() { const actionSheet = await actionSheetController.create({ header: 'Albums', cssClass: 'my-custom-class', buttons: [{ text: 'Delete', role: 'destructive', icon: 'trash', id: 'delete-button', data: { type: 'delete' }, handler: () => { console.log('Delete clicked'); } }, { text: 'Share', icon: 'share', data: 10, handler: () => { console.log('Share clicked'); } }, { text: 'Play (open modal)', icon: 'caret-forward-circle', data: 'Data value', handler: () => { console.log('Play clicked'); } }, { text: 'Favorite', icon: 'heart', handler: () => { console.log('Favorite clicked'); } }, { text: 'Cancel', icon: 'close', role: 'cancel', handler: () => { console.log('Cancel clicked'); } }] }); await actionSheet.present(); const { role, data } = await actionSheet.onDidDismiss(); console.log('onDidDismiss resolved with role and data', role, data); } render() { return [ <ion-content> <ion-button onClick={() => this.presentActionSheet()}>Present Action Sheet</ion-button> </ion-content> ]; } } ``` ### Vue ```html <template> <ion-button @click="presentActionSheet">Show Action Sheet</ion-button> </template> <script> import { IonButton, actionSheetController } from '@ionic/vue'; import { defineComponent } from 'vue'; import { caretForwardCircle, close, heart, trash, share } from 'ionicons/icons'; export default defineComponent({ components: { IonButton }, methods: { async presentActionSheet() { const actionSheet = await actionSheetController .create({ header: 'Albums', cssClass: 'my-custom-class', buttons: [ { text: 'Delete', role: 'destructive', icon: trash, id: 'delete-button', data: { type: 'delete' }, handler: () => { console.log('Delete clicked') }, }, { text: 'Share', icon: share, data: 10, handler: () => { console.log('Share clicked') }, }, { text: 'Play (open modal)', icon: caretForwardCircle, data: 'Data value', handler: () => { console.log('Play clicked') }, }, { text: 'Favorite', icon: heart, handler: () => { console.log('Favorite clicked') }, }, { text: 'Cancel', icon: close, role: 'cancel', handler: () => { console.log('Cancel clicked') }, }, ], }); await actionSheet.present(); const { role, data } = await actionSheet.onDidDismiss(); console.log('onDidDismiss resolved with role and data', role, data); }, }, }); </script> ``` Developers can also use this component directly in their template: ```html <template> <ion-button @click="setOpen(true)">Show Action Sheet</ion-button> <ion-action-sheet :is-open="isOpenRef" header="Albums" css-class="my-custom-class" :buttons="buttons" @didDismiss="setOpen(false)" > </ion-action-sheet> </template> <script> import { IonActionSheet, IonButton } from '@ionic/vue'; import { defineComponent, ref } from 'vue'; import { caretForwardCircle, close, heart, trash, share } from 'ionicons/icons'; export default defineComponent({ components: { IonActionSheet, IonButton }, setup() { const isOpenRef = ref(false); const setOpen = (state: boolean) => isOpenRef.value = state; const buttons = [ { text: 'Delete', role: 'destructive', icon: trash, data: { type: 'delete' } handler: () => { console.log('Delete clicked') }, }, { text: 'Share', icon: share, data: 10, handler: () => { console.log('Share clicked') }, }, { text: 'Play (open modal)', icon: caretForwardCircle, data: 'Data value', handler: () => { console.log('Play clicked') }, }, { text: 'Favorite', icon: heart, handler: () => { console.log('Favorite clicked') }, }, { text: 'Cancel', icon: close, role: 'cancel', handler: () => { console.log('Cancel clicked') }, }, ]; return { buttons, isOpenRef, setOpen } } }); </script> ``` ## Properties | Property | Attribute | Description | Type | Default | | ----------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ----------- | | `animated` | `animated` | If `true`, the action sheet will animate. | `boolean` | `true` | | `backdropDismiss` | `backdrop-dismiss` | If `true`, the action sheet will be dismissed when the backdrop is clicked. | `boolean` | `true` | | `buttons` | -- | An array of buttons for the action sheet. | `(string \| ActionSheetButton<any>)[]` | `[]` | | `cssClass` | `css-class` | Additional classes to apply for custom CSS. If multiple classes are provided they should be separated by spaces. | `string \| string[] \| undefined` | `undefined` | | `enterAnimation` | -- | Animation to use when the action sheet is presented. | `((baseEl: any, opts?: any) => Animation) \| undefined` | `undefined` | | `header` | `header` | Title for the action sheet. | `string \| undefined` | `undefined` | | `htmlAttributes` | -- | Additional attributes to pass to the action sheet. | `ActionSheetAttributes \| undefined` | `undefined` | | `keyboardClose` | `keyboard-close` | If `true`, the keyboard will be automatically dismissed when the overlay is presented. | `boolean` | `true` | | `leaveAnimation` | -- | Animation to use when the action sheet is dismissed. | `((baseEl: any, opts?: any) => Animation) \| undefined` | `undefined` | | `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` | | `subHeader` | `sub-header` | Subtitle for the action sheet. | `string \| undefined` | `undefined` | | `translucent` | `translucent` | If `true`, the action sheet will be translucent. Only applies when the mode is `"ios"` and the device supports [`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility). | `boolean` | `false` | ## Events | Event | Description | Type | | --------------------------- | --------------------------------------- | -------------------------------------- | | `ionActionSheetDidDismiss` | Emitted after the alert has dismissed. | `CustomEvent<OverlayEventDetail<any>>` | | `ionActionSheetDidPresent` | Emitted after the alert has presented. | `CustomEvent<void>` | | `ionActionSheetWillDismiss` | Emitted before the alert has dismissed. | `CustomEvent<OverlayEventDetail<any>>` | | `ionActionSheetWillPresent` | Emitted before the alert has presented. | `CustomEvent<void>` | ## Methods ### `dismiss(data?: any, role?: string | undefined) => Promise<boolean>` Dismiss the action sheet overlay after it has been presented. #### Returns Type: `Promise<boolean>` ### `onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>>` Returns a promise that resolves when the action sheet did dismiss. #### Returns Type: `Promise<OverlayEventDetail<T>>` ### `onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>>` Returns a promise that resolves when the action sheet will dismiss. #### Returns Type: `Promise<OverlayEventDetail<T>>` ### `present() => Promise<void>` Present the action sheet overlay after it has been created. #### Returns Type: `Promise<void>` ## CSS Custom Properties | Name | Description | | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | | `--backdrop-opacity` | Opacity of the backdrop | | `--background` | Background of the action sheet group | | `--button-background` | Background of the action sheet button | | `--button-background-activated` | Background of the action sheet button when pressed. Note: setting this will interfere with the Material Design ripple. | | `--button-background-activated-opacity` | Opacity of the action sheet button background when pressed | | `--button-background-focused` | Background of the action sheet button when tabbed to | | `--button-background-focused-opacity` | Opacity of the action sheet button background when tabbed to | | `--button-background-hover` | Background of the action sheet button on hover | | `--button-background-hover-opacity` | Opacity of the action sheet button background on hover | | `--button-background-selected` | Background of the selected action sheet button | | `--button-background-selected-opacity` | Opacity of the selected action sheet button background | | `--button-color` | Color of the action sheet button | | `--button-color-activated` | Color of the action sheet button when pressed | | `--button-color-focused` | Color of the action sheet button when tabbed to | | `--button-color-hover` | Color of the action sheet button on hover | | `--button-color-selected` | Color of the selected action sheet button | | `--color` | Color of the action sheet text | | `--height` | height of the action sheet | | `--max-height` | Maximum height of the action sheet | | `--max-width` | Maximum width of the action sheet | | `--min-height` | Minimum height of the action sheet | | `--min-width` | Minimum width of the action sheet | | `--width` | Width of the action sheet | ## Dependencies ### Used by - [ion-select](../select) ### Depends on - [ion-backdrop](../backdrop) - ion-icon - [ion-ripple-effect](../ripple-effect) ### Graph ```mermaid graph TD; ion-action-sheet --> ion-backdrop ion-action-sheet --> ion-icon ion-action-sheet --> ion-ripple-effect ion-select --> ion-action-sheet style ion-action-sheet fill:#f9f,stroke:#333,stroke-width:4px ``` ---------------------------------------------- *Built with [StencilJS](https://stenciljs.com/)*
core/src/components/action-sheet/readme.md
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.9988810420036316, 0.11505142599344254, 0.00016269652405753732, 0.00020822708029299974, 0.31323185563087463 ]
{ "id": 10, "code_window": [ " compares.push(await page.compareScreenshot('should open custom alert select'));\n", "\n", " await alert.callMethod('dismiss');\n", "\n", " // Custom Popover Select\n", " select = await page.find('#customPopoverSelect');\n", " await select.click();\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " expect(ionDismiss).toHaveReceivedEvent();\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 46 }
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, h } from '@stencil/core'; import { getIonMode } from '../../global/ionic-global'; import { ActionSheetButton, ActionSheetOptions, AlertInput, AlertOptions, CssClassMap, OverlaySelect, PopoverOptions, SelectChangeEventDetail, SelectInterface, SelectPopoverOption, StyleEventDetail } from '../../interface'; import { findItemLabel, focusElement, getAriaLabel, renderHiddenInput } from '../../utils/helpers'; import { actionSheetController, alertController, popoverController } from '../../utils/overlays'; import { hostContext } from '../../utils/theme'; import { watchForOptions } from '../../utils/watch-options'; import { SelectCompareFn } from './select-interface'; /** * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. * * @part placeholder - The text displayed in the select when there is no value. * @part text - The displayed value of the select. * @part icon - The select icon container. */ @Component({ tag: 'ion-select', styleUrls: { ios: 'select.ios.scss', md: 'select.md.scss' }, shadow: true }) export class Select implements ComponentInterface { private inputId = `ion-sel-${selectIds++}`; private overlay?: OverlaySelect; private didInit = false; private focusEl?: HTMLButtonElement; private mutationO?: MutationObserver; @Element() el!: HTMLIonSelectElement; @State() isExpanded = false; /** * If `true`, the user cannot interact with the select. */ @Prop() disabled = false; /** * The text to display on the cancel button. */ @Prop() cancelText = 'Cancel'; /** * The text to display on the ok button. */ @Prop() okText = 'OK'; /** * The text to display when the select is empty. */ @Prop() placeholder?: string; /** * The name of the control, which is submitted with the form data. */ @Prop() name: string = this.inputId; /** * The text to display instead of the selected option's value. */ @Prop() selectedText?: string | null; /** * If `true`, the select can accept multiple values. */ @Prop() multiple = false; /** * The interface the select should use: `action-sheet`, `popover` or `alert`. */ @Prop() interface: SelectInterface = 'alert'; /** * Any additional options that the `alert`, `action-sheet` or `popover` interface * can take. See the [ion-alert docs](../alert), the * [ion-action-sheet docs](../action-sheet) and the * [ion-popover docs](../popover) for the * create options for each interface. * * Note: `interfaceOptions` will not override `inputs` or `buttons` with the `alert` interface. */ @Prop() interfaceOptions: any = {}; /** * A property name or function used to compare object values */ @Prop() compareWith?: string | SelectCompareFn | null; /** * the value of the select. */ @Prop({ mutable: true }) value?: any | null; /** * Emitted when the value has changed. */ @Event() ionChange!: EventEmitter<SelectChangeEventDetail>; /** * Emitted when the selection is cancelled. */ @Event() ionCancel!: EventEmitter<void>; /** * Emitted when the select has focus. */ @Event() ionFocus!: EventEmitter<void>; /** * Emitted when the select loses focus. */ @Event() ionBlur!: EventEmitter<void>; /** * Emitted when the styles change. * @internal */ @Event() ionStyle!: EventEmitter<StyleEventDetail>; @Watch('disabled') @Watch('placeholder') @Watch('isExpanded') styleChanged() { this.emitStyle(); } @Watch('value') valueChanged() { this.emitStyle(); if (this.didInit) { this.ionChange.emit({ value: this.value, }); } } async connectedCallback() { this.updateOverlayOptions(); this.emitStyle(); this.mutationO = watchForOptions<HTMLIonSelectOptionElement>(this.el, 'ion-select-option', async () => { this.updateOverlayOptions(); }); } disconnectedCallback() { if (this.mutationO) { this.mutationO.disconnect(); this.mutationO = undefined; } } componentDidLoad() { this.didInit = true; } /** * Open the select overlay. The overlay is either an alert, action sheet, or popover, * depending on the `interface` property on the `ion-select`. * * @param event The user interface event that called the open. */ @Method() async open(event?: UIEvent): Promise<any> { if (this.disabled || this.isExpanded) { return undefined; } const overlay = this.overlay = await this.createOverlay(event); this.isExpanded = true; overlay.onDidDismiss().then(() => { this.overlay = undefined; this.isExpanded = false; this.setFocus(); }); await overlay.present(); // focus selected option for popovers if (this.interface === 'popover') { let indexOfSelected = this.childOpts.map(o => o.value).indexOf(this.value); indexOfSelected = indexOfSelected > -1 ? indexOfSelected : 0; // default to first option if nothing selected const selectedEl = overlay.querySelector<HTMLElement>(`.select-interface-option:nth-child(${indexOfSelected + 1})`); if (selectedEl) { focusElement(selectedEl); } } return overlay; } private createOverlay(ev?: UIEvent): Promise<OverlaySelect> { let selectInterface = this.interface; if (selectInterface === 'action-sheet' && this.multiple) { console.warn(`Select interface cannot be "${selectInterface}" with a multi-value select. Using the "alert" interface instead.`); selectInterface = 'alert'; } if (selectInterface === 'popover' && !ev) { console.warn(`Select interface cannot be a "${selectInterface}" without passing an event. Using the "alert" interface instead.`); selectInterface = 'alert'; } if (selectInterface === 'action-sheet') { return this.openActionSheet(); } if (selectInterface === 'popover') { return this.openPopover(ev!); } return this.openAlert(); } private updateOverlayOptions(): void { const overlay = (this.overlay as any); if (!overlay) { return; } const childOpts = this.childOpts; const value = this.value; switch (this.interface) { case 'action-sheet': overlay.buttons = this.createActionSheetButtons(childOpts, value); break; case 'popover': const popover = overlay.querySelector('ion-select-popover'); if (popover) { popover.options = this.createPopoverOptions(childOpts, value); } break; case 'alert': const inputType = (this.multiple ? 'checkbox' : 'radio'); overlay.inputs = this.createAlertInputs(childOpts, inputType, value); break; } } private createActionSheetButtons(data: HTMLIonSelectOptionElement[], selectValue: any): ActionSheetButton[] { const actionSheetButtons = data.map(option => { const value = getOptionValue(option); // Remove hydrated before copying over classes const copyClasses = Array.from(option.classList).filter(cls => cls !== 'hydrated').join(' '); const optClass = `${OPTION_CLASS} ${copyClasses}`; return { role: (isOptionSelected(selectValue, value, this.compareWith) ? 'selected' : ''), text: option.textContent, cssClass: optClass, handler: () => { this.value = value; } } as ActionSheetButton; }); // Add "cancel" button actionSheetButtons.push({ text: this.cancelText, role: 'cancel', handler: () => { this.ionCancel.emit(); } }); return actionSheetButtons; } private createAlertInputs(data: HTMLIonSelectOptionElement[], inputType: 'checkbox' | 'radio', selectValue: any): AlertInput[] { const alertInputs = data.map(option => { const value = getOptionValue(option); // Remove hydrated before copying over classes const copyClasses = Array.from(option.classList).filter(cls => cls !== 'hydrated').join(' '); const optClass = `${OPTION_CLASS} ${copyClasses}`; return { type: inputType, cssClass: optClass, label: option.textContent || '', value, checked: isOptionSelected(selectValue, value, this.compareWith), disabled: option.disabled }; }); return alertInputs; } private createPopoverOptions(data: HTMLIonSelectOptionElement[], selectValue: any): SelectPopoverOption[] { const popoverOptions = data.map(option => { const value = getOptionValue(option); // Remove hydrated before copying over classes const copyClasses = Array.from(option.classList).filter(cls => cls !== 'hydrated').join(' '); const optClass = `${OPTION_CLASS} ${copyClasses}`; return { text: option.textContent || '', cssClass: optClass, value, checked: isOptionSelected(selectValue, value, this.compareWith), disabled: option.disabled, handler: (selected: any) => { this.value = selected; if (!this.multiple) { this.close(); } } }; }); return popoverOptions; } private async openPopover(ev: UIEvent) { const interfaceOptions = this.interfaceOptions; const mode = getIonMode(this); const showBackdrop = mode === 'md' ? false : true; const multiple = this.multiple; const value = this.value; let event: Event | CustomEvent = ev; let size = 'auto'; const item = this.el.closest('ion-item'); // If the select is inside of an item containing a floating // or stacked label then the popover should take up the // full width of the item when it presents if (item && (item.classList.contains('item-label-floating') || item.classList.contains('item-label-stacked'))) { event = { ...ev, detail: { ionShadowTarget: item } } size = 'cover'; } const popoverOpts: PopoverOptions = { mode, event, alignment: 'center', size, showBackdrop, ...interfaceOptions, component: 'ion-select-popover', cssClass: ['select-popover', interfaceOptions.cssClass], componentProps: { header: interfaceOptions.header, subHeader: interfaceOptions.subHeader, message: interfaceOptions.message, multiple, value, options: this.createPopoverOptions(this.childOpts, value) } }; /** * Workaround for Stencil to autodefine * ion-select-popover and ion-popover when * using Custom Elements build. */ // tslint:disable-next-line if (false) { // @ts-ignore document.createElement('ion-select-popover'); document.createElement('ion-popover'); } return popoverController.create(popoverOpts); } private async openActionSheet() { const mode = getIonMode(this); const interfaceOptions = this.interfaceOptions; const actionSheetOpts: ActionSheetOptions = { mode, ...interfaceOptions, buttons: this.createActionSheetButtons(this.childOpts, this.value), cssClass: ['select-action-sheet', interfaceOptions.cssClass] }; /** * Workaround for Stencil to autodefine * ion-action-sheet when * using Custom Elements build. */ // tslint:disable-next-line if (false) { // @ts-ignore document.createElement('ion-action-sheet'); } return actionSheetController.create(actionSheetOpts); } private async openAlert() { const label = this.getLabel(); const labelText = (label) ? label.textContent : null; const interfaceOptions = this.interfaceOptions; const inputType = (this.multiple ? 'checkbox' : 'radio'); const mode = getIonMode(this); const alertOpts: AlertOptions = { mode, ...interfaceOptions, header: interfaceOptions.header ? interfaceOptions.header : labelText, inputs: this.createAlertInputs(this.childOpts, inputType, this.value), buttons: [ { text: this.cancelText, role: 'cancel', handler: () => { this.ionCancel.emit(); } }, { text: this.okText, handler: (selectedValues: any) => { this.value = selectedValues; } } ], cssClass: ['select-alert', interfaceOptions.cssClass, (this.multiple ? 'multiple-select-alert' : 'single-select-alert')] }; /** * Workaround for Stencil to autodefine * ion-alert when * using Custom Elements build. */ // tslint:disable-next-line if (false) { // @ts-ignore document.createElement('ion-alert'); } return alertController.create(alertOpts); } /** * Close the select interface. */ private close(): Promise<boolean> { // TODO check !this.overlay || !this.isFocus() if (!this.overlay) { return Promise.resolve(false); } return this.overlay.dismiss(); } private getLabel() { return findItemLabel(this.el); } private hasValue(): boolean { return this.getText() !== ''; } private get childOpts() { return Array.from(this.el.querySelectorAll('ion-select-option')); } private getText(): string { const selectedText = this.selectedText; if (selectedText != null && selectedText !== '') { return selectedText; } return generateText(this.childOpts, this.value, this.compareWith); } private setFocus() { if (this.focusEl) { this.focusEl.focus(); } } private emitStyle() { this.ionStyle.emit({ 'interactive': true, 'interactive-disabled': this.disabled, 'select': true, 'select-disabled': this.disabled, 'has-placeholder': this.placeholder !== undefined, 'has-value': this.hasValue(), 'has-focus': this.isExpanded, }); } private onClick = (ev: UIEvent) => { this.setFocus(); this.open(ev); } private onFocus = () => { this.ionFocus.emit(); } private onBlur = () => { this.ionBlur.emit(); } render() { const { disabled, el, inputId, isExpanded, name, placeholder, value } = this; const mode = getIonMode(this); const { labelText, labelId } = getAriaLabel(el, inputId); renderHiddenInput(true, el, name, parseValue(value), disabled); const displayValue = this.getText(); let addPlaceholderClass = false; let selectText = displayValue; if (selectText === '' && placeholder !== undefined) { selectText = placeholder; addPlaceholderClass = true; } const selectTextClasses: CssClassMap = { 'select-text': true, 'select-placeholder': addPlaceholderClass }; const textPart = addPlaceholderClass ? 'placeholder' : 'text'; // If there is a label then we need to concatenate it with the // current value (or placeholder) and a comma so it separates // nicely when the screen reader announces it, otherwise just // announce the value / placeholder const displayLabel = labelText !== undefined ? (selectText !== '' ? `${selectText}, ${labelText}` : labelText) : selectText; return ( <Host onClick={this.onClick} role="button" aria-haspopup="listbox" aria-disabled={disabled ? 'true' : null} aria-label={displayLabel} class={{ [mode]: true, 'in-item': hostContext('ion-item', el), 'select-disabled': disabled, 'select-expanded': isExpanded }} > <div aria-hidden="true" class={selectTextClasses} part={textPart}> {selectText} </div> <div class="select-icon" role="presentation" part="icon"> <div class="select-icon-inner"></div> </div> <label id={labelId}> {displayLabel} </label> <button type="button" disabled={disabled} id={inputId} aria-labelledby={labelId} aria-haspopup="listbox" aria-expanded={`${isExpanded}`} onFocus={this.onFocus} onBlur={this.onBlur} ref={(focusEl => this.focusEl = focusEl)} ></button> </Host> ); } } const isOptionSelected = (currentValue: any[] | any, compareValue: any, compareWith?: string | SelectCompareFn | null) => { if (currentValue === undefined) { return false; } if (Array.isArray(currentValue)) { return currentValue.some(val => compareOptions(val, compareValue, compareWith)); } else { return compareOptions(currentValue, compareValue, compareWith); } }; const getOptionValue = (el: HTMLIonSelectOptionElement) => { const value = el.value; return (value === undefined) ? el.textContent || '' : value; }; const parseValue = (value: any) => { if (value == null) { return undefined; } if (Array.isArray(value)) { return value.join(','); } return value.toString(); }; const compareOptions = (currentValue: any, compareValue: any, compareWith?: string | SelectCompareFn | null): boolean => { if (typeof compareWith === 'function') { return compareWith(currentValue, compareValue); } else if (typeof compareWith === 'string') { return currentValue[compareWith] === compareValue[compareWith]; } else { return Array.isArray(compareValue) ? compareValue.includes(currentValue) : currentValue === compareValue; } }; const generateText = (opts: HTMLIonSelectOptionElement[], value: any | any[], compareWith?: string | SelectCompareFn | null) => { if (value === undefined) { return ''; } if (Array.isArray(value)) { return value .map(v => textForValue(opts, v, compareWith)) .filter(opt => opt !== null) .join(', '); } else { return textForValue(opts, value, compareWith) || ''; } }; const textForValue = (opts: HTMLIonSelectOptionElement[], value: any, compareWith?: string | SelectCompareFn | null): string | null => { const selectOpt = opts.find(opt => { return compareOptions(getOptionValue(opt), value, compareWith); }); return selectOpt ? selectOpt.textContent : null; }; let selectIds = 0; const OPTION_CLASS = 'select-interface-option';
core/src/components/select/select.tsx
1
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.004720041994005442, 0.0004653228388633579, 0.0001633012725505978, 0.00017465803830418736, 0.0008318489417433739 ]
{ "id": 10, "code_window": [ " compares.push(await page.compareScreenshot('should open custom alert select'));\n", "\n", " await alert.callMethod('dismiss');\n", "\n", " // Custom Popover Select\n", " select = await page.find('#customPopoverSelect');\n", " await select.click();\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " expect(ionDismiss).toHaveReceivedEvent();\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 46 }
```html <ion-content> <ion-infinite-scroll> <ion-infinite-scroll-content loadingSpinner="bubbles" loadingText="Loading more data…"> </ion-infinite-scroll-content> </ion-infinite-scroll> </ion-content> ```
core/src/components/infinite-scroll-content/usage/angular.md
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017303817730862647, 0.00016855438298080117, 0.00016407058865297586, 0.00016855438298080117, 0.000004483794327825308 ]
{ "id": 10, "code_window": [ " compares.push(await page.compareScreenshot('should open custom alert select'));\n", "\n", " await alert.callMethod('dismiss');\n", "\n", " // Custom Popover Select\n", " select = await page.find('#customPopoverSelect');\n", " await select.click();\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " expect(ionDismiss).toHaveReceivedEvent();\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 46 }
@import "./note.md.vars"; @import "./note"; // Material Design Note // -------------------------------------------------- :host { --color: #{$note-md-color}; font-size: $note-md-font-size; }
core/src/components/note/note.md.scss
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.0001785043132258579, 0.0001774532429408282, 0.0001764021726557985, 0.0001774532429408282, 0.0000010510702850297093 ]
{ "id": 10, "code_window": [ " compares.push(await page.compareScreenshot('should open custom alert select'));\n", "\n", " await alert.callMethod('dismiss');\n", "\n", " // Custom Popover Select\n", " select = await page.find('#customPopoverSelect');\n", " await select.click();\n" ], "labels": [ "keep", "keep", "keep", "add", "keep", "keep", "keep" ], "after_edit": [ " expect(ionDismiss).toHaveReceivedEvent();\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 46 }
import { newE2EPage } from '@stencil/core/testing'; test('button: expand', async () => { const page = await newE2EPage({ url: '/src/components/button/test/expand?ionic:_testing=true' }); const compare = await page.compareScreenshot(); expect(compare).toMatchScreenshot(); });
core/src/components/button/test/expand/e2e.ts
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.002502360614016652, 0.0013376993592828512, 0.00017303817730862647, 0.0013376993592828512, 0.001164661138318479 ]
{ "id": 12, "code_window": [ "\n", " compares.push(await page.compareScreenshot('should open custom action sheet select'));\n", "\n", " await actionSheet.callMethod('dismiss');\n", "\n", " for (const compare of compares) {\n", " expect(compare).toMatchScreenshot();\n", " }\n", "});\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " expect(ionDismiss).toHaveReceivedEvent();\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 86 }
import { newE2EPage } from '@stencil/core/testing'; test('select: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true' }); const compares = []; compares.push(await page.compareScreenshot()); // Gender Alert Select let select = await page.find('#gender'); await select.click(); let alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open gender single select')); await alert.callMethod('dismiss'); // Skittles Action Sheet Select select = await page.find('#skittles'); await select.click(); let actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open skittles action sheet select')); await actionSheet.callMethod('dismiss'); // Custom Alert Select select = await page.find('#customAlertSelect'); await select.click(); alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom alert select')); await alert.callMethod('dismiss'); // Custom Popover Select select = await page.find('#customPopoverSelect'); await select.click(); let popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom popover select')); // select has no value, so first option should be focused by default const popoverOption1 = await popover.find('.select-interface-option:first-child'); expect(popoverOption1).toHaveClass('ion-focused'); let popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); await popoverOption2.click(); await page.waitForTimeout(500); await select.click(); popover = await page.find('ion-popover'); await popover.waitForVisible(); await page.waitForTimeout(250); popoverOption2 = await popover.find('.select-interface-option:nth-child(2)'); expect(popoverOption2).toHaveClass('ion-focused'); await popover.callMethod('dismiss'); // Custom Action Sheet Select select = await page.find('#customActionSheetSelect'); await select.click(); actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitForTimeout(250); compares.push(await page.compareScreenshot('should open custom action sheet select')); await actionSheet.callMethod('dismiss'); for (const compare of compares) { expect(compare).toMatchScreenshot(); } }); test('select:rtl: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true&rtl=true' }); const compares = []; compares.push(await page.compareScreenshot()); for (const compare of compares) { expect(compare).toMatchScreenshot(); } });
core/src/components/select/test/basic/e2e.ts
1
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.9979735016822815, 0.2737226188182831, 0.00016647789743728936, 0.013255089521408081, 0.39931437373161316 ]
{ "id": 12, "code_window": [ "\n", " compares.push(await page.compareScreenshot('should open custom action sheet select'));\n", "\n", " await actionSheet.callMethod('dismiss');\n", "\n", " for (const compare of compares) {\n", " expect(compare).toMatchScreenshot();\n", " }\n", "});\n", "\n" ], "labels": [ "keep", "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ], "after_edit": [ " expect(ionDismiss).toHaveReceivedEvent();\n", "\n" ], "file_path": "core/src/components/select/test/basic/e2e.ts", "type": "add", "edit_start_line_idx": 86 }
@import "../../themes/ionic.globals.md";
core/src/components/backdrop/backdrop.md.vars.scss
0
https://github.com/ionic-team/ionic-framework/commit/b835b7c0c7840f41c54f96743cc0a779ff474ab6
[ 0.00017928608576767147, 0.00017928608576767147, 0.00017928608576767147, 0.00017928608576767147, 0 ]