@vacantthinker/firefox-addon-framework-easy 2026.610.1322 → 2026.611.821

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.0610.1322",
3
+ "version": "2026.0611.0821",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
package/src/BaseORM.js CHANGED
@@ -1,21 +1,14 @@
1
1
  import {stoOpCheck, stoOpGet, stoOpRem, stoOpSet} from './opStorage.js';
2
2
 
3
3
  /**
4
- * Abstract base class BaseORM (similar to Java's Abstract Class).
5
- * Provides encapsulated CRUD operations for specific Key-Value pairs bound at instantiation.
4
+ * Abstract base class BaseORM.
5
+ * Provides encapsulated CRUD operations for JSON-serializable Key-Value pairs.
6
6
  */
7
7
  export class BaseORM {
8
- // Private fields for data encapsulation
9
- #id; // Added to store the raw unique identifier
8
+ #id;
10
9
  #fullStorageKey;
11
10
  #defaultValue;
12
11
 
13
- /**
14
- * Constructor
15
- * @param {string} prefix The prefix for the keys (e.g., 'magnetKey')
16
- * @param {string} id The unique identifier for this instance
17
- * @param {object} [defaultValue={}] Custom initial value
18
- */
19
12
  constructor(prefix, id, defaultValue = {}) {
20
13
  if (new.target === BaseORM) {
21
14
  throw new TypeError(
@@ -25,47 +18,28 @@ export class BaseORM {
25
18
  throw new Error('Both prefix and id must be specified.');
26
19
  }
27
20
 
28
- // Save the raw id to the private field
29
21
  this.#id = id;
30
-
31
22
  const formattedPrefix = prefix.endsWith(' ') ? prefix : `${prefix} `;
32
23
  this.#fullStorageKey = `${formattedPrefix}${id}`;
33
24
  this.#defaultValue = JSON.parse(JSON.stringify(defaultValue));
34
25
  }
35
26
 
36
- /**
37
- * Public Getter to retrieve the bound unique identifier (id).
38
- * Can be accessed as `this.id` inside subclasses or `instance.id` externally.
39
- * @return {string} The raw id
40
- */
41
27
  get id() {
42
28
  return this.#id;
43
29
  }
44
30
 
45
- /**
46
- * Protected Getter for subclasses to safely access the complete key.
47
- * Can be used in subclasses as `this.storageKey`.
48
- * @protected
49
- * @return {string} The full storage key
50
- */
51
31
  get storageKey() {
52
32
  return this.#fullStorageKey;
53
33
  }
54
34
 
55
- // Private helper method
56
35
  async #exists() {
57
36
  return await stoOpCheck(this.#fullStorageKey);
58
37
  }
59
38
 
60
- // Private helper method
61
39
  async #initDefaultObject() {
62
40
  await stoOpSet(this.#fullStorageKey, this.#defaultValue);
63
41
  }
64
42
 
65
- /**
66
- * [Read] Retrieve the value associated with the bound key.
67
- * @return {Promise<object>}
68
- */
69
43
  async get() {
70
44
  if (!(await this.#exists())) {
71
45
  await this.#initDefaultObject();
@@ -73,31 +47,16 @@ export class BaseORM {
73
47
  return await stoOpGet(this.#fullStorageKey);
74
48
  }
75
49
 
76
- /**
77
- * [Create/Update] Overwrite the value of the bound key completely.
78
- * @param {object} value The new Object data to store
79
- * @return {Promise<void>}
80
- */
81
50
  async set(value) {
82
51
  await stoOpSet(this.#fullStorageKey, value || this.#defaultValue);
83
52
  }
84
53
 
85
- /**
86
- * [Delete] Wipe the bound key from storage.
87
- * @return {Promise<object>}
88
- */
89
54
  async delete() {
90
55
  const previousValue = await this.get();
91
56
  await stoOpRem(this.#fullStorageKey);
92
57
  return previousValue;
93
58
  }
94
59
 
95
- /**
96
- * [Partial Update] Modify a single targeted key-value pair nested deep within the stored object.
97
- * @param {string} objectKey The internal key path inside the main value object
98
- * @param {*} objectValue The new value to map to that key
99
- * @return {Promise<object>} Returns the fully updated object structure
100
- */
101
60
  async updateValueKeyValue(objectKey, objectValue) {
102
61
  const currentData = await this.get();
103
62
  currentData[objectKey] = objectValue;
package/src/browserTab.js CHANGED
@@ -29,7 +29,7 @@ export function browserTabWaitReloadThenSendMessageToContentJs(message) {
29
29
  * @param message
30
30
  * @param message.tabId{number}
31
31
  * @param message.url{string}
32
- * @param message.options.focusNewTab{boolean}
32
+ * @param message.focusNewTab{boolean}
33
33
  * @returns {Promise<void>}
34
34
  */
35
35
  export async function browserTabCreateToDownload(message) {
@@ -45,9 +45,9 @@ export async function browserTabCreateToDownload(message) {
45
45
  delete message.tabId;
46
46
  }
47
47
  }
48
- if (message.options) {
49
- let focusNewTab = message.options.focusNewTab;
50
- Object.assign(properties, {active: focusNewTab});
48
+
49
+ if (message?.focusNewTab !== undefined) {
50
+ Object.assign(properties, {active: message.focusNewTab});
51
51
  }
52
52
 
53
53
  let {tabId} = await tabOpCreateNear(properties);
@@ -70,8 +70,7 @@ export async function browserTabCreateToDownload(message) {
70
70
  * * @param {Object} message - The message payload.
71
71
  * @param {number} [message.tabId] - Optional Tab ID to attach to.
72
72
  * @param {string} [message.url] - The URL to open.
73
- * @param {Object} [message.options] - Additional options.
74
- * @param {boolean} [message.options.focusNewTab] - Whether the newly created tab should be active.
73
+ * @param {boolean} [message.focusNewTab] - Whether the newly created tab should be active.
75
74
  * @returns {Promise<void>}
76
75
  */
77
76
  export async function browserTabCreateNearSendMessageToContentJs(message = {}) {
@@ -92,8 +91,8 @@ export async function browserTabCreateNearSendMessageToContentJs(message = {}) {
92
91
 
93
92
  // Use optional chaining to safely extract nested properties.
94
93
  // Only assign 'active' if 'focusNewTab' was explicitly provided.
95
- if (message?.options?.focusNewTab !== undefined) {
96
- Object.assign(properties, {active: message.options.focusNewTab});
94
+ if (message?.focusNewTab !== undefined) {
95
+ Object.assign(properties, {active: message.focusNewTab});
97
96
  }
98
97
 
99
98
  let {tabId} = await tabOpCreateNear(properties);
package/src/generate.js CHANGED
@@ -1,5 +1,3 @@
1
- // 新主题。
2
-
3
1
  /**
4
2
  *
5
3
  * @param videoInfo