@activecollab/components 2.0.398 → 2.0.399
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/presentation/whiteboard/bottomDock.js +194 -0
- package/dist/cjs/presentation/whiteboard/bottomDock.js.map +1 -0
- package/dist/cjs/presentation/whiteboard/canvasElements.js +877 -0
- package/dist/cjs/presentation/whiteboard/canvasElements.js.map +1 -0
- package/dist/cjs/presentation/whiteboard/elements.js +816 -0
- package/dist/cjs/presentation/whiteboard/elements.js.map +1 -0
- package/dist/cjs/presentation/whiteboard/fileElement.js +457 -0
- package/dist/cjs/presentation/whiteboard/fileElement.js.map +1 -0
- package/dist/cjs/presentation/whiteboard/glyphs.js +67 -0
- package/dist/cjs/presentation/whiteboard/glyphs.js.map +1 -0
- package/dist/cjs/presentation/whiteboard/inspector.js +884 -0
- package/dist/cjs/presentation/whiteboard/inspector.js.map +1 -0
- package/dist/cjs/presentation/whiteboard/linkElement.js +357 -0
- package/dist/cjs/presentation/whiteboard/linkElement.js.map +1 -0
- package/dist/cjs/presentation/whiteboard/outline.js +966 -0
- package/dist/cjs/presentation/whiteboard/outline.js.map +1 -0
- package/dist/cjs/presentation/whiteboard/peopleMenu.js +516 -0
- package/dist/cjs/presentation/whiteboard/peopleMenu.js.map +1 -0
- package/dist/cjs/presentation/whiteboard/settingsMenu.js +177 -0
- package/dist/cjs/presentation/whiteboard/settingsMenu.js.map +1 -0
- package/dist/esm/presentation/whiteboard/bottomDock.d.ts +51 -0
- package/dist/esm/presentation/whiteboard/bottomDock.d.ts.map +1 -0
- package/dist/esm/presentation/whiteboard/bottomDock.js +162 -0
- package/dist/esm/presentation/whiteboard/bottomDock.js.map +1 -0
- package/dist/esm/presentation/whiteboard/canvasElements.d.ts +61 -0
- package/dist/esm/presentation/whiteboard/canvasElements.d.ts.map +1 -0
- package/dist/esm/presentation/whiteboard/canvasElements.js +746 -0
- package/dist/esm/presentation/whiteboard/canvasElements.js.map +1 -0
- package/dist/esm/presentation/whiteboard/elements.d.ts +180 -0
- package/dist/esm/presentation/whiteboard/elements.d.ts.map +1 -0
- package/dist/esm/presentation/whiteboard/elements.js +736 -0
- package/dist/esm/presentation/whiteboard/elements.js.map +1 -0
- package/dist/esm/presentation/whiteboard/fileElement.d.ts +113 -0
- package/dist/esm/presentation/whiteboard/fileElement.d.ts.map +1 -0
- package/dist/esm/presentation/whiteboard/fileElement.js +430 -0
- package/dist/esm/presentation/whiteboard/fileElement.js.map +1 -0
- package/dist/esm/presentation/whiteboard/glyphs.d.ts +32 -0
- package/dist/esm/presentation/whiteboard/glyphs.d.ts.map +1 -0
- package/dist/esm/presentation/whiteboard/glyphs.js +50 -0
- package/dist/esm/presentation/whiteboard/glyphs.js.map +1 -0
- package/dist/esm/presentation/whiteboard/inspector.d.ts +100 -0
- package/dist/esm/presentation/whiteboard/inspector.d.ts.map +1 -0
- package/dist/esm/presentation/whiteboard/inspector.js +753 -0
- package/dist/esm/presentation/whiteboard/inspector.js.map +1 -0
- package/dist/esm/presentation/whiteboard/linkElement.d.ts +97 -0
- package/dist/esm/presentation/whiteboard/linkElement.d.ts.map +1 -0
- package/dist/esm/presentation/whiteboard/linkElement.js +327 -0
- package/dist/esm/presentation/whiteboard/linkElement.js.map +1 -0
- package/dist/esm/presentation/whiteboard/outline.d.ts +89 -0
- package/dist/esm/presentation/whiteboard/outline.d.ts.map +1 -0
- package/dist/esm/presentation/whiteboard/outline.js +870 -0
- package/dist/esm/presentation/whiteboard/outline.js.map +1 -0
- package/dist/esm/presentation/whiteboard/peopleMenu.d.ts +44 -0
- package/dist/esm/presentation/whiteboard/peopleMenu.d.ts.map +1 -0
- package/dist/esm/presentation/whiteboard/peopleMenu.js +440 -0
- package/dist/esm/presentation/whiteboard/peopleMenu.js.map +1 -0
- package/dist/esm/presentation/whiteboard/settingsMenu.d.ts +13 -0
- package/dist/esm/presentation/whiteboard/settingsMenu.d.ts.map +1 -0
- package/dist/esm/presentation/whiteboard/settingsMenu.js +155 -0
- package/dist/esm/presentation/whiteboard/settingsMenu.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withOpacity = exports.stopClick = exports.stickyGradient = exports.snapValue = exports.shapeBorder = exports.renderShapeBody = exports.gridLevel = exports.defaultShapeState = exports.WHEEL_SIZE = exports.WHEEL_RADIUS = exports.ToolbarTextControls = exports.ToolbarColorSwatch = exports.ToolbarActions = exports.THICKNESS_OPTIONS = exports.StyledToolbarLink = exports.StyledToolbarButton = exports.StyledSwatchRow = exports.StyledSticky = exports.StyledHandles = exports.StyledFormattingToolbar = exports.StyledFontSizeValue = exports.StyledColorWheel = exports.StyledColorPopover = exports.StyledCanvasLayer = exports.StyledCanvasElement = exports.ShapeTypeMenu = exports.ShapeFormattingToolbar = exports.SUBMENU_SHADOW = exports.STYLE_OPTIONS = exports.STICKY_FILL = exports.SHAPE_TYPE_OPTIONS = exports.SHAPE_TYPE_ICON = exports.SELECTION_BLUE = exports.ResizeHandles = exports.RESIZE_DIRECTIONS = exports.RADIUS_OPTIONS = exports.PostitFormattingToolbar = exports.OPACITY_OPTIONS = exports.INITIAL_SHAPES = exports.INITIAL_POSITIONS = exports.GRID_LEVELS = exports.FONT_SIZE_OPTIONS = exports.ELEMENT_TEXT = exports.ELEMENT_STROKE = exports.ELEMENT_FILL = exports.ELEMENT_BODIES = exports.ColorWheel = exports.ColorSwatchRow = exports.COLOR_PALETTE = exports.COLOR_OPTIONS = exports.CANVAS_ELEMENTS = exports.BORDER_STYLE_OPTIONS = exports.AlignmentMenu = exports.ALIGN_OPTIONS = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _glyphs = require("./glyphs");
|
|
10
|
+
var _Dot = require("../../components/Dot");
|
|
11
|
+
var _IconButton = require("../../components/IconButton");
|
|
12
|
+
var _Icons = require("../../components/Icons");
|
|
13
|
+
var _List = require("../../components/List");
|
|
14
|
+
var _Menu = require("../../components/Menu");
|
|
15
|
+
var _Tooltip = require("../../components/Tooltip");
|
|
16
|
+
var _colors = require("../../utils/colors");
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
25
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
26
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
27
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
28
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
29
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
30
|
+
/* ------------------------------------------------------------------ */
|
|
31
|
+
/* Canvas elements (1:1 with new-activecollab-front */
|
|
32
|
+
/* src/components/Whiteboards/ — constants.js, ShapeElement.jsx, */
|
|
33
|
+
/* PostitElement.jsx, ResizableWrapper.jsx, ResizeHandles.jsx, */
|
|
34
|
+
/* FormattingToolbarContainer.jsx + the two formatting toolbars) */
|
|
35
|
+
/* ------------------------------------------------------------------ */
|
|
36
|
+
|
|
37
|
+
/* element colors are canvas DATA (app constants), not theme — hardcoded */
|
|
38
|
+
var ELEMENT_FILL = exports.ELEMENT_FILL = "#ffffff";
|
|
39
|
+
var ELEMENT_STROKE = exports.ELEMENT_STROKE = "#374151";
|
|
40
|
+
var ELEMENT_TEXT = exports.ELEMENT_TEXT = "#1f2937";
|
|
41
|
+
var STICKY_FILL = exports.STICKY_FILL = "#fbbf24";
|
|
42
|
+
var SELECTION_BLUE = exports.SELECTION_BLUE = "#3b82f6";
|
|
43
|
+
|
|
44
|
+
/* COLOR_PALETTE from toolbar/colorPalette.js (submenu swatch rows) */
|
|
45
|
+
var COLOR_PALETTE = exports.COLOR_PALETTE = ["#ffffff", "#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#f97316", "#06b6d4", "#84cc16", "#ec4899", "#6b7280"];
|
|
46
|
+
|
|
47
|
+
/* Discrete option sets for the right Inspector — mirror the app's fixed
|
|
48
|
+
font-size ladder and the border-thickness steps offered in the toolbar. */
|
|
49
|
+
var FONT_SIZE_OPTIONS = exports.FONT_SIZE_OPTIONS = [10, 13, 16, 20, 24, 30, 36, 48, 72, 96, 144, 216, 288];
|
|
50
|
+
var THICKNESS_OPTIONS = exports.THICKNESS_OPTIONS = [1, 2, 3, 4, 5];
|
|
51
|
+
var OPACITY_OPTIONS = exports.OPACITY_OPTIONS = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
|
|
52
|
+
|
|
53
|
+
/* Corner radii scaled to the board: shapes are drawn at ~100–300px, so the jump
|
|
54
|
+
from a crisp corner to a pill reads across 0–64px. */
|
|
55
|
+
var RADIUS_OPTIONS = exports.RADIUS_OPTIONS = [0, 4, 8, 12, 16, 24, 32, 48, 64];
|
|
56
|
+
|
|
57
|
+
/* Element bodies are HTML, as the API returns them (the `body` field). The
|
|
58
|
+
Inspector renders them read-only; when a body is empty the field is omitted.
|
|
59
|
+
Mock the three cases across the canvas: a short body (shape-rounded, the
|
|
60
|
+
default selection), a long one that scrolls (shape-circle), and none at all
|
|
61
|
+
(shape-triangle / sticky). */
|
|
62
|
+
var ELEMENT_BODIES = exports.ELEMENT_BODIES = {
|
|
63
|
+
"shape-rounded": "<p>Marks the <strong>Kickoff</strong> phase.</p>",
|
|
64
|
+
"shape-circle": "<p>The <strong>discovery</strong> loop for this initiative.</p><p>We collect signals from support, sales and analytics, then cluster them into themes before committing to a direction.</p><ul><li>Owner: research</li><li>Inputs: interviews, tickets, funnel data</li><li>Output: a prioritised opportunity list</li></ul><p>See the <em>retro notes</em> and last quarter's readout for the full context and prior decisions.</p>"
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/* Named-colour options for the Inspector fill/stroke pickers, built from the
|
|
68
|
+
design system's shared data colours (utils/colors). Shaped for the DS Select
|
|
69
|
+
(id + name + color + textColor) so it renders the standard dot-and-radio menu
|
|
70
|
+
used by the label dialogs. */
|
|
71
|
+
var COLOR_OPTIONS = exports.COLOR_OPTIONS = Object.values(_colors.colors).map(function (entry) {
|
|
72
|
+
return {
|
|
73
|
+
id: entry.color,
|
|
74
|
+
name: entry.name,
|
|
75
|
+
color: entry.color,
|
|
76
|
+
textColor: entry.color
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
/* per-shape editable state (the app bakes opacity into rgba via
|
|
81
|
+
hexToRgba/parseOpacity; the mock keeps opacity separate and rebuilds
|
|
82
|
+
the color when rendering) */
|
|
83
|
+
|
|
84
|
+
var defaultShapeState = exports.defaultShapeState = function defaultShapeState(type) {
|
|
85
|
+
return {
|
|
86
|
+
type,
|
|
87
|
+
fill: ELEMENT_FILL,
|
|
88
|
+
fillOpacity: 100,
|
|
89
|
+
stroke: ELEMENT_STROKE,
|
|
90
|
+
strokeOpacity: 100,
|
|
91
|
+
strokeWidth: 2,
|
|
92
|
+
strokeDash: undefined,
|
|
93
|
+
borderRadius: type === "roundedRectangle" ? 12 : 0,
|
|
94
|
+
fontSize: 16,
|
|
95
|
+
bold: false,
|
|
96
|
+
italic: false,
|
|
97
|
+
underline: false,
|
|
98
|
+
strikethrough: false,
|
|
99
|
+
textColor: ELEMENT_TEXT,
|
|
100
|
+
align: "left"
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/* swatches are 6-digit hex, the color wheel returns hsl(...) */
|
|
105
|
+
var withOpacity = exports.withOpacity = function withOpacity(color, opacityPct) {
|
|
106
|
+
if (opacityPct >= 100) {
|
|
107
|
+
return color;
|
|
108
|
+
}
|
|
109
|
+
var alpha = opacityPct / 100;
|
|
110
|
+
if (color.startsWith("#")) {
|
|
111
|
+
var r = parseInt(color.slice(1, 3), 16);
|
|
112
|
+
var g = parseInt(color.slice(3, 5), 16);
|
|
113
|
+
var b = parseInt(color.slice(5, 7), 16);
|
|
114
|
+
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(alpha, ")");
|
|
115
|
+
}
|
|
116
|
+
if (color.startsWith("hsl(")) {
|
|
117
|
+
return color.replace("hsl(", "hsla(").replace(")", ", ".concat(alpha, ")"));
|
|
118
|
+
}
|
|
119
|
+
return color;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/* getShapeBorder from ShapeElement.jsx */
|
|
123
|
+
var shapeBorder = exports.shapeBorder = function shapeBorder(state) {
|
|
124
|
+
if (state.strokeWidth === 0) {
|
|
125
|
+
return "none";
|
|
126
|
+
}
|
|
127
|
+
var lineStyle = state.strokeDash === "5,5" ? "dashed" : state.strokeDash === "2,2" ? "dotted" : "solid";
|
|
128
|
+
return "".concat(state.strokeWidth, "px ").concat(lineStyle, " ").concat(withOpacity(state.stroke, state.strokeOpacity));
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/* PostitElement gradient: color → same color at ~87% alpha */
|
|
132
|
+
var stickyGradient = exports.stickyGradient = function stickyGradient(color) {
|
|
133
|
+
var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
|
|
134
|
+
var main = withOpacity(color, opacity);
|
|
135
|
+
var faded = withOpacity(color, Math.max(0, opacity - 13));
|
|
136
|
+
return "linear-gradient(135deg, ".concat(main, " 0%, ").concat(faded, " 100%)");
|
|
137
|
+
};
|
|
138
|
+
/* Grid config, aligned to the 8px design-system grid. dotSpacing drives the
|
|
139
|
+
dot layer; snapStep drives snapping — decoupled, so each level snaps finer
|
|
140
|
+
than its dots (Small: 16px dots / 8px snap; Large: 32px dots / 16px snap,
|
|
141
|
+
i.e. dots and half-dots). */
|
|
142
|
+
var GRID_LEVELS = exports.GRID_LEVELS = [{
|
|
143
|
+
value: "off",
|
|
144
|
+
label: "Off",
|
|
145
|
+
dotSpacing: null,
|
|
146
|
+
snapStep: null
|
|
147
|
+
}, {
|
|
148
|
+
value: "small",
|
|
149
|
+
label: "Small",
|
|
150
|
+
dotSpacing: 16,
|
|
151
|
+
snapStep: 8
|
|
152
|
+
}, {
|
|
153
|
+
value: "large",
|
|
154
|
+
label: "Large",
|
|
155
|
+
dotSpacing: 32,
|
|
156
|
+
snapStep: 16
|
|
157
|
+
}];
|
|
158
|
+
var gridLevel = exports.gridLevel = function gridLevel(value) {
|
|
159
|
+
var _GRID_LEVELS$find;
|
|
160
|
+
return (_GRID_LEVELS$find = GRID_LEVELS.find(function (level) {
|
|
161
|
+
return level.value === value;
|
|
162
|
+
})) !== null && _GRID_LEVELS$find !== void 0 ? _GRID_LEVELS$find : GRID_LEVELS[0];
|
|
163
|
+
};
|
|
164
|
+
/* default sizes from DEFAULT_SHAPE_SIZES / DEFAULT_STICKY_SIZE; positions are
|
|
165
|
+
board-space pixels (top-left) so dragging can snap to the pixel grid */
|
|
166
|
+
var CANVAS_ELEMENTS = exports.CANVAS_ELEMENTS = [{
|
|
167
|
+
id: "shape-circle",
|
|
168
|
+
kind: "shape",
|
|
169
|
+
initialType: "circle",
|
|
170
|
+
x: 320,
|
|
171
|
+
y: 180,
|
|
172
|
+
width: 80,
|
|
173
|
+
height: 80
|
|
174
|
+
}, {
|
|
175
|
+
id: "shape-rounded",
|
|
176
|
+
kind: "shape",
|
|
177
|
+
initialType: "roundedRectangle",
|
|
178
|
+
x: 560,
|
|
179
|
+
y: 300,
|
|
180
|
+
width: 100,
|
|
181
|
+
height: 60
|
|
182
|
+
}, {
|
|
183
|
+
id: "shape-triangle",
|
|
184
|
+
kind: "shape",
|
|
185
|
+
initialType: "triangle",
|
|
186
|
+
x: 820,
|
|
187
|
+
y: 170,
|
|
188
|
+
width: 80,
|
|
189
|
+
height: 80
|
|
190
|
+
}, {
|
|
191
|
+
id: "sticky",
|
|
192
|
+
kind: "sticky",
|
|
193
|
+
x: 430,
|
|
194
|
+
y: 430,
|
|
195
|
+
width: 120,
|
|
196
|
+
height: 120
|
|
197
|
+
}];
|
|
198
|
+
var INITIAL_SHAPES = exports.INITIAL_SHAPES = CANVAS_ELEMENTS.reduce(function (acc, element) {
|
|
199
|
+
if (element.kind === "shape" && element.initialType) {
|
|
200
|
+
acc[element.id] = defaultShapeState(element.initialType);
|
|
201
|
+
}
|
|
202
|
+
return acc;
|
|
203
|
+
}, {});
|
|
204
|
+
var INITIAL_POSITIONS = exports.INITIAL_POSITIONS = CANVAS_ELEMENTS.reduce(function (acc, element) {
|
|
205
|
+
acc[element.id] = {
|
|
206
|
+
x: element.x,
|
|
207
|
+
y: element.y
|
|
208
|
+
};
|
|
209
|
+
return acc;
|
|
210
|
+
}, {});
|
|
211
|
+
var snapValue = exports.snapValue = function snapValue(value, step) {
|
|
212
|
+
return step ? Math.round(value / step) * step : value;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/* deselect happens on canvas-background click (layer under the bars) */
|
|
216
|
+
var StyledCanvasLayer = exports.StyledCanvasLayer = _styledComponents.default.div.withConfig({
|
|
217
|
+
displayName: "elements__StyledCanvasLayer",
|
|
218
|
+
componentId: "sc-ohnju4-0"
|
|
219
|
+
})(["position:absolute;inset:0;&.drawing{cursor:crosshair;}"]);
|
|
220
|
+
|
|
221
|
+
/* ResizableWrapper: selected = 2px blue-500 ring @50%, hover = 4px
|
|
222
|
+
blue-400 ring @70% (Tailwind rings are box-shadows) */
|
|
223
|
+
var StyledCanvasElement = exports.StyledCanvasElement = _styledComponents.default.div.withConfig({
|
|
224
|
+
displayName: "elements__StyledCanvasElement",
|
|
225
|
+
componentId: "sc-ohnju4-1"
|
|
226
|
+
})(["position:absolute;cursor:move;&:hover:not(.selected){box-shadow:0 0 0 4px rgba(96,165,250,0.7);}&.selected{box-shadow:0 0 0 2px rgba(59,130,246,0.5);}&.is-card{cursor:grab;height:auto;&:hover:not(.selected),&.selected{box-shadow:none;}}.shape-fill{width:100%;height:100%;box-sizing:border-box;}"]);
|
|
227
|
+
|
|
228
|
+
/* PostitElement: 12px padding, shadow-lg, 1deg tilt that straightens on
|
|
229
|
+
hover, diagonal gradient to ~87% alpha, Comic Sans */
|
|
230
|
+
var StyledSticky = exports.StyledSticky = _styledComponents.default.div.withConfig({
|
|
231
|
+
displayName: "elements__StyledSticky",
|
|
232
|
+
componentId: "sc-ohnju4-2"
|
|
233
|
+
})(["width:100%;height:100%;box-sizing:border-box;padding:12px;box-shadow:0 10px 15px -3px rgba(0,0,0,0.1),0 4px 6px -4px rgba(0,0,0,0.1);transform:rotate(1deg);transition:transform 200ms;font-family:\"Comic Sans MS\",cursive,system-ui,sans-serif;line-height:1.4;word-break:break-word;white-space:pre-wrap;", ":hover &{transform:rotate(0deg);}"], StyledCanvasElement);
|
|
234
|
+
|
|
235
|
+
/* ResizeHandles: 8 12px blue squares w/ 2px white border on the box,
|
|
236
|
+
plus the 24px rotate handle outside the bottom-left corner */
|
|
237
|
+
var StyledHandles = exports.StyledHandles = _styledComponents.default.div.withConfig({
|
|
238
|
+
displayName: "elements__StyledHandles",
|
|
239
|
+
componentId: "sc-ohnju4-3"
|
|
240
|
+
})([".rh{position:absolute;width:12px;height:12px;box-sizing:border-box;background-color:", ";border:2px solid #ffffff;border-radius:2px;z-index:10;&:hover{background-color:#2563eb;}}.rh-nw{top:-6px;left:-6px;cursor:nw-resize;}.rh-n{top:-6px;left:50%;margin-left:-6px;cursor:n-resize;}.rh-ne{top:-6px;right:-6px;cursor:ne-resize;}.rh-w{top:50%;left:-6px;margin-top:-6px;cursor:w-resize;}.rh-e{top:50%;right:-6px;margin-top:-6px;cursor:e-resize;}.rh-sw{bottom:-6px;left:-6px;cursor:sw-resize;}.rh-s{bottom:-6px;left:50%;margin-left:-6px;cursor:s-resize;}.rh-se{bottom:-6px;right:-6px;cursor:se-resize;}.rotate-handle{position:absolute;bottom:-35px;left:-35px;width:24px;height:24px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;background-color:#ffffff;border:2px solid ", ";border-radius:50%;cursor:grab;z-index:11;svg{width:16px;height:16px;}}"], SELECTION_BLUE, SELECTION_BLUE);
|
|
241
|
+
var RESIZE_DIRECTIONS = exports.RESIZE_DIRECTIONS = ["nw", "n", "ne", "w", "e", "sw", "s", "se"];
|
|
242
|
+
var ResizeHandles = exports.ResizeHandles = function ResizeHandles() {
|
|
243
|
+
return /*#__PURE__*/_react.default.createElement(StyledHandles, {
|
|
244
|
+
onMouseDown: function onMouseDown(event) {
|
|
245
|
+
return event.stopPropagation();
|
|
246
|
+
}
|
|
247
|
+
}, RESIZE_DIRECTIONS.map(function (direction) {
|
|
248
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
249
|
+
key: direction,
|
|
250
|
+
className: "rh rh-".concat(direction)
|
|
251
|
+
});
|
|
252
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
253
|
+
className: "rotate-handle"
|
|
254
|
+
}, /*#__PURE__*/_react.default.createElement(_Icons.ArrowRefreshIcon, {
|
|
255
|
+
fill: SELECTION_BLUE
|
|
256
|
+
})));
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
/* FormattingToolbarContainer: Paper paper-2 (bg + 8px radius + shadow,
|
|
260
|
+
no border), 8px padding, 4px gap, centered 10px above the element */
|
|
261
|
+
var StyledFormattingToolbar = exports.StyledFormattingToolbar = _styledComponents.default.div.withConfig({
|
|
262
|
+
displayName: "elements__StyledFormattingToolbar",
|
|
263
|
+
componentId: "sc-ohnju4-4"
|
|
264
|
+
})(["position:absolute;bottom:calc(100% + 10px);left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:4px;padding:8px;border-radius:8px;background-color:var(--page-paper-main);box-shadow:var(--shadow-tertiary);white-space:nowrap;cursor:auto;z-index:20;.tb-group{position:relative;display:flex;align-items:center;gap:4px;padding-right:8px;margin-right:8px;border-right:1px solid var(--border-primary);}.tb-rel{position:relative;display:inline-flex;}.divider{width:1px;height:20px;background-color:var(--border-primary);margin:0 4px;flex-shrink:0;}"]);
|
|
265
|
+
|
|
266
|
+
/* Button variant="option" (idle) / "tertiary" (active), h-8 px-2 gap-1 */
|
|
267
|
+
var StyledToolbarButton = exports.StyledToolbarButton = _styledComponents.default.button.withConfig({
|
|
268
|
+
displayName: "elements__StyledToolbarButton",
|
|
269
|
+
componentId: "sc-ohnju4-5"
|
|
270
|
+
})(["display:inline-flex;align-items:center;justify-content:center;gap:4px;height:32px;box-sizing:border-box;padding:0 8px;border:0;border-radius:8px;background-color:transparent;color:var(--color-secondary);font-family:-apple-system,BlinkMacSystemFont,\"Roboto\",\"Helvetica Neue\",Arial,sans-serif;font-size:14px;cursor:pointer;&:hover{background-color:var(--color-theme-200);}&.active{background-color:var(--color-theme-300);}&.icon-only{width:32px;padding:0;}&:disabled{opacity:0.45;cursor:default;&:hover{background-color:transparent;}}svg{fill:currentColor;flex-shrink:0;}svg.i16{width:16px;height:16px;}svg.i12{width:12px;height:12px;}"]);
|
|
271
|
+
|
|
272
|
+
/* Same chrome as a toolbar button, but an <a> — used where the action is a real
|
|
273
|
+
navigation (Visit). `withComponent` keeps the styles and swaps the element, so
|
|
274
|
+
the props type becomes the anchor's. */
|
|
275
|
+
var StyledToolbarLink = exports.StyledToolbarLink = (0, _styledComponents.default)(StyledToolbarButton.withComponent("a")).withConfig({
|
|
276
|
+
displayName: "elements__StyledToolbarLink",
|
|
277
|
+
componentId: "sc-ohnju4-6"
|
|
278
|
+
})(["text-decoration:none;"]);
|
|
279
|
+
|
|
280
|
+
/* font-mono min-w-[24px] text-xs readout between the stepper buttons */
|
|
281
|
+
var StyledFontSizeValue = exports.StyledFontSizeValue = _styledComponents.default.span.withConfig({
|
|
282
|
+
displayName: "elements__StyledFontSizeValue",
|
|
283
|
+
componentId: "sc-ohnju4-7"
|
|
284
|
+
})(["min-width:24px;text-align:center;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:var(--color-secondary);"]);
|
|
285
|
+
var stopClick = exports.stopClick = function stopClick(event) {
|
|
286
|
+
return event.stopPropagation();
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
/* Shared drop shadow for the colour swatch popover / colour wheel that the
|
|
290
|
+
compact toolbar swatch trigger opens. */
|
|
291
|
+
var SUBMENU_SHADOW = exports.SUBMENU_SHADOW = "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)";
|
|
292
|
+
|
|
293
|
+
/* ColorWheelPopover: beside the submenu (SHAPE_POPOVER_CLASS) or below
|
|
294
|
+
a toolbar trigger (sticky default class) */
|
|
295
|
+
var StyledColorPopover = exports.StyledColorPopover = _styledComponents.default.div.withConfig({
|
|
296
|
+
displayName: "elements__StyledColorPopover",
|
|
297
|
+
componentId: "sc-ohnju4-8"
|
|
298
|
+
})(["position:absolute;box-sizing:border-box;padding:12px;background-color:var(--page-paper-main);border:1px solid var(--border-primary);border-radius:8px;box-shadow:", ";z-index:70;cursor:auto;&.beside{top:0;left:100%;margin-left:8px;}&.below{top:40px;left:0;}"], SUBMENU_SHADOW);
|
|
299
|
+
|
|
300
|
+
/* ImprovedColorWheel: hue = angle from east (atan2), saturation = distance,
|
|
301
|
+
lightness 50 — the canvas wheel replicated with CSS gradients */
|
|
302
|
+
var WHEEL_SIZE = exports.WHEEL_SIZE = 200;
|
|
303
|
+
var WHEEL_RADIUS = exports.WHEEL_RADIUS = WHEEL_SIZE / 2 - 5;
|
|
304
|
+
var StyledColorWheel = exports.StyledColorWheel = _styledComponents.default.button.withConfig({
|
|
305
|
+
displayName: "elements__StyledColorWheel",
|
|
306
|
+
componentId: "sc-ohnju4-9"
|
|
307
|
+
})(["display:block;width:", "px;height:", "px;padding:0;border:0;border-radius:50%;cursor:crosshair;box-shadow:", ";background:radial-gradient( circle closest-side,#ffffff,rgba(255,255,255,0) ),conic-gradient( from 90deg,#ff0000,#ffff00,#00ff00,#00ffff,#0000ff,#ff00ff,#ff0000 );"], WHEEL_SIZE, WHEEL_SIZE, SUBMENU_SHADOW);
|
|
308
|
+
var ColorWheel = exports.ColorWheel = function ColorWheel(_ref) {
|
|
309
|
+
var onColorChange = _ref.onColorChange;
|
|
310
|
+
return /*#__PURE__*/_react.default.createElement(StyledColorWheel, {
|
|
311
|
+
onClick: function onClick(event) {
|
|
312
|
+
var rect = event.currentTarget.getBoundingClientRect();
|
|
313
|
+
var dx = event.clientX - rect.left - WHEEL_SIZE / 2;
|
|
314
|
+
var dy = event.clientY - rect.top - WHEEL_SIZE / 2;
|
|
315
|
+
var distance = Math.sqrt(dx * dx + dy * dy);
|
|
316
|
+
if (distance > WHEEL_RADIUS) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
var angle = Math.atan2(dy, dx);
|
|
320
|
+
if (angle < 0) {
|
|
321
|
+
angle += 2 * Math.PI;
|
|
322
|
+
}
|
|
323
|
+
var hue = Math.round(angle * 180 / Math.PI);
|
|
324
|
+
var saturation = Math.round(Math.min(100, distance / WHEEL_RADIUS * 100));
|
|
325
|
+
onColorChange("hsl(".concat(hue, ", ").concat(saturation, "%, 50%)"));
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
/* ColorSwatchRow.jsx: 32px swatches + a "+" that opens the color wheel */
|
|
331
|
+
var StyledSwatchRow = exports.StyledSwatchRow = _styledComponents.default.div.withConfig({
|
|
332
|
+
displayName: "elements__StyledSwatchRow",
|
|
333
|
+
componentId: "sc-ohnju4-10"
|
|
334
|
+
})(["display:flex;flex-wrap:wrap;gap:8px;.swatch{width:32px;height:32px;box-sizing:border-box;padding:0;border:2px solid var(--border-primary);border-radius:4px;cursor:pointer;&:hover{border-color:var(--color-theme-500);}&.selected{box-shadow:0 0 0 2px ", ";}}.swatch-add{display:flex;align-items:center;justify-content:center;background-color:var(--color-theme-200);color:var(--color-secondary);}"], SELECTION_BLUE);
|
|
335
|
+
var ColorSwatchRow = exports.ColorSwatchRow = function ColorSwatchRow(_ref2) {
|
|
336
|
+
var selectedColor = _ref2.selectedColor,
|
|
337
|
+
includeTransparent = _ref2.includeTransparent,
|
|
338
|
+
onSelect = _ref2.onSelect,
|
|
339
|
+
onAddClick = _ref2.onAddClick;
|
|
340
|
+
return /*#__PURE__*/_react.default.createElement(StyledSwatchRow, null, includeTransparent ? /*#__PURE__*/_react.default.createElement("button", {
|
|
341
|
+
type: "button",
|
|
342
|
+
className: selectedColor === "transparent" ? "swatch swatch-add selected" : "swatch swatch-add",
|
|
343
|
+
"aria-label": "Transparent",
|
|
344
|
+
onClick: function onClick() {
|
|
345
|
+
return onSelect("transparent");
|
|
346
|
+
}
|
|
347
|
+
}, /*#__PURE__*/_react.default.createElement(_Icons.CircleSlashIcon, {
|
|
348
|
+
width: 20,
|
|
349
|
+
height: 20,
|
|
350
|
+
fill: "currentColor"
|
|
351
|
+
})) : null, COLOR_PALETTE.map(function (color) {
|
|
352
|
+
return /*#__PURE__*/_react.default.createElement("button", {
|
|
353
|
+
key: color,
|
|
354
|
+
type: "button",
|
|
355
|
+
className: selectedColor === color ? "swatch selected" : "swatch",
|
|
356
|
+
style: {
|
|
357
|
+
backgroundColor: color
|
|
358
|
+
},
|
|
359
|
+
onClick: function onClick() {
|
|
360
|
+
return onSelect(color);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}), /*#__PURE__*/_react.default.createElement("button", {
|
|
364
|
+
type: "button",
|
|
365
|
+
className: "swatch swatch-add",
|
|
366
|
+
onClick: onAddClick
|
|
367
|
+
}, /*#__PURE__*/_react.default.createElement(_glyphs.PlusGlyph, null)));
|
|
368
|
+
};
|
|
369
|
+
var SHAPE_TYPE_ICON = exports.SHAPE_TYPE_ICON = {
|
|
370
|
+
rectangle: /*#__PURE__*/_react.default.createElement(_glyphs.SquareGlyph, null),
|
|
371
|
+
roundedRectangle: /*#__PURE__*/_react.default.createElement(_Icons.RoundedRectangleIcon, {
|
|
372
|
+
className: "i16"
|
|
373
|
+
}),
|
|
374
|
+
circle: /*#__PURE__*/_react.default.createElement(_Icons.CircleIcon, {
|
|
375
|
+
className: "i16"
|
|
376
|
+
}),
|
|
377
|
+
triangle: /*#__PURE__*/_react.default.createElement(_Icons.TriangleIcon, {
|
|
378
|
+
className: "i16"
|
|
379
|
+
})
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
/* The four shape types, in the order the shape-type menu lists them. */
|
|
383
|
+
var SHAPE_TYPE_OPTIONS = exports.SHAPE_TYPE_OPTIONS = [{
|
|
384
|
+
type: "rectangle",
|
|
385
|
+
label: "Rectangle"
|
|
386
|
+
}, {
|
|
387
|
+
type: "roundedRectangle",
|
|
388
|
+
label: "Rounded Rectangle"
|
|
389
|
+
}, {
|
|
390
|
+
type: "circle",
|
|
391
|
+
label: "Circle"
|
|
392
|
+
}, {
|
|
393
|
+
type: "triangle",
|
|
394
|
+
label: "Triangle"
|
|
395
|
+
}];
|
|
396
|
+
|
|
397
|
+
/* Stroke pattern options — now only the Inspector's Stroke group renders these
|
|
398
|
+
(the shape floating toolbar no longer edits stroke). Mirrors the app's
|
|
399
|
+
STROKE_PATTERN_OPTIONS dash enum: solid | dashed | dotted. */
|
|
400
|
+
var BORDER_STYLE_OPTIONS = exports.BORDER_STYLE_OPTIONS = [{
|
|
401
|
+
value: undefined,
|
|
402
|
+
label: "Solid"
|
|
403
|
+
}, {
|
|
404
|
+
value: "5,5",
|
|
405
|
+
label: "Dashed"
|
|
406
|
+
}, {
|
|
407
|
+
value: "2,2",
|
|
408
|
+
label: "Dotted"
|
|
409
|
+
}];
|
|
410
|
+
|
|
411
|
+
/* ── Shared floating-toolbar controls ───────────────────────────────────────
|
|
412
|
+
The floating toolbars were flattened this session to match the app: compact,
|
|
413
|
+
collapsed controls (single-button dropdowns) with uniform 4px spacing and a
|
|
414
|
+
single hairline separator only before Lock / Delete. These mirror the shared
|
|
415
|
+
controls in the app's Inspector/Controls (ShapeTypeMenu, AlignmentMenu,
|
|
416
|
+
ColorPicker compact, ToolbarActions). */
|
|
417
|
+
|
|
418
|
+
/* ToolbarActions — the trailing block shared by EVERY floating toolbar:
|
|
419
|
+
separator → Lock → Delete, in the standard control colour (not red). Mirrors
|
|
420
|
+
app `toolbar/ToolbarActions.jsx`. */
|
|
421
|
+
|
|
422
|
+
var ToolbarActions = exports.ToolbarActions = function ToolbarActions(_ref3) {
|
|
423
|
+
var locked = _ref3.locked,
|
|
424
|
+
onToggleLock = _ref3.onToggleLock,
|
|
425
|
+
onDelete = _ref3.onDelete;
|
|
426
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
427
|
+
className: "divider"
|
|
428
|
+
}), /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
429
|
+
title: locked ? "Unlock" : "Lock"
|
|
430
|
+
}, /*#__PURE__*/_react.default.createElement(StyledToolbarButton, {
|
|
431
|
+
className: locked ? "icon-only active" : "icon-only",
|
|
432
|
+
"aria-pressed": locked,
|
|
433
|
+
onClick: onToggleLock
|
|
434
|
+
}, /*#__PURE__*/_react.default.createElement(_Icons.LockIcon, {
|
|
435
|
+
className: "i16"
|
|
436
|
+
}))), /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
437
|
+
title: "Delete"
|
|
438
|
+
}, /*#__PURE__*/_react.default.createElement(StyledToolbarButton, {
|
|
439
|
+
className: "icon-only",
|
|
440
|
+
onClick: onDelete
|
|
441
|
+
}, /*#__PURE__*/_react.default.createElement(_Icons.TrashIcon, {
|
|
442
|
+
className: "i16"
|
|
443
|
+
}))));
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
/* ShapeTypeMenu — collapsed shape-type picker: one icon button showing the
|
|
447
|
+
current shape, opening a dropdown of the four types. Modeled on the app's
|
|
448
|
+
ShapeTypeMenu (DS Menu + List). */
|
|
449
|
+
|
|
450
|
+
var ShapeTypeMenu = exports.ShapeTypeMenu = function ShapeTypeMenu(_ref4) {
|
|
451
|
+
var value = _ref4.value,
|
|
452
|
+
onChange = _ref4.onChange;
|
|
453
|
+
var _useState = (0, _react.useState)(false),
|
|
454
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
455
|
+
open = _useState2[0],
|
|
456
|
+
setOpen = _useState2[1];
|
|
457
|
+
return /*#__PURE__*/_react.default.createElement(_Menu.Menu, {
|
|
458
|
+
open: open,
|
|
459
|
+
onOpen: function onOpen() {
|
|
460
|
+
return setOpen(true);
|
|
461
|
+
},
|
|
462
|
+
onClose: function onClose() {
|
|
463
|
+
return setOpen(false);
|
|
464
|
+
},
|
|
465
|
+
position: "bottom-start",
|
|
466
|
+
target: /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
|
|
467
|
+
type: "button",
|
|
468
|
+
variant: "text gray",
|
|
469
|
+
active: open,
|
|
470
|
+
"aria-label": "Shape"
|
|
471
|
+
}, SHAPE_TYPE_ICON[value])
|
|
472
|
+
}, /*#__PURE__*/_react.default.createElement(_List.List, {
|
|
473
|
+
style: {
|
|
474
|
+
padding: "8px 0"
|
|
475
|
+
},
|
|
476
|
+
tabIndex: -1
|
|
477
|
+
}, SHAPE_TYPE_OPTIONS.map(function (option) {
|
|
478
|
+
return /*#__PURE__*/_react.default.createElement(_List.ListItem, {
|
|
479
|
+
key: option.type,
|
|
480
|
+
"aria-label": option.label,
|
|
481
|
+
onClick: function onClick() {
|
|
482
|
+
onChange(option.type);
|
|
483
|
+
setOpen(false);
|
|
484
|
+
}
|
|
485
|
+
}, SHAPE_TYPE_ICON[option.type], option.label);
|
|
486
|
+
})));
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
/* AlignmentMenu — collapsed alignment picker (single button + dropdown), the
|
|
490
|
+
compact-toolbar counterpart to the Inspector's expanded four-button row.
|
|
491
|
+
Mirrors the app's AlignmentMenu. */
|
|
492
|
+
|
|
493
|
+
var AlignmentMenu = exports.AlignmentMenu = function AlignmentMenu(_ref5) {
|
|
494
|
+
var _ALIGN_OPTIONS$find;
|
|
495
|
+
var value = _ref5.value,
|
|
496
|
+
onChange = _ref5.onChange,
|
|
497
|
+
disabled = _ref5.disabled;
|
|
498
|
+
var _useState3 = (0, _react.useState)(false),
|
|
499
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
500
|
+
open = _useState4[0],
|
|
501
|
+
setOpen = _useState4[1];
|
|
502
|
+
var selected = (_ALIGN_OPTIONS$find = ALIGN_OPTIONS.find(function (option) {
|
|
503
|
+
return option.value === value;
|
|
504
|
+
})) !== null && _ALIGN_OPTIONS$find !== void 0 ? _ALIGN_OPTIONS$find : ALIGN_OPTIONS[0];
|
|
505
|
+
return /*#__PURE__*/_react.default.createElement(_Menu.Menu, {
|
|
506
|
+
open: open,
|
|
507
|
+
onOpen: function onOpen() {
|
|
508
|
+
return setOpen(true);
|
|
509
|
+
},
|
|
510
|
+
onClose: function onClose() {
|
|
511
|
+
return setOpen(false);
|
|
512
|
+
},
|
|
513
|
+
position: "bottom-start",
|
|
514
|
+
target: /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
|
|
515
|
+
type: "button",
|
|
516
|
+
variant: "text gray",
|
|
517
|
+
active: open,
|
|
518
|
+
disabled: disabled,
|
|
519
|
+
"aria-label": "Alignment"
|
|
520
|
+
}, selected.icon)
|
|
521
|
+
}, /*#__PURE__*/_react.default.createElement(_List.List, {
|
|
522
|
+
style: {
|
|
523
|
+
padding: "8px 0"
|
|
524
|
+
},
|
|
525
|
+
tabIndex: -1
|
|
526
|
+
}, ALIGN_OPTIONS.map(function (option) {
|
|
527
|
+
return /*#__PURE__*/_react.default.createElement(_List.ListItem, {
|
|
528
|
+
key: option.value,
|
|
529
|
+
"aria-label": option.label,
|
|
530
|
+
onClick: function onClick() {
|
|
531
|
+
onChange(option.value);
|
|
532
|
+
setOpen(false);
|
|
533
|
+
}
|
|
534
|
+
}, option.icon, option.label);
|
|
535
|
+
})));
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
/* Compact swatch-only colour trigger: a single dot (or a CircleSlash chip when
|
|
539
|
+
transparent) that opens a swatch popover. The Inspector's ColorPickerField
|
|
540
|
+
keeps the swatch + name; the floating toolbars use this swatch-only variant.
|
|
541
|
+
`includeTransparent` is passed through to the swatch row — shape fill opts
|
|
542
|
+
in, sticky fill and text colour do not. */
|
|
543
|
+
|
|
544
|
+
var ToolbarColorSwatch = exports.ToolbarColorSwatch = function ToolbarColorSwatch(_ref6) {
|
|
545
|
+
var value = _ref6.value,
|
|
546
|
+
includeTransparent = _ref6.includeTransparent,
|
|
547
|
+
label = _ref6.label,
|
|
548
|
+
onChange = _ref6.onChange;
|
|
549
|
+
var _useState5 = (0, _react.useState)(false),
|
|
550
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
551
|
+
open = _useState6[0],
|
|
552
|
+
setOpen = _useState6[1];
|
|
553
|
+
var _useState7 = (0, _react.useState)(false),
|
|
554
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
555
|
+
wheelOpen = _useState8[0],
|
|
556
|
+
setWheelOpen = _useState8[1];
|
|
557
|
+
var isTransparent = value === "transparent";
|
|
558
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
559
|
+
className: "tb-rel"
|
|
560
|
+
}, /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
561
|
+
title: label
|
|
562
|
+
}, /*#__PURE__*/_react.default.createElement(StyledToolbarButton, {
|
|
563
|
+
className: open ? "icon-only active" : "icon-only",
|
|
564
|
+
"aria-label": label,
|
|
565
|
+
onClick: function onClick() {
|
|
566
|
+
setOpen(function (current) {
|
|
567
|
+
return !current;
|
|
568
|
+
});
|
|
569
|
+
setWheelOpen(false);
|
|
570
|
+
}
|
|
571
|
+
}, isTransparent ? /*#__PURE__*/_react.default.createElement(_Icons.CircleSlashIcon, {
|
|
572
|
+
width: 16,
|
|
573
|
+
height: 16,
|
|
574
|
+
fill: "currentColor"
|
|
575
|
+
}) : /*#__PURE__*/_react.default.createElement(_Dot.Dot, {
|
|
576
|
+
color: value,
|
|
577
|
+
size: 16
|
|
578
|
+
}))), open ? /*#__PURE__*/_react.default.createElement(StyledColorPopover, {
|
|
579
|
+
className: "below"
|
|
580
|
+
}, /*#__PURE__*/_react.default.createElement(ColorSwatchRow, {
|
|
581
|
+
selectedColor: value,
|
|
582
|
+
includeTransparent: includeTransparent,
|
|
583
|
+
onSelect: function onSelect(color) {
|
|
584
|
+
onChange(color);
|
|
585
|
+
setOpen(false);
|
|
586
|
+
},
|
|
587
|
+
onAddClick: function onAddClick() {
|
|
588
|
+
return setWheelOpen(function (current) {
|
|
589
|
+
return !current;
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
}), wheelOpen ? /*#__PURE__*/_react.default.createElement(StyledColorPopover, {
|
|
593
|
+
className: "beside"
|
|
594
|
+
}, /*#__PURE__*/_react.default.createElement(ColorWheel, {
|
|
595
|
+
onColorChange: function onColorChange(color) {
|
|
596
|
+
onChange(color);
|
|
597
|
+
setOpen(false);
|
|
598
|
+
}
|
|
599
|
+
})) : null) : null);
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
/* The text controls shared by the shape and sticky toolbars: font-size stepper,
|
|
603
|
+
B / I / U / S, and the collapsed alignment menu. Same set the app's sticky
|
|
604
|
+
and shape toolbars share (font-size picker, TextStyleButtons, AlignmentMenu).
|
|
605
|
+
Kept generic so both element shapes can drive it. */
|
|
606
|
+
|
|
607
|
+
var ToolbarTextControls = exports.ToolbarTextControls = function ToolbarTextControls(_ref7) {
|
|
608
|
+
var fontSize = _ref7.fontSize,
|
|
609
|
+
styleFlags = _ref7.styleFlags,
|
|
610
|
+
align = _ref7.align,
|
|
611
|
+
onFontSize = _ref7.onFontSize,
|
|
612
|
+
onToggleStyle = _ref7.onToggleStyle,
|
|
613
|
+
onAlign = _ref7.onAlign;
|
|
614
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
615
|
+
title: "Decrease font size"
|
|
616
|
+
}, /*#__PURE__*/_react.default.createElement(StyledToolbarButton, {
|
|
617
|
+
className: "icon-only",
|
|
618
|
+
"aria-label": "Decrease font size",
|
|
619
|
+
onClick: function onClick() {
|
|
620
|
+
return onFontSize(Math.max(8, fontSize - 2));
|
|
621
|
+
}
|
|
622
|
+
}, /*#__PURE__*/_react.default.createElement(_glyphs.MinusGlyph, {
|
|
623
|
+
className: "i16"
|
|
624
|
+
}))), /*#__PURE__*/_react.default.createElement(StyledFontSizeValue, null, fontSize), /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
625
|
+
title: "Increase font size"
|
|
626
|
+
}, /*#__PURE__*/_react.default.createElement(StyledToolbarButton, {
|
|
627
|
+
className: "icon-only",
|
|
628
|
+
"aria-label": "Increase font size",
|
|
629
|
+
onClick: function onClick() {
|
|
630
|
+
return onFontSize(Math.min(96, fontSize + 2));
|
|
631
|
+
}
|
|
632
|
+
}, /*#__PURE__*/_react.default.createElement(_glyphs.PlusGlyph, {
|
|
633
|
+
className: "i16"
|
|
634
|
+
}))), STYLE_OPTIONS.map(function (option) {
|
|
635
|
+
return /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
636
|
+
key: option.key,
|
|
637
|
+
title: option.label
|
|
638
|
+
}, /*#__PURE__*/_react.default.createElement(StyledToolbarButton, {
|
|
639
|
+
className: styleFlags[option.key] ? "icon-only active" : "icon-only",
|
|
640
|
+
"aria-label": option.label,
|
|
641
|
+
"aria-pressed": styleFlags[option.key],
|
|
642
|
+
onClick: function onClick() {
|
|
643
|
+
return onToggleStyle(option.key);
|
|
644
|
+
}
|
|
645
|
+
}, option.icon));
|
|
646
|
+
}), /*#__PURE__*/_react.default.createElement(AlignmentMenu, {
|
|
647
|
+
value: align,
|
|
648
|
+
onChange: onAlign
|
|
649
|
+
}));
|
|
650
|
+
};
|
|
651
|
+
/* ShapeFormattingToolbar — flat layout (was submenu-based): shape-type menu →
|
|
652
|
+
fill colour → the same text controls as the sticky toolbar → Lock / Delete.
|
|
653
|
+
Stroke is no longer edited here — it lives only in the Inspector's Stroke
|
|
654
|
+
group now. Mirrors the app's ShapeFormattingToolbar. */
|
|
655
|
+
var ShapeFormattingToolbar = exports.ShapeFormattingToolbar = function ShapeFormattingToolbar(_ref8) {
|
|
656
|
+
var _element$align;
|
|
657
|
+
var element = _ref8.element,
|
|
658
|
+
onUpdate = _ref8.onUpdate,
|
|
659
|
+
onDelete = _ref8.onDelete,
|
|
660
|
+
locked = _ref8.locked,
|
|
661
|
+
onToggleLock = _ref8.onToggleLock;
|
|
662
|
+
return /*#__PURE__*/_react.default.createElement(StyledFormattingToolbar, {
|
|
663
|
+
onClick: stopClick,
|
|
664
|
+
onMouseDown: stopClick
|
|
665
|
+
}, /*#__PURE__*/_react.default.createElement(ShapeTypeMenu, {
|
|
666
|
+
value: element.type,
|
|
667
|
+
onChange: function onChange(type) {
|
|
668
|
+
return onUpdate({
|
|
669
|
+
type
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
}), /*#__PURE__*/_react.default.createElement(ToolbarColorSwatch, {
|
|
673
|
+
value: element.fill,
|
|
674
|
+
includeTransparent: true,
|
|
675
|
+
label: "Fill color",
|
|
676
|
+
onChange: function onChange(fill) {
|
|
677
|
+
return onUpdate({
|
|
678
|
+
fill
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
}), /*#__PURE__*/_react.default.createElement(ToolbarTextControls, {
|
|
682
|
+
fontSize: element.fontSize,
|
|
683
|
+
styleFlags: element,
|
|
684
|
+
align: (_element$align = element.align) !== null && _element$align !== void 0 ? _element$align : "left",
|
|
685
|
+
onFontSize: function onFontSize(fontSize) {
|
|
686
|
+
return onUpdate({
|
|
687
|
+
fontSize
|
|
688
|
+
});
|
|
689
|
+
},
|
|
690
|
+
onToggleStyle: function onToggleStyle(key) {
|
|
691
|
+
return onUpdate({
|
|
692
|
+
[key]: !element[key]
|
|
693
|
+
});
|
|
694
|
+
},
|
|
695
|
+
onAlign: function onAlign(align) {
|
|
696
|
+
return onUpdate({
|
|
697
|
+
align
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
}), /*#__PURE__*/_react.default.createElement(ToolbarActions, {
|
|
701
|
+
locked: locked,
|
|
702
|
+
onToggleLock: onToggleLock,
|
|
703
|
+
onDelete: onDelete
|
|
704
|
+
}));
|
|
705
|
+
};
|
|
706
|
+
/* PostitFormattingToolbar — flat layout: note (fill) colour → the shared text
|
|
707
|
+
controls (font-size, B/I/U/S, alignment menu) → Lock / Delete. The note's
|
|
708
|
+
colour is its whole point, so its fill swatch does NOT offer Transparent.
|
|
709
|
+
Mirrors the app's PostitFormattingToolbar. */
|
|
710
|
+
var PostitFormattingToolbar = exports.PostitFormattingToolbar = function PostitFormattingToolbar(_ref9) {
|
|
711
|
+
var value = _ref9.value,
|
|
712
|
+
_onChange = _ref9.onChange,
|
|
713
|
+
onDelete = _ref9.onDelete,
|
|
714
|
+
locked = _ref9.locked,
|
|
715
|
+
onToggleLock = _ref9.onToggleLock;
|
|
716
|
+
return /*#__PURE__*/_react.default.createElement(StyledFormattingToolbar, {
|
|
717
|
+
onClick: stopClick,
|
|
718
|
+
onMouseDown: stopClick
|
|
719
|
+
}, /*#__PURE__*/_react.default.createElement(ToolbarColorSwatch, {
|
|
720
|
+
value: value.color,
|
|
721
|
+
label: "Note color",
|
|
722
|
+
onChange: function onChange(color) {
|
|
723
|
+
return _onChange(_objectSpread(_objectSpread({}, value), {}, {
|
|
724
|
+
color
|
|
725
|
+
}));
|
|
726
|
+
}
|
|
727
|
+
}), /*#__PURE__*/_react.default.createElement(ToolbarTextControls, {
|
|
728
|
+
fontSize: value.fontSize,
|
|
729
|
+
styleFlags: value,
|
|
730
|
+
align: value.align,
|
|
731
|
+
onFontSize: function onFontSize(fontSize) {
|
|
732
|
+
return _onChange(_objectSpread(_objectSpread({}, value), {}, {
|
|
733
|
+
fontSize
|
|
734
|
+
}));
|
|
735
|
+
},
|
|
736
|
+
onToggleStyle: function onToggleStyle(key) {
|
|
737
|
+
return _onChange(_objectSpread(_objectSpread({}, value), {}, {
|
|
738
|
+
[key]: !value[key]
|
|
739
|
+
}));
|
|
740
|
+
},
|
|
741
|
+
onAlign: function onAlign(align) {
|
|
742
|
+
return _onChange(_objectSpread(_objectSpread({}, value), {}, {
|
|
743
|
+
align
|
|
744
|
+
}));
|
|
745
|
+
}
|
|
746
|
+
}), /*#__PURE__*/_react.default.createElement(ToolbarActions, {
|
|
747
|
+
locked: locked,
|
|
748
|
+
onToggleLock: onToggleLock,
|
|
749
|
+
onDelete: onDelete
|
|
750
|
+
}));
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
/* shape body per current (editable) type */
|
|
754
|
+
var renderShapeBody = exports.renderShapeBody = function renderShapeBody(def, state) {
|
|
755
|
+
var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : def.width;
|
|
756
|
+
var height = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : def.height;
|
|
757
|
+
return state.type === "triangle" ?
|
|
758
|
+
/*#__PURE__*/
|
|
759
|
+
/* TriangleElement: SVG polygon, apex top-center */
|
|
760
|
+
_react.default.createElement("svg", {
|
|
761
|
+
width: "100%",
|
|
762
|
+
height: "100%",
|
|
763
|
+
style: {
|
|
764
|
+
display: "block",
|
|
765
|
+
overflow: "visible"
|
|
766
|
+
}
|
|
767
|
+
}, /*#__PURE__*/_react.default.createElement("polygon", {
|
|
768
|
+
points: "".concat(width / 2, ",0 ").concat(width, ",").concat(height, " 0,").concat(height),
|
|
769
|
+
fill: withOpacity(state.fill, state.fillOpacity),
|
|
770
|
+
stroke: withOpacity(state.stroke, state.strokeOpacity),
|
|
771
|
+
strokeWidth: state.strokeWidth,
|
|
772
|
+
strokeDasharray: state.strokeDash
|
|
773
|
+
})) : /*#__PURE__*/_react.default.createElement("div", {
|
|
774
|
+
className: "shape-fill",
|
|
775
|
+
style: {
|
|
776
|
+
backgroundColor: withOpacity(state.fill, state.fillOpacity),
|
|
777
|
+
border: shapeBorder(state),
|
|
778
|
+
borderRadius: state.type === "circle" ? "50%" : state.borderRadius
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
};
|
|
782
|
+
var ALIGN_OPTIONS = exports.ALIGN_OPTIONS = [{
|
|
783
|
+
value: "left",
|
|
784
|
+
label: "Align Left",
|
|
785
|
+
icon: /*#__PURE__*/_react.default.createElement(_Icons.TextAlignLeftIcon, null)
|
|
786
|
+
}, {
|
|
787
|
+
value: "center",
|
|
788
|
+
label: "Align Center",
|
|
789
|
+
icon: /*#__PURE__*/_react.default.createElement(_Icons.TextAlignCenterIcon, null)
|
|
790
|
+
}, {
|
|
791
|
+
value: "right",
|
|
792
|
+
label: "Align Right",
|
|
793
|
+
icon: /*#__PURE__*/_react.default.createElement(_Icons.TextAlignRightIcon, null)
|
|
794
|
+
}, {
|
|
795
|
+
value: "justify",
|
|
796
|
+
label: "Justify",
|
|
797
|
+
icon: /*#__PURE__*/_react.default.createElement(_Icons.TextAlignJustifyIcon, null)
|
|
798
|
+
}];
|
|
799
|
+
var STYLE_OPTIONS = exports.STYLE_OPTIONS = [{
|
|
800
|
+
key: "bold",
|
|
801
|
+
label: "Bold",
|
|
802
|
+
icon: /*#__PURE__*/_react.default.createElement(_Icons.TextStyleBoldIcon, null)
|
|
803
|
+
}, {
|
|
804
|
+
key: "italic",
|
|
805
|
+
label: "Italic",
|
|
806
|
+
icon: /*#__PURE__*/_react.default.createElement(_Icons.TextStyleItalicIcon, null)
|
|
807
|
+
}, {
|
|
808
|
+
key: "underline",
|
|
809
|
+
label: "Underline",
|
|
810
|
+
icon: /*#__PURE__*/_react.default.createElement(_Icons.TextStyleUnderlineIcon, null)
|
|
811
|
+
}, {
|
|
812
|
+
key: "strikethrough",
|
|
813
|
+
label: "Strikethrough",
|
|
814
|
+
icon: /*#__PURE__*/_react.default.createElement(_Icons.TextStyleStrikeIcon, null)
|
|
815
|
+
}];
|
|
816
|
+
//# sourceMappingURL=elements.js.map
|