Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ntp: customizer data/messages #1328

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions special-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
mgurgel marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "string"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{
"$ref": "types/background-data.json"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{
"$ref": "types/user-color-data.json"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{
"$ref": "./types/user-image-data.json"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{
"$ref": "types/theme-data.json"
}
]
}
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": ["theme"],
"properties": {
"theme": {
"$ref": "types/browser-theme.json"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"$schema": "http://json-schema.org/draft-07/schema#"
}
1 change: 1 addition & 0 deletions special-pages/pages/new-tab/messages/examples/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const initialSetupResponse = {
locale: 'en',
platform: { name: 'windows' },
updateNotification: { content: null },
customizer: { theme: 'system', userImages: [], userColor: null, background: { kind: 'default' } },
};

export {};
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
}
}
},
"customizer": {
"$ref": "./types/customizer-data.json"
},
"updateNotification": {
"oneOf": [
{
Expand Down
11 changes: 11 additions & 0 deletions special-pages/pages/new-tab/messages/types/background-data.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
101 changes: 101 additions & 0 deletions special-pages/pages/new-tab/messages/types/background.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Browser Theme",
"enum": [
"light",
"dark",
"system"
]
}
47 changes: 47 additions & 0 deletions special-pages/pages/new-tab/messages/types/colors.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
24 changes: 24 additions & 0 deletions special-pages/pages/new-tab/messages/types/customizer-data.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
12 changes: 12 additions & 0 deletions special-pages/pages/new-tab/messages/types/theme-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"theme"
],
"properties": {
"theme": {
"$ref": "./browser-theme.json"
}
}
}
19 changes: 19 additions & 0 deletions special-pages/pages/new-tab/messages/types/user-color-data.json
Original file line number Diff line number Diff line change
@@ -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"}
]
}
}
}
16 changes: 16 additions & 0 deletions special-pages/pages/new-tab/messages/types/user-image-data.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
20 changes: 20 additions & 0 deletions special-pages/pages/new-tab/messages/types/user-image.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading