diff --git a/prefs/zen/share.yaml b/prefs/zen/share.yaml new file mode 100644 index 000000000..d4cdd1a20 --- /dev/null +++ b/prefs/zen/share.yaml @@ -0,0 +1,6 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +- name: zen.share.enabled + value: true diff --git a/src/zen/moz.build b/src/zen/moz.build index 4910bc43d..d52de380d 100644 --- a/src/zen/moz.build +++ b/src/zen/moz.build @@ -15,4 +15,5 @@ DIRS += [ "urlbar", "toolkit", "sessionstore", + "share", ] diff --git a/src/zen/share/moz.build b/src/zen/share/moz.build new file mode 100644 index 000000000..005645c8c --- /dev/null +++ b/src/zen/share/moz.build @@ -0,0 +1,7 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +EXTRA_JS_MODULES.zen.share += [ + "share.schema.json", +] diff --git a/src/zen/share/share.schema.json b/src/zen/share/share.schema.json new file mode 100644 index 000000000..af4046b94 --- /dev/null +++ b/src/zen/share/share.schema.json @@ -0,0 +1,154 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Share Schema", + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "shared": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/$defs/shareable" + } + } + }, + "required": ["shared"], + "additionalProperties": false, + + "$defs": { + "shareable": { + "oneOf": [ + { "$ref": "#/$defs/space" }, + { "$ref": "#/$defs/folder" }, + { "$ref": "#/$defs/splitView" }, + { "$ref": "#/$defs/gradientPreset" } + ] + }, + + "gradientPreset": { + "type": "object", + "properties": { + "type": { "const": "gradientPreset" }, + "theme": { "$ref": "#/$defs/theme" } + }, + "required": ["type", "theme"], + "additionalProperties": false + }, + + "space": { + "type": "object", + "properties": { + "type": { "const": "space" }, + "name": { "type": "string" }, + "theme": { "$ref": "#/$defs/theme" }, + "items": { + "type": "array", + "items": { "$ref": "#/$defs/spaceItem" } + } + }, + "required": ["type", "name", "items"], + "additionalProperties": false + }, + + "theme": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["gradient"] + }, + "gradientColors": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#/$defs/gradientColor" } + } + }, + "required": ["type", "gradientColors"], + "additionalProperties": false + }, + + "gradientColor": { + "type": "object", + "properties": { + "c": { + "type": "array", + "items": { "type": "number" }, + "minItems": 3, + "maxItems": 3 + }, + "isCustom": { "type": "boolean" }, + "algorithm": { "type": "string" }, + "isPrimary": { "type": "boolean" }, + "lightness": { "type": "string" }, + "position": { + "type": "object", + "properties": { + "x": { "type": "number" }, + "y": { "type": "number" } + }, + "required": ["x", "y"], + "additionalProperties": false + }, + "type": { "type": "string" } + }, + "required": ["c", "type"], + "additionalProperties": false + }, + + "folder": { + "type": "object", + "properties": { + "type": { "const": "folder" }, + "name": { "type": "string" }, + "icon": { "type": "string" }, + "items": { + "type": "array", + "items": { "$ref": "#/$defs/folderItem" } + } + }, + "required": ["type", "name", "items"], + "additionalProperties": false + }, + + "tab": { + "type": "object", + "properties": { + "type": { "const": "tab" }, + "url": { + "type": "string", + "format": "uri" + }, + "label": { "type": "string" }, + "image": { "type": "string" }, + "isPinned": { "type": "boolean" } + }, + "required": ["type", "url"], + "additionalProperties": false + }, + + "splitView": { + "type": "object", + "properties": { + "type": { "const": "splitView" }, + "tabs": { + "type": "array", + "minItems": 2, + "maxItems": 4, + "items": { "$ref": "#/$defs/tab" } + } + }, + "required": ["type", "tabs"], + "additionalProperties": false + }, + + "spaceItem": { + "oneOf": [{ "$ref": "#/$defs/tab" }, { "$ref": "#/$defs/folder" }] + }, + + "folderItem": { + "oneOf": [{ "$ref": "#/$defs/tab" }, { "$ref": "#/$defs/folder" }] + } + } +}