@vacantthinker/firefox-addon-framework-easy 2026.616.2042 → 2026.617.1148

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.
@@ -0,0 +1,19 @@
1
+ import { BaseORM } from './BaseORM';
2
+ /**
3
+ * Abstract class for ORMs that store Map<number, V> data.
4
+ * Automatically handles the conversion between internal Record<number, V> and
5
+ * Map<number, V>.
6
+ */
7
+ export declare abstract class BaseNumberKeyORM<V> extends BaseORM<Record<number, V>> {
8
+ protected constructor(prefix: string, id: string);
9
+ /**
10
+ * Fetches data as Record, handles legacy arrays/corruption,
11
+ * and converts it to Map<number, V> with properly cast number keys.
12
+ */
13
+ protected getMap(): Promise<Map<number, V>>;
14
+ /**
15
+ * Converts internal Map<number, V> back to Record for storage.
16
+ */
17
+ protected setMap(map: Map<number, V>): Promise<void>;
18
+ }
19
+ //# sourceMappingURL=BaseNumberKeyORM.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseNumberKeyORM.d.ts","sourceRoot":"","sources":["../src/BaseNumberKeyORM.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC;;;;GAIG;AACH,8BAAsB,gBAAgB,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1E,SAAS,aAAa,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAKhD;;;OAGG;cACa,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAmBjD;;OAEG;cACa,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3D"}
@@ -0,0 +1,37 @@
1
+ import { BaseORM } from './BaseORM';
2
+ /**
3
+ * Abstract class for ORMs that store Map<number, V> data.
4
+ * Automatically handles the conversion between internal Record<number, V> and
5
+ * Map<number, V>.
6
+ */
7
+ export class BaseNumberKeyORM extends BaseORM {
8
+ constructor(prefix, id) {
9
+ // Hardcode the default value to an empty object
10
+ super(prefix, id, {});
11
+ }
12
+ /**
13
+ * Fetches data as Record, handles legacy arrays/corruption,
14
+ * and converts it to Map<number, V> with properly cast number keys.
15
+ */
16
+ async getMap() {
17
+ let data = await this.get();
18
+ // Data Migration / Corruption Guard (carried over from your original logic)
19
+ if (Array.isArray(data)) {
20
+ console.warn(`BaseNumberKeyORM: Old Array data detected for ${this.storageKey}. Migrating to Record.`);
21
+ data = Object.fromEntries(data);
22
+ await this.set(data);
23
+ }
24
+ else if (typeof data !== 'object' || data === null) {
25
+ data = {};
26
+ await this.set(data);
27
+ }
28
+ // Convert object entries back to Map, casting string keys to numbers
29
+ return new Map(Object.entries(data).map(([key, value]) => [Number(key), value]));
30
+ }
31
+ /**
32
+ * Converts internal Map<number, V> back to Record for storage.
33
+ */
34
+ async setMap(map) {
35
+ await this.set(Object.fromEntries(map));
36
+ }
37
+ }
@@ -0,0 +1,18 @@
1
+ import { BaseORM } from './BaseORM';
2
+ /**
3
+ * Abstract class for ORMs that store Map<string, V> data.
4
+ * Automatically handles the conversion between internal Record<string, V> and
5
+ * Map<string, V>.
6
+ */
7
+ export declare abstract class BaseStringKeyORM<V> extends BaseORM<Record<string, V>> {
8
+ protected constructor(prefix: string, id: string);
9
+ /**
10
+ * Fetches data as Record and converts it to Map<string, V>.
11
+ */
12
+ protected getMap(): Promise<Map<string, V>>;
13
+ /**
14
+ * Converts internal Map<string, V> back to Record for storage.
15
+ */
16
+ protected setMap(map: Map<string, V>): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=BaseStringKeyORM.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseStringKeyORM.d.ts","sourceRoot":"","sources":["../src/BaseStringKeyORM.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC;;;;GAIG;AACH,8BAAsB,gBAAgB,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1E,SAAS,aAAa,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAKhD;;OAEG;cACa,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAOjD;;OAEG;cACa,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3D"}
@@ -0,0 +1,26 @@
1
+ import { BaseORM } from './BaseORM';
2
+ /**
3
+ * Abstract class for ORMs that store Map<string, V> data.
4
+ * Automatically handles the conversion between internal Record<string, V> and
5
+ * Map<string, V>.
6
+ */
7
+ export class BaseStringKeyORM extends BaseORM {
8
+ constructor(prefix, id) {
9
+ // Hardcode the default value to an empty object
10
+ super(prefix, id, {});
11
+ }
12
+ /**
13
+ * Fetches data as Record and converts it to Map<string, V>.
14
+ */
15
+ async getMap() {
16
+ const data = await this.get();
17
+ // Convert object entries to Map
18
+ return new Map(Object.entries(data || {}));
19
+ }
20
+ /**
21
+ * Converts internal Map<string, V> back to Record for storage.
22
+ */
23
+ async setMap(map) {
24
+ await this.set(Object.fromEntries(map));
25
+ }
26
+ }
@@ -42,4 +42,11 @@ export interface MessagePayloadFocusTargetTab {
42
42
  export declare function ctJsFocusTargetTabUseRuntimeMessage(targetTabId: number): Promise<void>;
43
43
  export declare function ctJsFocusTargetTab(targetTabId: number): Promise<void>;
44
44
  export declare function ctJsRemoveDomainCache(domain: string): Promise<void>;
45
- //# sourceMappingURL=serviceOpContentJsYTB.d.ts.map
45
+ /**
46
+ * Executes a provided function once the DOM is ready.
47
+ * If the DOM is already ready, it executes immediately.
48
+ * * @param fn - The function to execute. Can be a synchronous or asynchronous
49
+ * function.
50
+ */
51
+ export declare function ctJsExecuteOnReady(fn: () => void | Promise<void>): Promise<void>;
52
+ //# sourceMappingURL=ContentJsYTB.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentJsYTB.d.ts","sourceRoot":"","sources":["../src/ContentJsYTB.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,GAAE,MAAc,GAAG,IAAI,CAmCvG;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOvE;AAED,wBAAsB,wBAAwB,kBAE7C;AAED,wBAAsB,wBAAwB,kBAE7C;AAED,wBAAsB,wBAAwB,kBAE7C;AAED,wBAAsB,uBAAuB,kBAE5C;AAED,wBAAsB,sBAAsB,kBAE3C;AAGD;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKpE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAW,EAAE,SAAS,UAAQ,QAShE;AAED,wBAAsB,YAAY,kBAIjC;AAED,MAAM,WAAW,4BAA4B;IAC3C,GAAG,EAAE,mBAAmB,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,mCAAmC,CAAC,WAAW,EAAE,MAAM,iBAM5E;AAED,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,iBAE3D;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,iBAEzD;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBtF"}
@@ -106,3 +106,24 @@ export async function ctJsFocusTargetTab(targetTabId) {
106
106
  export async function ctJsRemoveDomainCache(domain) {
107
107
  await browserBrowsingDataRemoveDomainCache(domain);
108
108
  }
109
+ /**
110
+ * Executes a provided function once the DOM is ready.
111
+ * If the DOM is already ready, it executes immediately.
112
+ * * @param fn - The function to execute. Can be a synchronous or asynchronous
113
+ * function.
114
+ */
115
+ export async function ctJsExecuteOnReady(fn) {
116
+ if (document.readyState === 'loading') {
117
+ // DOM is still loading, wait for the event
118
+ await new Promise((resolve) => {
119
+ document.addEventListener('DOMContentLoaded', async () => {
120
+ await fn();
121
+ resolve();
122
+ }, { once: true });
123
+ });
124
+ }
125
+ else {
126
+ // DOM is already ready, execute immediately
127
+ await fn();
128
+ }
129
+ }
package/dist/index.d.ts CHANGED
@@ -1,15 +1,17 @@
1
+ export * from './BaseNumberKeyORM';
1
2
  export * from './BaseORM';
3
+ export * from './BaseStringKeyORM';
2
4
  export * from './browserBrowsingData';
3
5
  export * from './browserDownload';
4
6
  export * from './browserNotification';
5
7
  export * from './browserRuntime';
6
8
  export * from './browserTab';
9
+ export * from './ContentJsYTB';
7
10
  export * from './opStorage';
8
11
  export * from './opTab';
9
12
  export * from './serviceCommon';
10
13
  export * from './serviceFetch';
11
14
  export * from './serviceGet';
12
- export * from './serviceOpContentJsYTB';
13
15
  export * from './serviceOpContent';
14
16
  export * from './serviceOperationYTB';
15
17
  export * from './serviceOpJavascript';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -1,15 +1,17 @@
1
+ export * from './BaseNumberKeyORM';
1
2
  export * from './BaseORM';
3
+ export * from './BaseStringKeyORM';
2
4
  export * from './browserBrowsingData';
3
5
  export * from './browserDownload';
4
6
  export * from './browserNotification';
5
7
  export * from './browserRuntime';
6
8
  export * from './browserTab';
9
+ export * from './ContentJsYTB';
7
10
  export * from './opStorage';
8
11
  export * from './opTab';
9
12
  export * from './serviceCommon';
10
13
  export * from './serviceFetch';
11
14
  export * from './serviceGet';
12
- export * from './serviceOpContentJsYTB';
13
15
  export * from './serviceOpContent';
14
16
  export * from './serviceOperationYTB';
15
17
  export * from './serviceOpJavascript';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.0616.2042",
3
+ "version": "2026.0617.1148",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"file":"serviceOpContentJsYTB.d.ts","sourceRoot":"","sources":["../src/serviceOpContentJsYTB.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,GAAE,MAAc,GAAG,IAAI,CAmCvG;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOvE;AAED,wBAAsB,wBAAwB,kBAE7C;AAED,wBAAsB,wBAAwB,kBAE7C;AAED,wBAAsB,wBAAwB,kBAE7C;AAED,wBAAsB,uBAAuB,kBAE5C;AAED,wBAAsB,sBAAsB,kBAE3C;AAGD;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKpE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAW,EAAE,SAAS,UAAQ,QAShE;AAED,wBAAsB,YAAY,kBAIjC;AAED,MAAM,WAAW,4BAA4B;IAC3C,GAAG,EAAE,mBAAmB,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,mCAAmC,CAAC,WAAW,EAAE,MAAM,iBAM5E;AAED,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,iBAE3D;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,iBAEzD"}