adnbn 0.2.2 → 0.2.4

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 (113) hide show
  1. package/dist/{AbstractBuilder-CKgY_Bta.d.ts → AbstractBuilder-BN4TmNJG.d.ts} +3 -3
  2. package/dist/{AbstractBuilder-Ce5zNRXr.d.mts → AbstractBuilder-C81kWZzQ.d.mts} +3 -3
  3. package/dist/{BaseTransport-C7uEgfUu.d.mts → BaseTransport-DNZ28gFF.d.mts} +1 -1
  4. package/dist/{BaseTransport-BdFTZfP0.d.ts → BaseTransport-Ecy2Kzti.d.ts} +1 -1
  5. package/dist/{Builder-FwJAxWos.d.ts → Builder-BOLvGGqp.d.ts} +2 -2
  6. package/dist/{Builder-rW3fzusy.d.mts → Builder-BP8SDHO1.d.mts} +2 -2
  7. package/dist/{Builder-7pbnGvHK.d.ts → Builder-Bc8US0PY.d.ts} +1 -1
  8. package/dist/{Builder-CCyBD4hF.d.mts → Builder-Df1LUO_f.d.mts} +1 -1
  9. package/dist/{Message-1cYgMdsu.d.mts → Message-Bnritk3D.d.mts} +1 -1
  10. package/dist/{Message-DAhczRx9.d.ts → Message-DFDaS7mV.d.ts} +1 -1
  11. package/dist/{MountBuilder-DjnAmTI0.d.ts → MountBuilder-BTltgVF2.d.mts} +26 -7
  12. package/dist/{MountBuilder-CjvMOcmn.d.mts → MountBuilder-C9Q-7PeI.d.ts} +26 -7
  13. package/dist/{ProxyRelay-Ce-szh9p.d.ts → ProxyRelay-DDOSZE3h.d.ts} +3 -3
  14. package/dist/{ProxyRelay-BOBEhRET.d.mts → ProxyRelay-Uel0ATcx.d.mts} +3 -3
  15. package/dist/{ProxyTransport-BTVUbDxE.d.mts → ProxyTransport-35rU8xqa.d.mts} +3 -3
  16. package/dist/{ProxyTransport-BW63K6SU.d.ts → ProxyTransport-D4jv5SFh.d.ts} +3 -3
  17. package/dist/{RegisterOffscreen-BukckdvS.d.mts → RegisterOffscreen-DT0gN5xN.d.mts} +2 -2
  18. package/dist/{RegisterOffscreen-DmlpLqjW.d.ts → RegisterOffscreen-df3W5HqA.d.ts} +2 -2
  19. package/dist/{RegisterRelay-MEVSR1sP.d.mts → RegisterRelay-DCVZ2_NI.d.mts} +2 -2
  20. package/dist/{RegisterRelay-BaIET78I.d.ts → RegisterRelay-PFT2ac4v.d.ts} +2 -2
  21. package/dist/{TransportMessage-Bk0wg4rF.d.mts → TransportMessage-CIKrv3DG.d.mts} +8 -4
  22. package/dist/{TransportMessage-BqMzXWZR.d.ts → TransportMessage-CsObvTPq.d.ts} +8 -4
  23. package/dist/{background-Zjiqg60g.d.ts → background-CpVjDFHQ.d.ts} +1 -1
  24. package/dist/{background-CyGGjmBx.d.mts → background-cxLBji1Q.d.mts} +1 -1
  25. package/dist/cli/index.cjs +52 -21
  26. package/dist/cli/index.cjs.map +1 -1
  27. package/dist/{command-BFsdm7Bx.d.mts → command-S2dcqx6Q.d.mts} +4 -3
  28. package/dist/{command-3i_5d__K.d.ts → command-TJ2JUrVd.d.ts} +4 -3
  29. package/dist/{content-sdYF4W-A.d.ts → content-B0znLIjr.d.ts} +37 -4
  30. package/dist/{content-BYoXVO6V.d.mts → content-DrrPH4ri.d.mts} +37 -4
  31. package/dist/entry/background/index.d.mts +2 -2
  32. package/dist/entry/background/index.d.ts +2 -2
  33. package/dist/entry/command/index.d.mts +3 -3
  34. package/dist/entry/command/index.d.ts +3 -3
  35. package/dist/entry/content/index.d.mts +2 -2
  36. package/dist/entry/content/index.d.ts +2 -2
  37. package/dist/entry/content/react/index.cjs +104 -18
  38. package/dist/entry/content/react/index.cjs.map +1 -1
  39. package/dist/entry/content/react/index.d.mts +4 -4
  40. package/dist/entry/content/react/index.d.ts +4 -4
  41. package/dist/entry/content/react/index.js +104 -18
  42. package/dist/entry/content/react/index.js.map +1 -1
  43. package/dist/entry/content/vanilla/index.cjs +108 -18
  44. package/dist/entry/content/vanilla/index.cjs.map +1 -1
  45. package/dist/entry/content/vanilla/index.d.mts +4 -4
  46. package/dist/entry/content/vanilla/index.d.ts +4 -4
  47. package/dist/entry/content/vanilla/index.js +108 -18
  48. package/dist/entry/content/vanilla/index.js.map +1 -1
  49. package/dist/entry/offscreen/index.cjs +27 -4
  50. package/dist/entry/offscreen/index.cjs.map +1 -1
  51. package/dist/entry/offscreen/index.d.mts +11 -9
  52. package/dist/entry/offscreen/index.d.ts +11 -9
  53. package/dist/entry/offscreen/index.js +27 -4
  54. package/dist/entry/offscreen/index.js.map +1 -1
  55. package/dist/entry/relay/index.d.mts +9 -8
  56. package/dist/entry/relay/index.d.ts +9 -8
  57. package/dist/entry/service/index.cjs +31 -10
  58. package/dist/entry/service/index.cjs.map +1 -1
  59. package/dist/entry/service/index.d.mts +5 -4
  60. package/dist/entry/service/index.d.ts +5 -4
  61. package/dist/entry/service/index.js +31 -10
  62. package/dist/entry/service/index.js.map +1 -1
  63. package/dist/entry/transport/index.d.mts +8 -7
  64. package/dist/entry/transport/index.d.ts +8 -7
  65. package/dist/entry/view/index.d.mts +2 -2
  66. package/dist/entry/view/index.d.ts +2 -2
  67. package/dist/entry/view/react/index.d.mts +4 -4
  68. package/dist/entry/view/react/index.d.ts +4 -4
  69. package/dist/entry/view/vanilla/index.d.mts +4 -4
  70. package/dist/entry/view/vanilla/index.d.ts +4 -4
  71. package/dist/{helpers-DnV3N7fU.d.mts → helpers-YDFORuZz.d.mts} +2 -2
  72. package/dist/{helpers-DnV3N7fU.d.ts → helpers-YDFORuZz.d.ts} +2 -2
  73. package/dist/index.cjs +11 -1
  74. package/dist/index.cjs.map +1 -1
  75. package/dist/index.d.mts +63 -22
  76. package/dist/index.d.ts +63 -22
  77. package/dist/index.js +11 -2
  78. package/dist/index.js.map +1 -1
  79. package/dist/message/index.cjs.map +1 -1
  80. package/dist/message/index.d.mts +4 -3
  81. package/dist/message/index.d.ts +4 -3
  82. package/dist/message/index.js.map +1 -1
  83. package/dist/message/react/index.cjs.map +1 -1
  84. package/dist/message/react/index.d.mts +1 -1
  85. package/dist/message/react/index.d.ts +1 -1
  86. package/dist/message/react/index.js.map +1 -1
  87. package/dist/{message-55r-wFjc.d.mts → message-jsmkeGHC.d.mts} +5 -1
  88. package/dist/{message-55r-wFjc.d.ts → message-jsmkeGHC.d.ts} +5 -1
  89. package/dist/offscreen/index.cjs +30 -5
  90. package/dist/offscreen/index.cjs.map +1 -1
  91. package/dist/offscreen/index.d.mts +10 -9
  92. package/dist/offscreen/index.d.ts +10 -9
  93. package/dist/offscreen/index.js +30 -5
  94. package/dist/offscreen/index.js.map +1 -1
  95. package/dist/{offscreen-B9GiglgN.d.mts → offscreen-2EP-rRfx.d.mts} +3 -3
  96. package/dist/{offscreen-BG5Abe8V.d.ts → offscreen-aHdkogKj.d.ts} +3 -3
  97. package/dist/relay/index.d.mts +8 -7
  98. package/dist/relay/index.d.ts +8 -7
  99. package/dist/{relay-DymeeDe7.d.ts → relay-DT46Ltms.d.ts} +3 -3
  100. package/dist/{relay-BYeTCwKO.d.mts → relay-vaJ5R2iC.d.mts} +3 -3
  101. package/dist/service/index.cjs +27 -4
  102. package/dist/service/index.cjs.map +1 -1
  103. package/dist/service/index.d.mts +8 -6
  104. package/dist/service/index.d.ts +8 -6
  105. package/dist/service/index.js +27 -4
  106. package/dist/service/index.js.map +1 -1
  107. package/dist/{service-BhJhIk-O.d.ts → service-6FdoYGNC.d.ts} +3 -3
  108. package/dist/{service-DsivypLQ.d.mts → service-C9HbDQPE.d.mts} +3 -3
  109. package/dist/{transport-B_uYwoGi.d.mts → transport-BrbirhXv.d.mts} +3 -2
  110. package/dist/{transport-BPmSUoEU.d.ts → transport-Co9Oxp0-.d.ts} +3 -2
  111. package/dist/{view-QDP2Maev.d.mts → view-Bs26Jcvi.d.mts} +1 -1
  112. package/dist/{view-D4dquvKl.d.ts → view-u9w7nMgw.d.ts} +1 -1
  113. package/package.json +1 -2
