Skip to content

Commit c6c9a5a

Browse files
authored
chore: merge pull request #7 from addon-stack/develop
2 parents ea4373a + cd26f6c commit c6c9a5a

File tree

9 files changed

+342
-773
lines changed

9 files changed

+342
-773
lines changed

.husky/pre-commit

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33
# Husky pre-commit hook: format and run related tests on staged files
44

5-
npx --no -- lint-staged
5+
npm run test:related
6+
npm run lint:fix:unsafe
7+
npm run format

.mailmap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Addon Stack <addonbonedev@gmail.com> <191148085+addon-stack@users.noreply.github.com>
2+
Addon Stack <addonbonedev@gmail.com> <addon-stack@users.noreply.github.com>

.release-it.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ const types = new Map([
102102
["ci", "🤖 CI"],
103103
["chore", "🧹 Chores"],
104104
["revert", "⏪ Reverts"],
105+
["test", "🧪 Tests"],
105106
]);
106107

107108
const normalizeRepoUrl = url => url.replace(/^git\+/, "").replace(/\.git$/, "");
@@ -199,7 +200,7 @@ module.exports = () => {
199200
writerOpts: {
200201
headerPartial:
201202
"## 🚀 Release {{#if name}}`{{name}}` {{else}}{{#if @root.pkg}}`{{@root.pkg.name}}` {{/if}}{{/if}}v{{version}} ({{date}})\n\n",
202-
footerPartial: `{{#if @root.contributors.length}}\n### 🙌 Contributors\n\n{{#each @root.contributors}}- {{#if url}}{{#if name}}[{{name}}]({{url}}){{#if login}} (@{{login}}){{/if}}{{else}}[@{{login}}]({{url}}){{/if}}{{else}}{{#if email}}{{#if name}}[{{name}}]({{email}}){{else}}{{email}}{{/if}}{{else}}{{name}}{{/if}}{{/if}} — {{count}} commits\n{{/each}}{{/if}}`,
203+
footerPartial: `{{#if @root.contributors.length}}\n### 🙌 Contributors\n\n{{#each @root.contributors}}- {{#if url}}{{#if name}}[{{name}}]({{url}}){{#if login}} (@{{login}}){{/if}}{{else}}[@{{login}}]({{url}}){{/if}}{{else}}{{#if email}}{{#if name}}[{{name}}](mailto:{{email}}){{else}}{{email}}{{/if}}{{else}}{{name}}{{/if}}{{/if}} — commits: {{count}}\n{{/each}}{{/if}}`,
203204
mainTemplate:
204205
"{{> header}}\n" +
205206
"{{#if noteGroups}}\n### 💥 Breaking Changes\n\n{{#each noteGroups}}{{#each notes}}* {{{text}}}\n\n{{/each}}{{/each}}{{/if}}" +

docs/sidebar.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Documentation:
66
- [Opera Sidebar Action API](https://help.opera.com/en/extensions/sidebar-action-api/)
77
- [Firefox Sidebar Action API](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/sidebarAction)
88

9-
A promise-based wrapper around Chrome's side panel (`chrome.sidePanel`, MV3) and Firefox/Opera `sidebarAction` APIs. Methods provide unified behavior to get/set options and behavior, open the panel, and, where supported (Opera), manage title and badge.
9+
A promise-based wrapper around Chrome's side panel (`chrome.sidePanel`, MV3) and Firefox/Opera `sidebarAction` APIs. Methods provide unified behavior to get/set options and behavior, open the panel, and, where supported, manage title and icon (Firefox & Opera) and badge (Opera).
1010

1111
## Methods
1212

@@ -18,13 +18,13 @@ A promise-based wrapper around Chrome's side panel (`chrome.sidePanel`, MV3) and
1818
- [setSidebarBehavior(behavior?)](#setSidebarBehavior)
1919
- [setSidebarPath(path, tabId?)](#setSidebarPath)
2020
- [getSidebarPath(tabId?)](#getSidebarPath)
21-
- [setSidebarTitle(title, tabId?)](#setSidebarTitle) [Opera]
22-
- [setSidebarIcon(details)](#setSidebarIcon) [Opera]
21+
- [setSidebarTitle(title, tabId?)](#setSidebarTitle) [Firefox, Opera]
22+
- [setSidebarIcon(details)](#setSidebarIcon) [Firefox, Opera]
2323
- [setSidebarBadgeText(text, tabId?)](#setSidebarBadgeText) [Opera]
2424
- [clearSidebarBadgeText(tabId?)](#clearSidebarBadgeText) [Opera]
2525
- [setSidebarBadgeTextColor(color, tabId?)](#setSidebarBadgeTextColor) [Opera]
2626
- [setSidebarBadgeBgColor(color, tabId?)](#setSidebarBadgeBgColor) [Opera]
27-
- [getSidebarTitle(tabId?)](#getSidebarTitle) [Opera]
27+
- [getSidebarTitle(tabId?)](#getSidebarTitle) [Firefox, Opera]
2828
- [getSidebarBadgeText(tabId?)](#getSidebarBadgeText) [Opera]
2929
- [getSidebarBadgeTextColor(tabId?)](#getSidebarBadgeTextColor) [Opera]
3030
- [getSidebarBadgeBgColor(tabId?)](#getSidebarBadgeBgColor) [Opera]
@@ -59,7 +59,7 @@ Gets the current side panel behavior settings. Throws if unsupported. [MV3]
5959
canOpenSidebar(): boolean
6060
```
6161

62-
Returns `true` if either `chrome.sidePanel` (MV3) or `browser.sidebarAction` (Firefox/Opera) is available.
62+
Returns `true` if `chrome.sidePanel` (MV3) is available, or if `browser.sidebarAction.open` is available (Firefox).
6363

6464
<a name="openSidebar"></a>
6565

@@ -69,7 +69,7 @@ Returns `true` if either `chrome.sidePanel` (MV3) or `browser.sidebarAction` (Fi
6969
openSidebar(options: chrome.sidePanel.OpenOptions): Promise<void>
7070
```
7171

72-
Opens the side panel with the given options in Chrome (MV3). Falls back to `browser.sidebarAction.open()` in Firefox. Logs a warning if unsupported.
72+
Opens the side panel with the given options in Chrome (MV3). Falls back to `browser.sidebarAction.open()` in Firefox. Logs a warning and resolves as a no-op if unsupported.
7373

7474
<a name="setSidebarOptions"></a>
7575

@@ -79,7 +79,7 @@ Opens the side panel with the given options in Chrome (MV3). Falls back to `brow
7979
setSidebarOptions(options?: chrome.sidePanel.PanelOptions): Promise<void>
8080
```
8181

82-
Sets side panel options (e.g., `path`) in Chrome (MV3). Logs a warning if unsupported. [MV3]
82+
Sets side panel options (e.g., `path`) in Chrome (MV3). Logs a warning and resolves as a no-op if unsupported. [MV3]
8383

8484
<a name="setSidebarBehavior"></a>
8585

@@ -89,7 +89,7 @@ Sets side panel options (e.g., `path`) in Chrome (MV3). Logs a warning if unsupp
8989
setSidebarBehavior(behavior?: chrome.sidePanel.PanelBehavior): Promise<void>
9090
```
9191

92-
Updates default panel behavior in Chrome (MV3). Logs a warning if unsupported. [MV3]
92+
Updates default panel behavior in Chrome (MV3). Logs a warning and resolves as a no-op if unsupported. [MV3]
9393

9494
<a name="setSidebarPath"></a>
9595

@@ -113,23 +113,26 @@ Retrieves the sidebar path from Chrome (MV3) or parses from `sidebarAction.getPa
113113

114114
<a name="setSidebarTitle"></a>
115115

116-
### setSidebarTitle [Opera]
116+
### setSidebarTitle [Firefox, Opera]
117117

118118
```
119119
setSidebarTitle(title: string | number, tabId?: number): Promise<void>
120120
```
121121

122-
Sets the sidebar title via `opr.sidebarAction.setTitle()` (Opera only). Logs a warning if unsupported.
122+
Sets the sidebar title via `sidebarAction.setTitle()` (Firefox/Opera). Logs a warning if unsupported.
123123

124124
<a name="setSidebarIcon"></a>
125125

126-
### setSidebarIcon [Opera]
126+
### setSidebarIcon [Firefox, Opera]
127127

128128
```
129129
setSidebarIcon(details: opr.sidebarAction.IconDetails): Promise<void>
130130
```
131131

132-
Sets the sidebar icon via `opr.sidebarAction.setIcon()` (Opera only). Logs a warning if unsupported.
132+
Sets the sidebar icon via `sidebarAction.setIcon()` (Firefox/Opera). Logs a warning if unsupported.
133+
134+
> Known issue (Opera): The `opr.sidebarAction.setIcon` API is currently broken and may fail with "Access to extension API denied".
135+
> See: https://forums.opera.com/topic/75680/opr-sidebaraction-seticon-api-is-broken-access-to-extension-api-denied
133136
134137
<a name="setSidebarBadgeText"></a>
135138

@@ -173,13 +176,13 @@ Sets the sidebar badge background color via `opr.sidebarAction.setBadgeBackgroun
173176

174177
<a name="getSidebarTitle"></a>
175178

176-
### getSidebarTitle [Opera]
179+
### getSidebarTitle [Firefox, Opera]
177180

178181
```
179182
getSidebarTitle(tabId?: number): Promise<string>
180183
```
181184

182-
Gets the sidebar title via `opr.sidebarAction.getTitle()` (Opera only). Throws if unsupported.
185+
Gets the sidebar title via `sidebarAction.getTitle()` (Firefox/Opera). Throws if unsupported.
183186

184187
<a name="getSidebarBadgeText"></a>
185188

0 commit comments

Comments
 (0)