adnbn 0.1.3 → 0.2.0

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/dist/index.d.mts CHANGED
@@ -7,8 +7,7 @@ import { Configuration, Filename } from '@rspack/core';
7
7
  import { Options } from 'html-rspack-tags-plugin';
8
8
  import { C as ContentScriptConfig, a as ContentScriptDefinition, s as ContentScriptAppendDefinition } from './content-BYoXVO6V.mjs';
9
9
  export { i as ContentScriptAnchor, j as ContentScriptAnchorGetter, k as ContentScriptAnchorResolver, w as ContentScriptAppend, f as ContentScriptBuilder, p as ContentScriptContainerCreator, o as ContentScriptContainerFactory, n as ContentScriptContainerOptions, m as ContentScriptContainerTag, b as ContentScriptContext, v as ContentScriptEntrypointOptions, z as ContentScriptMainFunction, t as ContentScriptMatches, x as ContentScriptMount, l as ContentScriptMountFunction, c as ContentScriptNode, g as ContentScriptNodeSet, u as ContentScriptOptions, r as ContentScriptProps, e as ContentScriptRenderHandler, y as ContentScriptRenderReactComponent, d as ContentScriptRenderValue, h as ContentScriptResolvedDefinition, q as ContentScriptWatchStrategy } from './content-BYoXVO6V.mjs';
10
- import { a as Language, j as LocaleNonPluralKeys, b as LocaleNativeStructure, i as LocaleSubstitutionsFor, k as LocalePluralKeys } from './NativeLocale-lgR6wNj3.mjs';
11
- export { d as LanguageCodes, f as LocaleDir } from './NativeLocale-lgR6wNj3.mjs';
10
+ import { a as Language } from './locale-Do4kUmgC.mjs';
12
11
  import { O as OffscreenDefinition } from './offscreen-B9GiglgN.mjs';
13
12
  export { d as OffscreenReason, c as OffscreenUnresolvedDefinition } from './offscreen-B9GiglgN.mjs';
14
13
  import { e as TransportType, a as TransportDictionary } from './transport-B_uYwoGi.mjs';
@@ -781,48 +780,6 @@ type Tab$2 = chrome.tabs.Tab;
781
780
  declare const getIcons: () => Record<string, Record<number, string>>;
782
781
  declare const changeActionIcon: (icon?: string, tab?: number | Tab$2) => Promise<void>;
783
782
 
784
- /**
785
- * Translates a given locale key into the corresponding localized string.
786
- *
787
- * @template K - A type representing the non-plural keys of the locale structure.
788
- * @param {K} key - The locale key to be translated.
789
- * @param {LocaleSubstitutionsFor<LocaleNativeStructure, K>} [substitutions] - Optional substitutions to be applied
790
- * within the localized string. These are typically placeholders replaced with dynamic values.
791
- * @returns {string} - The translated string for the given key, with substitutions applied if provided.
792
- */
793
- declare const _: <K extends LocaleNonPluralKeys<LocaleNativeStructure>>(key: K, substitutions?: LocaleSubstitutionsFor<LocaleNativeStructure, K>) => string;
794
- /**
795
- * Translates a given locale key into the corresponding localized string
796
- * based on a specific count for pluralization.
797
- *
798
- * @template K - A type representing the non-plural keys of the locale structure.
799
- * @param {K} key - The locale key to be translated.
800
- * @param {number} count - The count used to determine the pluralization form.
801
- * @param {LocaleSubstitutionsFor<LocaleNativeStructure, K>} [substitutions] - Optional substitutions to be applied
802
- * within the localized string. These are typically placeholders replaced with dynamic values.
803
- * @returns {string} - The translated string for the given key, adjusted for pluralization and with substitutions applied if provided.
804
- */
805
- declare const _c: <K extends LocalePluralKeys<LocaleNativeStructure>>(key: K, count: number, substitutions?: LocaleSubstitutionsFor<LocaleNativeStructure, K>) => string;
806
- /**
807
- * Converts a locale key into a standardized format and logs a warning if the key is not found
808
- * in the current language's locale keys.
809
- *
810
- * @param {Extract<keyof LocaleNativeStructure, string>} key - The locale key to be converted.
811
- * This key must be a string and exist within the `LocaleNativeStructure`.
812
- * @returns {string} - The converted locale message key.
813
- */
814
- declare const __: (key: keyof LocaleNativeStructure & string) => string;
815
- /**
816
- * Attempts to extract a locale key from the provided string and translates it
817
- * into the corresponding localized string. If no locale key can be extracted,
818
- * the original string is returned.
819
- *
820
- * @param {string} input - The input string from which a locale key is to be extracted.
821
- * @returns {string} - The translated string if a locale key is successfully extracted,
822
- * or the original string if no locale key is found.
823
- */
824
- declare const __t: (input: string) => string;
825
-
826
783
  type OffscreenParameters = chrome.offscreen.CreateParameters;
