diff --git a/special-pages/package.json b/special-pages/package.json index 578143cc03..913ddedf70 100644 --- a/special-pages/package.json +++ b/special-pages/package.json @@ -19,6 +19,7 @@ "test.android": "npm run test-int -- --project android", "test.headed": "npm run test-int -- --headed", "test.ui": "npm run test-int -- --ui", + "preserve": "npm run build.dev", "serve": "http-server -c-1 --port 3210 ../build/integration/pages", "watch": "node watch.mjs" }, diff --git a/special-pages/pages/new-tab/messages/customizer_deleteImage.notify.json b/special-pages/pages/new-tab/messages/customizer_deleteImage.notify.json new file mode 100644 index 0000000000..7d778cdd79 --- /dev/null +++ b/special-pages/pages/new-tab/messages/customizer_deleteImage.notify.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + } + } +} diff --git a/special-pages/pages/new-tab/messages/customizer_onBackgroundUpdate.subscribe.json b/special-pages/pages/new-tab/messages/customizer_onBackgroundUpdate.subscribe.json new file mode 100644 index 0000000000..4007eb5a64 --- /dev/null +++ b/special-pages/pages/new-tab/messages/customizer_onBackgroundUpdate.subscribe.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "types/background-data.json" + } + ] +} diff --git a/special-pages/pages/new-tab/messages/customizer_onColorUpdate.subscribe.json b/special-pages/pages/new-tab/messages/customizer_onColorUpdate.subscribe.json new file mode 100644 index 0000000000..ea202ed0ef --- /dev/null +++ b/special-pages/pages/new-tab/messages/customizer_onColorUpdate.subscribe.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "types/user-color-data.json" + } + ] +} diff --git a/special-pages/pages/new-tab/messages/customizer_onImagesUpdate.subscribe.json b/special-pages/pages/new-tab/messages/customizer_onImagesUpdate.subscribe.json new file mode 100644 index 0000000000..8d32e84360 --- /dev/null +++ b/special-pages/pages/new-tab/messages/customizer_onImagesUpdate.subscribe.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "./types/user-image-data.json" + } + ] +} diff --git a/special-pages/pages/new-tab/messages/customizer_onThemeUpdate.subscribe.json b/special-pages/pages/new-tab/messages/customizer_onThemeUpdate.subscribe.json new file mode 100644 index 0000000000..bedf7ed51a --- /dev/null +++ b/special-pages/pages/new-tab/messages/customizer_onThemeUpdate.subscribe.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "types/theme-data.json" + } + ] +} diff --git a/special-pages/pages/new-tab/messages/customizer_setBackground.notify.json b/special-pages/pages/new-tab/messages/customizer_setBackground.notify.json new file mode 100644 index 0000000000..ea9b4b40f8 --- /dev/null +++ b/special-pages/pages/new-tab/messages/customizer_setBackground.notify.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": [ + "background" + ], + "properties": { + "background": { + "$ref": "./types/background.json#/definitions/background-variant" + } + } +} diff --git a/special-pages/pages/new-tab/messages/customizer_setTheme.notify.json b/special-pages/pages/new-tab/messages/customizer_setTheme.notify.json new file mode 100644 index 0000000000..8acd7bb2a9 --- /dev/null +++ b/special-pages/pages/new-tab/messages/customizer_setTheme.notify.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": ["theme"], + "properties": { + "theme": { + "$ref": "types/browser-theme.json" + } + } +} diff --git a/special-pages/pages/new-tab/messages/customizer_upload.notify.json b/special-pages/pages/new-tab/messages/customizer_upload.notify.json new file mode 100644 index 0000000000..0af74a3197 --- /dev/null +++ b/special-pages/pages/new-tab/messages/customizer_upload.notify.json @@ -0,0 +1,3 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#" +} diff --git a/special-pages/pages/new-tab/messages/examples/widgets.js b/special-pages/pages/new-tab/messages/examples/widgets.js index e3ff48d08e..bee51c554b 100644 --- a/special-pages/pages/new-tab/messages/examples/widgets.js +++ b/special-pages/pages/new-tab/messages/examples/widgets.js @@ -41,6 +41,7 @@ const initialSetupResponse = { locale: 'en', platform: { name: 'windows' }, updateNotification: { content: null }, + customizer: { theme: 'system', userImages: [], userColor: null, background: { kind: 'default' } }, }; export {}; diff --git a/special-pages/pages/new-tab/messages/initialSetup.response.json b/special-pages/pages/new-tab/messages/initialSetup.response.json index b08fb9352c..2cd81f6779 100644 --- a/special-pages/pages/new-tab/messages/initialSetup.response.json +++ b/special-pages/pages/new-tab/messages/initialSetup.response.json @@ -29,6 +29,9 @@ } } }, + "customizer": { + "$ref": "./types/customizer-data.json" + }, "updateNotification": { "oneOf": [ { diff --git a/special-pages/pages/new-tab/messages/types/background-data.json b/special-pages/pages/new-tab/messages/types/background-data.json new file mode 100644 index 0000000000..5f12c1f734 --- /dev/null +++ b/special-pages/pages/new-tab/messages/types/background-data.json @@ -0,0 +1,11 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Background Data", + "type": "object", + "required": ["background"], + "properties": { + "background": { + "$ref": "./background.json#/definitions/background-variant" + } + } +} diff --git a/special-pages/pages/new-tab/messages/types/background.json b/special-pages/pages/new-tab/messages/types/background.json new file mode 100644 index 0000000000..42061f0ba8 --- /dev/null +++ b/special-pages/pages/new-tab/messages/types/background.json @@ -0,0 +1,101 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "background-variant": { + "title": "Background Variant", + "oneOf": [ + { + "$ref": "#/definitions/default" + }, + { + "$ref": "#/definitions/solid" + }, + { + "$ref": "#/definitions/hex" + }, + { + "$ref": "#/definitions/gradient" + }, + { + "$ref": "#/definitions/image" + } + ] + }, + "default": { + "type": "object", + "required": [ + "kind" + ], + "title": "Default Background", + "properties": { + "kind": { + "const": "default" + } + } + }, + "solid": { + "type": "object", + "required": [ + "kind", + "value" + ], + "title": "Solid Color Background", + "properties": { + "kind": { + "const": "color" + }, + "value": { + "$ref": "./colors.json#/definitions/colors" + } + } + }, + "hex": { + "type": "object", + "required": [ + "kind", + "value" + ], + "title": "Hex Value Background", + "properties": { + "kind": { + "const": "hex" + }, + "value": { + "type": "string" + } + } + }, + "gradient": { + "type": "object", + "required": [ + "kind", + "value" + ], + "title": "Gradient Background", + "properties": { + "kind": { + "const": "gradient" + }, + "value": { + "$ref": "./colors.json#/definitions/gradients" + } + } + }, + "image": { + "type": "object", + "required": [ + "kind", + "value" + ], + "title": "User Image Background", + "properties": { + "kind": { + "const": "userImage" + }, + "value": { + "$ref": "./user-image.json" + } + } + } + } +} diff --git a/special-pages/pages/new-tab/messages/types/browser-theme.json b/special-pages/pages/new-tab/messages/types/browser-theme.json new file mode 100644 index 0000000000..1ce532afbd --- /dev/null +++ b/special-pages/pages/new-tab/messages/types/browser-theme.json @@ -0,0 +1,9 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Browser Theme", + "enum": [ + "light", + "dark", + "system" + ] +} diff --git a/special-pages/pages/new-tab/messages/types/colors.json b/special-pages/pages/new-tab/messages/types/colors.json new file mode 100644 index 0000000000..05f44d2a0f --- /dev/null +++ b/special-pages/pages/new-tab/messages/types/colors.json @@ -0,0 +1,47 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "gradients": { + "title": "Predefined Gradient", + "enum": [ + "gradient01", + "gradient02", + "gradient03", + "gradient04", + "gradient05", + "gradient06", + "gradient07", + "gradient08" + ] + }, + "colors": { + "title": "Predefined Color", + "enum": [ + "color01", + "color02", + "color03", + "color04", + "color05", + "color06", + "color07", + "color08", + "color09", + "color10", + "color11", + "color12", + "color13", + "color14", + "color15", + "color16", + "color17", + "color18", + "color19" + ] + }, + "colorScheme": { + "title": "Background Color Scheme", + "description": "Note: this is different to the Browser Theme", + "enum": ["light", "dark"] + } + } +} diff --git a/special-pages/pages/new-tab/messages/types/customizer-data.json b/special-pages/pages/new-tab/messages/types/customizer-data.json new file mode 100644 index 0000000000..70dab1f7f7 --- /dev/null +++ b/special-pages/pages/new-tab/messages/types/customizer-data.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Customizer Data", + "type": "object", + "required": [ + "background", + "theme", + "userImages", + "userColor" + ], + "properties": { + "background": {"$ref": "./background.json#/definitions/background-variant"}, + "theme": { "$ref": "./browser-theme.json" }, + "userImages": { + "type": "array", + "items": { + "$ref": "./user-image.json" + } + }, + "userColor": { + "$ref": "./user-color-data.json#/definitions/userColor" + } + } +} diff --git a/special-pages/pages/new-tab/messages/types/theme-data.json b/special-pages/pages/new-tab/messages/types/theme-data.json new file mode 100644 index 0000000000..0766788082 --- /dev/null +++ b/special-pages/pages/new-tab/messages/types/theme-data.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": [ + "theme" + ], + "properties": { + "theme": { + "$ref": "./browser-theme.json" + } + } +} diff --git a/special-pages/pages/new-tab/messages/types/user-color-data.json b/special-pages/pages/new-tab/messages/types/user-color-data.json new file mode 100644 index 0000000000..350cc65cff --- /dev/null +++ b/special-pages/pages/new-tab/messages/types/user-color-data.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "User Color Data", + "type": "object", + "required": [ + "userColor" + ], + "properties": { + "userColor": {"$ref": "#/definitions/userColor"} + }, + "definitions": { + "userColor": { + "oneOf": [ + {"type": "null"}, + {"$ref": "./background.json#/definitions/hex"} + ] + } + } +} diff --git a/special-pages/pages/new-tab/messages/types/user-image-data.json b/special-pages/pages/new-tab/messages/types/user-image-data.json new file mode 100644 index 0000000000..d8d4a8846b --- /dev/null +++ b/special-pages/pages/new-tab/messages/types/user-image-data.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "User Image Data", + "type": "object", + "required": [ + "userImages" + ], + "properties": { + "userImages": { + "type": "array", + "items": { + "$ref": "./user-image.json" + } + } + } +} diff --git a/special-pages/pages/new-tab/messages/types/user-image.json b/special-pages/pages/new-tab/messages/types/user-image.json new file mode 100644 index 0000000000..1736f44134 --- /dev/null +++ b/special-pages/pages/new-tab/messages/types/user-image.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "UserImage", + "type": "object", + "required": ["id", "colorScheme", "src", "thumb"], + "properties": { + "id": { + "type": "string" + }, + "src": { + "type": "string" + }, + "thumb": { + "type": "string" + }, + "colorScheme": { + "$ref": "./colors.json#/definitions/colorScheme" + } + } +} diff --git a/special-pages/pages/new-tab/public/backgrounds/bg-01-thumb.jpg b/special-pages/pages/new-tab/public/backgrounds/bg-01-thumb.jpg new file mode 100644 index 0000000000..6e0da17afb Binary files /dev/null and b/special-pages/pages/new-tab/public/backgrounds/bg-01-thumb.jpg differ diff --git a/special-pages/pages/new-tab/public/backgrounds/bg-01.jpg b/special-pages/pages/new-tab/public/backgrounds/bg-01.jpg new file mode 100644 index 0000000000..a4af5d0fb0 Binary files /dev/null and b/special-pages/pages/new-tab/public/backgrounds/bg-01.jpg differ diff --git a/special-pages/pages/new-tab/public/backgrounds/bg-02-thumb.jpg b/special-pages/pages/new-tab/public/backgrounds/bg-02-thumb.jpg new file mode 100644 index 0000000000..d39ec6fcb0 Binary files /dev/null and b/special-pages/pages/new-tab/public/backgrounds/bg-02-thumb.jpg differ diff --git a/special-pages/pages/new-tab/public/backgrounds/bg-02.jpg b/special-pages/pages/new-tab/public/backgrounds/bg-02.jpg new file mode 100644 index 0000000000..c1bf4a0e3a Binary files /dev/null and b/special-pages/pages/new-tab/public/backgrounds/bg-02.jpg differ diff --git a/special-pages/pages/new-tab/public/backgrounds/bg-03-thumb.jpg b/special-pages/pages/new-tab/public/backgrounds/bg-03-thumb.jpg new file mode 100644 index 0000000000..06bf64d7a6 Binary files /dev/null and b/special-pages/pages/new-tab/public/backgrounds/bg-03-thumb.jpg differ diff --git a/special-pages/pages/new-tab/public/backgrounds/bg-03.jpg b/special-pages/pages/new-tab/public/backgrounds/bg-03.jpg new file mode 100644 index 0000000000..c7265d5f2a Binary files /dev/null and b/special-pages/pages/new-tab/public/backgrounds/bg-03.jpg differ diff --git a/special-pages/pages/new-tab/public/gradients/gradient01.svg b/special-pages/pages/new-tab/public/gradients/gradient01.svg new file mode 100644 index 0000000000..a9fcd06723 --- /dev/null +++ b/special-pages/pages/new-tab/public/gradients/gradient01.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/special-pages/pages/new-tab/public/gradients/gradient02.svg b/special-pages/pages/new-tab/public/gradients/gradient02.svg new file mode 100644 index 0000000000..de7ab3b7e0 --- /dev/null +++ b/special-pages/pages/new-tab/public/gradients/gradient02.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/special-pages/pages/new-tab/public/gradients/gradient03.svg b/special-pages/pages/new-tab/public/gradients/gradient03.svg new file mode 100644 index 0000000000..0639b84c25 --- /dev/null +++ b/special-pages/pages/new-tab/public/gradients/gradient03.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/special-pages/pages/new-tab/public/gradients/gradient04.svg b/special-pages/pages/new-tab/public/gradients/gradient04.svg new file mode 100644 index 0000000000..9843eade10 --- /dev/null +++ b/special-pages/pages/new-tab/public/gradients/gradient04.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/special-pages/pages/new-tab/public/gradients/gradient05.svg b/special-pages/pages/new-tab/public/gradients/gradient05.svg new file mode 100644 index 0000000000..eee5ce1a30 --- /dev/null +++ b/special-pages/pages/new-tab/public/gradients/gradient05.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/special-pages/pages/new-tab/public/gradients/gradient06.svg b/special-pages/pages/new-tab/public/gradients/gradient06.svg new file mode 100644 index 0000000000..a91178e5f9 --- /dev/null +++ b/special-pages/pages/new-tab/public/gradients/gradient06.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/special-pages/pages/new-tab/public/gradients/gradient07.svg b/special-pages/pages/new-tab/public/gradients/gradient07.svg new file mode 100644 index 0000000000..1527605f9d --- /dev/null +++ b/special-pages/pages/new-tab/public/gradients/gradient07.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/special-pages/pages/new-tab/public/gradients/gradient08.svg b/special-pages/pages/new-tab/public/gradients/gradient08.svg new file mode 100644 index 0000000000..a7c77f9a44 --- /dev/null +++ b/special-pages/pages/new-tab/public/gradients/gradient08.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/special-pages/pages/new-tab/public/gradients/grain.png b/special-pages/pages/new-tab/public/gradients/grain.png new file mode 100644 index 0000000000..8d3ef5245c Binary files /dev/null and b/special-pages/pages/new-tab/public/gradients/grain.png differ diff --git a/special-pages/pages/new-tab/types/new-tab.ts b/special-pages/pages/new-tab/types/new-tab.ts index 888e36b868..2697cc8bf6 100644 --- a/special-pages/pages/new-tab/types/new-tab.ts +++ b/special-pages/pages/new-tab/types/new-tab.ts @@ -6,6 +6,46 @@ * @module NewTab Messages */ +export type BackgroundVariant = + | DefaultBackground + | SolidColorBackground + | HexValueBackground + | GradientBackground + | UserImageBackground; +export type PredefinedColor = + | "color01" + | "color02" + | "color03" + | "color04" + | "color05" + | "color06" + | "color07" + | "color08" + | "color09" + | "color10" + | "color11" + | "color12" + | "color13" + | "color14" + | "color15" + | "color16" + | "color17" + | "color18" + | "color19"; +export type PredefinedGradient = + | "gradient01" + | "gradient02" + | "gradient03" + | "gradient04" + | "gradient05" + | "gradient06" + | "gradient07" + | "gradient08"; +/** + * Note: this is different to the Browser Theme + */ +export type BackgroundColorScheme = "light" | "dark"; +export type BrowserTheme = "light" | "dark" | "system"; /** * Represents the expansion state of a widget */ @@ -45,6 +85,10 @@ export type RMFIcon = "Announce" | "DDGAnnounce" | "CriticalUpdate" | "AppUpdate export interface NewTabMessages { notifications: | ContextMenuNotification + | CustomizerDeleteImageNotification + | CustomizerSetBackgroundNotification + | CustomizerSetThemeNotification + | CustomizerUploadNotification | FavoritesAddNotification | FavoritesMoveNotification | FavoritesOpenNotification @@ -74,6 +118,10 @@ export interface NewTabMessages { | StatsGetConfigRequest | StatsGetDataRequest; subscriptions: + | CustomizerOnBackgroundUpdateSubscription + | CustomizerOnColorUpdateSubscription + | CustomizerOnImagesUpdateSubscription + | CustomizerOnThemeUpdateSubscription | FavoritesOnConfigUpdateSubscription | FavoritesOnDataUpdateSubscription | NextStepsOnConfigUpdateSubscription @@ -101,6 +149,67 @@ export interface VisibilityMenuItem { */ title: string; } +/** + * Generated from @see "../messages/customizer_deleteImage.notify.json" + */ +export interface CustomizerDeleteImageNotification { + method: "customizer_deleteImage"; + params: CustomizerDeleteImageNotify; +} +export interface CustomizerDeleteImageNotify { + id: string; +} +/** + * Generated from @see "../messages/customizer_setBackground.notify.json" + */ +export interface CustomizerSetBackgroundNotification { + method: "customizer_setBackground"; + params: CustomizerSetBackgroundNotify; +} +export interface CustomizerSetBackgroundNotify { + background: BackgroundVariant; +} +export interface DefaultBackground { + kind: "default"; +} +export interface SolidColorBackground { + kind: "color"; + value: PredefinedColor; +} +export interface HexValueBackground { + kind: "hex"; + value: string; +} +export interface GradientBackground { + kind: "gradient"; + value: PredefinedGradient; +} +export interface UserImageBackground { + kind: "userImage"; + value: UserImage; +} +export interface UserImage { + id: string; + src: string; + thumb: string; + colorScheme: BackgroundColorScheme; +} +/** + * Generated from @see "../messages/customizer_setTheme.notify.json" + */ +export interface CustomizerSetThemeNotification { + method: "customizer_setTheme"; + params: CustomizerSetThemeNotify; +} +export interface CustomizerSetThemeNotify { + theme: BrowserTheme; +} +/** + * Generated from @see "../messages/customizer_upload.notify.json" + */ +export interface CustomizerUploadNotification { + method: "customizer_upload"; +} /** * Generated from @see "../messages/favorites_add.notify.json" */ @@ -369,6 +478,7 @@ export interface InitialSetupResponse { platform: { name: "macos" | "windows" | "android" | "ios" | "integration"; }; + customizer?: CustomizerData; updateNotification: null | UpdateNotificationData; } export interface WidgetListItem { @@ -382,6 +492,12 @@ export interface NewTabPageSettings { state: "enabled" | "disabled"; }; } +export interface CustomizerData { + background: BackgroundVariant; + theme: BrowserTheme; + userImages: UserImage[]; + userColor: null | HexValueBackground; +} export interface UpdateNotificationData { content: null | UpdateNotification; } @@ -474,6 +590,46 @@ export interface TrackerCompany { displayName: string; count: number; } +/** + * Generated from @see "../messages/customizer_onBackgroundUpdate.subscribe.json" + */ +export interface CustomizerOnBackgroundUpdateSubscription { + subscriptionEvent: "customizer_onBackgroundUpdate"; + params: BackgroundData; +} +export interface BackgroundData { + background: BackgroundVariant; +} +/** + * Generated from @see "../messages/customizer_onColorUpdate.subscribe.json" + */ +export interface CustomizerOnColorUpdateSubscription { + subscriptionEvent: "customizer_onColorUpdate"; + params: UserColorData; +} +export interface UserColorData { + userColor: null | HexValueBackground; +} +/** + * Generated from @see "../messages/customizer_onImagesUpdate.subscribe.json" + */ +export interface CustomizerOnImagesUpdateSubscription { + subscriptionEvent: "customizer_onImagesUpdate"; + params: UserImageData; +} +export interface UserImageData { + userImages: UserImage[]; +} +/** + * Generated from @see "../messages/customizer_onThemeUpdate.subscribe.json" + */ +export interface CustomizerOnThemeUpdateSubscription { + subscriptionEvent: "customizer_onThemeUpdate"; + params: ThemeData; +} +export interface ThemeData { + theme: BrowserTheme; +} /** * Generated from @see "../messages/favorites_onConfigUpdate.subscribe.json" */