feat: Created share files, schemas and prefs, p=#11814, c=no-component

This commit is contained in:
mr. m
2026-01-05 19:42:01 +01:00
committed by GitHub
parent 591193b748
commit 75f4f0c3e6
4 changed files with 168 additions and 0 deletions

6
prefs/zen/share.yaml Normal file
View File

@@ -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

View File

@@ -15,4 +15,5 @@ DIRS += [
"urlbar",
"toolkit",
"sessionstore",
"share",
]

7
src/zen/share/moz.build Normal file
View File

@@ -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",
]

View File

@@ -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" }]
}
}
}