827
784
 
828
785
  type OffscreenAlias = string;
@@ -883,4 +840,4 @@ declare const defineSidebar: (options: SidebarDefinition) => SidebarDefinition;
883
840
  declare const getSidebars: () => SidebarMap;
884
841
  declare const changeSidebar: (alias: SidebarAlias, tab?: number | Tab) => Promise<void>;
885
842
 
886
- export { BackgroundConfig, BackgroundDefinition, Browser, Command, CommandConfig, CommandDefinition, type Config, type ConfigDefinition, ContentScriptAppendDefinition, ContentScriptConfig, ContentScriptDefinition, ExecuteActionCommandDefinition, Language, type ManifestBuilder, ManifestIncognito, Mode, type OffscreenAlias, OffscreenDefinition, type OffscreenMap, type PageAlias, type PageConfig, type PageDefinition, type PageMap, type PageProps, type Plugin, type PluginDefinition, type PopupAlias, type PopupMap, type ReadonlyConfig, RelayDefinition, ServiceDefinition, type SidebarAlias, type SidebarMap, type UserConfig, _, __, __t, _c, changeActionIcon, changePopup, changeSidebar, defineBackground, defineCommand, defineConfig, defineContentScript, defineContentScriptAppend, defineExecuteActionCommand, defineOffscreen, definePage, definePlugin, definePopup, defineRelay, defineService, defineSidebar, getApp, getBrowser, getEnv, getIcons, getManifestVersion, getOffscreen, getOffscreens, getPageUrl, getPages, getPopups, getRelay, getService, getSidebars, isBrowser };
843
+ export { BackgroundConfig, BackgroundDefinition, Browser, Command, CommandConfig, CommandDefinition, type Config, type ConfigDefinition, ContentScriptAppendDefinition, ContentScriptConfig, ContentScriptDefinition, ExecuteActionCommandDefinition, type ManifestBuilder, ManifestIncognito, Mode, type OffscreenAlias, OffscreenDefinition, type OffscreenMap, type PageAlias, type PageConfig, type PageDefinition, type PageMap, type PageProps, type Plugin, type PluginDefinition, type PopupAlias, type PopupMap, type ReadonlyConfig, RelayDefinition, ServiceDefinition, type SidebarAlias, type SidebarMap, type UserConfig, changeActionIcon, changePopup, changeSidebar, defineBackground, defineCommand, defineConfig, defineContentScript, defineContentScriptAppend, defineExecuteActionCommand, defineOffscreen, definePage, definePlugin, definePopup, defineRelay, defineService, defineSidebar, getApp, getBrowser, getEnv, getIcons, getManifestVersion, getOffscreen, getOffscreens, getPageUrl, getPages, getPopups, getRelay, getService, getSidebars, isBrowser };
package/dist/index.d.ts CHANGED
@@ -7,8 +7,7 @@ import { Configuration, Filename } from '@rspack/core';
7
7
  import { Options } from 'html-rspack-tags-plugin';
8
8
  import { C as ContentScriptConfig, a as ContentScriptDefinition, s as ContentScriptAppendDefinition } from './content-sdYF4W-A.js';
9
9
  export { i as ContentScriptAnchor, j as ContentScriptAnchorGetter, k as ContentScriptAnchorResolver, w as ContentScriptAppend, f as ContentScriptBuilder, p as ContentScriptContainerCreator, o as ContentScriptContainerFactory, n as ContentScriptContainerOptions, m as ContentScriptContainerTag, b as ContentScriptContext, v as ContentScriptEntrypointOptions, z as ContentScriptMainFunction, t as ContentScriptMatches, x as ContentScriptMount, l as ContentScriptMountFunction, c as ContentScriptNode, g as ContentScriptNodeSet, u as ContentScriptOptions, r as ContentScriptProps, e as ContentScriptRenderHandler, y as ContentScriptRenderReactComponent, d as ContentScriptRenderValue, h as ContentScriptResolvedDefinition, q as ContentScriptWatchStrategy } from './content-sdYF4W-A.js';