@@ -1,5 +1,5 @@
1
- import { E as EntrypointOptions, A as Awaiter } from './helpers-DnV3N7fU.mjs';
2
- import { B as BackgroundConfig } from './background-CyGGjmBx.mjs';
1
+ import { E as EntrypointOptions, A as Awaiter } from './helpers-YDFORuZz.mjs';
2
+ import { B as BackgroundConfig } from './background-cxLBji1Q.mjs';
3
3
 
4
4
  type Tab = chrome.tabs.Tab;
5
5
  declare const CommandExecuteActionName = "_execute_action";
@@ -20,5 +20,6 @@ interface CommandDefinition extends CommandEntrypointOptions {
20
20
  execute: CommandExecute;
21
21
  }
22
22
  type ExecuteActionCommandDefinition = Omit<CommandDefinition, "name">;
23
+ type CommandUnresolvedDefinition = Partial<CommandDefinition>;
23
24
 
24
- export { type CommandDefinition as C, type ExecuteActionCommandDefinition as E, type CommandExecute as a, type CommandConfig as b, CommandExecuteActionName as c };
25
+ export { type CommandDefinition as C, type ExecuteActionCommandDefinition as E, type CommandExecute as a, type CommandConfig as b, type CommandUnresolvedDefinition as c, CommandExecuteActionName as d };
@@ -1,5 +1,5 @@
1
- import { E as EntrypointOptions, A as Awaiter } from './helpers-DnV3N7fU.js';
2
- import { B as BackgroundConfig } from './background-Zjiqg60g.js';
1
+ import { E as EntrypointOptions, A as Awaiter } from './helpers-YDFORuZz.js';
2
+ import { B as BackgroundConfig } from './background-CpVjDFHQ.js';
3
3
 
