Skip to content

Commit

Permalink
add some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed Dec 4, 2024
1 parent 81e8ec8 commit 74b67a3
Showing 1 changed file with 109 additions and 1 deletion.
110 changes: 109 additions & 1 deletion special-pages/pages/new-tab/app/customizer/customizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,121 @@ title: Customizer
],
"widgetConfigs": [
{ "id": "favorites", "visibility": "visible" },
{ "id": "privacyStats", "visibility": "visible" },
{ "id": "privacyStats", "visibility": "visible" }
],
"settings": {
"customizerDrawer": {
"state": "enabled"
}
},
"customizer": {
"userImages": [],
"theme": "dark",
"background": { "kind": "default" }
}
}
```

## Initial Data

- Add the key `customizer` to `initialSetup`
- The data takes the following form: {@link "NewTab Messages".CustomizerData}
- Example from `initialSetup`

```json
{
"...": "...",
"customizer": {
"userImages": [],
"theme": "dark",
"background": { "kind": "default" }
}
}
```

## Subscriptions

- {@link "NewTab Messages".CustomizerOnBackgroundUpdateSubscription `customizer_onBackgroundUpdate`}.
- Sends {@link "NewTab Messages".CustomizerOnBackgroundUpdateSubscribe} whenever needed.
- For example:
- ```json
{
"background": { "kind": "color", "value": "color01" }
}
```
- ```json
{
"background": { "kind": "gradient", "value": "gradient01" }
}
```
- ```json
{
"background": { "kind": "hex", "value": "#cacaca" }
}
```
- ```json
{
"background": { "kind": "default" }
}
```
- ```json
{
"background": {
"kind": "userImage",
"value": { "id": "abc", "src": "...", "thumb": "...", "colorScheme": "light" }
}
}
```

- {@link "NewTab Messages".CustomizerOnImagesUpdateSubscription `customizer_onImagesUpdate`}.
- Sends {@link "NewTab Messages".CustomizerOnImagesUpdateSubscribe} whenever needed.
- For example, this would be pushed into the page following a successful upload
- Note: In that situation, you'd send this followed by `customizer_onBackgroundUpdate` above
- For example:
- ```json
{
"userImages": [{"id": "abc", "src": "...", "thumb": "...", "colorScheme": "light" }]
}
```

- {@link "NewTab Messages".CustomizerOnThemeUpdateSubscription `customizer_onThemeUpdate`}.
- Sends {@link "NewTab Messages".CustomizerOnThemeUpdateSubscribe} whenever needed.
- For example:
- ```json
{
"theme": "system"
}
```

## Notifications

- {@link "NewTab Messages".CustomizerSetBackgroundNotification `customizer_setBackground`}.
- Sends {@link "NewTab Messages".CustomizerSetBackgroundNotify} whenever needed.
- For example:
- ```json
{
"background": { "kind": "color", "value": "color01" }
}
```

- {@link "NewTab Messages".CustomizerSetThemeNotification `customizer_setTheme`}.
- Sends {@link "NewTab Messages".CustomizerSetBackgroundNotify} whenever needed.
- For example:
- ```json
{
"theme": "light"
}
```

- {@link "NewTab Messages".CustomizerUploadNotification `customizer_upload`}.
- Sent to trigger a file upload


- {@link "NewTab Messages".CustomizerDeleteImageNotification `customizer_deleteImage`}.
- Sends {@link "NewTab Messages".CustomizerDeleteImageNotify} whenever needed.
- For example:
- ```json
{
"id": "abc"
}
```

0 comments on commit 74b67a3

Please sign in to comment.