10
- import { a as Language, j as LocaleNonPluralKeys, b as LocaleNativeStructure, i as LocaleSubstitutionsFor, k as LocalePluralKeys } from './NativeLocale-lgR6wNj3.js';
11
- export { d as LanguageCodes, f as LocaleDir } from './NativeLocale-lgR6wNj3.js';
10
+ import { a as Language } from './locale-Do4kUmgC.js';
12
11
  import { O as OffscreenDefinition } from './offscreen-BG5Abe8V.js';
13
12
  export { d as OffscreenReason, c as OffscreenUnresolvedDefinition } from './offscreen-BG5Abe8V.js';
14
13
  import { e as TransportType, a as TransportDictionary } from './transport-BPmSUoEU.js';
@@ -781,48 +780,6 @@ type Tab$2 = chrome.tabs.Tab;
781
780
  declare const getIcons: () => Record<string, Record<number, string>>;
782
781
  declare const changeActionIcon: (icon?: string, tab?: number | Tab$2) => Promise<void>;
783
782
 
784
- /**
785
- * Translates a given locale key into the corresponding localized string.
786
- *
787
- * @template K - A type representing the non-plural keys of the locale structure.
788
- * @param {K} key - The locale key to be translated.
789
- * @param {LocaleSubstitutionsFor<LocaleNativeStructure, K>} [substitutions] - Optional substitutions to be applied
790
- * within the localized string. These are typically placeholders replaced with dynamic values.
791
- * @returns {string} - The translated string for the given key, with substitutions applied if provided.
792
- */
793
- declare const _: <K extends LocaleNonPluralKeys<LocaleNativeStructure>>(key: K, substitutions?: LocaleSubstitutionsFor<LocaleNativeStructure, K>) => string;
794
- /**
795
- * Translates a given locale key into the corresponding localized string
796
- * based on a specific count for pluralization.
797
- *
798
- * @template K - A type representing the non-plural keys of the locale structure.
799
- * @param {K} key - The locale key to be translated.
800
- * @param {number} count - The count used to determine the pluralization form.
801
- * @param {LocaleSubstitutionsFor<LocaleNativeStructure, K>} [substitutions] - Optional substitutions to be applied
802
- * within the localized string. These are typically placeholders replaced with dynamic values.
803
- * @returns {string} - The translated string for the given key, adjusted for pluralization and with substitutions applied if provided.
804
- */
805
- declare const _c: <K extends LocalePluralKeys<LocaleNativeStructure>>(key: K, count: number, substitutions?: LocaleSubstitutionsFor<LocaleNativeStructure, K>) => string;
806
- /**
807
- * Converts a locale key into a standardized format and logs a warning if the key is not found
808
- * in the current language's locale keys.
809
- *
810
- * @param {Extract<keyof LocaleNativeStructure, string>} key - The locale key to be converted.
811
- * This key must be a string and exist within the `LocaleNativeStructure`.
812
- * @returns {string} - The converted locale message key.
813
- */
814
- declare const __: (key: keyof LocaleNativeStructure & string) => string;
815
- /**
816
- * Attempts to extract a locale key from the provided string and translates it
817
- * into the corresponding localized string. If no locale key can be extracted,
818
- * the original string is returned.
819
- *
820
- * @param {string} input - The input string from which a locale key is to be extracted.
821
- * @returns {string} - The translated string if a locale key is successfully extracted,
822
- * or the original string if no locale key is found.
823
- */
824
- declare const __t: (input: string) => string;
825
-
826
783
  type OffscreenParameters = chrome.offscreen.CreateParameters;
827
784
 
828
785
  type OffscreenAlias = string;
@@ -883,4 +840,4 @@ declare const defineSidebar: (options: SidebarDefinition) => SidebarDefinition;
883
840
  declare const getSidebars: () => SidebarMap;
884
841
  declare const changeSidebar: (alias: SidebarAlias, tab?: number | Tab) => Promise<void>;
885
842
 