4
4
  type Tab = chrome.tabs.Tab;
5
5
  declare const CommandExecuteActionName = "_execute_action";
@@ -20,5 +20,6 @@ interface CommandDefinition extends CommandEntrypointOptions {
20
20
  execute: CommandExecute;
21
21
  }
22
22
  type ExecuteActionCommandDefinition = Omit<CommandDefinition, "name">;
23
+ type CommandUnresolvedDefinition = Partial<CommandDefinition>;
23
24
 
24
- export { type CommandDefinition as C, type ExecuteActionCommandDefinition as E, type CommandExecute as a, type CommandConfig as b, CommandExecuteActionName as c };
25
+ export { type CommandDefinition as C, type ExecuteActionCommandDefinition as E, type CommandExecute as a, type CommandConfig as b, type CommandUnresolvedDefinition as c, CommandExecuteActionName as d };
@@ -1,6 +1,6 @@
1
1
  import { ReactNode, FC } from 'react';
2
2
  import { Optional } from 'utility-types';
3
- import { E as EntrypointOptions, A as Awaiter, P as PickNonFunctionProperties, a as EntrypointBuilder } from './helpers-DnV3N7fU.js';
3
+ import { E as EntrypointOptions, A as Awaiter, P as PickNonFunctionProperties, a as EntrypointBuilder } from './helpers-YDFORuZz.js';
4
4
 
5
5
  type ExecutionWorld = chrome.scripting.ExecutionWorld;
6
6
  type RunAt = chrome.userScripts.RunAt;
@@ -68,8 +68,8 @@ declare enum ContentScriptAppend {
68
68
  }
69
69
  type ContentScriptMountFunction = (anchor: Element, container: Element) => void | (() => void);
70
70
  interface ContentScriptMount {
71
- mount(): void;
72
- unmount(): void;
71
+ mount(): boolean | undefined | void;
72
+ unmount(): boolean | undefined | void;
73
73
  }
