@archont561/qgis-sdk 0.4.0 → 0.6.0

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,6 +1,58 @@
1
- import { BridgeStreamTerminal2, WireTransport2, InvokeOptions2, BridgeSubscription2, BridgeClient2 } from "./chunk-wtv4vt4q.js";
2
- import { HostOperationId2, HostOperations2 } from "./chunk-khemhx86.js";
3
- import { OperationShape2, StreamShape2, OperationMap2, StreamMap2, BridgeSchema2 } from "./chunk-jjx14tgd.js";
1
+ import { PluginDescription2, BridgeStreamTerminal2, WireTransport2, InvokeOptions2, BridgeSubscription2, BridgeClient2 } from "./chunk-8c12nwme.js";
2
+ import { HostOperationId2, HostOperations2 } from "./chunk-7tgzmz0m.js";
3
+ /** What one declared action promises: an object in, a value out. */
4
+ interface OperationShape2 {
5
+ readonly request: object;
6
+ readonly result: unknown;
7
+ }
8
+ /** What one declared stream promises: an object in, discriminated events out. */
9
+ interface StreamShape2 {
10
+ readonly request: object;
11
+ readonly event: {
12
+ readonly kind: string;
13
+ readonly payload: unknown;
14
+ };
15
+ }
16
+ /** The default, untyped map: any id, any shape. */
17
+ type OperationMap2 = {
18
+ readonly [id: string]: OperationShape2;
19
+ };
20
+ /** The default, untyped map: any id, any shape. */
21
+ type StreamMap2 = {
22
+ readonly [id: string]: StreamShape2;
23
+ };
24
+ /**
25
+ * A parsed plugin description carrying its `Operations` and `Streams` types.
26
+ *
27
+ * The `"~types"` member is compile-time only: it is never set, and a schema is
28
+ * a frozen {@link PluginDescription} and nothing more at run time. It is a
29
+ * string key, not a unique symbol, so the type stays structurally the same
30
+ * across the package's entry points.
31
+ */
32
+ interface BridgeSchema2<
33
+ O = OperationMap2,
34
+ S = StreamMap2
35
+ > extends PluginDescription2 {
36
+ readonly "~types"?: {
37
+ readonly operations: O;
38
+ readonly streams: S;
39
+ };
40
+ }
41
+ /** The `Operations` map a schema carries. */
42
+ type OperationsOf2<Schema> = Schema extends BridgeSchema2<infer O, unknown> ? O : never;
43
+ /** The `Streams` map a schema carries. */
44
+ type StreamsOf2<Schema> = Schema extends BridgeSchema2<unknown, infer S> ? S : never;
45
+ /**
46
+ * Parse a description and type it; the generated module is the only caller.
47
+ *
48
+ * The description is checked the way any description is (`schema_version`,
49
+ * ids, handlers, declared streams), so a hand-edited or stale module fails
50
+ * here, at import, rather than on the first call.
51
+ */
52
+ declare function defineBridgeSchema2<
53
+ O extends Record<keyof O, OperationShape2>,
54
+ S extends Record<keyof S, StreamShape2>
55
+ >(input: string | Readonly<Record<string, unknown>>): BridgeSchema2<O, S>;
4
56
  /** Options for {@link QgisSdk.fromBridgeSchema}. */
5
57
  interface QgisSdkOptions2 {
6
58
  /** A transport to speak through; defaults to the page's QWebChannel. */
@@ -23,6 +75,17 @@ type StreamHandle2 = BridgeSubscription2;
23
75
  type OperationMethod2<Op extends OperationShape2> = {} extends Op["request"] ? (request?: Op["request"], options?: InvokeOptions2) => Promise<Op["result"]> : (request: Op["request"], options?: InvokeOptions2) => Promise<Op["result"]>;
24
76
  /** The method one declared stream becomes. */
25
77
  type StreamMethod2<St extends StreamShape2> = (request: St["request"], handlers: StreamHandlers2<St["event"]>, options?: InvokeOptions2) => Promise<StreamHandle2>;
78
+ /**
79
+ * The running palette, when the handshake carried one (decision-16): the
80
+ * `QPalette` colour roles the host read, as CSS hex (`#rrggbb` or
81
+ * `#rrggbbaa`) by their camel-cased role name, and whether the window colour
82
+ * is dark. `qgis-sdk-ui` turns it into the `--qgis-sdk-*` custom properties;
83
+ * a page outside QGIS sees `null` and keeps the documented defaults.
84
+ */
85
+ interface QgisSdkHostTheme2 {
86
+ readonly palette: Readonly<Record<string, string>>;
87
+ readonly dark: boolean;
88
+ }
26
89
  /** What the handshake told this page about the host (decision-27). */
27
90
  interface QgisSdkHost2 extends HostOperations2 {
28
91
  /**
@@ -30,6 +93,11 @@ interface QgisSdkHost2 extends HostOperations2 {
30
93
  * until {@link QgisSdkCore.ready} has resolved.
31
94
  */
32
95
  readonly granted: readonly HostOperationId2[];
96
+ /**
97
+ * The host's palette, `null` until {@link QgisSdkCore.ready} has resolved
98
+ * and when the host sent none.
99
+ */
100
+ readonly theme: QgisSdkHostTheme2 | null;
33
101
  }
34
102
  /** The members every `QgisSdk` has, whatever its schema declares. */
35
103
  interface QgisSdkCore2<
@@ -84,4 +152,4 @@ declare namespace QgisSdk2 {
84
152
  S extends Record<keyof S, StreamShape2>
85
153
  >(schema: BridgeSchema2<O, S>, options?: QgisSdkOptions2): QgisSdk2<O, S>;
86
154
  }
87
- export { QgisSdkOptions2, StreamHandlers2, StreamHandle2, OperationMethod2, StreamMethod2, QgisSdkHost2, QgisSdkCore2, OperationTree2, StreamTree2, QGIS_SDK_MEMBERS2, QgisSdk2 };
155
+ export { OperationShape2, StreamShape2, OperationMap2, StreamMap2, BridgeSchema2, OperationsOf2, StreamsOf2, defineBridgeSchema2, QgisSdkOptions2, StreamHandlers2, StreamHandle2, OperationMethod2, StreamMethod2, QgisSdkHostTheme2, QgisSdkHost2, QgisSdkCore2, OperationTree2, StreamTree2, QGIS_SDK_MEMBERS2, QgisSdk2 };