886
- export { BackgroundConfig, BackgroundDefinition, Browser, Command, CommandConfig, CommandDefinition, type Config, type ConfigDefinition, ContentScriptAppendDefinition, ContentScriptConfig, ContentScriptDefinition, ExecuteActionCommandDefinition, Language, type ManifestBuilder, ManifestIncognito, Mode, type OffscreenAlias, OffscreenDefinition, type OffscreenMap, type PageAlias, type PageConfig, type PageDefinition, type PageMap, type PageProps, type Plugin, type PluginDefinition, type PopupAlias, type PopupMap, type ReadonlyConfig, RelayDefinition, ServiceDefinition, type SidebarAlias, type SidebarMap, type UserConfig, _, __, __t, _c, changeActionIcon, changePopup, changeSidebar, defineBackground, defineCommand, defineConfig, defineContentScript, defineContentScriptAppend, defineExecuteActionCommand, defineOffscreen, definePage, definePlugin, definePopup, defineRelay, defineService, defineSidebar, getApp, getBrowser, getEnv, getIcons, getManifestVersion, getOffscreen, getOffscreens, getPageUrl, getPages, getPopups, getRelay, getService, getSidebars, isBrowser };
843
+ export { BackgroundConfig, BackgroundDefinition, Browser, Command, CommandConfig, CommandDefinition, type Config, type ConfigDefinition, ContentScriptAppendDefinition, ContentScriptConfig, ContentScriptDefinition, ExecuteActionCommandDefinition, type ManifestBuilder, ManifestIncognito, Mode, type OffscreenAlias, OffscreenDefinition, type OffscreenMap, type PageAlias, type PageConfig, type PageDefinition, type PageMap, type PageProps, type Plugin, type PluginDefinition, type PopupAlias, type PopupMap, type ReadonlyConfig, RelayDefinition, ServiceDefinition, type SidebarAlias, type SidebarMap, type UserConfig, changeActionIcon, changePopup, changeSidebar, defineBackground, defineCommand, defineConfig, defineContentScript, defineContentScriptAppend, defineExecuteActionCommand, defineOffscreen, definePage, definePlugin, definePopup, defineRelay, defineService, defineSidebar, getApp, getBrowser, getEnv, getIcons, getManifestVersion, getOffscreen, getOffscreens, getPageUrl, getPages, getPopups, getRelay, getService, getSidebars, isBrowser };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { setActionIcon, getUrl, setActionPopup, setActionTitle, setSidebarPath, setSidebarTitle, getI18nMessage, getI18nUILanguage, isManifestVersion3, hasOffscreen, closeOffscreen, createOffscreen, isAvailableScripting, getManifestVersion as getManifestVersion$1, isBackground, sendTabMessage, sendMessage, onMessage } from '@adnbn/browser';
1
+ import { setActionIcon, getUrl, setActionPopup, setActionTitle, setSidebarPath, setSidebarTitle, isManifestVersion3, hasOffscreen, closeOffscreen, createOffscreen, isAvailableScripting, getManifestVersion as getManifestVersion$1, isBackground, sendTabMessage, sendMessage, getI18nMessage, getI18nUILanguage, onMessage } from '@adnbn/browser';
2
2
  import { nanoid } from 'nanoid';
3
3
  import get from 'get-value';
4
4
  import injectScriptFactory from '@adnbn/inject-script';
@@ -185,6 +185,14 @@ var changeActionIcon = async (icon, tab) => {
185
185
  await setActionIcon({ path: icons, tabId: tab });
186
186
  };
187
187
 
188
+ // src/types/manifest.ts
189
+ var ManifestIncognito = /* @__PURE__ */ ((ManifestIncognito2) => {
190
+ ManifestIncognito2["Spanning"] = "spanning";
191
+ ManifestIncognito2["Split"] = "split";
192
+ ManifestIncognito2["NotAllowed"] = "not_allowed";
193
+ return ManifestIncognito2;
194
+ })(ManifestIncognito || {});
195
+
188
196
  // src/types/locale.ts