74
74
  interface ContentScriptProps extends ContentScriptEntrypointOptions {
75
75
  anchor: Element;
@@ -89,8 +89,41 @@ type ContentScriptContainerOptions = {
89
89
  type ContentScriptContainerFactory = (props: ContentScriptProps) => Awaiter<Element | ContentScriptContainerTag | ContentScriptContainerOptions>;
90
90
  type ContentScriptContainerCreator = (props: ContentScriptProps) => Awaiter<Element>;
91
91
  type ContentScriptWatchStrategy = (update: () => void, context: ContentScriptContext) => () => void;
92
+ declare enum ContentScriptEvent {
93
+ Mount = "mount",
94
+ Unmount = "unmount",
95
+ Add = "add",
96
+ Remove = "remove"
97
+ }
98
+ type ContentScriptEventCallback = (event: ContentScriptEvent, node: ContentScriptNode) => void;
99
+ interface ContentScriptEventEmitter {
100
+ on(callback: ContentScriptEventCallback): void;
101
+ off(callback: ContentScriptEventCallback): void;
102
+ emit(event: ContentScriptEvent, node: ContentScriptNode): void;
103
+ emitMount(node: ContentScriptNode): void;
104
+ emitUnmount(node: ContentScriptNode): void;
105
+ emitAdd(node: ContentScriptNode): void;
106
+ emitRemove(node: ContentScriptNode): void;
107
+ removeAllListeners(): void;
108
+ listenerCount(): number;
109
+ hasListeners(): boolean;
110
+ }
92
111
  interface ContentScriptContext extends ContentScriptMount {
93
112
  nodes: ReadonlySet<ContentScriptNode>;
113
+ /**
114
+ * Registers a callback function that will be invoked when a specific content script context event occurs.
115
+ *
116
+ * @param {ContentScriptEventCallback} callback - The function to be executed when the event is triggered. Receives event-related data as its argument.
117
+ * @return {Function} A function that can be called to unsubscribe the callback from the event.
118
+ */
119
+ watch(callback: ContentScriptEventCallback): () => void;
120
+ /**
121
+ * Stops watching for changes or events that were previously being observed.
122
+ * Unsubscribes from all event listeners that were registered through the watch method.
123
+ *
124
+ * @return {void} No return value.
125
+ */
126
+ unwatch(): void;
94
127
  }
95
128
  type ContentScriptMainFunction = (context: ContentScriptContext, options: ContentScriptOptions) => Awaiter<void>;
96
129
  interface ContentScriptNode extends ContentScriptMount {
@@ -120,4 +153,4 @@ interface ContentScriptBuilder extends EntrypointBuilder {
120
153
  getContext(): ContentScriptContext;
121
154
  }
122
155
 
123
- export { type ContentScriptConfig as C, type ContentScriptDefinition as a, type ContentScriptContext as b, type ContentScriptNode as c, type ContentScriptRenderValue as d, type ContentScriptRenderHandler as e, type ContentScriptBuilder as f, type ContentScriptNodeSet as g, type ContentScriptResolvedDefinition as h, type ContentScriptAnchor as i, type ContentScriptAnchorGetter as j, type ContentScriptAnchorResolver as k, type ContentScriptMountFunction as l, type ContentScriptContainerTag as m, type ContentScriptContainerOptions as n, type ContentScriptContainerFactory as o, type ContentScriptContainerCreator as p, type ContentScriptWatchStrategy as q, type ContentScriptProps as r, type ContentScriptAppendDefinition as s, ContentScriptMatches as t, type ContentScriptOptions as u, type ContentScriptEntrypointOptions as v, ContentScriptAppend as w, type ContentScriptMount as x, type ContentScriptRenderReactComponent as y, type ContentScriptMainFunction as z };
156
+ export { type ContentScriptMount as A, type ContentScriptRenderReactComponent as B, type ContentScriptConfig as C, type ContentScriptMainFunction as D, type ContentScriptDefinition as a, type ContentScriptContext as b, type ContentScriptNode as c, type ContentScriptRenderValue as d, type ContentScriptRenderHandler as e, type ContentScriptBuilder as f, type ContentScriptEventEmitter as g, type ContentScriptNodeSet as h, type ContentScriptEventCallback as i, ContentScriptEvent as j, type ContentScriptResolvedDefinition as k, type ContentScriptAnchor as l, type ContentScriptAnchorGetter as m, type ContentScriptAnchorResolver as n, type ContentScriptMountFunction as o, type ContentScriptContainerTag as p, type ContentScriptContainerOptions as q, type ContentScriptContainerFactory as r, type ContentScriptContainerCreator as s, type ContentScriptWatchStrategy as t, type ContentScriptProps as u, type ContentScriptAppendDefinition as v, ContentScriptMatches as w, type ContentScriptOptions as x, type ContentScriptEntrypointOptions as y, ContentScriptAppend as z };
@@ -1,6 +1,6 @@
1
1
  import { ReactNode, FC } from 'react';
2
2
  import { Optional } from 'utility-types';
3
- import { E as EntrypointOptions, A as Awaiter, P as PickNonFunctionProperties, a as EntrypointBuilder } from './helpers-DnV3N7fU.mjs';
3
+ import { E as EntrypointOptions, A as Awaiter, P as PickNonFunctionProperties, a as EntrypointBuilder } from './helpers-YDFORuZz.mjs';
4
4
 
5
5
  type ExecutionWorld = chrome.scripting.ExecutionWorld;
6
6
  type RunAt = chrome.userScripts.RunAt;
@@ -68,8 +68,8 @@ declare enum ContentScriptAppend {
68
68
  }
69
69
  type ContentScriptMountFunction = (anchor: Element, container: Element) => void | (() => void);
70
70
  interface ContentScriptMount {
71
- mount(): void;
72
- unmount(): void;
71
+ mount(): boolean | undefined | void;
72
+ unmount(): boolean | undefined | void;
73
73
  }
74
74
  interface ContentScriptProps extends ContentScriptEntrypointOptions {
75
75
  anchor: Element;
@@ -89,8 +89,41 @@ type ContentScriptContainerOptions = {
89
89
  type ContentScriptContainerFactory = (props: ContentScriptProps) => Awaiter<Element | ContentScriptContainerTag | ContentScriptContainerOptions>;
90
90
  type ContentScriptContainerCreator = (props: ContentScriptProps) => Awaiter<Element>;
91
91
  type ContentScriptWatchStrategy = (update: () => void, context: ContentScriptContext) => () => void;
92
+ declare enum ContentScriptEvent {
93
+ Mount = "mount",
94
+ Unmount = "unmount",
95
+ Add = "add",
96
+ Remove = "remove"
97
+ }
98
+ type ContentScriptEventCallback = (event: ContentScriptEvent, node: ContentScriptNode) => void;
99
+ interface ContentScriptEventEmitter {
100
+ on(callback: ContentScriptEventCallback): void;
101
+ off(callback: ContentScriptEventCallback): void;
102
+ emit(event: ContentScriptEvent, node: ContentScriptNode): void;
103
+ emitMount(node: ContentScriptNode): void;
104
+ emitUnmount(node: ContentScriptNode): void;
105
+ emitAdd(node: ContentScriptNode): void;
106
+ emitRemove(node: ContentScriptNode): void;
107
+ removeAllListeners(): void;
108
+ listenerCount(): number;
109
+ hasListeners(): boolean;
110
+ }
92
111
  interface ContentScriptContext extends ContentScriptMount {
93
112
  nodes: ReadonlySet<ContentScriptNode>;
113
+ /**
114
+ * Registers a callback function that will be invoked when a specific content script context event occurs.
115
+ *
116
+ * @param {ContentScriptEventCallback} callback - The function to be executed when the event is triggered. Receives event-related data as its argument.
117
+ * @return {Function} A function that can be called to unsubscribe the callback from the event.
118
+ */
119
+ watch(callback: ContentScriptEventCallback): () => void;
120
+ /**
121
+ * Stops watching for changes or events that were previously being observed.
122
+ * Unsubscribes from all event listeners that were registered through the watch method.
123
+ *
124
+ * @return {void} No return value.
125
+ */
126
+ unwatch(): void;
94
127
  }
95
128
  type ContentScriptMainFunction = (context: ContentScriptContext, options: ContentScriptOptions) => Awaiter<void>;
96
129
  interface ContentScriptNode extends ContentScriptMount {
@@ -120,4 +153,4 @@ interface ContentScriptBuilder extends EntrypointBuilder {
120
153
  getContext(): ContentScriptContext;
121
154
  }
122
155
 
123
- export { type ContentScriptConfig as C, type ContentScriptDefinition as a, type ContentScriptContext as b, type ContentScriptNode as c, type ContentScriptRenderValue as d, type ContentScriptRenderHandler as e, type ContentScriptBuilder as f, type ContentScriptNodeSet as g, type ContentScriptResolvedDefinition as h, type ContentScriptAnchor as i, type ContentScriptAnchorGetter as j, type ContentScriptAnchorResolver as k, type ContentScriptMountFunction as l, type ContentScriptContainerTag as m, type ContentScriptContainerOptions as n, type ContentScriptContainerFactory as o, type ContentScriptContainerCreator as p, type ContentScriptWatchStrategy as q, type ContentScriptProps as r, type ContentScriptAppendDefinition as s, ContentScriptMatches as t, type ContentScriptOptions as u, type ContentScriptEntrypointOptions as v, ContentScriptAppend as w, type ContentScriptMount as x, type ContentScriptRenderReactComponent as y, type ContentScriptMainFunction as z };
156
+ export { type ContentScriptMount as A, type ContentScriptRenderReactComponent as B, type ContentScriptConfig as C, type ContentScriptMainFunction as D, type ContentScriptDefinition as a, type ContentScriptContext as b, type ContentScriptNode as c, type ContentScriptRenderValue as d, type ContentScriptRenderHandler as e, type ContentScriptBuilder as f, type ContentScriptEventEmitter as g, type ContentScriptNodeSet as h, type ContentScriptEventCallback as i, ContentScriptEvent as j, type ContentScriptResolvedDefinition as k, type ContentScriptAnchor as l, type ContentScriptAnchorGetter as m, type ContentScriptAnchorResolver as n, type ContentScriptMountFunction as o, type ContentScriptContainerTag as p, type ContentScriptContainerOptions as q, type ContentScriptContainerFactory as r, type ContentScriptContainerCreator as s, type ContentScriptWatchStrategy as t, type ContentScriptProps as u, type ContentScriptAppendDefinition as v, ContentScriptMatches as w, type ContentScriptOptions as x, type ContentScriptEntrypointOptions as y, ContentScriptAppend as z };
@@ -1,5 +1,5 @@
1
- import { a as BackgroundDefinition, b as BackgroundMainHandler } from '../../background-CyGGjmBx.mjs';
2
- import '../../helpers-DnV3N7fU.mjs';
1
+ import { a as BackgroundDefinition, b as BackgroundMainHandler } from '../../background-cxLBji1Q.mjs';
2
+ import '../../helpers-YDFORuZz.mjs';
3
3
 
4
4
  declare const isValidBackgroundDefinition: (definition: any) => definition is BackgroundDefinition;
5
5
  declare const isValidBackgroundMainHandler: (main: unknown) => main is BackgroundMainHandler;
@@ -1,5 +1,5 @@
1
- import { a as BackgroundDefinition, b as BackgroundMainHandler } from '../../background-Zjiqg60g.js';
2
- import '../../helpers-DnV3N7fU.js';
1
+ import { a as BackgroundDefinition, b as BackgroundMainHandler } from '../../background-CpVjDFHQ.js';
2
+ import '../../helpers-YDFORuZz.js';
3
3
 
4
4
  declare const isValidBackgroundDefinition: (definition: any) => definition is BackgroundDefinition;
5
5
  declare const isValidBackgroundMainHandler: (main: unknown) => main is BackgroundMainHandler;
@@ -1,6 +1,6 @@
1
- import { C as CommandDefinition, a as CommandExecute } from '../../command-BFsdm7Bx.mjs';
2
- import '../../helpers-DnV3N7fU.mjs';
3
- import '../../background-CyGGjmBx.mjs';
1
+ import { C as CommandDefinition, a as CommandExecute } from '../../command-S2dcqx6Q.mjs';
2
+ import '../../helpers-YDFORuZz.mjs';
3
+ import '../../background-cxLBji1Q.mjs';
4
4
 
5
5
  declare const isValidCommandDefinition: (definition: any) => definition is CommandDefinition;
6
6
  declare const isValidCommandExecuteFunction: (execute: any) => execute is CommandExecute;
@@ -1,6 +1,6 @@
1
- import { C as CommandDefinition, a as CommandExecute } from '../../command-3i_5d__K.js';
2
- import '../../helpers-DnV3N7fU.js';
3
- import '../../background-Zjiqg60g.js';
1
+ import { C as CommandDefinition, a as CommandExecute } from '../../command-TJ2JUrVd.js';
2
+ import '../../helpers-YDFORuZz.js';
3
+ import '../../background-CpVjDFHQ.js';
4
4
 
5
5
  declare const isValidCommandDefinition: (definition: any) => definition is CommandDefinition;
6
6
  declare const isValidCommandExecuteFunction: (execute: any) => execute is CommandExecute;
@@ -1,7 +1,7 @@
1
- import { w as ContentScriptAppend, l as ContentScriptMountFunction, a as ContentScriptDefinition, d as ContentScriptRenderValue, e as ContentScriptRenderHandler } from '../../content-BYoXVO6V.mjs';
1
+ import { z as ContentScriptAppend, o as ContentScriptMountFunction, a as ContentScriptDefinition, d as ContentScriptRenderValue, e as ContentScriptRenderHandler } from '../../content-DrrPH4ri.mjs';
2
2
  import 'react';
3
3
  import 'utility-types';
4
- import '../../helpers-DnV3N7fU.mjs';
4
+ import '../../helpers-YDFORuZz.mjs';
5
5
 
6
6
  declare const contentScriptMountAppendResolver: (append?: ContentScriptAppend) => ContentScriptMountFunction;
7
7
 
@@ -1,7 +1,7 @@
1
- import { w as ContentScriptAppend, l as ContentScriptMountFunction, a as ContentScriptDefinition, d as ContentScriptRenderValue, e as ContentScriptRenderHandler } from '../../content-sdYF4W-A.js';
1
+ import { z as ContentScriptAppend, o as ContentScriptMountFunction, a as ContentScriptDefinition, d as ContentScriptRenderValue, e as ContentScriptRenderHandler } from '../../content-B0znLIjr.js';
2
2
  import 'react';
3
3
  import 'utility-types';
4
- import '../../helpers-DnV3N7fU.js';
4
+ import '../../helpers-YDFORuZz.js';
5
5
 
6
6
  declare const contentScriptMountAppendResolver: (append?: ContentScriptAppend) => ContentScriptMountFunction;
7
7
 
@@ -65,11 +65,7 @@ var contentScriptAnchorResolver = (anchor) => async () => {
65
65
  }
66
66
  } else if (typeof resolved === "string") {
67
67
  if (resolved.startsWith("/")) {
68
- const notRegex = /not\(\s*[^)]+\s*\)/;
69
- const condition = `not(@${attr})`;
70
- if (notRegex.test(resolved)) {
71
- resolved = `(${resolved})[${condition}]`;
72
- }
68
+ resolved = `(${resolved})[not(@${attr})]`;
73
69
  const result = document.evaluate(
74
70
  resolved,
75
71
  document,
@@ -179,6 +175,9 @@ var contentScriptLocationResolver = (strategy) => (update, context) => {
179
175
 
180
176
  // src/entry/content/core/Context.ts
181
177
  var Context_default = class {
178
+ constructor(emitter) {
179
+ this.emitter = emitter;
180
+ }
182
181
  collection = /* @__PURE__ */ new Set();
183
182
  get nodes() {
184
183
  return this.collection;
@@ -188,6 +187,7 @@ var Context_default = class {
188
187
  if (!node.anchor.isConnected) {
189
188
  node.unmount();
190
189
  this.collection.delete(node);
190
+ this.emitter.emitRemove(node);
191
191
  continue;
192
192
  }
193
193
  node.mount();
@@ -198,23 +198,72 @@ var Context_default = class {
198
198
  node.unmount();
199
199
  if (!node.anchor.isConnected) {
200
200
  this.collection.delete(node);
201
+ this.emitter.emitRemove(node);
201
202
  }
202
203
  }
203
204
  }
205
+ watch(callback) {
206
+ this.emitter.on(callback);
207
+ return () => {
208
+ this.emitter.off(callback);
209
+ };
210
+ }
211
+ unwatch() {
212
+ this.emitter.removeAllListeners();
213
+ }
204
214
  };
205
215
 
206
216
  // src/entry/content/core/ManagedContext.ts
207
217
  var ManagedContext_default = class extends Context_default {
208
218
  add(node) {
209
219
  this.collection.add(node);
220
+ this.emitter.emitAdd(node);
210
221
  return this;
211
222
  }
212
223
  };
213
224
 
225
+ // src/entry/content/core/EventEmitter.ts
226
+ var EventEmitter_default = class {
227
+ listeners = /* @__PURE__ */ new Set();
228
+ emit(event, node) {
229
+ for (const listener of this.listeners) {
230
+ listener(event, node);
231
+ }
232
+ }
233
+ emitAdd(node) {
234
+ this.emit("add" /* Add */, node);
235
+ }
236
+ emitMount(node) {
237
+ this.emit("mount" /* Mount */, node);
238
+ }
239
+ emitRemove(node) {
240
+ this.emit("remove" /* Remove */, node);
241
+ }
242
+ emitUnmount(node) {
243
+ this.emit("unmount" /* Unmount */, node);
244
+ }
245
+ hasListeners() {
246
+ return this.listenerCount() > 0;
247
+ }
248
+ listenerCount() {
249
+ return this.listeners.size;
250
+ }
251
+ off(callback) {
252
+ this.listeners.delete(callback);
253
+ }
254
+ on(callback) {
255
+ this.listeners.add(callback);
256
+ }
257
+ removeAllListeners() {
258
+ this.listeners.clear();
259
+ }
260
+ };
261
+
214
262
  // src/entry/content/core/Builder.ts
215
263
  var Builder_default2 = class extends Builder_default {
216
264
  definition;
217
- context = new ManagedContext_default();
265
+ emitter = new EventEmitter_default();
266
+ context = new ManagedContext_default(this.emitter);
218
267
  unwatch;
219
268
  isProcessing = false;
220
269
  constructor(definition) {
@@ -257,6 +306,7 @@ var Builder_default2 = class extends Builder_default {
257
306
  async build() {
258
307
  await this.destroy();
259
308
  const { render, main, anchor, container, watch, mount, ...options } = this.definition;
309
+ await (main == null ? void 0 : main(this.context, options));
260
310
  if (render !== void 0) {
261
311
  await this.processing();
262
312
  this.unwatch = watch(() => {
@@ -265,7 +315,6 @@ var Builder_default2 = class extends Builder_default {
265
315
  });
266
316
  }, this.context);
267
317
  }
268
- await (main == null ? void 0 : main(this.context, options));
269
318
  }
270
319
  async destroy() {
271
320
  var _a;
@@ -304,14 +353,18 @@ var Node_default = class {
304
353
  this.mark();
305
354
  if (!this.container && this._container) {
306
355
  this.container = this._container.cloneNode(false);
356
+ return true;
307
357
  }
358
+ return false;
308
359
  }
309
360
  unmount() {
310
361
  this.unmark();
311
362
  if (this.container) {
312
363
  this.container.remove();
313
364
  this.container = void 0;
365
+ return true;
314
366
  }
367
+ return false;
315
368
  }
316
369
  mark() {
317
370
  let id = this.anchor.getAttribute(this.attr);
@@ -339,21 +392,24 @@ var MountNode_default = class {
339
392
  return this.node.container;
340
393
  }
341
394
  mount() {
342
- var _a;
343
395
  this.node.mount();
344
396
  if (!this.container || this.container.isConnected) {
345
- return;
397
+ return false;
346
398
  }
347
- const unmounting = (_a = this.mounter) == null ? void 0 : _a.call(this, this.anchor, this.container);
348
- if (unmounting) {
349
- this.unmounting = unmounting;
399
+ if (this.mounter) {
400
+ const unmounting = this.mounter(this.anchor, this.container);
401
+ if (unmounting) {
402
+ this.unmounting = unmounting;
403
+ }
404
+ return true;
350
405
  }
406
+ return false;
351
407
  }
352
408
  unmount() {
353
409
  var _a;
354
410
  (_a = this.unmounting) == null ? void 0 : _a.call(this);
355
411
  this.unmounting = void 0;
356
- this.node.unmount();
412
+ return !!this.node.unmount();
357
413
  }
358
414
  };
359
415
 
@@ -380,7 +436,8 @@ var MountBuilder_default = class extends Builder_default2 {
380
436
  }
381
437
  async createNode(anchor) {
382
438
  let container;
383
- if (await this.getValue(anchor)) {
439
+ const value = await this.getValue(anchor);
440
+ if (typeof value !== "boolean" && value !== void 0) {
384
441
  container = await this.definition.container(this.getProps(anchor));
385
442
  }
386
443
  return new MountNode_default(new Node_default(anchor, container), this.definition.mount);
@@ -389,6 +446,34 @@ var MountBuilder_default = class extends Builder_default2 {
389
446
  this.values.delete(anchor);
390
447
  }
391
448
  };
449
+
450
+ // src/entry/content/core/EventNode.ts
451
+ var EventNode_default = class {
452
+ constructor(node, emitter) {
453
+ this.node = node;
454
+ this.emitter = emitter;
455
+ }
456
+ get anchor() {
457
+ return this.node.anchor;
458
+ }
459
+ get container() {
460
+ return this.node.container;
461
+ }
462
+ mount() {
463
+ const result = this.node.mount();
464
+ if (result === true) {
465
+ this.emitter.emitMount(this.node);
466
+ }
467
+ return !!result;
468
+ }
469
+ unmount() {
470
+ const result = this.node.unmount();
471
+ if (result === true) {
472
+ this.emitter.emitUnmount(this.node);
473
+ }
474
+ return !!result;
475
+ }
476
+ };
392
477
  var Node_default2 = class {
393
478
  constructor(node, component) {
394
479
  this.node = node;
@@ -404,20 +489,21 @@ var Node_default2 = class {
404
489
  mount() {
405
490
  this.node.mount();
406
491
  if (!this.container || this.root) {
407
- return;
492
+ return false;
408
493
  }
409
494
  if (!this.component) {
410
495
  console.warn("Content script react component is empty");
411
- return;
496
+ return false;
412
497
  }
413
498
  this.root = client.createRoot(this.container);
414
499
  this.root.render(this.component);
500
+ return true;
415
501
  }
416
502
  unmount() {
417
503
  var _a;
418
504
  (_a = this.root) == null ? void 0 : _a.unmount();
419
505
  this.root = void 0;
420
- this.node.unmount();
506
+ return !!this.node.unmount();
421
507
  }
422
508
  };
423
509
  var contentScriptReactRenderResolver = (render) => async (props) => {
@@ -444,7 +530,7 @@ var Builder_default3 = class extends MountBuilder_default {
444
530
  value = void 0;
445
531
  console.warn("Content script react value is not a valid React element");
446
532
  }
447
- return new Node_default2(await super.createNode(anchor), value);
533
+ return new EventNode_default(new Node_default2(await super.createNode(anchor), value), this.emitter);
448
534
  }
449
535
  };
450
536