summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/fonts/actions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /devtools/client/inspector/fonts/actions
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/inspector/fonts/actions')
-rw-r--r--devtools/client/inspector/fonts/actions/font-editor.js70
-rw-r--r--devtools/client/inspector/fonts/actions/font-options.js21
-rw-r--r--devtools/client/inspector/fonts/actions/fonts.js21
-rw-r--r--devtools/client/inspector/fonts/actions/index.js42
-rw-r--r--devtools/client/inspector/fonts/actions/moz.build12
5 files changed, 166 insertions, 0 deletions
diff --git a/devtools/client/inspector/fonts/actions/font-editor.js b/devtools/client/inspector/fonts/actions/font-editor.js
new file mode 100644
index 0000000000..0542604d7b
--- /dev/null
+++ b/devtools/client/inspector/fonts/actions/font-editor.js
@@ -0,0 +1,70 @@
+/* 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/. */
+
+"use strict";
+
+const {
+ APPLY_FONT_VARIATION_INSTANCE,
+ RESET_EDITOR,
+ SET_FONT_EDITOR_DISABLED,
+ UPDATE_AXIS_VALUE,
+ UPDATE_EDITOR_STATE,
+ UPDATE_PROPERTY_VALUE,
+ UPDATE_WARNING_MESSAGE,
+} = require("resource://devtools/client/inspector/fonts/actions/index.js");
+
+module.exports = {
+ resetFontEditor() {
+ return {
+ type: RESET_EDITOR,
+ };
+ },
+
+ setEditorDisabled(disabled = false) {
+ return {
+ type: SET_FONT_EDITOR_DISABLED,
+ disabled,
+ };
+ },
+
+ applyInstance(name, values) {
+ return {
+ type: APPLY_FONT_VARIATION_INSTANCE,
+ name,
+ values,
+ };
+ },
+
+ updateAxis(axis, value) {
+ return {
+ type: UPDATE_AXIS_VALUE,
+ axis,
+ value,
+ };
+ },
+
+ updateFontEditor(fonts, properties = {}, id = "") {
+ return {
+ type: UPDATE_EDITOR_STATE,
+ fonts,
+ properties,
+ id,
+ };
+ },
+
+ updateFontProperty(property, value) {
+ return {
+ type: UPDATE_PROPERTY_VALUE,
+ property,
+ value,
+ };
+ },
+
+ updateWarningMessage(warning) {
+ return {
+ type: UPDATE_WARNING_MESSAGE,
+ warning,
+ };
+ },
+};
diff --git a/devtools/client/inspector/fonts/actions/font-options.js b/devtools/client/inspector/fonts/actions/font-options.js
new file mode 100644
index 0000000000..8dfe101edd
--- /dev/null
+++ b/devtools/client/inspector/fonts/actions/font-options.js
@@ -0,0 +1,21 @@
+/* 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/. */
+
+"use strict";
+
+const {
+ UPDATE_PREVIEW_TEXT,
+} = require("resource://devtools/client/inspector/fonts/actions/index.js");
+
+module.exports = {
+ /**
+ * Update the preview text in the font inspector
+ */
+ updatePreviewText(previewText) {
+ return {
+ type: UPDATE_PREVIEW_TEXT,
+ previewText,
+ };
+ },
+};
diff --git a/devtools/client/inspector/fonts/actions/fonts.js b/devtools/client/inspector/fonts/actions/fonts.js
new file mode 100644
index 0000000000..5682e65521
--- /dev/null
+++ b/devtools/client/inspector/fonts/actions/fonts.js
@@ -0,0 +1,21 @@
+/* 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/. */
+
+"use strict";
+
+const {
+ UPDATE_FONTS,
+} = require("resource://devtools/client/inspector/fonts/actions/index.js");
+
+module.exports = {
+ /**
+ * Update the list of fonts in the font inspector
+ */
+ updateFonts(allFonts) {
+ return {
+ type: UPDATE_FONTS,
+ allFonts,
+ };
+ },
+};
diff --git a/devtools/client/inspector/fonts/actions/index.js b/devtools/client/inspector/fonts/actions/index.js
new file mode 100644
index 0000000000..21597b8c41
--- /dev/null
+++ b/devtools/client/inspector/fonts/actions/index.js
@@ -0,0 +1,42 @@
+/* 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/. */
+
+"use strict";
+
+const { createEnum } = require("resource://devtools/client/shared/enum.js");
+
+createEnum(
+ [
+ // Reset font editor to intial state.
+ "RESET_EDITOR",
+
+ // Set the font editor disabled state which prevents users from interacting with inputs.
+ "SET_FONT_EDITOR_DISABLED",
+
+ // Apply the variation settings of a font instance.
+ "APPLY_FONT_VARIATION_INSTANCE",
+
+ // Update the custom font variation instance with the current axes values.
+ "UPDATE_CUSTOM_INSTANCE",
+
+ // Update the value of a variable font axis.
+ "UPDATE_AXIS_VALUE",
+
+ // Update font editor with applicable fonts and user-defined CSS font properties.
+ "UPDATE_EDITOR_STATE",
+
+ // Update the list of fonts.
+ "UPDATE_FONTS",
+
+ // Update the preview text.
+ "UPDATE_PREVIEW_TEXT",
+
+ // Update the value of a CSS font property
+ "UPDATE_PROPERTY_VALUE",
+
+ // Update the warning message with the reason for not showing the font editor
+ "UPDATE_WARNING_MESSAGE",
+ ],
+ module.exports
+);
diff --git a/devtools/client/inspector/fonts/actions/moz.build b/devtools/client/inspector/fonts/actions/moz.build
new file mode 100644
index 0000000000..31452af580
--- /dev/null
+++ b/devtools/client/inspector/fonts/actions/moz.build
@@ -0,0 +1,12 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+DevToolsModules(
+ "font-editor.js",
+ "font-options.js",
+ "fonts.js",
+ "index.js",
+)