@g9tm/lynxcontrols-pilot 0.0.0-stage → 2.4.1

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.
Files changed (99) hide show
  1. package/README.md +159 -2
  2. package/catalog/cards/G9PilotHost.md +16 -0
  3. package/catalog/cards/G9PilotMask.md +10 -0
  4. package/catalog/cards/G9PilotPanel.md +10 -0
  5. package/catalog/catalog.json +420 -0
  6. package/catalog/index.md +7 -0
  7. package/check/cli.mjs +5 -0
  8. package/check/index.mjs +137 -0
  9. package/check/index.test.mjs +180 -0
  10. package/config/cli.mjs +31 -0
  11. package/config/index.d.ts +62 -0
  12. package/config/index.mjs +380 -0
  13. package/config/index.test.mjs +406 -0
  14. package/dist/.tsbuildinfo +1 -0
  15. package/dist/anchors.d.ts +39 -0
  16. package/dist/anchors.d.ts.map +1 -0
  17. package/dist/anchors.jsx +103 -0
  18. package/dist/bridge.d.ts +4 -0
  19. package/dist/bridge.d.ts.map +1 -0
  20. package/dist/bridge.jsx +143 -0
  21. package/dist/busy.d.ts +4 -0
  22. package/dist/busy.d.ts.map +1 -0
  23. package/dist/busy.jsx +43 -0
  24. package/dist/commands.d.ts +24 -0
  25. package/dist/commands.d.ts.map +1 -0
  26. package/dist/commands.jsx +286 -0
  27. package/dist/consent.d.ts +51 -0
  28. package/dist/consent.d.ts.map +1 -0
  29. package/dist/consent.jsx +131 -0
  30. package/dist/explore.d.ts +36 -0
  31. package/dist/explore.d.ts.map +1 -0
  32. package/dist/explore.jsx +133 -0
  33. package/dist/flags.d.ts +69 -0
  34. package/dist/flags.d.ts.map +1 -0
  35. package/dist/flags.jsx +81 -0
  36. package/dist/host-core.d.ts +36 -0
  37. package/dist/host-core.d.ts.map +1 -0
  38. package/dist/host-core.jsx +90 -0
  39. package/dist/host-sink.d.ts +43 -0
  40. package/dist/host-sink.d.ts.map +1 -0
  41. package/dist/host-sink.jsx +87 -0
  42. package/dist/index-marks.d.ts +33 -0
  43. package/dist/index-marks.d.ts.map +1 -0
  44. package/dist/index-marks.jsx +40 -0
  45. package/dist/index-observe.d.ts +17 -0
  46. package/dist/index-observe.d.ts.map +1 -0
  47. package/dist/index-observe.jsx +14 -0
  48. package/dist/index.d.ts +18 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.jsx +11 -0
  51. package/dist/info.d.ts +10 -0
  52. package/dist/info.d.ts.map +1 -0
  53. package/dist/info.jsx +9 -0
  54. package/dist/kit.d.ts +67 -0
  55. package/dist/kit.d.ts.map +1 -0
  56. package/dist/kit.jsx +1 -0
  57. package/dist/layer.d.ts +4 -0
  58. package/dist/layer.d.ts.map +1 -0
  59. package/dist/layer.jsx +10 -0
  60. package/dist/layers.d.ts +4 -0
  61. package/dist/layers.d.ts.map +1 -0
  62. package/dist/layers.jsx +146 -0
  63. package/dist/mask.d.ts +20 -0
  64. package/dist/mask.d.ts.map +1 -0
  65. package/dist/mask.jsx +35 -0
  66. package/dist/net.d.ts +17 -0
  67. package/dist/net.d.ts.map +1 -0
  68. package/dist/net.jsx +60 -0
  69. package/dist/observe.d.ts +99 -0
  70. package/dist/observe.d.ts.map +1 -0
  71. package/dist/observe.jsx +194 -0
  72. package/dist/off.d.ts +45 -0
  73. package/dist/off.d.ts.map +1 -0
  74. package/dist/off.jsx +81 -0
  75. package/dist/otlp.d.ts +61 -0
  76. package/dist/otlp.d.ts.map +1 -0
  77. package/dist/otlp.jsx +141 -0
  78. package/dist/panel.d.ts +13 -0
  79. package/dist/panel.d.ts.map +1 -0
  80. package/dist/panel.jsx +182 -0
  81. package/dist/session.d.ts +42 -0
  82. package/dist/session.d.ts.map +1 -0
  83. package/dist/session.jsx +115 -0
  84. package/dist/types.d.ts +47 -0
  85. package/dist/types.d.ts.map +1 -0
  86. package/dist/types.jsx +1 -0
  87. package/dist/watch.d.ts +17 -0
  88. package/dist/watch.d.ts.map +1 -0
  89. package/dist/watch.jsx +165 -0
  90. package/doctor/cli.mjs +5 -0
  91. package/doctor/index.mjs +214 -0
  92. package/doctor/index.test.mjs +174 -0
  93. package/gradle/g9pilot.app.gradle +55 -0
  94. package/gradle/g9pilot.settings.gradle +27 -0
  95. package/ios/g9pilot.rb +47 -0
  96. package/package.json +66 -4
  97. package/rspeedy/index.d.ts +40 -0
  98. package/rspeedy/index.mjs +100 -0
  99. package/rspeedy/index.test.mjs +192 -0
