@vue/devtools-kit 9.0.0-rc.1 → 9.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,3 @@
1
- import { CreatePageScriptChannelOptions, PageScriptChannel } from "devframe/in-page-channel";
2
- //#region src/runtime/budget.d.ts
3
1
  interface RuntimeBudget {
4
2
  components: {
5
3
  autoTrack: boolean;
@@ -27,8 +25,6 @@ interface RuntimeBudget {
27
25
  declare const defaultRuntimeBudget: RuntimeBudget;
28
26
  type RuntimeBudgetInput = Partial<{ [K in keyof RuntimeBudget]: Partial<RuntimeBudget[K]>; }>;
29
27
  declare function resolveRuntimeBudget(input?: RuntimeBudgetInput): RuntimeBudget;
30
- //#endregion
31
- //#region src/codec/handles.d.ts
32
28
  type ValueHandle = string;
33
29
  interface ValueHandleEntry {
34
30
  handle: ValueHandle;
@@ -55,8 +51,6 @@ declare class ValueHandleRegistry {
55
51
  clear(): void;
56
52
  private evictOverflow;
57
53
  }
58
- //#endregion
59
- //#region src/codec/encode.d.ts
60
54
  interface ValueEntry {
61
55
  key: string;
62
56
  value: EncodedValue;
@@ -153,8 +147,26 @@ interface ValueCodecOptions {
153
147
  declare function encodeValue(value: unknown, options?: ValueCodecOptions): EncodedValue;
154
148
  declare function safeOwnEnumerableStringKeys(value: object): string[];
155
149
  declare function formatPreviewKey(value: unknown): string;
156
- //#endregion
157
- //#region src/plugin/api.d.ts
150
+ interface PluginSettingsChange {
151
+ key: string;
152
+ value: unknown;
153
+ oldValue: unknown;
154
+ settings: Record<string, unknown>;
155
+ }
156
+ /**
157
+ * Setting values for one plugin id. Adapters that register the same id for several apps
158
+ * share one instance, so a change reaches every app's `setPluginSettings` handlers.
159
+ */
160
+ declare class PluginSettings {
161
+ private readonly descriptor;
162
+ private values;
163
+ private readonly listeners;
164
+ constructor(descriptor: PluginDescriptor);
165
+ get(): Record<string, unknown>;
166
+ sync(): void;
167
+ subscribe(listener: (change: PluginSettingsChange) => Promise<void>): () => void;
168
+ update(key: string, value: unknown): Promise<void>;
169
+ }
158
170
  interface PluginDescriptor {
159
171
  id: PluginId;
160
172
  label?: string;
@@ -325,10 +337,8 @@ interface PluginApiAdapter {
325
337
  clearHooks(): void;
326
338
  callHook<K extends keyof DevToolsPluginAPIHooks>(key: K, payload: Parameters<DevToolsPluginAPIHooks[K]>[0]): Promise<void>;
327
339
  }
328
- declare function createPluginApiAdapter(descriptor: PluginDescriptor, runtime: DevtoolsRuntime, resolvePluginSettings?: (pluginId: string) => Record<string, unknown> | undefined): PluginApiAdapter;
340
+ declare function createPluginApiAdapter(descriptor: PluginDescriptor, runtime: DevtoolsRuntime, resolvePluginSettings?: (pluginId: string) => Record<string, unknown> | undefined, settings?: PluginSettings): PluginApiAdapter;
329
341
  declare function reportPluginError(pluginId: PluginId, context: string, error: unknown): void;
330
- //#endregion
331
- //#region src/protocol/messages.d.ts
332
342
  interface AppSnapshot {
333
343
  id: AppId;
334
344
  name: string;
@@ -509,8 +519,6 @@ type StateValueMessage = {
509
519
  snapshotId?: string;
510
520
  pagination?: StatePagination;
511
521
  };
512
- //#endregion
513
- //#region src/protocol/patches.d.ts
514
522
  type ComponentTreePatch = {
515
523
  op: 'insert';
516
524
  parentId?: ComponentId;
@@ -528,8 +536,6 @@ type ComponentTreePatch = {
528
536
  parentId: ComponentId;
529
537
  children: ComponentId[];
530
538
  };
531
- //#endregion
532
- //#region src/runtime/types.d.ts
533
539
  type AppId = string;
534
540
  type ComponentId = string;
535
541
  type InspectorId = string;
@@ -681,8 +687,6 @@ interface RuntimeCommandResult {
681
687
  error?: unknown;
682
688
  }
683
689
  type RuntimeEventHandler<TEvent extends RuntimeDomainEvent = RuntimeDomainEvent> = (event: TEvent) => void;
684
- //#endregion
685
- //#region src/runtime/registry.d.ts
686
690
  interface ComponentRecord {
687
691
  id: ComponentId;
688
692
  uid?: number | string;
@@ -715,12 +719,14 @@ interface AppRecord {
715
719
  app: AppRef;
716
720
  vueTypes?: VueTypeMap;
717
721
  rootInstance?: InstanceRef;
722
+ vapor?: boolean;
718
723
  components: Map<ComponentId, ComponentRecord>;
719
724
  createdAt: number;
720
725
  updatedAt: number;
721
726
  }
722
727
  type ComponentSnapshot = ComponentTreeNodeSnapshot;
723
728
  interface ComponentRecordOverrides {
729
+ renderKey?: unknown;
724
730
  inactive?: boolean;
725
731
  tags?: ComponentTreeNodeTag[];
726
732
  domOrder?: number[];
@@ -731,6 +737,7 @@ interface WalkedComponentChild {
731
737
  instance: InstanceRef;
732
738
  tags?: ComponentTreeNodeTag[];
733
739
  inactive?: boolean;
740
+ renderKey?: unknown;
734
741
  }
735
742
  declare class ComponentDomOrderCache {
736
743
  private parents;
@@ -747,6 +754,7 @@ declare class RuntimeRegistry {
747
754
  private apps;
748
755
  private componentIds;
749
756
  private retiredApps;
757
+ private vaporChildren;
750
758
  private eventDomOrder?;
751
759
  private getEventDomOrder;
752
760
  apply(event: RuntimeEvent): AppRecord | ComponentRecord | undefined;
@@ -756,6 +764,9 @@ declare class RuntimeRegistry {
756
764
  ensureComponent(appId: AppId, instance: InstanceRef, parent: InstanceRef | undefined, time: number, forcedUid?: string, overrides?: ComponentRecordOverrides, domOrderCache?: ComponentDomOrderCache): ComponentRecord | undefined;
757
765
  refreshComponentTree(appId: AppId, options?: RefreshComponentTreeOptions): ComponentRecord[];
758
766
  removeComponent(appId: AppId, componentId?: ComponentId, instance?: InstanceRef): ComponentRecord | undefined;
767
+ getInstanceChildren(instance: InstanceRef): WalkedComponentChild[];
768
+ trackVaporChild(instance: InstanceRef): void;
769
+ untrackVaporChild(instance: InstanceRef): void;
759
770
  getApp(appId: AppId): AppRecord | undefined;
760
771
  getAppByRef(app: AppRef): AppRecord | undefined;
761
772
  listApps(): AppRecord[];
@@ -766,12 +777,11 @@ declare class RuntimeRegistry {
766
777
  getComponentChildCount(record: ComponentRecord): number;
767
778
  getComponentChildren(record: ComponentRecord): WalkedComponentChild[];
768
779
  refreshChild(parent: ComponentRecord, child: WalkedComponentChild, cache: ComponentDomOrderCache): ComponentRecord | undefined;
780
+ refreshDomOrder(record: ComponentRecord, cache: ComponentDomOrderCache): void;
769
781
  toAppSnapshot(record: AppRecord): AppSnapshot;
770
782
  toComponentSnapshot(record: ComponentRecord): ComponentSnapshot;
771
783
  }
772
784
  declare function readComponentName(instance: object): string;
773
- //#endregion
774
- //#region src/runtime/inspectors.d.ts
775
785
  interface RuntimeInspectorAction {
776
786
  icon: string;
777
787
  tooltip?: string;
@@ -807,8 +817,6 @@ declare class RuntimeInspectorStore {
807
817
  clear(): void;
808
818
  private toInfo;
809
819
  }
810
- //#endregion
811
- //#region src/runtime/performance.d.ts
812
820
  interface RuntimePerformanceSnapshot {
813
821
  receivedEvents: number;
814
822
  emittedEvents: number;
@@ -829,8 +837,6 @@ interface RuntimePerformanceMonitor {
829
837
  setCollectionState(active: boolean, attachedClients: number): void;
830
838
  }
831
839
  declare function createRuntimePerformanceMonitor(collectionActive: boolean): RuntimePerformanceMonitor;
832
- //#endregion
833
- //#region src/protocol/requests.d.ts
834
840
  type ComponentTarget = {
835
841
  componentId: string;
836
842
  } | {
@@ -1101,8 +1107,6 @@ interface RuntimeRequests {
1101
1107
  queryCustom<T = unknown>(request: RuntimeQuery): Promise<T>;
1102
1108
  commandCustom(request: RuntimeCommand): Promise<RuntimeCommandResult>;
1103
1109
  }
1104
- //#endregion
1105
- //#region src/runtime/components.d.ts
1106
1110
  interface ComponentTreeSnapshot {
1107
1111
  appId?: AppId;
1108
1112
  version: number;
@@ -1141,6 +1145,7 @@ declare class ComponentTreeStore {
1141
1145
  isVisible(appId: AppId, componentId: ComponentId): boolean;
1142
1146
  touch(record: ComponentRecord): ComponentTreePatchBatch | undefined;
1143
1147
  removeApp(appId: AppId): void;
1148
+ private refreshChildOrder;
1144
1149
  private upsert;
1145
1150
  private remove;
1146
1151
  private commit;
@@ -1158,8 +1163,6 @@ declare class ComponentTreeStore {
1158
1163
  private isPatchVisible;
1159
1164
  private pruneToVisible;
1160
1165
  }
1161
- //#endregion
1162
- //#region src/runtime/events.d.ts
1163
1166
  interface RuntimeEventLog {
1164
1167
  dispatch(event: RuntimeDomainEvent): void;
1165
1168
  subscribe(type: '*', handler: RuntimeEventHandler): () => void;
@@ -1169,16 +1172,12 @@ interface RuntimeEventLog {
1169
1172
  clear(): void;
1170
1173
  }
1171
1174
  declare function createRuntimeEventLog(): RuntimeEventLog;
1172
- //#endregion
1173
- //#region src/runtime/scheduler.d.ts
1174
1175
  interface RuntimeScheduler {
1175
1176
  schedule(key: string, task: () => MaybePromise<void>, delayMs?: number): boolean;
1176
1177
  flush(): Promise<void>;
1177
1178
  clear(): void;
1178
1179
  }
1179
1180
  declare function createRuntimeScheduler(): RuntimeScheduler;
1180
- //#endregion
1181
- //#region src/runtime/state/index.d.ts
1182
1181
  interface LegacyComponentStateEntry {
1183
1182
  type?: string;
1184
1183
  key?: string | number | symbol;
@@ -1241,8 +1240,6 @@ declare class ComponentStateCollector {
1241
1240
  private collectReactivityGraph;
1242
1241
  private getReactivityGraphNodeId;
1243
1242
  }
1244
- //#endregion
1245
- //#region src/runtime/runtime.d.ts
1246
1243
  type RuntimeQueryHandler<T = unknown> = (query: RuntimeQuery, runtime: DevtoolsRuntime) => MaybePromise<T>;
1247
1244
  type RuntimeCommandHandler<Payload = unknown> = (command: RuntimeCommand<Payload>, runtime: DevtoolsRuntime) => MaybePromise<RuntimeCommandResult | void>;
1248
1245
  interface DevtoolsRuntime extends RuntimeRequests {
@@ -1273,8 +1270,6 @@ interface CreateDevtoolsRuntimeOptions {
1273
1270
  componentInspectorDockController?: ComponentInspectorDockController;
1274
1271
  }
1275
1272
  declare function createDevtoolsRuntime(options?: CreateDevtoolsRuntimeOptions): DevtoolsRuntime;
1276
- //#endregion
1277
- //#region src/runtime/component-inspector.d.ts
1278
1273
  interface ComponentBounds {
1279
1274
  left: number;
1280
1275
  top: number;
@@ -1285,16 +1280,12 @@ type ComponentInspectorDockRestore = () => Promise<void> | void;
1285
1280
  interface ComponentInspectorDockController {
1286
1281
  closeForComponentInspection(): Promise<ComponentInspectorDockRestore | undefined> | ComponentInspectorDockRestore | undefined;
1287
1282
  }
1288
- //#endregion
1289
- //#region src/rpc/constants.d.ts
1290
1283
  declare const DEVTOOLS_RPC_QUERY = "devtools:query";
1291
1284
  declare const DEVTOOLS_RPC_COMMAND = "devtools:command";
1292
1285
  declare const DEVTOOLS_RPC_EVENT = "devtools:event";
1293
1286
  declare const DEVTOOLS_IFRAME_RPC_SOURCE = "vue-devtools";
1294
1287
  declare const DEVTOOLS_IFRAME_RPC_CONNECT = "devtools:iframe-rpc-connect";
1295
1288
  declare const DEFAULT_DEVTOOLS_RPC_CHANNEL_ID = "vue-devtools";
1296
- //#endregion
1297
- //#region src/rpc/types.d.ts
1298
1289
  type DevtoolsRpcChannelKind = 'iframe' | 'extension';
1299
1290
  interface DevtoolsRpcEvent {
1300
1291
  type: RuntimeDomainEvent['type'];
@@ -1337,8 +1328,6 @@ interface DevtoolsInPageProtocol {
1337
1328
  };
1338
1329
  }
1339
1330
  declare function toDevtoolsRpcEvent(event: RuntimeDomainEvent): DevtoolsRpcEvent | undefined;
1340
- //#endregion
1341
- //#region src/rpc/channel.d.ts
1342
1331
  interface DevtoolsRpcChannel {
1343
1332
  post(data: unknown, ...extras: unknown[]): unknown;
1344
1333
  on(handler: (data: unknown, ...extras: unknown[]) => void): unknown;
@@ -1352,8 +1341,6 @@ interface DevtoolsRpcChannelHandle {
1352
1341
  dispose(): void;
1353
1342
  }
1354
1343
  declare function createMessagePortDevtoolsRpcChannel(port: MessagePort): DevtoolsRpcChannel;
1355
- //#endregion
1356
- //#region src/rpc/client.d.ts
1357
1344
  interface CreateDevtoolsRpcClientOptions {
1358
1345
  channel: DevtoolsRpcChannel;
1359
1346
  disposeChannel?: () => void;
@@ -1364,8 +1351,6 @@ interface DevtoolsRpcClient extends RuntimeRequests {
1364
1351
  dispose(): void;
1365
1352
  }
1366
1353
  declare function createDevtoolsRpcClient(options: CreateDevtoolsRpcClientOptions): DevtoolsRpcClient;
1367
- //#endregion
1368
- //#region src/rpc/channels/extension.d.ts
1369
1354
  declare const DEVTOOLS_EXTENSION_PORT_SOURCE = "vue-devtools";
1370
1355
  declare const DEVTOOLS_EXTENSION_PORT_VERSION = 1;
1371
1356
  type DevtoolsExtensionPortRole = 'page' | 'panel';
@@ -1457,8 +1442,6 @@ declare function createChromeRuntimePortDevtoolsRpcChannel(port: ChromeRuntimePo
1457
1442
  declare function connectDevtoolsExtensionClient(options?: ConnectDevtoolsExtensionClientOptions): DevtoolsExtensionRpcClient;
1458
1443
  declare function createExtensionDevtoolsClientHost(options?: ConnectDevtoolsExtensionClientOptions): DevtoolsClientHost;
1459
1444
  declare function isExtensionDevtoolsClientHostAvailable(options?: Pick<ConnectDevtoolsExtensionClientOptions, 'chrome' | 'tabId'>): boolean;
1460
- //#endregion
1461
- //#region src/rpc/connect.d.ts
1462
1445
  interface DevtoolsClientHost {
1463
1446
  readonly kind: DevtoolsRpcChannelKind;
1464
1447
  available(): boolean;
@@ -1471,8 +1454,432 @@ interface ConnectDevtoolsClientOptions {
1471
1454
  }
1472
1455
  declare function connectDevtoolsClient(options?: ConnectDevtoolsClientOptions): DevtoolsRpcClient;
1473
1456
  declare function getDefaultDevtoolsClientHosts(options?: ConnectDevtoolsClientOptions): DevtoolsClientHost[];
1474
- //#endregion
1475
- //#region src/rpc/server.d.ts
1457
+ /** The Standard Typed interface. This is a base type extended by other specs. */
1458
+ interface StandardTypedV1<Input = unknown, Output = Input> {
1459
+ /** The Standard properties. */
1460
+ readonly "~standard": StandardTypedV1.Props<Input, Output>;
1461
+ }
1462
+ declare namespace StandardTypedV1 {
1463
+ /** The Standard Typed properties interface. */
1464
+ interface Props<Input = unknown, Output = Input> {
1465
+ /** The version number of the standard. */
1466
+ readonly version: 1;
1467
+ /** The vendor name of the schema library. */
1468
+ readonly vendor: string;
1469
+ /** Inferred types associated with the schema. */
1470
+ readonly types?: Types<Input, Output> | undefined;
1471
+ }
1472
+ /** The Standard Typed types interface. */
1473
+ interface Types<Input = unknown, Output = Input> {
1474
+ /** The input type of the schema. */
1475
+ readonly input: Input;
1476
+ /** The output type of the schema. */
1477
+ readonly output: Output;
1478
+ }
1479
+ /** Infers the input type of a Standard Typed. */
1480
+ type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
1481
+ /** Infers the output type of a Standard Typed. */
1482
+ type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
1483
+ }
1484
+ /** The Standard Schema interface. */
1485
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
1486
+ /** The Standard Schema properties. */
1487
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
1488
+ }
1489
+ declare namespace StandardSchemaV1 {
1490
+ /** The Standard Schema properties interface. */
1491
+ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
1492
+ /** Validates unknown input values. */
1493
+ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
1494
+ }
1495
+ /** The result interface of the validate function. */
1496
+ type Result<Output> = SuccessResult<Output> | FailureResult;
1497
+ /** The result interface if validation succeeds. */
1498
+ interface SuccessResult<Output> {
1499
+ /** The typed output value. */
1500
+ readonly value: Output;
1501
+ /** A falsy value for `issues` indicates success. */
1502
+ readonly issues?: undefined;
1503
+ }
1504
+ interface Options {
1505
+ /** Explicit support for additional vendor-specific parameters, if needed. */
1506
+ readonly libraryOptions?: Record<string, unknown> | undefined;
1507
+ }
1508
+ /** The result interface if validation fails. */
1509
+ interface FailureResult {
1510
+ /** The issues of failed validation. */
1511
+ readonly issues: ReadonlyArray<Issue>;
1512
+ }
1513
+ /** The issue interface of the failure output. */
1514
+ interface Issue {
1515
+ /** The error message of the issue. */
1516
+ readonly message: string;
1517
+ /** The path of the issue, if any. */
1518
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
1519
+ }
1520
+ /** The path segment interface of the issue. */
1521
+ interface PathSegment {
1522
+ /** The key representing a path segment. */
1523
+ readonly key: PropertyKey;
1524
+ }
1525
+ /** The Standard types interface. */
1526
+ interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
1527
+ /** Infers the input type of a Standard. */
1528
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
1529
+ /** Infers the output type of a Standard. */
1530
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
1531
+ }
1532
+ type Thenable<T> = T | Promise<T>;
1533
+ /**
1534
+ * Agent exposure settings for an RPC function. When this field is set,
1535
+ * the function is surfaced to agents (e.g. via the devframe MCP adapter)
1536
+ * as a callable tool. Functions without an `agent` field are not exposed;
1537
+ * default-deny.
1538
+ */
1539
+ interface RpcFunctionAgentOptions {
1540
+ /**
1541
+ * Human-readable description shown to the agent. Required, since agents
1542
+ * rely on this to decide when to invoke the tool. Keep it to ~1–3
1543
+ * sentences explaining what the tool does and when to use it.
1544
+ */
1545
+ description: string;
1546
+ /**
1547
+ * Optional human-friendly display title. Maps to the MCP tool `title`
1548
+ * annotation. Falls back to the RPC function `name` when omitted.
1549
+ */
1550
+ title?: string;
1551
+ /**
1552
+ * Safety classification. Drives MCP annotations (`readOnlyHint`,
1553
+ * `destructiveHint`) downstream.
1554
+ * - `'read'`: no side effects; safe to call freely.
1555
+ * - `'action'`: mutates state but not destructive.
1556
+ * - `'destructive'`: may perform destructive updates.
1557
+ *
1558
+ * When omitted it is inferred from the function `type`:
1559
+ * - `'static'` / `'query'` → `'read'`
1560
+ * - `'action'` / `'event'` → `'action'`
1561
+ */
1562
+ safety?: 'read' | 'action' | 'destructive';
1563
+ /** Free-form tags for grouping or filtering. */
1564
+ tags?: readonly string[];
1565
+ /**
1566
+ * Optional example invocations shown to agents. Returned verbatim in
1567
+ * the agent manifest.
1568
+ */
1569
+ examples?: readonly {
1570
+ args: unknown[];
1571
+ description?: string;
1572
+ }[];
1573
+ }
1574
+ /**
1575
+ * Positional argument schemas for an RPC function. Each entry is any
1576
+ * [Standard Schema](https://standardschema.dev)-compliant validator
1577
+ * (valibot, zod, arktype, …); the entry at index `i` validates argument
1578
+ * `i` at call time and drives that argument's inferred type.
1579
+ */
1580
+ type RpcArgsSchema = readonly StandardSchemaV1[];
1581
+ /**
1582
+ * Return-value schema for an RPC function. Any
1583
+ * [Standard Schema](https://standardschema.dev)-compliant validator; it
1584
+ * validates the handler's resolved return value and drives its inferred
1585
+ * type.
1586
+ */
1587
+ type RpcReturnSchema = StandardSchemaV1;
1588
+ interface EventsMap {
1589
+ [event: string]: any;
1590
+ }
1591
+ interface EventUnsubscribe {
1592
+ (): void;
1593
+ }
1594
+ interface EventEmitter<Events extends EventsMap> {
1595
+ /**
1596
+ * Calls each of the listeners registered for a given event.
1597
+ *
1598
+ * ```js
1599
+ * ee.emit('tick', tickType, tickDuration)
1600
+ * ```
1601
+ *
1602
+ * @param event The event name.
1603
+ * @param args The arguments for listeners.
1604
+ */
1605
+ emit: <K extends keyof Events>(event: K, ...args: Parameters<Events[K]>) => void;
1606
+ /**
1607
+ * Calls the listeners for a given event once and then removes the listener.
1608
+ *
1609
+ * @param event The event name.
1610
+ * @param args The arguments for listeners.
1611
+ */
1612
+ emitOnce: <K extends keyof Events>(event: K, ...args: Parameters<Events[K]>) => void;
1613
+ /**
1614
+ * Event names in keys and arrays with listeners in values.
1615
+ *
1616
+ * @internal
1617
+ */
1618
+ _listeners: Partial<{ [E in keyof Events]: Events[E][]; }>;
1619
+ /**
1620
+ * Add a listener for a given event.
1621
+ *
1622
+ * ```js
1623
+ * const unbind = ee.on('tick', (tickType, tickDuration) => {
1624
+ * count += 1
1625
+ * })
1626
+ *
1627
+ * disable () {
1628
+ * unbind()
1629
+ * }
1630
+ * ```
1631
+ *
1632
+ * @param event The event name.
1633
+ * @param cb The listener function.
1634
+ * @returns Unbind listener from event.
1635
+ */
1636
+ on: <K extends keyof Events>(event: K, cb: Events[K]) => EventUnsubscribe;
1637
+ /**
1638
+ * Add a listener for a given event once.
1639
+ *
1640
+ * ```js
1641
+ * const unbind = ee.once('tick', (tickType, tickDuration) => {
1642
+ * count += 1
1643
+ * })
1644
+ *
1645
+ * disable () {
1646
+ * unbind()
1647
+ * }
1648
+ * ```
1649
+ *
1650
+ * @param event The event name.
1651
+ * @param cb The listener function.
1652
+ * @returns Unbind listener from event.
1653
+ */
1654
+ once: <K extends keyof Events>(event: K, cb: Events[K]) => EventUnsubscribe;
1655
+ }
1656
+ type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
1657
+ type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;
1658
+ type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
1659
+ type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
1660
+ type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
1661
+ type ImmutableObject<T> = { readonly [K in keyof T]: Immutable<T[K]>; };
1662
+ /**
1663
+ * Serializable patch describing a single mutation to a `SharedState`.
1664
+ * Structurally compatible with JSON-Patch and is safe to send over RPC.
1665
+ */
1666
+ interface SharedStatePatch {
1667
+ op: 'add' | 'remove' | 'replace';
1668
+ path: readonly (string | number)[];
1669
+ value?: unknown;
1670
+ }
1671
+ /**
1672
+ * State host that is immutable by default with explicit mutate.
1673
+ */
1674
+ interface SharedState<T> {
1675
+ /**
1676
+ * Get the current state. Immutable.
1677
+ */
1678
+ value: () => Immutable<T>;
1679
+ /**
1680
+ * Subscribe to state changes.
1681
+ */
1682
+ on: EventEmitter<SharedStateEvents<T>>['on'];
1683
+ /**
1684
+ * Mutate the state.
1685
+ */
1686
+ mutate: (fn: (state: T) => void, syncId?: string) => void;
1687
+ /**
1688
+ * Apply patches to the state.
1689
+ */
1690
+ patch: (patches: SharedStatePatch[], syncId?: string) => void;
1691
+ /**
1692
+ * Sync IDs that have been applied to the state.
1693
+ */
1694
+ syncIds: Set<string>;
1695
+ }
1696
+ interface SharedStateEvents<T> {
1697
+ updated: (fullState: T, patches: SharedStatePatch[] | undefined, syncId: string) => void;
1698
+ }
1699
+ /**
1700
+ * The shared contract of one in-page channel, declared once (usually in a
1701
+ * `shared/protocol.ts` both sides import) and passed to both endpoints as a
1702
+ * type parameter. Purely a type; the only runtime companion is the
1703
+ * channel-name constant declared next to it.
1704
+ */
1705
+ interface InPageChannelProtocol {
1706
+ functions?: {
1707
+ /** Functions implemented by the page script. */
1708
+ pageScript?: Record<string, (...args: any[]) => any>;
1709
+ /** Functions implemented by panels. */
1710
+ panel?: Record<string, (...args: any[]) => any>;
1711
+ };
1712
+ events?: {
1713
+ /** Events emitted by panels and received by the page script. */
1714
+ pageScript?: Record<string, (...args: any[]) => void>;
1715
+ /** Events emitted by the page script and received by panels. */
1716
+ panel?: Record<string, (...args: any[]) => void>;
1717
+ };
1718
+ /**
1719
+ * Shared-state slots. The page script is the authority: it owns the
1720
+ * canonical value; panels are seeded on connect and converge through
1721
+ * syncId-deduplicated patches.
1722
+ */
1723
+ sharedStates?: Record<string, object>;
1724
+ }
1725
+ type SideFunctions<S> = S extends Record<string, (...args: any[]) => any> ? S : Record<string, never>;
1726
+ type SideDeclarations<P extends InPageChannelProtocol, Kind extends 'functions' | 'events', Side extends 'pageScript' | 'panel'> = Kind extends keyof P ? Side extends keyof NonNullable<P[Kind]> ? SideFunctions<NonNullable<NonNullable<P[Kind]>[Side]>> : Record<string, never> : Record<string, never>;
1727
+ type PageScriptFunctions<P extends InPageChannelProtocol> = SideDeclarations<P, 'functions', 'pageScript'>;
1728
+ type PanelFunctions<P extends InPageChannelProtocol> = SideDeclarations<P, 'functions', 'panel'>;
1729
+ type SharedStates<P extends InPageChannelProtocol> = P['sharedStates'] extends Record<string, object> ? P['sharedStates'] : Record<string, never>;
1730
+ type FnArgs<F> = F extends ((...args: infer A) => any) ? A : never;
1731
+ type FnReturn<F> = F extends ((...args: any[]) => infer R) ? Awaited<R> : never;
1732
+ type PageScriptEvents<P extends InPageChannelProtocol> = SideDeclarations<P, 'events', 'pageScript'>;
1733
+ type PanelEvents<P extends InPageChannelProtocol> = SideDeclarations<P, 'events', 'panel'>;
1734
+ /**
1735
+ * Converts a protocol function to its accepted endpoint handler.
1736
+ *
1737
+ * @internal
1738
+ */
1739
+ type ProtocolHandler<F> = F extends ((...args: any[]) => any) ? (...args: FnArgs<F>) => Thenable<FnReturn<F>> : never;
1740
+ /**
1741
+ * Function metadata with its handler constrained by a protocol function.
1742
+ *
1743
+ * @internal
1744
+ */
1745
+ interface InPageDefinitionOptionBase {
1746
+ /** Optional Standard Schema array validating the arguments. */
1747
+ args?: RpcArgsSchema;
1748
+ /** Optional Standard Schema validating the resolved return value. */
1749
+ returns?: RpcReturnSchema;
1750
+ jsonSerializable?: boolean;
1751
+ }
1752
+ interface InPageFunctionOptionBase extends InPageDefinitionOptionBase {
1753
+ /** Expose this function through DevFrame's browser-to-node agent bridge. */
1754
+ agent?: RpcFunctionAgentOptions;
1755
+ }
1756
+ interface InPageEventFunctionOption<F> extends InPageDefinitionOptionBase {
1757
+ type?: 'event';
1758
+ handler?: ProtocolHandler<F>;
1759
+ }
1760
+ type InPageEventOption<F> = [F] extends [never] ? never : InPageEventFunctionOption<F>;
1761
+ interface InPageQueryFunctionOption<F> extends InPageFunctionOptionBase {
1762
+ type?: 'query';
1763
+ handler: ProtocolHandler<F>;
1764
+ }
1765
+ interface InPageActionFunctionOption<F> extends InPageFunctionOptionBase {
1766
+ type: 'action';
1767
+ handler: ProtocolHandler<F>;
1768
+ }
1769
+ type InPageFunctionOption<F> = InPageQueryFunctionOption<F> | InPageActionFunctionOption<F>;
1770
+ /**
1771
+ * Functions implemented by {@link createPageScriptChannel}.
1772
+ *
1773
+ * @internal
1774
+ */
1775
+ type CreatePageScriptChannelOptionsFunctions<P extends InPageChannelProtocol> = { [NAME in keyof PageScriptFunctions<P> & string]: InPageFunctionOption<PageScriptFunctions<P>[NAME]>; };
1776
+ /**
1777
+ * Options shared by both in-page channel endpoints.
1778
+ *
1779
+ * @internal
1780
+ */
1781
+ interface InPageChannelCommonOptions {
1782
+ /**
1783
+ * Channel name, namespaced with the devframe id by convention
1784
+ * (e.g. `devframes:plugin:a11y`). Both endpoints must use the same name.
1785
+ */
1786
+ name: string;
1787
+ /**
1788
+ * Origins accepted during the handshake (and used as `targetOrigin` when
1789
+ * posting handshake messages). The in-page channel is same-origin by
1790
+ * definition, so this defaults to `[location.origin]`.
1791
+ */
1792
+ allowedOrigins?: string[];
1793
+ /**
1794
+ * Timeout for request/response calls, in milliseconds; `-1` disables.
1795
+ * Rejections are `InPageChannelError`s (code `timeout`) carrying the
1796
+ * endpoint status, so a hanging call explains itself.
1797
+ * @default 15000
1798
+ */
1799
+ callTimeoutMs?: number;
1800
+ /**
1801
+ * Liveness heartbeat guarding against silently dead ports. Defaults to a
1802
+ * 5s ping / 12s silence window; pass `false` to disable, on both
1803
+ * endpoints together.
1804
+ */
1805
+ heartbeat?: {
1806
+ intervalMs?: number;
1807
+ timeoutMs?: number;
1808
+ } | false;
1809
+ /**
1810
+ * Applied to each outgoing argument and handler result before posting;
1811
+ * the place to unwrap framework reactivity (Vue `toRaw`, Solid `unwrap`)
1812
+ * into plain structured-cloneable values.
1813
+ */
1814
+ serialize?: (value: unknown) => unknown;
1815
+ /** Applied to each incoming argument and call result. */
1816
+ deserialize?: (value: unknown) => unknown;
1817
+ }
1818
+ /** Options for {@link createPageScriptChannel}. */
1819
+ interface CreatePageScriptChannelOptions<Protocol extends InPageChannelProtocol = InPageChannelProtocol> extends InPageChannelCommonOptions {
1820
+ /** Every page-script function declaration, with a required handler. */
1821
+ functions: CreatePageScriptChannelOptionsFunctions<Protocol>;
1822
+ /** Optional metadata or handlers for incoming events. Listeners may instead subscribe through `channel.on()`. */
1823
+ events?: { [NAME in keyof PageScriptEvents<Protocol> & string]?: InPageEventOption<PageScriptEvents<Protocol>[NAME]>; };
1824
+ /**
1825
+ * Window whose `message` events carry panel hellos. Defaults to the
1826
+ * global `window`; pass `false` to skip the handshake listener entirely
1827
+ * (bring-your-own ports via `addPanelPort` only).
1828
+ */
1829
+ window?: Window | false;
1830
+ }
1831
+ /**
1832
+ * The channel shared-state accessor, mirroring `rpc.sharedState`, with the
1833
+ * page script playing the server's role as rendezvous and authority. The
1834
+ * page script's first `get` of a key must provide `initialValue`; a panel's
1835
+ * `get` without one resolves once the authority's first replay arrives.
1836
+ */
1837
+ interface InPageSharedStateHost<P extends InPageChannelProtocol> {
1838
+ get: <K extends keyof SharedStates<P> & string>(key: K, options?: {
1839
+ initialValue?: SharedStates<P>[K];
1840
+ }) => Promise<SharedState<SharedStates<P>[K]>>;
1841
+ }
1842
+ /** Emitter events of a page-script endpoint. */
1843
+ interface PageScriptChannelEvents<P extends InPageChannelProtocol> {
1844
+ 'panel:connected': (panel: PanelPeer<P>) => void;
1845
+ 'panel:disconnected': (panel: PanelPeer<P>) => void;
1846
+ }
1847
+ /** One connected panel, as seen from the page script. */
1848
+ interface PanelPeer<P extends InPageChannelProtocol> {
1849
+ /** Unique id of the panel endpoint (stable across its lifetime, not reloads). */
1850
+ readonly id: string;
1851
+ /** Call one panel's function and await the result. */
1852
+ call: <K extends keyof PanelFunctions<P> & string>(name: K, ...args: FnArgs<PanelFunctions<P>[K]>) => Promise<FnReturn<PanelFunctions<P>[K]>>;
1853
+ /** Disconnect this panel. */
1854
+ close: () => void;
1855
+ }
1856
+ /**
1857
+ * The page-script endpoint of an in-page channel: answers panel handshakes,
1858
+ * holds one dedicated port per connected panel, fans events out to all of
1859
+ * them, and is the authority for the channel's shared states.
1860
+ */
1861
+ interface PageScriptChannel<P extends InPageChannelProtocol> {
1862
+ readonly name: string;
1863
+ /**
1864
+ * This page context's instance id (persisted per tab in sessionStorage),
1865
+ * carried in every handshake so panels can pin to one instance when the
1866
+ * same app is open in several tabs.
1867
+ */
1868
+ readonly instanceId: string;
1869
+ /** Currently connected panels. */
1870
+ readonly panels: readonly PanelPeer<P>[];
1871
+ readonly events: Pick<EventEmitter<PageScriptChannelEvents<P>>, 'on' | 'once'>;
1872
+ /** Fan an event out to every connected panel. */
1873
+ emit: <K extends keyof PanelEvents<P> & string>(name: K, ...args: FnArgs<PanelEvents<P>[K]>) => void;
1874
+ /** Subscribe to an event emitted by a panel. Returns an unsubscribe function. */
1875
+ on: <K extends keyof PageScriptEvents<P> & string>(name: K, listener: (...args: FnArgs<PageScriptEvents<P>[K]>) => void) => () => void;
1876
+ /** Page-script-authoritative shared states, replayed to joining panels. */
1877
+ readonly sharedState: InPageSharedStateHost<P>;
1878
+ /** Adopt a pre-established port as a panel peer (bring-your-own transport). */
1879
+ addPanelPort: (port: MessagePort) => PanelPeer<P>;
1880
+ /** Tear the endpoint down: disconnect every panel, stop answering hellos. */
1881
+ close: () => void;
1882
+ }
1476
1883
  interface DevtoolsRpcServer {
1477
1884
  attachInPage(options: Pick<CreatePageScriptChannelOptions<DevtoolsInPageProtocol>, 'name' | 'window' | 'allowedOrigins'>): {
1478
1885
  channel: PageScriptChannel<DevtoolsInPageProtocol>;
@@ -1482,8 +1889,6 @@ interface DevtoolsRpcServer {
1482
1889
  dispose(): void;
1483
1890
  }
1484
1891
  declare function createDevtoolsRpcServer(runtime: DevtoolsRuntime): DevtoolsRpcServer;
1485
- //#endregion
1486
- //#region src/rpc/channels/iframe.d.ts
1487
1892
  interface StartIframeDevtoolsRpcHostOptions {
1488
1893
  window?: Window;
1489
1894
  channelId?: string;
@@ -1499,5 +1904,4 @@ declare function startIframeDevtoolsRpcHost(server: DevtoolsRpcServer, options?:
1499
1904
  declare function connectDevtoolsIframeClient(options?: ConnectDevtoolsIframeClientOptions): DevtoolsRpcClient;
1500
1905
  declare function createIframeDevtoolsClientHost(options?: ConnectDevtoolsIframeClientOptions): DevtoolsClientHost;
1501
1906
  declare function isIframeDevtoolsClientHostAvailable(options?: Pick<ConnectDevtoolsIframeClientOptions, 'window' | 'targetWindow'>): boolean;
1502
- //#endregion
1503
1907
  export { DEVTOOLS_RPC_COMMAND as $, formatPreviewKey as $n, RuntimeQuery as $t, connectDevtoolsExtensionClient as A, DevToolsPluginAPI as An, AppRecord as At, DevtoolsRpcChannel as B, PluginSettingOption as Bn, ComponentId as Bt, DevtoolsExtensionFrameController as C, RouterRouteSnapshot as Cn, RuntimePerformanceMonitor as Ct, DevtoolsExtensionPortDescriptor as D, StatePagination as Dn, RuntimeInspectorInfo as Dt, DevtoolsExtensionFramesChangedMessage as E, StatePageOptions as En, RuntimeInspectorAction as Et, isExtensionDevtoolsClientHostAvailable as F, MutableInspectorStatePayload as Fn, RuntimeRegistry as Ft, DevtoolsRpcClientFunctions as G, TimelineLayerOptions as Gn, RuntimeCommand as Gt, createMessagePortDevtoolsRpcChannel as H, PluginSetupFunction as Hn, InstanceRef as Ht, parseDevtoolsExtensionPortName as I, MutableInspectorTreePayload as In, WalkedComponentChild as It, DevtoolsRpcServerFunctions as J, reportPluginError as Jn, RuntimeDomainEventType as Jt, DevtoolsRpcEvent as K, VisitComponentTreePayload as Kn, RuntimeCommandResult as Kt, CreateDevtoolsRpcClientOptions as L, PLUGIN_API_CAPABILITIES as Ln, readComponentName as Lt, createDevtoolsExtensionPortName as M, InspectComponentPayload as Mn, ComponentRecord as Mt, createExtensionDevtoolsClientHost as N, InspectTimelineEventPayload as Nn, ComponentSnapshot as Nt, DevtoolsExtensionPortRole as O, StateValueMessage as On, RuntimeInspectorRecord as Ot, isDevtoolsExtensionFrameControlMessage as P, MutableEditStatePayload as Pn, RefreshComponentTreeOptions as Pt, DEVTOOLS_IFRAME_RPC_SOURCE as Q, encodeValue as Qn, RuntimeEventType as Qt, DevtoolsRpcClient as R, PluginApiAdapter as Rn, AppId as Rt, DevtoolsExtensionFrameControlMessage as S, RouterRouteRecordSnapshot as Sn, RuntimeRequests as St, DevtoolsExtensionFrameSelectMessage as T, StateEntry as Tn, createRuntimePerformanceMonitor as Tt, DevtoolsInPageProtocol as U, SetPluginSettingsPayload as Un, MaybePromise as Ut, DevtoolsRpcChannelHandle as V, PluginSettingsItem as Vn, InspectorId as Vt, DevtoolsRpcChannelKind as W, TimelineEventOptions as Wn, PluginId as Wt, DEFAULT_DEVTOOLS_RPC_CHANNEL_ID as X, ValueCodecOptions as Xn, RuntimeEventBase as Xt, toDevtoolsRpcEvent as Y, EncodedValue as Yn, RuntimeEvent as Yt, DEVTOOLS_IFRAME_RPC_CONNECT as Z, ValueEntry as Zn, RuntimeEventHandler as Zt, DEVTOOLS_EXTENSION_FRAME_CONTROL_SOURCE as _, PluginsSnapshotMessage as _n, ComponentTreeStore as _t, isIframeDevtoolsClientHostAvailable as a, ComponentStateSection as an, RuntimeBudget as ar, DevtoolsRuntime as at, DevtoolsExtensionFrameActivatedMessage as b, ReactivityGraphSnapshot as bn, RuntimeQueryMap as bt, createDevtoolsRpcServer as c, ComponentTreeNodeTag as cn, resolveRuntimeBudget as cr, createDevtoolsRuntime as ct, connectDevtoolsClient as d, CustomInspectorTreeNode as dn, RuntimeScheduler as dt, VueTypeMap as en, safeOwnEnumerableStringKeys as er, DEVTOOLS_RPC_EVENT as et, getDefaultDevtoolsClientHosts as f, DevtoolsCapabilitiesMessage as fn, createRuntimeScheduler as ft, ConnectDevtoolsExtensionClientOptions as g, PluginSnapshot as gn, ComponentTreeSnapshot as gt, ChromeRuntimePort as h, InspectorsListMessage as hn, ComponentTreePatchBatch as ht, createIframeDevtoolsClientHost as i, ComponentInspectionResultMessage as in, ValueHandleRegistryOptions as ir, CreateDevtoolsRuntimeOptions as it, createChromeRuntimePortDevtoolsRpcChannel as j, DevToolsPluginAPIHooks as jn, ComponentDomOrderCache as jt, DevtoolsExtensionRpcClient as k, CustomInspectorOptions as kn, RuntimeInspectorStore as kt, ConnectDevtoolsClientOptions as l, ComponentTreePageMessage as ln, ComponentStateCollector as lt, ChromeExtensionEvent as m, InspectorTreeSnapshotMessage as mn, createRuntimeEventLog as mt, StartIframeDevtoolsRpcHostOptions as n, AppSnapshot as nn, ValueHandleEntry as nr, ComponentInspectorDockController as nt, startIframeDevtoolsRpcHost as o, ComponentStateSnapshotMessage as on, RuntimeBudgetInput as or, RuntimeCommandHandler as ot, ChromeExtensionApi as p, ExpandedValueMessage as pn, RuntimeEventLog as pt, DevtoolsRpcEventHandler as q, createPluginApiAdapter as qn, RuntimeDomainEvent as qt, connectDevtoolsIframeClient as r, AppsSnapshotMessage as rn, ValueHandleRegistry as rr, ComponentInspectorDockRestore as rt, DevtoolsRpcServer as s, ComponentTreeNodeSnapshot as sn, defaultRuntimeBudget as sr, RuntimeQueryHandler as st, ConnectDevtoolsIframeClientOptions as t, ComponentTreePatch as tn, ValueHandle as tr, DEVTOOLS_RPC_QUERY as tt, DevtoolsClientHost as u, ComponentTreeSnapshotMessage as un, LegacyComponentStateEntry as ut, DEVTOOLS_EXTENSION_PORT_SOURCE as v, ReactivityGraphNode as vn, RuntimeCommandMap as vt, DevtoolsExtensionFrameDescriptor as w, RouterSnapshotMessage as wn, RuntimePerformanceSnapshot as wt, DevtoolsExtensionFrameActivationReason as x, ReactivityRelationship as xn, RuntimeQueryRequest as xt, DEVTOOLS_EXTENSION_PORT_VERSION as y, ReactivityGraphNodeType as yn, RuntimeCommandRequest as yt, createDevtoolsRpcClient as z, PluginDescriptor as zn, AppRef as zt };