@vacantthinker/firefox-addon-framework-easy 2026.616.2031 → 2026.617.739

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
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
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';
@@ -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,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"}
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
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';
package/dist/opTab.d.ts CHANGED
@@ -54,7 +54,8 @@ export declare function tabOpQueryDomain(domain: string): Promise<{
54
54
  */
55
55
  export declare function tabOpQueryUrl(url: string): Promise<number[]>;
56
56
  /**
57
- * browserRuntimeGetPagesURL("optionsALL.html"
57
+ * Ensures only one tab with the given URL exists, focuses/reloads it,
58
+ * or creates a new one if it doesn't exist. Closes duplicates if found.
58
59
  * @param url
59
60
  */
60
61
  export declare function tabOpCreateKeepOnlyOneFocusTrue(url: string): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"opTab.d.ts","sourceRoot":"","sources":["../src/opTab.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,WACf,SAAQ,OAAO,CAAC,IAAI,CAAC,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,WAAW,GAAG,IAAI,CAGtE;AA4BD;;GAEG;AACH,wBAAsB,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC,CAExG;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC,CAMnH;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC,CAKlH;AAED,UAAU,sBAAsB;IAC9B,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC;IACjD,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,CAc3F;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAMvF;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAEvE;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,OAA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ED
@@ -118,24 +118,33 @@ export async function tabOpQueryUrl(url) {
118
118
  .map((t) => t.id);
119
119
  }
120
120
  /**
121
- * browserRuntimeGetPagesURL("optionsALL.html"
121
+ * Ensures only one tab with the given URL exists, focuses/reloads it,
122
+ * or creates a new one if it doesn't exist. Closes duplicates if found.
122
123
  * @param url
123
124
  */
124
125
  export async function tabOpCreateKeepOnlyOneFocusTrue(url) {
125
126
  const tabIds = await tabOpQueryUrl(url);
126
- let tabId = tabIds.shift();
127
- if (tabIds.length >= 1 && tabId) {
128
- await tabOpFocus(tabId);
129
- await tabOpReload(tabId);
127
+ if (tabIds.length > 0) {
128
+ // 1. Pick the first existing tab to focus and reload
129
+ const targetTabId = tabIds[0];
130
+ await tabOpFocus(targetTabId);
131
+ await tabOpReload(targetTabId);
132
+ // 2. Cleanup: If there are accidental duplicates, close them
133
+ if (tabIds.length > 1) {
134
+ const extraTabIds = tabIds.slice(1);
135
+ await tabOpRemove(extraTabIds);
136
+ }
130
137
  }
131
138
  else {
139
+ // 3. No tabs exist with this URL, create a new one
132
140
  await tabOpCreateActiveTrue({ url });
133
141
  }
134
142
  }
135
143
  export async function tabOpQueryThenReloadALL(url) {
136
144
  const tabIds = await tabOpQueryUrl(url);
137
145
  if (tabIds.length >= 1) {
138
- tabIds.forEach(tabId => tabOpReload(tabId));
146
+ // Reload all matching tabs concurrently and wait for completion
147
+ await Promise.all(tabIds.map(tabId => tabOpReload(tabId)));
139
148
  }
140
149
  }
141
150
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.0616.2031",
3
+ "version": "2026.0617.0739",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",