@@ -0,0 +1,87 @@
1
+ const BRIDGELESS_UNSUPPORTED = Object.freeze([
2
+ Object.freeze({
3
+ rule: 'perf.memoryGrowth',
4
+ reason: 'the memory series comes from the native host'
5
+ }),
6
+ Object.freeze({
7
+ rule: 'perf.longFrame',
8
+ reason: "only the page thread's stalls are measured; the UI thread's frames come from the native host"
9
+ })
10
+ ]);
11
+ function nativeHost() {
12
+ try {
13
+ var _ref;
14
+ return "u" < typeof NativeModules ? null : null != (_ref = null == NativeModules ? void 0 : NativeModules.G9HostModule) ? _ref : null;
15
+ } catch {
16
+ return null;
17
+ }
18
+ }
19
+ function globalEvents() {
20
+ try {
21
+ return lynx.getJSModule('GlobalEventEmitter');
22
+ } catch {
23
+ return null;
24
+ }
25
+ }
26
+ function installHostSink(buffer, options) {
27
+ var _options_unsupported;
28
+ const host = void 0 === options.host ? nativeHost() : options.host;
29
+ if ('function' != typeof (null == host ? void 0 : host.pilotFindings)) return ()=>void 0;
30
+ const send = host.pilotFindings.bind(host);
31
+ const unsupported = null != (_options_unsupported = options.unsupported) ? _options_unsupported : BRIDGELESS_UNSUPPORTED;
32
+ let checks = 0;
33
+ const push = ()=>{
34
+ try {
35
+ const payload = {
36
+ findings: buffer.list(),
37
+ unsupported,
38
+ checks
39
+ };
40
+ send(JSON.stringify(payload));
41
+ } catch {}
42
+ };
43
+ const offBuffer = buffer.subscribe(push);
44
+ const self = (command, args)=>options.dispatch({
45
+ id: `${command}.${Date.now()}`,
46
+ command,
47
+ args,
48
+ kid: 'self-host',
49
+ scopes: [
50
+ '*'
51
+ ]
52
+ });
53
+ const onCheck = ()=>{
54
+ self('oracle.check', {}).catch(()=>void 0).then(()=>{
55
+ checks++;
56
+ push();
57
+ });
58
+ };
59
+ const onError = (message)=>{
60
+ const text = 'string' == typeof message ? message : JSON.stringify(null != message ? message : '');
61
+ self('pilot.lynxError', {
62
+ message: text
63
+ }).catch(()=>void 0);
64
+ };
65
+ const events = void 0 === options.events ? globalEvents() : options.events;
66
+ const handlers = [
67
+ [
68
+ 'g9:pilot-check',
69
+ onCheck
70
+ ],
71
+ [
72
+ 'g9:lynx-error',
73
+ onError
74
+ ]
75
+ ];
76
+ for (const [name, handler] of handlers)try {
77
+ null == events || events.addListener(name, handler);
78
+ } catch {}
79
+ push();
80
+ return ()=>{
81
+ offBuffer();
82
+ for (const [name, handler] of handlers)try {
83
+ null == events || events.removeListener(name, handler);
84
+ } catch {}
85
+ };
86
+ }
87
+ export { BRIDGELESS_UNSUPPORTED, installHostSink };
@@ -0,0 +1,33 @@
1
+ import type { G9AroundRequestOptions } from './net.js';
2
+ export type { G9ConsentAsk } from './consent.js';
3
+ export type { G9PilotModule, G9PilotProfile, G9PilotSettings } from './flags.js';
4
+ export { type G9PilotInfo, g9Pilot } from './info.js';
5
+ export { G9PilotMask, type G9PilotMaskProps } from './mask.js';
6
+ export type { G9AroundRequestOptions } from './net.js';
7
+ export type { G9FindingsBuffer, G9PilotFinding, G9PilotReport, G9PilotSummary } from './observe.js';
8
+ export type { G9PilotAuditEntry, G9PilotController, G9PilotSession } from './session.js';
9
+ export type { G9PilotApi, G9PilotHostProps } from './types.js';
10
+ /** The request itself: this build does not watch requests (no shaping, no busy reason, no black box). */
11
+ export declare function aroundRequest<T>(_method: string, _url: string, run: () => Promise<T>, _options?: G9AroundRequestOptions<T>): Promise<T>;
12
+ /** A request net.shape failed (never thrown in this build: nothing is shaped). */
13
+ export declare class G9ShapedRequestError extends Error {
14
+ readonly status: number | null;
15
+ constructor(status: number | null, message: string);
16
+ }
17
+ /** False: this build carries no bridge. */
18
+ export declare const G9_PILOT_BRIDGE: boolean;
19
+ /** Always null: this build keeps no findings. */
20
+ export declare function g9PilotFindings(): null;
21
+ /** Always null: only a bridge build keeps a session (who talked to this device). */
22
+ export declare function g9PilotSession(): null;
23
+ /** The test ids for this app: inside the app's G9Host, around the page content. */
24
+ export declare const G9PilotHost: (props: import("./types.js").G9PilotHostProps) => import("react").ReactNode;
25
+ /** Props of G9PilotPanel (this build shows none). */
26
+ export interface G9PilotPanelProps {
27
+ readonly findings?: number;
28
+ }
29
+ /** Nothing: this build carries no watch to show. */
30
+ export declare function G9PilotPanel(_props: G9PilotPanelProps): null;
31
+ /** False: this build has no panel to open. */
32
+ export declare function openG9PilotPanel(_props?: G9PilotPanelProps): boolean;
33
+ //# sourceMappingURL=index-marks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-marks.d.ts","sourceRoot":"","sources":["../src/index-marks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAEpD,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,KAAK,WAAW,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC5D,YAAY,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjG,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACtF,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE5D,yGAAyG;AACzG,wBAAgB,aAAa,CAAC,CAAC,EAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACrB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,CAAC,CAAC,GACnC,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED,kFAAkF;AAClF,qBAAa,oBAAqB,SAAQ,KAAK;IAE3C,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;gBAArB,MAAM,EAAE,MAAM,GAAG,IAAI,EAC9B,OAAO,EAAE,MAAM;CAKlB;AAED,2CAA2C;AAC3C,eAAO,MAAM,eAAe,EAAE,OAAe,CAAC;AAE9C,iDAAiD;AACjD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,oFAAoF;AACpF,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAID,mFAAmF;AACnF,eAAO,MAAM,WAAW,0EAAmC,CAAC;AAE5D,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,oDAAoD;AACpD,wBAAgB,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAE5D;AAED,8CAA8C;AAC9C,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAEpE"}
@@ -0,0 +1,40 @@
1
+ import { makePilotHost } from "./host-core.jsx";
2
+ function _define_property(obj, key, value) {
3
+ if (key in obj) Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ else obj[key] = value;
10
+ return obj;
11
+ }
12
+ function aroundRequest(_method, _url, run, _options) {
13
+ return run();
14
+ }
15
+ class G9ShapedRequestError extends Error {
16
+ constructor(status, message){
17
+ super(message), _define_property(this, "status", void 0), this.status = status;
18
+ this.name = 'G9ShapedRequestError';
19
+ }
20
+ }
21
+ const G9_PILOT_BRIDGE = false;
22
+ function g9PilotFindings() {
23
+ return null;
24
+ }
25
+ function g9PilotSession() {
26
+ return null;
27
+ }
28
+ const none = ()=>()=>void 0;
29
+ const G9PilotHost = makePilotHost({
30
+ install: none
31
+ });
32
+ function G9PilotPanel(_props) {
33
+ return null;
34
+ }
35
+ function openG9PilotPanel(_props) {
36
+ return false;
37
+ }
38
+ export { g9Pilot } from "./info.jsx";
39
+ export { G9PilotMask } from "./mask.jsx";
40
+ export { G9PilotHost, G9PilotPanel, G9ShapedRequestError, G9_PILOT_BRIDGE, aroundRequest, g9PilotFindings, g9PilotSession, openG9PilotPanel };
@@ -0,0 +1,17 @@
1
+ export type { G9ConsentAsk } from './consent.js';
2
+ export type { G9PilotModule, G9PilotProfile, G9PilotSettings } from './flags.js';
3
+ export { type G9PilotInfo, g9Pilot } from './info.js';
4
+ export { G9PilotMask, type G9PilotMaskProps } from './mask.js';
5
+ export { aroundRequest, type G9AroundRequestOptions, G9ShapedRequestError } from './net.js';
6
+ export type { G9FindingsBuffer, G9PilotFinding, G9PilotReport, G9PilotSummary } from './observe.js';
7
+ export { G9PilotPanel, type G9PilotPanelProps, openG9PilotPanel } from './panel.js';
8
+ export type { G9PilotAuditEntry, G9PilotController, G9PilotSession } from './session.js';
9
+ export type { G9PilotApi, G9PilotHostProps } from './types.js';
10
+ export { g9PilotFindings } from './watch.js';
11
+ /** False: this build carries no bridge (the app's own commands are never called). */
12
+ export declare const G9_PILOT_BRIDGE: boolean;
13
+ /** G9AppPilot's watch for this app: inside the app's G9Host, around the page content. */
14
+ export declare const G9PilotHost: (props: import("./types.js").G9PilotHostProps) => import("react").ReactNode;
15
+ /** Always null: only a bridge build keeps a session (who talked to this device). */
16
+ export declare function g9PilotSession(): null;
17
+ //# sourceMappingURL=index-observe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-observe.d.ts","sourceRoot":"","sources":["../src/index-observe.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,KAAK,WAAW,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,KAAK,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AACzF,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACjF,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACtF,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,qFAAqF;AACrF,eAAO,MAAM,eAAe,EAAE,OAAe,CAAC;AAE9C,yFAAyF;AACzF,eAAO,MAAM,WAAW,0EAA2C,CAAC;AAEpE,oFAAoF;AACpF,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
@@ -0,0 +1,14 @@
1
+ import { makePilotHost } from "./host-core.jsx";
2
+ import { g9PilotFindings, installWatch } from "./watch.jsx";
3
+ const G9_PILOT_BRIDGE = false;
4
+ const G9PilotHost = makePilotHost({
5
+ install: installWatch
6
+ });
7
+ function g9PilotSession() {
8
+ return null;
9
+ }
10
+ export { g9Pilot } from "./info.jsx";
11
+ export { G9PilotMask } from "./mask.jsx";
12
+ export { G9ShapedRequestError, aroundRequest } from "./net.jsx";
13
+ export { G9PilotPanel, openG9PilotPanel } from "./panel.jsx";
14
+ export { G9PilotHost, G9_PILOT_BRIDGE, g9PilotFindings, g9PilotSession };
@@ -0,0 +1,18 @@
1
+ export type { G9ConsentAsk } from './consent.js';
2
+ export type { G9PilotModule, G9PilotProfile, G9PilotSettings } from './flags.js';
3
+ export { type G9PilotInfo, g9Pilot } from './info.js';
4
+ export { G9PilotMask, type G9PilotMaskProps } from './mask.js';
5
+ export { aroundRequest, type G9AroundRequestOptions, G9ShapedRequestError } from './net.js';
6
+ export type { G9FindingsBuffer, G9PilotFinding, G9PilotReport, G9PilotSummary } from './observe.js';
7
+ export { G9PilotPanel, type G9PilotPanelProps, openG9PilotPanel } from './panel.js';
8
+ export { type G9PilotAuditEntry, type G9PilotController, type G9PilotSession, g9PilotSession } from './session.js';
9
+ export type { G9PilotApi, G9PilotHostProps } from './types.js';
10
+ export { g9PilotFindings } from './watch.js';
11
+ /** True: this build carries the bridge (an app guards its own command code with it, so a release drops that code). */
12
+ export declare const G9_PILOT_BRIDGE: boolean;
13
+ /**
14
+ * G9AppPilot for this app: inside the app's G9Host, around the page content. The test ids, busy reasons and anchors,
15
+ * the always-awake watch, and the signed bridge with every module the build's environment carries.
16
+ */
17
+ export declare const G9PilotHost: (props: import("./types.js").G9PilotHostProps) => import("react").ReactNode;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,KAAK,WAAW,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,KAAK,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AACzF,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChH,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,sHAAsH;AACtH,eAAO,MAAM,eAAe,EAAE,OAAc,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,WAAW,0EAA6B,CAAC"}
package/dist/index.jsx ADDED
@@ -0,0 +1,11 @@
1
+ import { bridgeLevel } from "./bridge.jsx";
2
+ import { makePilotHost } from "./host-core.jsx";
3
+ const G9_PILOT_BRIDGE = true;
4
+ const G9PilotHost = makePilotHost(bridgeLevel);
5
+ export { g9Pilot } from "./info.jsx";
6
+ export { G9PilotMask } from "./mask.jsx";
7
+ export { G9ShapedRequestError, aroundRequest } from "./net.jsx";
8
+ export { G9PilotPanel, openG9PilotPanel } from "./panel.jsx";
9
+ export { g9PilotSession } from "./session.jsx";
10
+ export { g9PilotFindings } from "./watch.jsx";
11
+ export { G9PilotHost, G9_PILOT_BRIDGE };
package/dist/info.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { type G9PilotModule, type G9PilotProfile, type G9PilotSettings } from './flags.js';
2
+ /** What this build carries of G9AppPilot. */
3
+ export interface G9PilotInfo {
4
+ readonly profile: G9PilotProfile;
5
+ readonly modules: readonly G9PilotModule[];
6
+ readonly settings: G9PilotSettings;
7
+ }
8
+ /** What this build carries: its profile, its modules and the page's settings (never a key). */
9
+ export declare function g9Pilot(): G9PilotInfo;
10
+ //# sourceMappingURL=info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../src/info.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,EAIrB,MAAM,SAAS,CAAC;AAEjB,6CAA6C;AAC7C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAC3C,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;CACpC;AAED,+FAA+F;AAC/F,wBAAgB,OAAO,IAAI,WAAW,CAErC"}
package/dist/info.jsx ADDED
@@ -0,0 +1,9 @@
1
+ import { PROFILE, SETTINGS, pilotModules } from "./flags.jsx";
2
+ function g9Pilot() {
3
+ return {
4
+ profile: PROFILE,
5
+ modules: pilotModules(),
6
+ settings: SETTINGS
7
+ };
8
+ }
9
+ export { g9Pilot };
package/dist/kit.d.ts ADDED
@@ -0,0 +1,67 @@
1
+ export interface KitStore<T> {
2
+ getSnapshot(): T;
3
+ subscribe(listener: () => void): () => void;
4
+ }
5
+ export interface KitSheetEntry {
6
+ readonly id: number;
7
+ readonly status: string;
8
+ readonly options: {
9
+ readonly isModal?: boolean;
10
+ readonly states?: readonly string[];
11
+ };
12
+ }
13
+ export interface KitSheetService {
14
+ readonly stack: KitStore<readonly KitSheetEntry[]>;
15
+ getOpenCount(): number;
16
+ closeTop(): void;
17
+ }
18
+ export interface KitPopupEntry {
19
+ readonly phase: string;
20
+ readonly descriptor: {
21
+ readonly title?: string | null;
22
+ readonly message?: string | null;
23
+ readonly buttons: ReadonlyArray<{
24
+ readonly text: string;
25
+ readonly testId?: string | null;
26
+ }>;
27
+ readonly form?: {
28
+ readonly fieldKeys: readonly string[];
29
+ setText(key: string, value: string): void;
30
+ getText(key: string): string | null;
31
+ } | null;
32
+ };
33
+ }
34
+ export interface KitPopupService {
35
+ readonly queue: KitStore<KitPopupEntry | null>;
36
+ dismissAll(): void;
37
+ }
38
+ /** G9LynxControls 2.0's open popovers (menus, action sheets, the command palette): `@g9tm/lynxcontrols/popover`. */
39
+ export interface KitPopovers {
40
+ getSnapshot(): readonly {
41
+ readonly key: string;
42
+ readonly kind: string;
43
+ close(): void;
44
+ }[];
45
+ closeAll(): void;
46
+ }
47
+ export interface LynxControlsKit {
48
+ readonly sheet: {
49
+ g9Sheets(): KitSheetService | null | undefined;
50
+ useG9Sheets(): KitSheetService;
51
+ useG9SheetContext(): {
52
+ readonly handle: {
53
+ readonly id: number;
54
+ };
55
+ } | null;
56
+ readonly g9SheetShowThrottleMs: number;
57
+ };
58
+ readonly popup: {
59
+ g9Popups(): KitPopupService | null | undefined;
60
+ useG9Popups(): KitPopupService;
61
+ };
62
+ /** 2.0: the popovers. A menu, an action sheet or the palette covers the page; ui.dismissAll closes them first. */
63
+ readonly popover?: {
64
+ readonly g9Popovers: KitPopovers;
65
+ };
66
+ }
67
+ //# sourceMappingURL=kit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,WAAW,IAAI,CAAC,CAAC;IACjB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KACrC,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,aAAa,EAAE,CAAC,CAAC;IACnD,YAAY,IAAI,MAAM,CAAC;IACvB,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACjC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;YAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;SACjC,CAAC,CAAC;QACH,QAAQ,CAAC,IAAI,CAAC,EAAE;YACd,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;YACtC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;YAC1C,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;SACrC,GAAG,IAAI,CAAC;KACV,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAC/C,UAAU,IAAI,IAAI,CAAC;CACpB;AAED,oHAAoH;AACpH,MAAM,WAAW,WAAW;IAC1B,WAAW,IAAI,SAAS;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,IAAI,IAAI,CAAA;KAAE,EAAE,CAAC;IACzF,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,IAAI,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;QAC/C,WAAW,IAAI,eAAe,CAAC;QAC/B,iBAAiB,IAAI;YAAE,QAAQ,CAAC,MAAM,EAAE;gBAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,GAAG,IAAI,CAAC;QACzE,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;KACxC,CAAC;IACF,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,IAAI,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;QAC/C,WAAW,IAAI,eAAe,CAAC;KAChC,CAAC;IACF,kHAAkH;IAClH,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAA;KAAE,CAAC;CACzD"}
package/dist/kit.jsx ADDED
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,4 @@
1
+ import type { HostLayer } from '@g9tm/app-pilot-lynx';
2
+ import type { LynxControlsKit } from './kit.js';
3
+ export declare function lynxControlsLayerHook(kit: LynxControlsKit): () => HostLayer | null;
4
+ //# sourceMappingURL=layer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../src/layer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAE7C,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,SAAS,GAAG,IAAI,CAKlF"}
package/dist/layer.jsx ADDED
@@ -0,0 +1,10 @@
1
+ function lynxControlsLayerHook(kit) {
2
+ return function() {
3
+ const sheet = kit.sheet.useG9SheetContext();
4
+ return sheet ? {
5
+ layer: 'sheet',
6
+ sheetId: sheet.handle.id
7
+ } : null;
8
+ };
9
+ }
10
+ export { lynxControlsLayerHook };
@@ -0,0 +1,4 @@
1
+ import { type LayerModel } from '@g9tm/app-pilot-lynx';
2
+ import type { LynxControlsKit } from './kit.js';
3
+ export declare function lynxControlsLayers(kit: LynxControlsKit): LayerModel;
4
+ //# sourceMappingURL=layers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layers.d.ts","sourceRoot":"","sources":["../src/layers.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,KAAK,UAAU,EAAwC,MAAM,sBAAsB,CAAC;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAW7C,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,eAAe,GAAG,UAAU,CA4HnE"}
@@ -0,0 +1,146 @@
1
+ import { domId, queryRect } from "@g9tm/app-pilot-lynx";
2
+ const sleep = (ms)=>new Promise((r)=>setTimeout(r, ms));
3
+ function quietly(read, fallback) {
4
+ try {
5
+ return read();
6
+ } catch {
7
+ return fallback;
8
+ }
9
+ }
10
+ function lynxControlsLayers(kit) {
11
+ const g9Sheets = ()=>kit.sheet.g9Sheets();
12
+ const g9Popups = ()=>kit.popup.g9Popups();
13
+ let lastShownAt = 0;
14
+ let watched = null;
15
+ const watch = ()=>{
16
+ const stack = quietly(()=>{
17
+ var _g9Sheets;
18
+ return null == (_g9Sheets = g9Sheets()) ? void 0 : _g9Sheets.stack;
19
+ }, void 0);
20
+ if (!stack || stack === watched) return;
21
+ watched = stack;
22
+ const seen = new Set();
23
+ const read = ()=>{
24
+ for (const e of stack.getSnapshot())if (!seen.has(e.id)) {
25
+ seen.add(e.id);
26
+ lastShownAt = Date.now();
27
+ }
28
+ };
29
+ read();
30
+ stack.subscribe(read);
31
+ };
32
+ return {
33
+ pageCoveredBySheet () {
34
+ if (quietly(()=>{
35
+ var _ref;
36
+ var _kit_popover;
37
+ return (null != (_ref = null == (_kit_popover = kit.popover) ? void 0 : _kit_popover.g9Popovers.getSnapshot()) ? _ref : []).some((p)=>'popover' !== p.kind);
38
+ }, false)) return true;
39
+ const stack = quietly(()=>{
40
+ var _g9Sheets;
41
+ return null == (_g9Sheets = g9Sheets()) ? void 0 : _g9Sheets.stack;
42
+ }, void 0);
43
+ if (!stack) return false;
44
+ return stack.getSnapshot().some((e)=>{
45
+ var _e_options_states;
46
+ return ('open' === e.status || 'opening' === e.status) && (false !== e.options.isModal || (null == (_e_options_states = e.options.states) ? void 0 : _e_options_states.length) === 1 && 'large' === e.options.states[0]);
47
+ });
48
+ },
49
+ lastSheetShownAt () {
50
+ watch();
51
+ return lastShownAt;
52
+ },
53
+ sheetShowThrottleMs: kit.sheet.g9SheetShowThrottleMs,
54
+ popup () {
55
+ var _d_title, _d_message, _d_form;
56
+ const entry = quietly(()=>{
57
+ var _ref;
58
+ var _g9Popups;
59
+ return null != (_ref = null == (_g9Popups = g9Popups()) ? void 0 : _g9Popups.queue.getSnapshot()) ? _ref : null;
60
+ }, null);
61
+ if (!entry) return null;
62
+ const d = entry.descriptor;
63
+ return {
64
+ title: null != (_d_title = d.title) ? _d_title : null,
65
+ message: null != (_d_message = d.message) ? _d_message : null,
66
+ buttons: d.buttons.map((b, i)=>({
67
+ text: b.text,
68
+ elementId: b.testId ? domId(b.testId) : `G9Popup_Button_${i}`
69
+ })),
70
+ form: null != (_d_form = d.form) ? _d_form : null
71
+ };
72
+ },
73
+ async popupButtonRects (popup) {
74
+ const captions = popup.buttons.map((b)=>b.text);
75
+ const footer = await queryRect('.g9-popup__footer');
76
+ if (!footer || 0 === captions.length) return null;
77
+ const shown = captions.slice(0, 3);
78
+ const stacked = captions.length > 3 || footer.height > 60 && captions.length > 1 && footer.height > footer.width / 2;
79
+ if (stacked) {
80
+ const h = footer.height / captions.length;
81
+ return captions.map((_, i)=>({
82
+ x: footer.x,
83
+ y: footer.y + i * h,
84
+ width: footer.width,
85
+ height: h
86
+ }));
87
+ }
88
+ const w = footer.width / shown.length;
89
+ return shown.map((_, i)=>({
90
+ x: footer.x + i * w,
91
+ y: footer.y,
92
+ width: w,
93
+ height: footer.height
94
+ }));
95
+ },
96
+ async dismissAll () {
97
+ let wasOpen = false;
98
+ let sheetsBefore = 0;
99
+ const popovers = quietly(()=>{
100
+ var _ref;
101
+ var _kit_popover;
102
+ return null != (_ref = null == (_kit_popover = kit.popover) ? void 0 : _kit_popover.g9Popovers.getSnapshot().length) ? _ref : 0;
103
+ }, 0);
104
+ if (popovers > 0) {
105
+ wasOpen = true;
106
+ quietly(()=>{
107
+ var _kit_popover;
108
+ return null == (_kit_popover = kit.popover) ? void 0 : _kit_popover.g9Popovers.closeAll();
109
+ }, void 0);
110
+ }
111
+ try {
112
+ var _ref;
113
+ const sheets = g9Sheets();
114
+ sheetsBefore = null != (_ref = null == sheets ? void 0 : sheets.getOpenCount()) ? _ref : 0;
115
+ if (sheetsBefore > 0) {
116
+ wasOpen = true;
117
+ for(let i = 0; i < Math.min(sheetsBefore, 8); i++){
118
+ var _ref1, _ref2;
119
+ const open = null != (_ref1 = null == sheets ? void 0 : sheets.getOpenCount()) ? _ref1 : 0;
120
+ if (0 === open) break;
121
+ null == sheets || sheets.closeTop();
122
+ const deadline = Date.now() + 1500;
123
+ while((null != (_ref2 = null == sheets ? void 0 : sheets.getOpenCount()) ? _ref2 : 0) >= open && Date.now() < deadline)await sleep(50);
124
+ }
125
+ }
126
+ } catch {}
127
+ quietly(()=>{
128
+ var _g9Popups;
129
+ return null == (_g9Popups = g9Popups()) ? void 0 : _g9Popups.dismissAll();
130
+ }, void 0);
131
+ await sleep(250);
132
+ const sheetsAfter = quietly(()=>{
133
+ var _ref;
134
+ var _g9Sheets;
135
+ return null != (_ref = null == (_g9Sheets = g9Sheets()) ? void 0 : _g9Sheets.getOpenCount()) ? _ref : 0;
136
+ }, 0);
137
+ return {
138
+ wasOpen,
139
+ stillOpen: sheetsAfter > 0,
140
+ sheetsBefore,
141
+ sheetsAfter
142
+ };
143
+ }
144
+ };
145
+ }
146
+ export { lynxControlsLayers };
package/dist/mask.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from '@lynx-js/react';
2
+ /** Props of {@link G9PilotMask}. */
3
+ export interface G9PilotMaskProps {
4
+ readonly children?: ReactNode;
5
+ /** A test id for the masked box (default: a generated one). */
6
+ readonly id?: string;
7
+ readonly className?: string;
8
+ }
9
+ /** A box whose content a masked screenshot never shows (a card number, a private note). */
10
+ export declare function G9PilotMask(props: G9PilotMaskProps): ReactNode;
11
+ /** The boxes (dp, the page's coordinates) of every secret target on screen. */
12
+ export declare function maskRects(): Promise<Array<{
13
+ x: number;
14
+ y: number;
15
+ width: number;
16
+ height: number;
17
+ }>>;
18
+ /** Registers `pilot.maskRects` (what the native screenshot blacks out); returns the uninstaller. */
19
+ export declare function installMasking(): () => void;
20
+ //# sourceMappingURL=mask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../src/mask.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAU,MAAM,gBAAgB,CAAC;AAIxD,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,2FAA2F;AAC3F,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAQ9D;AAED,+EAA+E;AAC/E,wBAAsB,SAAS,IAAI,OAAO,CAAC,KAAK,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CASzG;AAED,oGAAoG;AACpG,wBAAgB,cAAc,IAAI,MAAM,IAAI,CAK3C"}
package/dist/mask.jsx ADDED
@@ -0,0 +1,35 @@
1
+ import { registerCommand } from "@g9tm/app-pilot";
2
+ import { allTestTargets, queryNodeRect, useTestId } from "@g9tm/app-pilot-lynx";
3
+ import { useRef } from "@lynx-js/react";
4
+ let masks = 0;
5
+ function G9PilotMask(props) {
6
+ var _props_id;
7
+ const auto = useRef(`g9pilot.mask.${++masks}`);
8
+ const target = useTestId(null != (_props_id = props.id) ? _props_id : auto.current, {
9
+ type: 'View',
10
+ secret: true
11
+ });
12
+ return <view className={`g9-pilot-mask${props.className ? ` ${props.className}` : ''}`} {...target}>
13
+ {props.children}
14
+ </view>;
15
+ }
16
+ async function maskRects() {
17
+ const out = [];
18
+ for (const t of allTestTargets()){
19
+ var _ref;
20
+ var _t_node;
21
+ if (!t.secret) continue;
22
+ const rect = await queryNodeRect(null != (_ref = null == (_t_node = t.node) ? void 0 : _t_node.call(t)) ? _ref : null);
23
+ if (rect && rect.width > 0 && rect.height > 0) out.push(rect);
24
+ }
25
+ return out;
26
+ }
27
+ function installMasking() {
28
+ return registerCommand('pilot.maskRects', async ()=>({
29
+ rects: await maskRects()
30
+ }), {
31
+ scope: 'observe',
32
+ description: 'The boxes a screenshot must black out (secret targets: password fields, <G9PilotMask>), in dp.'
33
+ });
34
+ }
35
+ export { G9PilotMask, installMasking, maskRects };
package/dist/net.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ /** How the app's own response looks to {@link aroundRequest}. */
2
+ export interface G9AroundRequestOptions<T> {
3
+ /** The HTTP status of a response (default: its `status` field). */
4
+ readonly statusOf?: (response: T) => number | null;
5
+ /** The response a shaped status or a replayed answer stands for (default: the request fails with that status). */
6
+ readonly answer?: (status: number, text: string | null) => T;
7
+ /** A request that waits on the server for news (default: a path ending in `/wait`): not a busy reason. */
8
+ readonly longPoll?: (url: string) => boolean;
9
+ }
10
+ /** A request the build's net.shape said to fail or replace: what `answer` gets when the app gives none. */
11
+ export declare class G9ShapedRequestError extends Error {
12
+ readonly status: number | null;
13
+ constructor(status: number | null, message: string);
14
+ }
15
+ /** Runs one request the way G9AppPilot watches it (see the file header). `run` makes the real request. */
16
+ export declare function aroundRequest<T>(method: string, url: string, run: () => Promise<T>, options?: G9AroundRequestOptions<T>): Promise<T>;
17
+ //# sourceMappingURL=net.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"net.d.ts","sourceRoot":"","sources":["../src/net.ts"],"names":[],"mappings":"AAMA,iEAAiE;AACjE,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,CAAC;IACnD,kHAAkH;IAClH,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC;IAC7D,0GAA0G;IAC1G,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CAC9C;AAKD,2GAA2G;AAC3G,qBAAa,oBAAqB,SAAQ,KAAK;IAE3C,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;gBAArB,MAAM,EAAE,MAAM,GAAG,IAAI,EAC9B,OAAO,EAAE,MAAM;CAKlB;AAED,0GAA0G;AAC1G,wBAAsB,aAAa,CAAC,CAAC,EACnC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACrB,OAAO,GAAE,sBAAsB,CAAC,CAAC,CAAM,GACtC,OAAO,CAAC,CAAC,CAAC,CAiCZ"}