diff --git a/special-pages/pages/new-tab/app/customizer/customizer.md b/special-pages/pages/new-tab/app/customizer/customizer.md index 88f71c7ba4..9c84460d48 100644 --- a/special-pages/pages/new-tab/app/customizer/customizer.md +++ b/special-pages/pages/new-tab/app/customizer/customizer.md @@ -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" + } + ```