summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/flexbox/actions/flexbox.js
blob: 64c1e1f07482155fc4c7e43bc2565da7d93fdc62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* 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 {
  CLEAR_FLEXBOX,
  UPDATE_FLEXBOX,
  UPDATE_FLEXBOX_COLOR,
  UPDATE_FLEXBOX_HIGHLIGHTED,
} = require("resource://devtools/client/inspector/flexbox/actions/index.js");

module.exports = {
  /**
   * Clears the flexbox state by resetting it back to the initial flexbox state.
   */
  clearFlexbox() {
    return {
      type: CLEAR_FLEXBOX,
    };
  },

  /**
   * Updates the flexbox state with the newly selected flexbox.
   */
  updateFlexbox(flexbox) {
    return {
      type: UPDATE_FLEXBOX,
      flexbox,
    };
  },

  /**
   * Updates the color used for the flexbox's highlighter.
   *
   * @param  {String} color
   *         The color to use for this nodeFront's flexbox highlighter.
   */
  updateFlexboxColor(color) {
    return {
      type: UPDATE_FLEXBOX_COLOR,
      color,
    };
  },

  /**
   * Updates the flexbox highlighted state.
   *
   * @param  {Boolean} highlighted
   *         Whether or not the flexbox highlighter is highlighting the flexbox.
   */
  updateFlexboxHighlighted(highlighted) {
    return {
      type: UPDATE_FLEXBOX_HIGHLIGHTED,
      highlighted,
    };
  },
};