189
197
  var Language = /* @__PURE__ */ ((Language5) => {
190
198
  Language5["Arabic"] = "ar";
@@ -244,11 +252,6 @@ var Language = /* @__PURE__ */ ((Language5) => {
244
252
  Language5["ChineseTaiwan"] = "zh_TW";
245
253
  return Language5;
246
254
  })(Language || {});
247
- var LocaleDir = /* @__PURE__ */ ((LocaleDir2) => {
248
- LocaleDir2["RightToLeft"] = "rtl";
249
- LocaleDir2["LeftToRight"] = "ltr";
250
- return LocaleDir2;
251
- })(LocaleDir || {});
252
255
  var LocaleNestedKeysSeparator = ".";
253
256
  var LocaleKeysSeparator = "_";
254
257
  var LocaleValuesSeparator = "|";
@@ -363,9 +366,6 @@ var AbstractLocale_default = class {
363
366
  var convertLocaleKey = (key) => {
364
367
  return key.replaceAll(LocaleNestedKeysSeparator, LocaleKeysSeparator);
365
368
  };
366
- var convertLocaleMessageKey = (key) => {
367
- return `__MSG_${convertLocaleKey(key)}__`;
368
- };
369
369
  var extractLocaleKey = (key) => {
370
370
  if (isLocaleKey(key)) {
371
371
  return key.substring(1);
@@ -418,20 +418,10 @@ var NativeLocale = class _NativeLocale extends AbstractLocale_default {
418
418
  }
419
419
  };
420
420
 
421
- // src/main/locale.ts
421
+ // src/locale/helpers.ts
422
422
  var _ = (key, substitutions) => {
423
423
  return NativeLocale.getInstance().trans(key, substitutions);
424
424
  };
425
- var _c = (key, count, substitutions) => {
426
- return NativeLocale.getInstance().choice(key, count, substitutions);
427
- };
428
- var __ = (key) => {
429
- const locale = NativeLocale.getInstance();
430
- if (!locale.keys().has(key)) {
431
- console.warn(`Locale key "${key}" not found in "${locale.lang()}" language.`);
432
- }
433
- return convertLocaleMessageKey(key);
434
- };
435
425
  var __t = (input) => {
436
426
  const localeKey = extractLocaleKey(input);
437
427
  if (localeKey) {
@@ -440,14 +430,6 @@ var __t = (input) => {
440
430
  return input;
441
431
  };
442
432
 
443
- // src/types/manifest.ts
444
- var ManifestIncognito = /* @__PURE__ */ ((ManifestIncognito2) => {
445
- ManifestIncognito2["Spanning"] = "spanning";
446
- ManifestIncognito2["Split"] = "split";
447
- ManifestIncognito2["NotAllowed"] = "not_allowed";
448
- return ManifestIncognito2;
449
- })(ManifestIncognito || {});
450
-
451
433
  // src/transport/BaseTransport.ts
452
434
  var BaseTransport_default = class {
453
435
  constructor(name) {
@@ -1024,6 +1006,6 @@ var changeSidebar = async (alias, tab) => {
1024
1006
  }
1025
1007
  };
1026
1008
 
1027
- export { Browser, Command, CommandExecuteActionName, ContentScriptAppend, ContentScriptMatches, Language, LanguageCodes, LocaleDir, ManifestIncognito, Mode, OffscreenReason, _, __, __t, _c, changeActionIcon, changePopup, changeSidebar, contentScriptMountAppendResolver, defineBackground, defineCommand, defineConfig, defineContentScript, defineContentScriptAppend, defineExecuteActionCommand, defineOffscreen, definePage, definePlugin, definePopup, defineRelay, defineService, defineSidebar, getApp, getBrowser, getEnv, getIcons, getManifestVersion, getOffscreen, getOffscreens, getPageUrl, getPages, getPopups, getRelay, getService, getSidebars, isBrowser, isContentScriptDefinition, isValidContentScriptDefinitionRenderValue };
1009
+ export { Browser, Command, CommandExecuteActionName, ContentScriptAppend, ContentScriptMatches, ManifestIncognito, Mode, OffscreenReason, changeActionIcon, changePopup, changeSidebar, contentScriptMountAppendResolver, defineBackground, defineCommand, defineConfig, defineContentScript, defineContentScriptAppend, defineExecuteActionCommand, defineOffscreen, definePage, definePlugin, definePopup, defineRelay, defineService, defineSidebar, getApp, getBrowser, getEnv, getIcons, getManifestVersion, getOffscreen, getOffscreens, getPageUrl, getPages, getPopups, getRelay, getService, getSidebars, isBrowser, isContentScriptDefinition, isValidContentScriptDefinitionRenderValue };
1028
1010
  //# sourceMappingURL=index.js.map
1029
1011
  //# sourceMappingURL=index.js.map