@sheetxl/studio-mui 0.8.0-beta.10 → 0.8.0-beta.12

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.
Files changed (150) hide show
  1. package/browser/esm/{ByeL_BZuJ2kl8gtf.mjs → 0IBZhOJaVmzJxuTv.mjs} +1 -1
  2. package/browser/esm/2nRxqrNYbmEn8fS8.mjs +386 -0
  3. package/browser/esm/{fb126BNj3F8URR19.mjs → 7fVZXXuonYb6Z7FU.mjs} +3 -3
  4. package/browser/esm/BAzhmMX4Fk_qnUTp.mjs +414 -0
  5. package/browser/esm/BGL3x0W74D7qZXlf.mjs +318 -0
  6. package/browser/esm/BHGr2gsFofTdAFxq.mjs +515 -0
  7. package/browser/esm/{DU3J8Gcf-WpBxNYg.mjs → BKhcJI-G15D3kGap.mjs} +4 -4
  8. package/browser/esm/BNbub9weuqm3mcoF.mjs +335 -0
  9. package/browser/esm/BSv9MVJaz1DVEffm.mjs +975 -0
  10. package/browser/esm/BWfLpYmd3cSgJ0C6.mjs +141 -0
  11. package/browser/esm/BZqwbIE8qzjSOYcJ.mjs +582 -0
  12. package/browser/esm/BZy9xUrYpAtnKeji.mjs +1288 -0
  13. package/browser/esm/{CIu1bjPJe_x31Oww.mjs → BnkwC5rsg9LZyhoP.mjs} +3 -3
  14. package/browser/esm/BpJsBv413cNQpyg0.mjs +319 -0
  15. package/browser/esm/BpVrgbVISiTDyFR3.mjs +197 -0
  16. package/browser/esm/BsngRDhvVYGVBJeK.mjs +1546 -0
  17. package/browser/esm/{C1Rp2hZrApo5MUc8.mjs → C29TKq47CbXs652l.mjs} +2 -2
  18. package/browser/esm/{CEvZe2cZK-voZTif.mjs → C8p2iMad_NNCwGI_.mjs} +5 -5
  19. package/browser/esm/CBzXksWnb-1gGEWZ.mjs +212 -0
  20. package/browser/esm/{IQLeaAbtGTipUsOD.mjs → CFIAWgpU3UyepLBn.mjs} +25 -24
  21. package/browser/esm/CJD4jF4m9cBGHzr_.mjs +31 -0
  22. package/browser/esm/{CjznclrKqJRi7u9O.mjs → CMc7G7cevxzPGxr9.mjs} +2 -2
  23. package/browser/esm/{B1Yp_uy1vFHcJB3U.mjs → CYtULLhY9M2m3DeH.mjs} +1 -1
  24. package/browser/esm/CeF35ZeFP28Do5Zx.mjs +1379 -0
  25. package/browser/esm/{xKiLJKiLxto8SayF.mjs → CjYKDxU4EP2Kf_vo.mjs} +2 -2
  26. package/browser/esm/{D8al_cJ4U-NgzwoK.mjs → Cq82lvdjyBvlJ8xJ.mjs} +19 -17
  27. package/browser/esm/{X1Db3b_7b_7OuCk6.mjs → CuRxFAO42JkQvMEx.mjs} +1 -1
  28. package/browser/esm/Cvk2yY90hpgXWMAt.mjs +103 -0
  29. package/browser/esm/D0slJycx3nq53qmf.mjs +14 -0
  30. package/browser/esm/{9eKCkvqpMQwqcXiw.mjs → D2jzliMwAo2ENpfi.mjs} +1 -1
  31. package/browser/esm/D5Fn0Hqllwv5HY6i.mjs +7581 -0
  32. package/browser/esm/D5N4nGaZsXtrHAOh.mjs +831 -0
  33. package/browser/esm/D7AqPfyhMiuda5l5.mjs +412 -0
  34. package/browser/esm/DHZA48ZMCETvHmeP.mjs +161 -0
  35. package/browser/esm/DX2_vf7WX6uRLaOZ.mjs +94 -0
  36. package/browser/esm/DaxpbAF1ShkT7hNU.mjs +490 -0
  37. package/browser/esm/{D6S8kVTzOjCn0-SK.mjs → Db3oHfXiRtcH015t.mjs} +162 -156
  38. package/browser/esm/Dt47Huh1l3C4_5_w.mjs +87 -0
  39. package/browser/esm/{DmCQbW4zwkT_Rq88.mjs → DtPt0phL7m56YfHZ.mjs} +1 -1
  40. package/browser/esm/{CoSiOS-og0zFw4Ws.mjs → DtTDaXmnWUoG4VBO.mjs} +2 -2
  41. package/browser/esm/{DHY19rkSiiRZxShC.mjs → DuuyN4-7K6_io2Py.mjs} +3 -3
  42. package/browser/esm/{yZxC4qUENOlMhVUH.mjs → NeGeLF3gbGMZyV6E.mjs} +1 -1
  43. package/browser/esm/PY3Br5Bo_TxcCnCU.mjs +252 -0
  44. package/browser/esm/WIhvQtBkGiw-oFUs.mjs +2566 -0
  45. package/browser/esm/WgIvwAENeO8LANax.mjs +437 -0
  46. package/browser/esm/{DBtc4lku0uHVcqWn.mjs → Yjq3p_7eVGFw2Jod.mjs} +3 -3
  47. package/browser/esm/index.mjs +1053 -192
  48. package/browser/esm/jFRFCWlkD7Dsrhkh.mjs +236 -0
  49. package/browser/esm/lKXEDVt2ow1NlWJj.mjs +392 -0
  50. package/browser/esm/{Blaj2R5hYxtLAW__.mjs → oC0OwOddhOD0OoCJ.mjs} +6 -6
  51. package/browser/esm/{sFOAxZpxXo-qvDSp.mjs → tIKqpsA0vNXH9EgU.mjs} +1 -1
  52. package/browser/esm/{5cbK03T_Oh3tNdR7.mjs → u84rSnESjxqB6gay.mjs} +1 -1
  53. package/licenses/dependencies.txt +94 -94
  54. package/node/esm/{BcwMb6CyVfvEwbHn.mjs → B8Ls4Eh1k8-Yiry_.mjs} +1 -1
  55. package/node/esm/{CKu1AtRgyltyEdEN.mjs → B9X3n8MglL4OitAV.mjs} +1 -1
  56. package/node/esm/{ETK6T6G0SIcFXDe5.mjs → BBGoyqs2L_ccSH1e.mjs} +40 -40
  57. package/node/esm/BLv99aovW4R3C5PE.mjs +515 -0
  58. package/node/esm/BUGU_5lUtnCRlp3n.mjs +519 -0
  59. package/node/esm/BalROFG_oa9PFs9Q.mjs +141 -0
  60. package/node/esm/{ah3CUg4-VmNstGk_.mjs → BqVxnA1mo52ubjdf.mjs} +2 -2
  61. package/node/esm/C3FCh9xju2SccUIE.mjs +1283 -0
  62. package/node/esm/{Bb1sLMqXWKjdve23.mjs → C4F6WY8M4nkLyxdb.mjs} +2 -2
  63. package/node/esm/CKWeipCqqpLnLE5e.mjs +391 -0
  64. package/node/esm/CTnVNfz4eqFnM92M.mjs +212 -0
  65. package/node/esm/Cfi_ly8fBDZZdiZT.mjs +72 -0
  66. package/node/esm/CgKa6JuyJ1tTodev.mjs +1703 -0
  67. package/node/esm/{cqzp431iNSLWictb.mjs → Cq53M7bAUSXMNq1f.mjs} +22 -22
  68. package/node/esm/{BYsG3KYVmxSe_CIQ.mjs → Cr8AYWUoU-XVt0hu.mjs} +1 -1
  69. package/node/esm/CyuOE595I2e-U4cG.mjs +236 -0
  70. package/node/esm/D72CupF9mfy2D1Xa.mjs +94 -0
  71. package/node/esm/{DNSjK5DAH3M14Qbc.mjs → DGDHFK8okuVbRCe5.mjs} +1 -1
  72. package/node/esm/{B8SQfjKjzYHLxzZR.mjs → DJFkALt4XrwkMbnU.mjs} +163 -157
  73. package/node/esm/DJpwI8PlKBI2rk0r.mjs +319 -0
  74. package/node/esm/{DZzvTQxIKr9LbEsA.mjs → DQaGPUYbgL4Y5YZW.mjs} +32 -30
  75. package/node/esm/{D9rzScOA9pEYFrtz.mjs → DsNYnq4NtYBxPmeA.mjs} +20 -20
  76. package/node/esm/DygDgOpa9sJ6YFVS.mjs +385 -0
  77. package/node/esm/Dz0Hg87UcJ-awwiI.mjs +489 -0
  78. package/node/esm/M7YxvRPGCuxuk9aK.mjs +142 -0
  79. package/node/esm/QNjtpX8rIpqGGLEJ.mjs +1379 -0
  80. package/node/esm/{B_jRGdwGFkudwmL-.mjs → ZzvsynJTCSuChYS-.mjs} +1 -1
  81. package/node/esm/{ci8d-mF1H9wnYzix.mjs → di_8-pXh90j4BO4j.mjs} +1 -1
  82. package/node/esm/dm8dmEaTIqfmgyeL.mjs +412 -0
  83. package/node/esm/{D6oQL8knsPpgdXuk.mjs → fmya3XQnTGyQisvT.mjs} +2 -2
  84. package/node/esm/gPYAb_A0T5ZwcQ1E.mjs +318 -0
  85. package/node/esm/index.mjs +8915 -13417
  86. package/node/esm/wB8xMpyJ_NvE16yG.mjs +975 -0
  87. package/node/esm/zGAcd4Jr7wkvXDBS.mjs +197 -0
  88. package/package.json +9 -9
  89. package/resources/locales/de/groups.cmd.json +4 -0
  90. package/resources/locales/de/ui.msg.json +100 -1
  91. package/resources/locales/en/groups.cmd.json +4 -0
  92. package/resources/locales/en/ui.msg.json +100 -1
  93. package/types/src/anchorItems/AnchorItemsDescriptor.d.ts +4 -4
  94. package/types/src/anomalies/AnomaliesPlugin.d.ts +5 -0
  95. package/types/src/anomalies/AnomaliesTaskPane.d.ts +17 -0
  96. package/types/src/anomalies/index.d.ts +3 -0
  97. package/types/src/border/BorderPopupButton.d.ts +1 -1
  98. package/types/src/border/BorderTemplateIcon.d.ts +6 -1
  99. package/types/src/chart/ChartFormatPanel.d.ts +20 -0
  100. package/types/src/chart/ChartPlugin.d.ts +6 -0
  101. package/types/src/chart/index.d.ts +3 -0
  102. package/types/src/color/ColorPopupButton.d.ts +1 -1
  103. package/types/src/command/AccountingStyleCommandButton.d.ts +1 -1
  104. package/types/src/command/DocThemeCommandButton.d.ts +1 -1
  105. package/types/src/command/FontFamilyCommandButton.d.ts +1 -1
  106. package/types/src/command/FontSizeCommandButton.d.ts +1 -1
  107. package/types/src/command/InsertCellControlCommandButton.d.ts +17 -0
  108. package/types/src/command/LanguageCommandButton.d.ts +1 -1
  109. package/types/src/command/LocaleCommandButton.d.ts +1 -1
  110. package/types/src/command/index.d.ts +1 -0
  111. package/types/src/comments/CommentCard.d.ts +2 -2
  112. package/types/src/conditionalFormat/IconPickerPopupButton.d.ts +1 -1
  113. package/types/src/conditions/ConditionEditor.d.ts +1 -1
  114. package/types/src/conditions/OperatorAndParamEditor.d.ts +1 -1
  115. package/types/src/conditions/OperatorSelectPopupButton.d.ts +1 -1
  116. package/types/src/conditions/useFormulaOption.d.ts +2 -2
  117. package/types/src/dialog/WorkbookStatisticsDialog.d.ts +1 -1
  118. package/types/src/fill/PatternPopupButton.d.ts +1 -1
  119. package/types/src/format/BorderPreview.d.ts +11 -4
  120. package/types/src/format/useFormatSelection.d.ts +4 -4
  121. package/types/src/formulaBar/IFormulaBar.d.ts +4 -2
  122. package/types/src/formulaBar/MobileFormulaBar.d.ts +18 -6
  123. package/types/src/formulaBar/MobileInputToolbar.d.ts +9 -3
  124. package/types/src/formulaBar/useFormulaBarSession.d.ts +6 -3
  125. package/types/src/index.d.ts +15 -6
  126. package/types/src/itemsPanel/ItemsPanel.d.ts +5 -0
  127. package/types/src/named/NamedDetailsPanel.d.ts +2 -2
  128. package/types/src/protection/ProtectedCellsPanel.d.ts +2 -2
  129. package/types/src/protection/{SheetProtectionPanel.d.ts → WorksheetProtectionPanel.d.ts} +6 -6
  130. package/types/src/protection/index.d.ts +1 -1
  131. package/types/src/slicer/PresetSlicerStylesCommandButton.d.ts +2 -2
  132. package/types/src/statusBar/PendingStatus.d.ts +19 -0
  133. package/types/src/statusBar/index.d.ts +1 -0
  134. package/types/src/studio/StudioProps.d.ts +10 -10
  135. package/types/src/template/TemplatePanel.d.ts +5 -1
  136. package/types/src/theme/ThemeSelectPopupButton.d.ts +1 -1
  137. package/types/src/toolbar/WorkbookToolbars.d.ts +1 -1
  138. package/types/src/workbook/DefaultRenderers.d.ts +31 -19
  139. package/types/src/workbook/WorkbookContextMenu.d.ts +4 -0
  140. package/types/src/workbook/WorkbookElement.d.ts +5 -4
  141. package/types/src/workbook/WorkbookStrip.d.ts +8 -7
  142. package/types/src/workbook/index.d.ts +1 -1
  143. package/browser/esm/Biy7bhzzzPb5sfRN.mjs +0 -152
  144. package/browser/esm/COv-m-c2byCgvU3M.mjs +0 -14861
  145. package/browser/esm/CtEFHbzYNvYjDYvi.mjs +0 -236
  146. package/browser/esm/Die9NXVFveHvcCT-.mjs +0 -4205
  147. package/browser/esm/sam1KGQZ59B_fADz.mjs +0 -1941
  148. package/node/esm/BYVLi0md4AYuDsB_.mjs +0 -236
  149. package/node/esm/BYwXhrEwkRAt9nJS.mjs +0 -71
  150. package/node/esm/Cmt8Wv806N7NmE4Y.mjs +0 -3344
@@ -1,1941 +0,0 @@
1
- /**
2
- * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.10
3
- *
4
- * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */
7
- import { t as e } from "./DmCQbW4zwkT_Rq88.mjs";
8
- import { t } from "./5cbK03T_Oh3tNdR7.mjs";
9
- import { t as n } from "./Biy7bhzzzPb5sfRN.mjs";
10
- import { Color as r, IBorders as i, IColor as a, IFill as o, ITheme as s } from "@sheetxl/sdk";
11
- import { StyledStrokePath as c } from "@sheetxl/react";
12
- import { DynamicIcon as l, KeyCodes as u, ReactUtils as d, lazyComponent as f, useCallbackRef as p, useCommands as m, useFloatStack as h, useTranslator as g } from "@sheetxl/utils-react";
13
- import { Suspense as _, forwardRef as v, memo as y, useCallback as b, useEffect as x, useLayoutEffect as S, useMemo as C, useRef as w, useState as T } from "react";
14
- import { AnimatedLoadingPanel as E, ExhibitIconButton as D, ExhibitMenuItem as O, ExhibitPopupIconButton as k, ExhibitPopupMenuItem as A, ExhibitTooltip as ee, LazyLoadErrorPanel as j, PopupButtonType as M, SimpleTooltip as N, createStrokeShadowFilter as P } from "@sheetxl/utils-mui";
15
- import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
16
- import { Box as R, Button as te, Divider as z, FormControl as B, IconButton as V, InputAdornment as H, InputLabel as U, ListItemButton as W, MenuItem as G, Select as ne, SvgIcon as K, TextField as re, Typography as ie, useTheme as ae } from "@mui/material";
17
- import { TimerUtils as oe, defineLazyModule as se, messageKey as q } from "@sheetxl/utils";
18
- var ce = {
19
- Preset: "preset",
20
- Custom: "custom"
21
- }, J = {
22
- Start: "start",
23
- End: "end"
24
- }, le = y((t) => {
25
- let { selectedColor: n, onSelectColor: r, onPreviewColor: i, onClick: a, onKeyDown: o, onMouseOver: s, onMouseLeave: c, onFocus: l, style: f = d.EmptyCssProperties, children: p, alphaWhite: m, alphaGrey: h, darkMode: g, alphaCheckSize: _ = 7, ...v } = t;
26
- if (!n) throw Error("a selectedColor is required");
27
- let y = b((e) => {
28
- a?.(e), e.isDefaultPrevented() || (e.ctrlKey ? i?.(n.toRGBA()) : r?.(n.toRGBA()));
29
- }, [
30
- r,
31
- i,
32
- a,
33
- n
34
- ]), x = b((e) => {
35
- s?.(e), e.isDefaultPrevented() || i?.(n.toRGBA());
36
- }, [
37
- i,
38
- s,
39
- n
40
- ]), S = b((e) => {
41
- c?.(e), e.isDefaultPrevented();
42
- }, [i, c]), w = b((e) => {
43
- l?.(e), e.isDefaultPrevented() || i?.(n.toRGBA());
44
- }, [
45
- i,
46
- l,
47
- n
48
- ]), T = b((e) => {
49
- o?.(e), e.isDefaultPrevented() || e.keyCode === u.Enter && r?.(n.toRGBA());
50
- }, [
51
- r,
52
- o,
53
- n
54
- ]), E = C(() => n.toRGBA().alpha === 1 ? null : I(e, {
55
- size: _,
56
- white: m,
57
- grey: h,
58
- style: {
59
- position: "absolute",
60
- width: "calc(100% - 1.5px)",
61
- height: "calc(100% - 1.5px)",
62
- top: "0.75px",
63
- left: "0.75px"
64
- }
65
- }), [
66
- m,
67
- h,
68
- n
69
- ]);
70
- return L("div", {
71
- style: {
72
- position: "absolute",
73
- height: "100%",
74
- width: "100%",
75
- top: "0px",
76
- left: "0px",
77
- cursor: "pointer",
78
- outline: "none",
79
- ...f
80
- },
81
- tabIndex: 0,
82
- ...v,
83
- onClick: y,
84
- onKeyDown: T,
85
- onMouseOver: x,
86
- onMouseLeave: S,
87
- onFocus: w,
88
- children: [E, I("div", {
89
- style: {
90
- position: "absolute",
91
- top: "0px",
92
- left: "0px",
93
- height: "100%",
94
- width: "100%",
95
- background: n.toCSS(g)
96
- },
97
- children: p
98
- })]
99
- });
100
- }), ue = y((e) => {
101
- let { schemeColorLookup: t, selectedColor: n, previewColor: i, colorDef: o, onSelectColorDef: s, onPreviewColorDef: c, propsSwatch: l, defaultButtonSize: u = 24, isLarge: d = !1, compareRGB: f = !1, darkMode: p = !1, ...m } = e, h = new r({
102
- val: o.definition.val,
103
- adjs: o.definition.adjs
104
- }, (e) => t(e)), g = f ? h.toRGBA().toString() : h.toString(), _ = n && (f ? n.toRGBA().toString() : n.toString()) === g, v = i && (f ? i.toRGBA().toString() : i.toString()) === g, y = [];
105
- y.push({ [a.AdjustmentType.Inv]: !0 }), y.push({ [a.AdjustmentType.Alpha]: 100 });
106
- let x = h.toRGBA().alpha === 0 && l?.alphaGrey ? l.alphaGrey : h.adjust(y).toRGBA(p).toString(), S = b(() => {
107
- s?.(o);
108
- }, [s, o]), C = b((e) => {
109
- c?.(o);
110
- }, [c, o]);
111
- return I(N, {
112
- disableInteractive: !0,
113
- slotProps: { popper: {
114
- style: { pointerEvents: "none" },
115
- disablePortal: !0,
116
- popperOptions: {
117
- strategy: "fixed",
118
- modifiers: [{
119
- name: "preventOverflow",
120
- enabled: !0,
121
- options: { boundariesElement: "viewport" }
122
- }]
123
- }
124
- } },
125
- title: o.description,
126
- placement: "bottom-start",
127
- children: I("div", {
128
- style: {
129
- width: u * (d ? 1.2 : 1) + "px",
130
- height: u * (d ? 1.2 : 1) + "px",
131
- position: "relative",
132
- boxSizing: "border-box",
133
- cursor: "pointer",
134
- outline: "none"
135
- },
136
- ...m,
137
- children: L(le, {
138
- selectedColor: h,
139
- title: void 0,
140
- onSelectColor: S,
141
- onPreviewColor: C,
142
- alphaCheckSize: d ? 9 : void 0,
143
- darkMode: p,
144
- ...l,
145
- children: [I("div", { style: {
146
- position: "absolute",
147
- width: "100%",
148
- height: "100%",
149
- top: "0px",
150
- left: "0px",
151
- pointerEvents: "none",
152
- borderColor: x,
153
- borderWidth: "2px",
154
- borderStyle: "solid",
155
- boxSizing: "border-box",
156
- opacity: _ ? "1" : "0"
157
- } }), I("div", { style: {
158
- position: "absolute",
159
- width: .33 * u * (d ? 1.2 : 1) + "px",
160
- height: .33 * u * (d ? 1.2 : 1) + "px",
161
- left: "calc(50% - 0.5px)",
162
- top: "calc(50% - 0.5px)",
163
- transform: "translate(-50%,-50%)",
164
- pointerEvents: "none",
165
- background: x,
166
- borderRadius: "50%",
167
- opacity: v ? "1" : "0"
168
- } })]
169
- })
170
- })
171
- });
172
- }), de = y((e) => {
173
- let { title: t, schemeColorLookup: n, colorDefs: r, selectedColor: i, previewColor: a, onSelectColorDef: o, onPreviewColorDef: s, style: c = d.EmptyCssProperties, compareRGB: l = !1, darkMode: u, propsSwatch: f, ...p } = e, m;
174
- if (Array.isArray(r[0])) m = r;
175
- else {
176
- m = [];
177
- for (let e = 0; e < r.length; e++) m.push([r[e]]);
178
- }
179
- let h = b((e) => {
180
- o?.(e);
181
- }, [o]), g = b((e) => {
182
- s?.(e);
183
- }, [s]), _ = C(() => {
184
- let e = [];
185
- for (let t = 0; t < m.length; t++) {
186
- let r = [], o = m[t];
187
- for (let e = 0; e < o.length; e++) {
188
- let s = o[e];
189
- r.push(I(ue, {
190
- schemeColorLookup: n,
191
- colorDef: s,
192
- selectedColor: i,
193
- previewColor: a,
194
- onSelectColorDef: h,
195
- onPreviewColorDef: g,
196
- propsSwatch: f,
197
- compareRGB: l,
198
- darkMode: u
199
- }, t + " " + e));
200
- }
201
- let s = I(R, {
202
- className: "button-col",
203
- sx: {
204
- display: "flex",
205
- flexDirection: "column",
206
- justifyContent: "space-between",
207
- boxShadow: (e) => e.shadows[2],
208
- borderRadius: "2px",
209
- overflow: "hidden"
210
- },
211
- children: r
212
- }, "" + t);
213
- e.push(s);
214
- }
215
- return e;
216
- }, [
217
- m,
218
- i,
219
- a,
220
- h,
221
- g
222
- ]), v = C(() => t ? I(ie, {
223
- noWrap: !0,
224
- component: "div",
225
- sx: {
226
- display: "flex",
227
- flexShrink: "0",
228
- paddingLeft: "6px",
229
- paddingBottom: "4px",
230
- paddingTop: "0px",
231
- userSelect: "none",
232
- color: (e) => e.palette.text.secondary
233
- },
234
- children: t
235
- }) : null, [t]);
236
- return L(R, {
237
- style: { ...c },
238
- children: [v, I(R, {
239
- sx: {
240
- display: "flex",
241
- flexDirection: "row",
242
- gap: "6px",
243
- marginBottom: "14px",
244
- flexWrap: "wrap",
245
- justifyContent: "flex-start"
246
- },
247
- ...p,
248
- children: _
249
- })]
250
- });
251
- }), fe = (e, t) => ({
252
- description: e,
253
- definition: {
254
- val: t,
255
- adjs: []
256
- }
257
- }), Y = (e, t, n, i, a, o) => {
258
- let s = fe(e, t);
259
- i?.push(s);
260
- let c = new r({
261
- val: s.definition.val,
262
- adjs: s.definition.adjs
263
- }, n), l = c.toString();
264
- a?.set(l, c);
265
- let u = c.toRGBA().toString();
266
- o?.set(u, c);
267
- }, pe = f(se("studio:customColorPanel", () => import("./C1Rp2hZrApo5MUc8.mjs")).load, { renderError: (e) => I(j, { error: e }) }), me = y(v((e, t) => {
268
- let { selectedColor: n = null, previewColor: i = e.selectedColor ?? null, recentColors: a, schemeLookup: o, disableAlpha: c = !1, previewDebounceTime: u = 100, initialPanelType: d, defaultButtonSize: f = 24, width: m, onElementLoad: h, onDone: v, onEyeDropStart: y, onEyeDropStop: S, onPreviewColor: w, onPreviewColorImmediate: D, onSelectColor: O, autoColor: k, autoColorLabel: A, autoColorLabelKey: ee, autoColorPosition: j = J.Start, compareRGB: M = !1, darkMode: N = !1, style: P, ...B } = e, H = g(), U = A ?? H(ee ?? q("color.automatic")), G = i || n, ne = p(w ?? ((e) => {}), [w]), K = p(D ?? ((e) => {}), [D]), re = p(O ?? ((e, t) => {}), [O]), se = p(y ?? (() => {}), [y]), le = p(S ?? (() => {}), [S]), [fe, me] = T(!1), he = ae(), X = C(() => o || r.getDefaultSchemeLookup(), [o]), Z = C(() => {
269
- let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [];
270
- Y(H("color.scheme.bg1"), "bg1", X, n, e, t), Y(H("color.scheme.tx1"), "tx1", X, n, e, t), Y(H("color.scheme.bg2"), "bg2", X, n, e, t), Y(H("color.scheme.tx2"), "tx2", X, n, e, t), Y(H("color.scheme.accent", { n: 1 }), "accent1", X, n, e, t), Y(H("color.scheme.accent", { n: 2 }), "accent2", X, n, e, t), Y(H("color.scheme.accent", { n: 3 }), "accent3", X, n, e, t), Y(H("color.scheme.accent", { n: 4 }), "accent4", X, n, e, t), Y(H("color.scheme.accent", { n: 5 }), "accent5", X, n, e, t), Y(H("color.scheme.accent", { n: 6 }), "accent6", X, n, e, t);
271
- let r = s.buildPalette(n, X, e, t), i = [];
272
- if (Y(H("color.standard.darkRed"), "C00000", X, i, e, t), Y(H("color.standard.red"), "FF0000", X, i, e, t), Y(H("color.standard.orange"), "FFC000", X, i, e, t), Y(H("color.standard.yellow"), "FFFF00", X, i, e, t), Y(H("color.standard.lightGreen"), "92D050", X, i, e, t), Y(H("color.standard.green"), "00B050", X, i, e, t), Y(H("color.standard.lightBlue"), "00B0F0", X, i, e, t), Y(H("color.standard.blue"), "0070C0", X, i, e, t), Y(H("color.standard.darkBlue"), "002060", X, i, e, t), c ? Y(H("color.standard.purpleFruit"), "7030A0", X, i, e, t) : Y(H("color.standard.transparent"), "00000000", X, i, e, t), k) {
273
- let t = k.toString();
274
- e.set(t, k);
275
- }
276
- let o = /* @__PURE__ */ new Map(), l = typeof a == "function" ? a() : a, u = [];
277
- for (let e = 0; l && e < l.length; e++) {
278
- let t = l[e].toString();
279
- o.set(t, l[e]), u.push({
280
- description: H("color.recent", { n: e + 1 }),
281
- definition: { val: l[e].toString() }
282
- });
283
- }
284
- return {
285
- primaryColors: n,
286
- modifiedPresets: r,
287
- standardColors: i,
288
- recentColorsLimited: u,
289
- mapAllPresets: e,
290
- mapAllPresetsRGB: t,
291
- mapRecent: o
292
- };
293
- }, [
294
- X,
295
- a,
296
- c,
297
- k
298
- ]);
299
- x(() => {
300
- h?.();
301
- }, []);
302
- let [Q, ge] = T(!1), _e = b(() => {
303
- ge((e) => !e);
304
- }, []);
305
- x(() => {
306
- if (d) ge(d === ce.Custom);
307
- else if (n) {
308
- let e = n.toString(), t = Z.mapAllPresets.get(e);
309
- t ||= (e = n.toRGBA().toString(), Z.mapAllPresetsRGB.get(e));
310
- let r = Z.mapRecent.get(e);
311
- ge(!t && !r);
312
- }
313
- }, [n, d]);
314
- let ve = b(oe.debounce((e) => {
315
- ne?.(e);
316
- }, u), [ne, u]), [ye, be] = T();
317
- x(() => {
318
- be(i || n);
319
- }, [i, n]);
320
- let xe = p((e) => {
321
- K && (K(e), ve(e));
322
- }, [K]), Se = p((e) => {
323
- xe(e ? new r({
324
- val: e.definition.val,
325
- adjs: e.definition.adjs
326
- }, X) : null);
327
- }, [X]), Ce = b((e) => {
328
- e.ctrlKey && ge(!0);
329
- }, []), we = p((e) => {
330
- let t = !1;
331
- if (e) {
332
- let n = e.toString();
333
- t = !Z.mapAllPresets.has(n);
334
- }
335
- re?.(e, t);
336
- }, [re, Z]), $ = p((e) => {
337
- let t = e ? new r({
338
- val: e.definition.val,
339
- adjs: e.definition.adjs
340
- }, X) : null;
341
- Promise.resolve(v?.()).then(() => {
342
- we(t);
343
- });
344
- }, [X, v]), Te = p((e) => {
345
- xe(e ? new r(e, X) : null);
346
- }, [X]), Ee = C(() => window.EyeDropper === void 0 ? I(F, {}) : I(V, {
347
- "aria-label": H("color.eyeDropper"),
348
- size: "small",
349
- sx: { color: (e) => e.palette.text.icon ?? e.palette.action.active },
350
- onClick: async () => {
351
- me(!0), se?.(), await new EyeDropper().open().then((e) => {
352
- me(!1), le?.();
353
- let t = new r(e.sRGBHex), n = t.toString(), i = Z.mapAllPresets.get(n);
354
- if (i ||= (n = t.toRGBA().toString(), Z.mapAllPresetsRGB.get(n)), !i) {
355
- let e = t.toRGBA();
356
- Z.mapAllPresetsRGB.forEach((t, n) => {
357
- let r = t.toRGBA(), a = Math.abs(r.red - e.red) + Math.abs(r.blue - e.blue) + Math.abs(r.green - e.green);
358
- a < 3 && a < 255 && (i = t);
359
- });
360
- }
361
- ge(!i), xe(i || t);
362
- }).catch((e) => {
363
- me(!1), e?.name !== "AbortError" && console.error(e);
364
- });
365
- },
366
- children: I(l, { iconKey: "Colorize" })
367
- }), [Z, N]), De = C(() => {
368
- if (!Q) return;
369
- let e = {
370
- opacity: Q ? 1 : "0",
371
- position: "absolute",
372
- top: "0px",
373
- left: "0px",
374
- width: "100%",
375
- height: "100%",
376
- boxSizing: "border-box"
377
- };
378
- return I(_, {
379
- fallback: I("div", {
380
- style: e,
381
- children: I(E, {})
382
- }),
383
- children: I(pe, {
384
- style: e,
385
- selectedColor: G ? G.toRGBA().toString() : "transparent",
386
- onColorChange: Te,
387
- disableAlpha: c
388
- })
389
- });
390
- }, [Q, G]), Oe = C(() => ({
391
- onClick: Ce,
392
- alphaGrey: he.palette.text.icon ?? he.palette.action.active
393
- }), [Ce, he]), ke = C(() => {
394
- if (!k) return null;
395
- let e = {
396
- description: U,
397
- definition: {
398
- val: k.getVal(),
399
- adjs: k.getAdjustments()
400
- }
401
- };
402
- return I(F, { children: L(W, {
403
- sx: {
404
- display: "flex",
405
- color: (e) => e.palette.text.secondary
406
- },
407
- onMouseOver: () => {
408
- Se(null);
409
- },
410
- onClick: () => {
411
- $(null);
412
- },
413
- children: [I(R, {
414
- sx: {
415
- flex: "none",
416
- boxShadow: (e) => e.shadows[2],
417
- borderRadius: (e) => e.spacing(.5),
418
- overflow: "hidden"
419
- },
420
- children: I(ue, {
421
- schemeColorLookup: X,
422
- colorDef: e,
423
- selectedColor: n === null ? k : n,
424
- previewColor: i === null ? k : i,
425
- defaultButtonSize: f,
426
- isLarge: !0,
427
- darkMode: N,
428
- compareRGB: M,
429
- propsSwatch: Oe
430
- })
431
- }), I(ie, {
432
- noWrap: !0,
433
- component: "div",
434
- style: {
435
- display: "flex",
436
- flex: "1 1 100%",
437
- marginLeft: "8px",
438
- userSelect: "none"
439
- },
440
- children: U
441
- })]
442
- }) });
443
- }, [
444
- k,
445
- U,
446
- X,
447
- n,
448
- i,
449
- N,
450
- M,
451
- f,
452
- Oe
453
- ]);
454
- return L(R, {
455
- ref: t,
456
- sx: {
457
- width: m,
458
- outline: "none",
459
- padding: "10px 10px",
460
- overflow: "hidden",
461
- boxSizing: "content-box"
462
- },
463
- style: P,
464
- ...B,
465
- children: [
466
- L("div", {
467
- style: {
468
- position: "relative",
469
- display: "flex"
470
- },
471
- children: [L("div", {
472
- style: { opacity: Q ? "0" : 1 },
473
- children: [
474
- ke && j === J.Start ? L(F, { children: [ke, I(z, { style: {
475
- marginTop: "2px",
476
- marginBottom: "10px"
477
- } })] }) : null,
478
- I(de, {
479
- title: H("color.themeColors"),
480
- schemeColorLookup: X,
481
- colorDefs: Z.primaryColors,
482
- selectedColor: n,
483
- previewColor: i === void 0 ? n : i,
484
- propsSwatch: Oe,
485
- onPreviewColorDef: Se,
486
- onSelectColorDef: $,
487
- compareRGB: M,
488
- darkMode: N
489
- }),
490
- I(de, {
491
- schemeColorLookup: X,
492
- colorDefs: Z.modifiedPresets,
493
- selectedColor: n,
494
- previewColor: i === void 0 ? n : i,
495
- propsSwatch: Oe,
496
- onPreviewColorDef: Se,
497
- onSelectColorDef: $,
498
- compareRGB: M,
499
- darkMode: N
500
- }),
501
- I(z, { style: { marginBottom: "10px" } }),
502
- I(de, {
503
- title: H("color.standardColors"),
504
- schemeColorLookup: X,
505
- colorDefs: Z.standardColors,
506
- selectedColor: n,
507
- previewColor: i === void 0 ? n : i,
508
- propsSwatch: Oe,
509
- onPreviewColorDef: Se,
510
- onSelectColorDef: $,
511
- compareRGB: M,
512
- darkMode: N
513
- }),
514
- L("div", {
515
- style: {
516
- opacity: Z.recentColorsLimited.length === 0 ? "0" : void 0,
517
- display: Z.recentColorsLimited.length === 0 ? "none" : void 0
518
- },
519
- children: [I(z, { style: { marginBottom: "10px" } }), I(de, {
520
- title: H("color.recentColors"),
521
- schemeColorLookup: X,
522
- colorDefs: Z.recentColorsLimited,
523
- selectedColor: n,
524
- previewColor: i === void 0 ? n : i,
525
- propsSwatch: Oe,
526
- onPreviewColorDef: Se,
527
- onSelectColorDef: $,
528
- compareRGB: M,
529
- darkMode: N
530
- })]
531
- }),
532
- ke && j === J.End ? L(F, { children: [
533
- I(z, { sx: {
534
- marginTop: "2px",
535
- marginBottom: "2px"
536
- } }),
537
- ke,
538
- I("div", { style: { marginBottom: "2px" } })
539
- ] }) : null
540
- ]
541
- }), De]
542
- }),
543
- I(z, { style: { marginBottom: "10px" } }),
544
- L("div", {
545
- style: {
546
- display: "flex",
547
- flexDirection: "row",
548
- alignItems: "center",
549
- gap: "8px",
550
- paddingLeft: "2px",
551
- paddingRight: "2px"
552
- },
553
- children: [
554
- Ee,
555
- I("div", { style: { flex: "1 1 0%" } }),
556
- L("div", {
557
- style: {
558
- flex: "0 0 auto",
559
- display: "flex",
560
- gap: "8px"
561
- },
562
- children: [I(te, {
563
- style: { minWidth: "75px" },
564
- value: "check",
565
- variant: "outlined",
566
- size: "small",
567
- onClick: () => {
568
- _e();
569
- },
570
- children: L("span", {
571
- style: {
572
- display: "grid",
573
- alignItems: "center"
574
- },
575
- children: [I("span", {
576
- style: {
577
- gridArea: "1 / 1",
578
- visibility: Q ? "hidden" : "visible"
579
- },
580
- children: H("color.custom")
581
- }), I("span", {
582
- style: {
583
- gridArea: "1 / 1",
584
- visibility: Q ? "visible" : "hidden"
585
- },
586
- children: H("color.preset")
587
- })]
588
- })
589
- }), I(te, {
590
- variant: "contained",
591
- size: "small",
592
- style: { minWidth: "75px" },
593
- onClick: () => {
594
- Promise.resolve(v?.()).then(() => {
595
- we(ye ?? null);
596
- });
597
- },
598
- children: H("color.done")
599
- })]
600
- })
601
- ]
602
- })
603
- ]
604
- });
605
- })), he = I(l, { iconKey: "circle.colored" }), X = y(v((e, t) => {
606
- let { selectedColor: n, quickColor: r, icon: i = he, tooltip: a, label: o, onPreviewColor: s, onPreviewColorImmediate: c, onSelectColor: d, variant: f = M.Toolbar, propsPanel: m, shouldCloseFloatAll: h = !0, compareRGB: g = !1, darkMode: _ = !1, ...v } = e, y = p(s ?? ((e) => {}), [s]), x = p(c ?? ((e) => {}), [c]), S = p(d ?? ((e, t) => {}), [d]), [E, D] = T(() => {}), [O, ee] = T(!1), j = r || (O ? E : void 0) || n || m?.autoColor, N = w(!1), P = b(() => {
607
- ee(!1);
608
- }, []), F = p(() => {
609
- D(n), ee(!0);
610
- }, [n]), L = p((e) => {
611
- N.current || (D(e), y?.(e));
612
- }, [y]), te = p((e) => {
613
- N.current || (D(e), x?.(e));
614
- }, [x]), z = p((e, t) => {
615
- N.current || (D(void 0), S?.(e, t));
616
- }, [S]), B = C(() => {
617
- let e = typeof i == "function" ? i() : i;
618
- typeof e == "string" && (e = I(l, { iconKey: e }));
619
- let t = (e) => e && e !== "none" ? e : void 0, n = t(j?.toCSS(_)) ?? t(m?.autoColor?.toCSS(_)) ?? "transparent";
620
- return I(R, {
621
- className: "color-wrapper",
622
- sx: {
623
- lineHeight: "0",
624
- color: "inherit",
625
- "& .activeColor": { fill: n },
626
- "& .style_grey": { fill: (e) => e.palette.text.icon ?? e.palette.action.active }
627
- },
628
- children: e
629
- });
630
- }, [
631
- j,
632
- m?.autoColor,
633
- i,
634
- _
635
- ]), V = p((e) => {
636
- S?.(r ?? null, !1);
637
- }, [S, r]), [H, U] = T(!1), W = b((e) => {
638
- let { closeFloat: t, closeFloatAll: r } = e;
639
- return I(me, {
640
- ...m,
641
- selectedColor: n,
642
- previewColor: E,
643
- onDone: h ? r : t,
644
- onKeyDown: (e) => {
645
- e.which === u.Enter && (h ? r?.() : t?.());
646
- },
647
- onPreviewColorImmediate: te,
648
- onPreviewColor: L,
649
- onSelectColor: z,
650
- onEyeDropStart: () => U(!0),
651
- onEyeDropStop: () => U(!1),
652
- compareRGB: g,
653
- darkMode: _
654
- });
655
- }, [
656
- n,
657
- E,
658
- h,
659
- j,
660
- m?.autoColor,
661
- _
662
- ]), G = {
663
- onQuickClick: r ? V : void 0,
664
- createPopupPanel: W,
665
- propsPopup: { propsPopper: { resizeOnOverflow: !1 } },
666
- onPopupOpen: F,
667
- onPopupClose: P,
668
- tooltip: a || o || "Color",
669
- label: o,
670
- icon: B,
671
- ...v
672
- };
673
- return f === M.Toolbar ? I(k, {
674
- ref: t,
675
- ...G
676
- }) : I(A, {
677
- ref: t,
678
- ...G
679
- });
680
- })), Z = 82;
681
- function Q(e, t) {
682
- if (!t) return "";
683
- switch (t.style) {
684
- case i.StrokeStyle.None: return e("border.style.none");
685
- case i.StrokeStyle.Hair: return e("border.style.hair");
686
- case i.StrokeStyle.Dotted: return e("border.style.dotted");
687
- case i.StrokeStyle.Dashed: return e("border.style.dashed");
688
- case i.StrokeStyle.DashDot: return e("border.style.dashDot");
689
- case i.StrokeStyle.DashDotDot: return e("border.style.dashDotDot");
690
- case i.StrokeStyle.Double: return e("border.style.double");
691
- case i.StrokeStyle.Thin: return e("border.style.thin");
692
- case i.StrokeStyle.Medium: return e("border.style.medium");
693
- case i.StrokeStyle.MediumDashed: return e("border.style.mediumDashed");
694
- case i.StrokeStyle.MediumDashDot: return e("border.style.mediumDashDot");
695
- case i.StrokeStyle.MediumDashDotDot: return e("border.style.mediumDashDotDot");
696
- case i.StrokeStyle.SlantDashDot: return e("border.style.slantDashDot");
697
- case i.StrokeStyle.Thick: return e("border.style.thick");
698
- default: return t.description;
699
- }
700
- }
701
- var ge = (e) => {
702
- let { styleColor: t, length: n = Z, width: r = 1, dashArray: i, sx: a, isDouble: o = !1, isAngled: s = !1, darkMode: l = !1, ...u } = e;
703
- return I(K, {
704
- sx: {
705
- width: `${n}px`,
706
- height: `${r}px`,
707
- color: "inherit",
708
- overflow: "visible",
709
- "& .activeColor": { stroke: (e) => `${t ? t.toRGBA(l).toString() : e.palette.text.icon ?? e.palette.action.active}` },
710
- "& .style_grey": { stroke: (e) => e.palette.text.icon ?? e.palette.action.active },
711
- ...a
712
- },
713
- height: r,
714
- width: n,
715
- viewBox: `0 0 ${n} ${r}`,
716
- ...u,
717
- children: I(c, {
718
- length: n,
719
- width: r,
720
- dashArray: i,
721
- isDouble: o,
722
- isAngled: s,
723
- className: "activeColor"
724
- })
725
- });
726
- }, _e = y(v((e, t) => {
727
- let { variant: n, showLabels: r = !1, disabled: a, createPopupPanel: o, styleColor: s, selectedStyle: c, onSelectStyle: l, showNone: d = !0, darkMode: f, sx: m, ...h } = e, _ = p(l ?? ((e) => {}), []), v = g(), y = b((e) => {
728
- let { popupContainer: t, closeFloat: n, ...o } = e, l = [], p = i.BuiltInDefinitionsArray;
729
- for (let e = 0; e < p.length; e++) {
730
- let t = p[e];
731
- if (t.description === "None" && !d) continue;
732
- let i = I(ge, {
733
- styleColor: s,
734
- length: Z,
735
- width: t.width,
736
- darkMode: f,
737
- dashArray: t.pattern,
738
- isDouble: t.description.toLowerCase().includes("double"),
739
- isAngled: t.description.toLowerCase().includes("slant")
740
- }), o = null;
741
- o = r ? L(F, { children: [I(R, {
742
- sx: { marginRight: "6px" },
743
- children: Q(v, t)
744
- }), L(R, {
745
- sx: {
746
- marginLeft: "6px",
747
- marginRight: "6px",
748
- display: "flex",
749
- alignItems: "center",
750
- flex: "1 1 100%"
751
- },
752
- children: [I("div", { style: { flex: "1 1 100%" } }), i]
753
- })] }) : t.description === "None" ? Q(v, t) : i, l.push(I(O, {
754
- className: "border-stroke",
755
- tabIndex: 0,
756
- sx: {
757
- height: "28px",
758
- "& svg path.activeColor": { filter: P(4) },
759
- paddingLeft: "16px"
760
- },
761
- propsTooltip: { description: r ? "" : Q(v, t) },
762
- icon: null,
763
- disabled: a,
764
- onMouseDown: (e) => e.preventDefault(),
765
- onMouseUp: () => {
766
- n?.(), _(t.style);
767
- },
768
- onKeyDown: (e) => {
769
- e.which === u.Enter && n?.();
770
- },
771
- selected: t.style === c,
772
- children: o
773
- }, e));
774
- }
775
- return I(R, {
776
- sx: {
777
- display: "flex",
778
- flexDirection: "column",
779
- paddingTop: "4px",
780
- paddingBottom: "4px"
781
- },
782
- children: l
783
- });
784
- }, [
785
- a,
786
- d,
787
- s,
788
- c,
789
- f,
790
- v
791
- ]), x = {
792
- disabled: a,
793
- icon: C(() => {
794
- let e = i.BuiltInDefinitions.get(c);
795
- if (!e) return null;
796
- let t;
797
- return t = e.description === "None" ? I(R, {
798
- sx: { minWidth: `${Z}px` },
799
- children: Q(v, e)
800
- }) : I(ge, {
801
- styleColor: s,
802
- length: Z,
803
- width: e.width,
804
- dashArray: e.pattern,
805
- darkMode: f,
806
- isDouble: e.description.toLowerCase().includes("double"),
807
- isAngled: e.description.toLowerCase().includes("slant")
808
- }), I(R, {
809
- className: "border-stroke",
810
- sx: {
811
- paddingLeft: "12px",
812
- marginLeft: "4px",
813
- marginRight: "4px",
814
- height: "24px",
815
- display: "flex",
816
- alignItems: "center",
817
- "& svg path.activeColor": { filter: P() }
818
- },
819
- children: t
820
- });
821
- }, [
822
- c,
823
- s,
824
- v
825
- ]),
826
- tooltip: v("border.styleTooltip", { style: Q(v, C(() => i.BuiltInDefinitions.get(c), [c])) }),
827
- sx: m,
828
- createPopupPanel: y,
829
- ...h
830
- };
831
- return n === M.Toolbar ? I(k, { ...x }) : I(A, { ...x });
832
- }));
833
- function ve(e, t, n) {
834
- return e === o.BuiltInSheetPattern.Solid ? {
835
- foreground: n,
836
- background: t
837
- } : {
838
- foreground: t,
839
- background: n
840
- };
841
- }
842
- var ye = y((e) => {
843
- let { patternType: n, foreground: r, background: i, createCell: a, darkMode: s = !1, className: c, style: l, ...u } = e, d = C(() => {
844
- let e = ve(n, r, i);
845
- return a({ style: { fill: {
846
- type: o.Type.Pattern,
847
- patternType: n,
848
- foreground: e.foreground ?? void 0,
849
- background: e.background ?? void 0
850
- } } })?.getStyle().getFill().toCSS(s) ?? {};
851
- }, [
852
- n,
853
- r,
854
- i,
855
- a,
856
- s
857
- ]);
858
- return I("div", {
859
- className: t("sxl-pattern-swatch", c),
860
- style: {
861
- width: "100%",
862
- height: "100%",
863
- ...d,
864
- ...l
865
- },
866
- ...u
867
- });
868
- });
869
- ye.displayName = "PatternSwatch";
870
- var be = Object.freeze([
871
- o.BuiltInSheetPattern.Solid,
872
- o.BuiltInSheetPattern.DarkGray,
873
- o.BuiltInSheetPattern.MediumGray,
874
- o.BuiltInSheetPattern.LightGray,
875
- o.BuiltInSheetPattern.Gray125,
876
- o.BuiltInSheetPattern.Gray0625,
877
- o.BuiltInSheetPattern.DarkHorizontal,
878
- o.BuiltInSheetPattern.DarkVertical,
879
- o.BuiltInSheetPattern.DarkDown,
880
- o.BuiltInSheetPattern.DarkUp,
881
- o.BuiltInSheetPattern.DarkGrid,
882
- o.BuiltInSheetPattern.DarkTrellis,
883
- o.BuiltInSheetPattern.LightHorizontal,
884
- o.BuiltInSheetPattern.LightVertical,
885
- o.BuiltInSheetPattern.LightDown,
886
- o.BuiltInSheetPattern.LightUp,
887
- o.BuiltInSheetPattern.LightGrid,
888
- o.BuiltInSheetPattern.LightTrellis
889
- ]);
890
- function xe(e, t) {
891
- switch (t) {
892
- case o.BuiltInSheetPattern.None: return e("fill.pattern.none");
893
- case o.BuiltInSheetPattern.Solid: return e("fill.pattern.solid");
894
- case o.BuiltInSheetPattern.Gray0625: return e("fill.pattern.gray0625");
895
- case o.BuiltInSheetPattern.Gray125: return e("fill.pattern.gray125");
896
- case o.BuiltInSheetPattern.LightGray: return e("fill.pattern.lightGray");
897
- case o.BuiltInSheetPattern.MediumGray: return e("fill.pattern.mediumGray");
898
- case o.BuiltInSheetPattern.DarkGray: return e("fill.pattern.darkGray");
899
- case o.BuiltInSheetPattern.LightHorizontal: return e("fill.pattern.lightHorizontal");
900
- case o.BuiltInSheetPattern.LightVertical: return e("fill.pattern.lightVertical");
901
- case o.BuiltInSheetPattern.LightDown: return e("fill.pattern.lightDown");
902
- case o.BuiltInSheetPattern.LightUp: return e("fill.pattern.lightUp");
903
- case o.BuiltInSheetPattern.LightGrid: return e("fill.pattern.lightGrid");
904
- case o.BuiltInSheetPattern.LightTrellis: return e("fill.pattern.lightTrellis");
905
- case o.BuiltInSheetPattern.DarkHorizontal: return e("fill.pattern.darkHorizontal");
906
- case o.BuiltInSheetPattern.DarkVertical: return e("fill.pattern.darkVertical");
907
- case o.BuiltInSheetPattern.DarkDown: return e("fill.pattern.darkDown");
908
- case o.BuiltInSheetPattern.DarkUp: return e("fill.pattern.darkUp");
909
- case o.BuiltInSheetPattern.DarkGrid: return e("fill.pattern.darkGrid");
910
- case o.BuiltInSheetPattern.DarkTrellis: return e("fill.pattern.darkTrellis");
911
- default: return t;
912
- }
913
- }
914
- var Se = y((e) => {
915
- let { selectedPattern: t, foreground: n, background: r, onSelectPattern: i, createCell: a, darkMode: o = !1, disabled: s, ...c } = e, l = g(), u = p(i ?? ((e) => {}), [i]), d = b((e) => {
916
- let { closeFloat: i } = e;
917
- return I(R, {
918
- sx: {
919
- display: "grid",
920
- gridTemplateColumns: "repeat(6, 34px)",
921
- gap: "4px",
922
- padding: "8px"
923
- },
924
- children: be.map((e) => I(ee, {
925
- label: xe(l, e),
926
- children: I(R, {
927
- role: "button",
928
- tabIndex: 0,
929
- "aria-label": xe(l, e),
930
- "aria-pressed": e === t,
931
- onMouseDown: (e) => e.preventDefault(),
932
- onMouseUp: () => {
933
- i?.(), u(e);
934
- },
935
- onKeyDown: (t) => {
936
- t.key !== "Enter" && t.key !== " " || (t.preventDefault(), i?.(), u(e));
937
- },
938
- sx: {
939
- width: "34px",
940
- height: "34px",
941
- cursor: "pointer",
942
- borderRadius: "2px",
943
- outline: (n) => e === t ? `2px solid ${n.palette.primary.main}` : `1px solid ${n.palette.divider}`,
944
- outlineOffset: "-1px",
945
- "&:hover": { outline: (e) => `2px solid ${e.palette.primary.light}` }
946
- },
947
- children: I(ye, {
948
- patternType: e,
949
- foreground: n,
950
- background: r,
951
- createCell: a,
952
- darkMode: o
953
- })
954
- })
955
- }, e))
956
- });
957
- }, [
958
- t,
959
- n,
960
- r,
961
- a,
962
- o,
963
- u,
964
- l
965
- ]);
966
- return I(k, {
967
- disabled: s,
968
- tooltip: l("fill.patternTooltip", { pattern: xe(l, t) }),
969
- createPopupPanel: d,
970
- icon: I(R, {
971
- sx: {
972
- width: "48px",
973
- height: "20px",
974
- borderRadius: "2px",
975
- outline: (e) => `1px solid ${e.palette.divider}`,
976
- outlineOffset: "-1px",
977
- overflow: "hidden"
978
- },
979
- children: I(ye, {
980
- patternType: t,
981
- foreground: n,
982
- background: r,
983
- createCell: a,
984
- darkMode: o
985
- })
986
- }),
987
- ...c
988
- });
989
- });
990
- Se.displayName = "PatternPopupButton";
991
- var Ce = {
992
- resizeOnOverflow: !1,
993
- placement: "bottom",
994
- offsets: [0, 2],
995
- shift: { padding: 8 }
996
- }, we = ((e) => {
997
- let t = [], n = e.length;
998
- for (let r = 0; r < n; r++) {
999
- let [i, a] = e[(r + n - 1) % n], [o, s, c] = e[r], [l, u] = e[(r + 1) % n], d = (e, t) => {
1000
- let n = Math.hypot(e - o, t - s) || 1, r = Math.min(c, n / 2);
1001
- return [o + (e - o) / n * r, s + (t - s) / n * r];
1002
- }, [f, p] = d(i, a), [m, h] = d(l, u);
1003
- t.push(`${r === 0 ? "M" : "L"}${f.toFixed(2)} ${p.toFixed(2)} Q${o} ${s} ${m.toFixed(2)} ${h.toFixed(2)}`);
1004
- }
1005
- return t.join(" ") + " Z";
1006
- })([
1007
- [
1008
- 7,
1009
- .5,
1010
- 1
1011
- ],
1012
- [
1013
- 13.5,
1014
- 6,
1015
- 1.5
1016
- ],
1017
- [
1018
- 13.5,
1019
- 16.5,
1020
- 2
1021
- ],
1022
- [
1023
- .5,
1024
- 16.5,
1025
- 2
1026
- ],
1027
- [
1028
- .5,
1029
- 6,
1030
- 1.5
1031
- ]
1032
- ]), $ = (e) => Math.max(0, Math.min(1, e)), Te = (e, t, n) => {
1033
- try {
1034
- return (e instanceof r ? e : new r(e, t)).toCSS(n);
1035
- } catch {
1036
- return "transparent";
1037
- }
1038
- }, Ee = (e, t, n) => {
1039
- try {
1040
- let i = new r(e, n).toRGBA(), a = new r(t, n).toRGBA(), o = (e, t) => Math.round((e + t) / 2).toString(16).padStart(2, "0");
1041
- return `${o(i.red, a.red)}${o(i.green, a.green)}${o(i.blue, a.blue)}`;
1042
- } catch {
1043
- return e;
1044
- }
1045
- }, De = (e, t) => e.offset === t.offset && String(e.color) === String(t.color), Oe = (e, t) => e.length === t.length && e.every((e, n) => De(e, t[n])), ke = y((e) => {
1046
- let { percent: t, disabled: n, inputRef: r, onChange: i } = e, a = g(), [o, s] = T(String(t)), [c, l] = T(!1);
1047
- return x(() => {
1048
- c || s(String(t));
1049
- }, [t, c]), I(re, {
1050
- type: "number",
1051
- size: "small",
1052
- disabled: n,
1053
- inputRef: r,
1054
- label: a("fill.gradientPosition"),
1055
- value: o,
1056
- onFocus: () => l(!0),
1057
- onBlur: () => {
1058
- l(!1), s(String(t));
1059
- },
1060
- onChange: (e) => {
1061
- if (s(e.target.value), e.target.value === "") return;
1062
- let t = Math.max(0, Math.min(100, parseInt(e.target.value, 10) || 0));
1063
- i(t);
1064
- },
1065
- slotProps: {
1066
- htmlInput: {
1067
- min: 0,
1068
- max: 100,
1069
- step: 5,
1070
- style: { textAlign: "right" }
1071
- },
1072
- inputLabel: { shrink: !0 },
1073
- input: { endAdornment: I(H, {
1074
- position: "end",
1075
- disableTypography: !0,
1076
- children: "%"
1077
- }) }
1078
- },
1079
- sx: { width: 120 }
1080
- });
1081
- });
1082
- ke.displayName = "StopPositionField";
1083
- var Ae = y((e) => {
1084
- let { index: n, stop: i, offset: a, schemeLookup: o, recentColors: s, darkMode: c, disabled: u, canRemove: d, rampRef: f, onDrag: m, onMove: _, onPreviewColor: v, onChangeColor: y, onRemove: x, onOpenChange: S } = e, E = g(), O = ae(), k = C(() => new r(i.color, o), [i.color, o]), [A, ee] = T(void 0), [j, M] = T(null), [P, te] = T(!1), [z, B] = T(!1), [V, H] = T(!1), [U, W] = T(!1), G = w(null), ne = w(!1), K = p((e) => {
1085
- ee(e), v(n, e ?? null);
1086
- }, [n, v]), re = p((e) => {
1087
- _(n, e / 100);
1088
- }, [n, _]), ie = Math.round(100 * a), oe = Te(A ?? k, o, c), se = b((e) => {
1089
- let { closeFloat: t } = e;
1090
- return L(R, {
1091
- className: "sxl-gradient-stop-popup",
1092
- sx: {
1093
- display: "flex",
1094
- flexDirection: "column"
1095
- },
1096
- children: [I(me, {
1097
- selectedColor: k,
1098
- previewColor: A,
1099
- disableAlpha: !0,
1100
- schemeLookup: o,
1101
- recentColors: s,
1102
- darkMode: c,
1103
- onDone: t,
1104
- onPreviewColor: K,
1105
- onPreviewColorImmediate: K,
1106
- onSelectColor: (e) => {
1107
- K(void 0), e && y(n, e);
1108
- }
1109
- }), I(R, {
1110
- sx: {
1111
- display: "flex",
1112
- alignItems: "center",
1113
- gap: 1,
1114
- paddingX: 1,
1115
- paddingBottom: 1
1116
- },
1117
- children: I(ke, {
1118
- percent: ie,
1119
- disabled: u,
1120
- inputRef: G,
1121
- onChange: re
1122
- })
1123
- })]
1124
- });
1125
- }, [
1126
- k,
1127
- A,
1128
- ie,
1129
- n,
1130
- o,
1131
- s,
1132
- c,
1133
- u,
1134
- K,
1135
- y,
1136
- re
1137
- ]), q = h({
1138
- anchor: j,
1139
- label: "gradient-stop",
1140
- createPopupPanel: se,
1141
- propsPopper: Ce,
1142
- onOpen: () => {
1143
- te(!0), S(n, !0), ne.current && (ne.current = !1, requestAnimationFrame(() => G.current?.focus()));
1144
- },
1145
- onClose: () => {
1146
- te(!1), S(n, !1), K(void 0);
1147
- }
1148
- }), ce = p((e) => {
1149
- ne.current = e, q.reference.open(0);
1150
- }, [q]), J = p(() => {
1151
- P ? q.reference.close(0) : ce(!1);
1152
- }, [
1153
- P,
1154
- q,
1155
- ce
1156
- ]), le = w(null), ue = p((e) => {
1157
- u || e.button !== 0 || (e.currentTarget.setPointerCapture(e.pointerId), le.current = {
1158
- pointerId: e.pointerId,
1159
- startX: e.clientX,
1160
- startOffset: a,
1161
- moved: !1,
1162
- offset: a
1163
- });
1164
- }, [u, a]), de = p((e) => {
1165
- let t = le.current;
1166
- if (!t || t.pointerId !== e.pointerId) return;
1167
- let r = e.clientX - t.startX;
1168
- if (!t.moved) {
1169
- if (Math.abs(r) < 3) return;
1170
- t.moved = !0, B(!0), W(!1), q.reference.close(0);
1171
- }
1172
- let i = f.current?.getBoundingClientRect().width ?? 0;
1173
- t.offset = i > 0 ? $(t.startOffset + r / i) : t.startOffset, m(n, t.offset, !1);
1174
- }, [
1175
- n,
1176
- f,
1177
- q,
1178
- m
1179
- ]), fe = p((e) => {
1180
- let t = le.current;
1181
- if (t && t.pointerId === e.pointerId) {
1182
- if (le.current = null, t.moved) return B(!1), m(n, t.offset, !0), void _(n, t.offset);
1183
- J();
1184
- }
1185
- }, [
1186
- n,
1187
- m,
1188
- _,
1189
- J
1190
- ]), Y = p((e) => {
1191
- let t = le.current;
1192
- t && t.pointerId === e.pointerId && (le.current = null, t.moved && (B(!1), m(n, t.startOffset, !0)));
1193
- }, [n, m]), pe = p((e) => {
1194
- if (u) return;
1195
- let t = e.shiftKey ? .1 : .01;
1196
- switch (e.key) {
1197
- case "ArrowLeft":
1198
- _(n, $(a - t));
1199
- break;
1200
- case "ArrowRight":
1201
- _(n, $(a + t));
1202
- break;
1203
- case "Home":
1204
- _(n, 0);
1205
- break;
1206
- case "End":
1207
- _(n, 1);
1208
- break;
1209
- case "Delete":
1210
- case "Backspace":
1211
- d && x(n);
1212
- break;
1213
- case "Enter":
1214
- case " ":
1215
- ce(!0);
1216
- break;
1217
- case "Escape":
1218
- if (!P) return;
1219
- q.reference.close(0);
1220
- break;
1221
- default: return;
1222
- }
1223
- e.preventDefault();
1224
- }, [
1225
- u,
1226
- n,
1227
- a,
1228
- d,
1229
- P,
1230
- q,
1231
- ce,
1232
- _,
1233
- x
1234
- ]), he = P || z || V, X = !u && !z && !P && U, Z = L(R, {
1235
- className: "sxl-gradient-stop-toolbar",
1236
- onPointerDown: (e) => {
1237
- e.stopPropagation();
1238
- },
1239
- sx: {
1240
- display: "flex",
1241
- alignItems: "center",
1242
- gap: .25
1243
- },
1244
- children: [I(D, {
1245
- tabIndex: -1,
1246
- propsTooltip: {
1247
- label: E("fill.gradientStopColor"),
1248
- simple: !0
1249
- },
1250
- icon: I(R, {
1251
- className: "color-wrapper",
1252
- sx: {
1253
- lineHeight: 0,
1254
- "& .activeColor": { fill: oe }
1255
- },
1256
- children: I(l, { iconKey: "circle.colored" })
1257
- }),
1258
- onClick: () => {
1259
- W(!1), J();
1260
- }
1261
- }), I(D, {
1262
- tabIndex: -1,
1263
- disabled: !d,
1264
- propsTooltip: {
1265
- label: E("fill.gradientRemoveStop"),
1266
- simple: !0
1267
- },
1268
- icon: I(l, { iconKey: "Close" }),
1269
- onClick: () => x(n)
1270
- })]
1271
- });
1272
- return L(F, { children: [I(N, {
1273
- title: Z,
1274
- open: X,
1275
- onOpen: () => W(!0),
1276
- onClose: () => W(!1),
1277
- enterDelay: 250,
1278
- enterNextDelay: 250,
1279
- leaveDelay: 400,
1280
- placement: "bottom",
1281
- disableFocusListener: !0,
1282
- disableTouchListener: !0,
1283
- slotProps: { tooltip: { sx: {
1284
- backgroundColor: (e) => e.palette.background.paper,
1285
- color: (e) => e.palette.text.primary,
1286
- border: (e) => `1px solid ${e.palette.divider}`,
1287
- boxShadow: (e) => e.shadows[3],
1288
- padding: "2px",
1289
- marginTop: "4px !important"
1290
- } } },
1291
- children: I(R, {
1292
- ref: M,
1293
- role: "button",
1294
- tabIndex: u ? -1 : 0,
1295
- "aria-label": E("fill.gradientStop", { position: ie }),
1296
- "aria-disabled": u || void 0,
1297
- className: t("sxl-gradient-stop", {
1298
- "sxl-gradient-stop-open": P,
1299
- "sxl-gradient-stop-dragging": z
1300
- }),
1301
- onPointerDown: ue,
1302
- onPointerMove: de,
1303
- onPointerUp: fe,
1304
- onPointerCancel: Y,
1305
- onFocus: () => H(!0),
1306
- onBlur: () => H(!1),
1307
- onKeyDown: pe,
1308
- sx: {
1309
- position: "absolute",
1310
- left: 100 * a + "%",
1311
- top: "calc(100% - 4px)",
1312
- width: 14,
1313
- height: 17,
1314
- transform: "translateX(-50%)",
1315
- transition: z ? "none" : "left 120ms ease-out",
1316
- lineHeight: 0,
1317
- cursor: u ? "default" : z ? "grabbing" : "grab",
1318
- touchAction: "none",
1319
- outline: "none",
1320
- zIndex: +!!z,
1321
- filter: he ? `drop-shadow(0 1px 2px ${O.palette.action.active})` : void 0
1322
- },
1323
- children: I("svg", {
1324
- width: 14,
1325
- height: 17,
1326
- viewBox: "0 0 14 17",
1327
- "aria-hidden": "true",
1328
- children: I("path", {
1329
- d: we,
1330
- fill: oe,
1331
- stroke: he ? O.palette.primary.main : O.palette.text.secondary,
1332
- strokeWidth: he ? 1.5 : 1,
1333
- strokeLinejoin: "round"
1334
- })
1335
- })
1336
- })
1337
- }), q.component] });
1338
- });
1339
- Ae.displayName = "StopHandle";
1340
- var je = y((e) => {
1341
- let { stops: n, onChange: r, minStops: i = 2, maxStops: a = 8, schemeLookup: o, recentColors: s, darkMode: c = !1, disabled: u = !1, className: d, ...f } = e, m = g(), h = w(null), _ = w({
1342
- known: [],
1343
- next: 1
1344
- }), v = C(() => {
1345
- let e = _.current, t = ((e, t, n) => {
1346
- for (let n of t) if (Oe(e, n.stops)) return n.keys;
1347
- let r = /* @__PURE__ */ new Set();
1348
- return e.map((e) => {
1349
- for (let n of t) {
1350
- let t = n.stops.findIndex((t, i) => !r.has(n.keys[i]) && De(t, e));
1351
- if (t >= 0) return r.add(n.keys[t]), n.keys[t];
1352
- }
1353
- return -1;
1354
- }).map((e) => e >= 0 ? e : n());
1355
- })(n, e.known, () => e.next++);
1356
- return e.known[0]?.keys !== t && (e.known = [{
1357
- stops: n,
1358
- keys: t
1359
- }, ...e.known].slice(0, 3)), t;
1360
- }, [n]), [y, b] = T(null), [x, E] = T(null), [O, k] = T(null);
1361
- S(() => {
1362
- b((e) => {
1363
- if (!e?.released) return e;
1364
- let t = v.indexOf(e.key);
1365
- return t >= 0 && n[t].offset === e.offset ? null : e;
1366
- });
1367
- }, [n, v]), S(() => {
1368
- if (!y?.released) return;
1369
- let e = window.setTimeout(() => b((e) => e?.released ? null : e), 1e3);
1370
- return () => window.clearTimeout(e);
1371
- }, [y]);
1372
- let A = !u && n.length < a, ee = !u && n.length > i, j = p((e) => {
1373
- let t = [...e].sort((e, t) => e.stop.offset - t.stop.offset), n = {
1374
- stops: t.map((e) => e.stop),
1375
- keys: t.map((e) => e.key)
1376
- }, i = _.current;
1377
- i.known = [n, ...i.known].slice(0, 3), r(n.stops.slice());
1378
- }, [r]), M = p(() => n.map((e, t) => ({
1379
- stop: e,
1380
- key: v[t]
1381
- })), [n, v]), N = p((e, t, n) => {
1382
- b({
1383
- key: v[e],
1384
- offset: t,
1385
- released: n
1386
- });
1387
- }, [v]), P = p((e, t) => {
1388
- j(M().map((n, r) => r === e ? {
1389
- ...n,
1390
- stop: {
1391
- ...n.stop,
1392
- offset: t
1393
- }
1394
- } : n));
1395
- }, [M, j]), F = p((e, t) => {
1396
- E(t ? {
1397
- key: v[e],
1398
- color: t
1399
- } : null);
1400
- }, [v]), te = p((e, t) => {
1401
- let n = v[e];
1402
- k((e) => t ? n : e === n ? null : e);
1403
- }, [v]), z = p((e, t) => {
1404
- j(M().map((n, r) => r === e ? {
1405
- ...n,
1406
- stop: {
1407
- ...n.stop,
1408
- color: t.toString()
1409
- }
1410
- } : n));
1411
- }, [M, j]), B = p((e) => {
1412
- n.length <= i || j(M().filter((t, n) => n !== e));
1413
- }, [
1414
- n,
1415
- i,
1416
- M,
1417
- j
1418
- ]), V = p((e) => {
1419
- if (n.length >= a) return;
1420
- let t = [...n].sort((e, t) => e.offset - t.offset), r = e;
1421
- if (r === void 0) {
1422
- let e = -1;
1423
- for (let n = 0; n + 1 < t.length; n++) {
1424
- let i = t[n + 1].offset - t[n].offset;
1425
- i > e && (e = i, r = (t[n].offset + t[n + 1].offset) / 2);
1426
- }
1427
- r === void 0 && (r = 1);
1428
- }
1429
- let i = [...t].reverse().find((e) => e.offset <= r) ?? t[0], s = t.find((e) => e.offset >= r) ?? t[t.length - 1];
1430
- j([...M(), {
1431
- stop: {
1432
- offset: r,
1433
- color: Ee(i.color, s.color, o)
1434
- },
1435
- key: _.current.next++
1436
- }]);
1437
- }, [
1438
- n,
1439
- a,
1440
- o,
1441
- M,
1442
- j
1443
- ]), H = p((e) => {
1444
- if (!A || e.button !== 0 || O !== null || e.target.closest(".sxl-gradient-stop")) return;
1445
- let t = e.currentTarget.getBoundingClientRect();
1446
- t.width <= 0 || V($((e.clientX - t.left) / t.width));
1447
- }, [
1448
- A,
1449
- O,
1450
- V
1451
- ]), U = C(() => {
1452
- let e = n.map((e, t) => ({
1453
- offset: y?.key === v[t] ? y.offset : e.offset,
1454
- css: Te(x?.key === v[t] ? x.color : e.color, o, c)
1455
- }));
1456
- return e.sort((e, t) => e.offset - t.offset), `linear-gradient(90deg, ${e.map((e) => `${e.css} ${(100 * e.offset).toFixed(2)}%`).join(", ")})`;
1457
- }, [
1458
- n,
1459
- v,
1460
- y,
1461
- x,
1462
- o,
1463
- c
1464
- ]);
1465
- return L(R, {
1466
- className: t("sxl-gradient-stops", d),
1467
- sx: {
1468
- display: "flex",
1469
- alignItems: "flex-start",
1470
- gap: .5,
1471
- minWidth: 0
1472
- },
1473
- ...f,
1474
- children: [I(R, {
1475
- sx: {
1476
- flex: 1,
1477
- minWidth: 0,
1478
- paddingX: "7px",
1479
- paddingBottom: "15px"
1480
- },
1481
- children: I(R, {
1482
- ref: h,
1483
- className: "sxl-gradient-stops-ramp",
1484
- onPointerDown: H,
1485
- sx: {
1486
- position: "relative",
1487
- height: 18,
1488
- borderRadius: 1,
1489
- border: (e) => `1px solid ${e.palette.divider}`,
1490
- backgroundImage: U,
1491
- backgroundRepeat: "no-repeat",
1492
- cursor: A ? "copy" : "default",
1493
- opacity: u ? .5 : 1
1494
- },
1495
- children: n.map((e, t) => I(Ae, {
1496
- index: t,
1497
- stop: e,
1498
- offset: y?.key === v[t] ? y.offset : e.offset,
1499
- schemeLookup: o,
1500
- recentColors: s,
1501
- darkMode: c,
1502
- disabled: u,
1503
- canRemove: ee,
1504
- rampRef: h,
1505
- onDrag: N,
1506
- onMove: P,
1507
- onPreviewColor: F,
1508
- onChangeColor: z,
1509
- onRemove: B,
1510
- onOpenChange: te
1511
- }, v[t]))
1512
- })
1513
- }), I(D, {
1514
- disabled: !A,
1515
- propsTooltip: {
1516
- label: m("fill.gradientAddStop"),
1517
- simple: !0
1518
- },
1519
- icon: I(l, { iconKey: "Add" }),
1520
- onClick: () => V(),
1521
- sx: { marginTop: "-3px" }
1522
- })]
1523
- });
1524
- });
1525
- je.displayName = "GradientStopsBar";
1526
- var Me = y((e) => {
1527
- let { value: n, onChange: r, minStops: i, maxStops: a, schemeLookup: s, recentColors: c, darkMode: l = !1, disabled: u = !1, className: d, ...f } = e, m = g(), h = p((e) => {
1528
- r({
1529
- ...n,
1530
- ...e
1531
- });
1532
- }, [n, r]), _ = n.gradientType === o.GradientType.Linear;
1533
- return L(R, {
1534
- className: t("sxl-gradient-editor", d),
1535
- sx: {
1536
- display: "flex",
1537
- flexDirection: "column",
1538
- gap: 1.25,
1539
- minWidth: 0
1540
- },
1541
- ...f,
1542
- children: [L(R, {
1543
- sx: {
1544
- display: "flex",
1545
- flexWrap: "wrap",
1546
- gap: 1,
1547
- alignItems: "center"
1548
- },
1549
- children: [L(B, {
1550
- size: "small",
1551
- sx: {
1552
- minWidth: 132,
1553
- flex: "1 1 132px"
1554
- },
1555
- children: [I(U, {
1556
- shrink: !0,
1557
- children: m("fill.gradientStyle")
1558
- }), L(ne, {
1559
- label: m("fill.gradientStyle"),
1560
- notched: !0,
1561
- disabled: u,
1562
- value: n.gradientType,
1563
- onChange: (e) => h({ gradientType: e.target.value }),
1564
- children: [I(G, {
1565
- value: o.GradientType.Linear,
1566
- children: m("fill.gradientLinear")
1567
- }), I(G, {
1568
- value: o.GradientType.Path,
1569
- children: m("fill.gradientRadial")
1570
- })]
1571
- })]
1572
- }), I(re, {
1573
- label: m("fill.gradientAngle"),
1574
- type: "number",
1575
- size: "small",
1576
- disabled: u || !_,
1577
- value: n.angle,
1578
- onChange: (e) => {
1579
- let t = parseInt(e.target.value, 10) || 0;
1580
- h({ angle: (t % 360 + 360) % 360 });
1581
- },
1582
- slotProps: {
1583
- htmlInput: {
1584
- min: 0,
1585
- max: 359,
1586
- step: 15
1587
- },
1588
- inputLabel: { shrink: !0 }
1589
- },
1590
- sx: { width: 104 }
1591
- })]
1592
- }), L(R, {
1593
- sx: {
1594
- display: "flex",
1595
- flexDirection: "column",
1596
- gap: .5,
1597
- minWidth: 0
1598
- },
1599
- children: [I(ie, {
1600
- variant: "caption",
1601
- component: "div",
1602
- sx: { color: "text.secondary" },
1603
- children: m("fill.gradientStops")
1604
- }), I(je, {
1605
- stops: n.stops,
1606
- onChange: (e) => h({ stops: e }),
1607
- minStops: i,
1608
- maxStops: a,
1609
- schemeLookup: s,
1610
- recentColors: c,
1611
- darkMode: l,
1612
- disabled: u
1613
- })]
1614
- })]
1615
- });
1616
- });
1617
- Me.displayName = "GradientEditor";
1618
- var Ne = (e) => {
1619
- let t = e.getStops();
1620
- return {
1621
- gradientType: e.getGradientType(),
1622
- angle: e.getAngle() ?? 0,
1623
- stops: t.length >= 2 ? t.map((e) => ({
1624
- offset: e.getOffset(),
1625
- color: e.getColor().toString()
1626
- })) : [...Pe.stops]
1627
- };
1628
- }, Pe = Object.freeze({
1629
- gradientType: o.GradientType.Linear,
1630
- angle: 90,
1631
- stops: [{
1632
- offset: 0,
1633
- color: "ffffff"
1634
- }, {
1635
- offset: 1,
1636
- color: "4472c4"
1637
- }]
1638
- }), Fe = (e, t, n) => () => {
1639
- t === e && n();
1640
- }, Ie = y((e) => {
1641
- let { label: t, value: r, min: i, max: a, step: o = 1, decimals: s = !1, width: c, disabled: l, onChange: u } = e, d = w(null), f = (e) => Math.max(i, Math.min(a, e)), p = (e) => {
1642
- let t = s ? parseFloat(e) : parseInt(e, 10);
1643
- return Number.isNaN(t) ? null : f(t);
1644
- };
1645
- return I(n, {
1646
- label: t,
1647
- value: String(r),
1648
- disabled: l,
1649
- hideAdornment: !0,
1650
- helperText: null,
1651
- propsInput: {
1652
- type: "number",
1653
- min: i,
1654
- max: a,
1655
- step: o
1656
- },
1657
- sx: {
1658
- width: c,
1659
- minWidth: 0,
1660
- "& input": { textAlign: "right" }
1661
- },
1662
- onChangeInput: (e) => {
1663
- let t = p(e);
1664
- t !== null && (d.current = t, u(t));
1665
- },
1666
- onDone: (e) => {
1667
- let t = p(e) ?? f(0), n = d.current;
1668
- d.current = null, n !== t && u(t);
1669
- }
1670
- });
1671
- });
1672
- Ie.displayName = "FormatNumberField";
1673
- var Le = {
1674
- display: "flex",
1675
- flexDirection: "column",
1676
- gap: 1.5,
1677
- minWidth: 0
1678
- }, Re = y((e) => {
1679
- let { label: t, children: n, sx: r, ...i } = e;
1680
- return L(R, {
1681
- sx: {
1682
- display: "flex",
1683
- flexDirection: "column",
1684
- gap: .75,
1685
- minWidth: 0,
1686
- ...r
1687
- },
1688
- ...i,
1689
- children: [t ? I(ie, {
1690
- variant: "caption",
1691
- component: "div",
1692
- sx: {
1693
- color: "text.secondary",
1694
- lineHeight: 1.4
1695
- },
1696
- children: t
1697
- }) : null, n]
1698
- });
1699
- });
1700
- Re.displayName = "FormatSection";
1701
- var ze = y((e) => {
1702
- let { children: t, sx: n, ...r } = e;
1703
- return I(R, {
1704
- sx: {
1705
- display: "flex",
1706
- flexWrap: "wrap",
1707
- alignItems: "center",
1708
- gap: 1,
1709
- minWidth: 0,
1710
- ...n
1711
- },
1712
- ...r,
1713
- children: t
1714
- });
1715
- });
1716
- ze.displayName = "FormatRow";
1717
- var Be = y((e) => {
1718
- let { children: t, sx: n, ...r } = e;
1719
- return I(R, {
1720
- sx: {
1721
- display: "flex",
1722
- alignItems: "center",
1723
- gap: .25,
1724
- flexWrap: "wrap",
1725
- minWidth: 0,
1726
- ...n
1727
- },
1728
- ...r,
1729
- children: t
1730
- });
1731
- });
1732
- Be.displayName = "FormatButtonGroup";
1733
- var Ve = o.BuiltInSheetPattern.Gray125, He = new r(a.Named.Transparent), Ue = (e) => ({
1734
- fill: e.style.getFill(),
1735
- styles: e.styles,
1736
- schemeLookup: e.schemeLookup,
1737
- darkMode: e.darkMode,
1738
- disabled: e.disabled,
1739
- createCell: e.createCell,
1740
- applyFill: (t, n) => e.applyStyle({ fill: t }, n)
1741
- }), We = y((e) => {
1742
- let { selection: n, disabled: i, maxGradientStops: s, className: c, ...l } = e, u = g(), { fill: d, applyFill: f, createCell: h, schemeLookup: _, styles: v, darkMode: y } = n, b = i || n.disabled, x = p((e, t) => {
1743
- f(e.fill, t);
1744
- }, [f]), S = d.getType(), w = S === o.Type.None ? o.Type.Solid : S, T = S === o.Type.Pattern ? d : null, E = T?.getPatternType() ?? Ve, D = T ? ve(E, T.getForeground(), T.getBackground()) : null, O = C(() => new r(a.Scheme.Tx1, _), [_]), k = D?.foreground ?? O, A = D?.background ?? new r(a.Named.Transparent, _), ee = S === o.Type.Solid ? d.getColor() : null, j = p(() => v.recentColors(), [v]), [M] = m(["formatFillColor"]), N = M?.getContext(), P = N?.quickColor ?? null, te = p((e, t) => {
1745
- e && t && v.addRecentColor(e), N?.onColorSelect?.(e), e ? x({ fill: {
1746
- type: o.Type.Solid,
1747
- color: e.toString()
1748
- } }, q("op.setFillColor")) : x({ fill: { type: o.Type.None } }, q("op.setFillNone"));
1749
- }, [
1750
- x,
1751
- v,
1752
- N
1753
- ]), z = p((e) => {
1754
- let t = e.patternType ?? E, n = ve(t, e.foreground ?? k.toString(), e.background ?? A.toString());
1755
- x({ fill: {
1756
- type: o.Type.Pattern,
1757
- patternType: t,
1758
- foreground: n.foreground,
1759
- background: n.background
1760
- } }, q("op.setFillPattern"));
1761
- }, [
1762
- x,
1763
- E,
1764
- k,
1765
- A
1766
- ]), V = p((e) => {
1767
- x({ fill: {
1768
- type: o.Type.Gradient,
1769
- gradientType: e.gradientType,
1770
- angle: e.angle,
1771
- stops: e.stops.map((e) => ({
1772
- offset: e.offset,
1773
- color: e.color
1774
- }))
1775
- } }, q("op.setFillGradient"));
1776
- }, [x]), H = p((e) => {
1777
- if (e !== w) switch (e) {
1778
- case o.Type.Solid:
1779
- x({ fill: {
1780
- type: o.Type.Solid,
1781
- color: (P ?? d.getColor())?.toString() ?? "ffffff"
1782
- } }, q("op.setFillSolid"));
1783
- break;
1784
- case o.Type.Pattern:
1785
- z({});
1786
- break;
1787
- case o.Type.Gradient: V(Pe);
1788
- }
1789
- }, [
1790
- w,
1791
- d,
1792
- P,
1793
- x,
1794
- z,
1795
- V
1796
- ]), W = p(() => {
1797
- switch (S) {
1798
- case o.Type.Pattern:
1799
- z({});
1800
- break;
1801
- case o.Type.Gradient:
1802
- V(Ne(d));
1803
- break;
1804
- case o.Type.Solid:
1805
- x({ fill: {
1806
- type: o.Type.Solid,
1807
- color: d.getColor().toString()
1808
- } }, q("op.setFillColor"));
1809
- break;
1810
- default: x({ fill: { type: o.Type.None } }, q("op.setFillNone"));
1811
- }
1812
- }, [
1813
- S,
1814
- d,
1815
- x,
1816
- z,
1817
- V
1818
- ]);
1819
- return L(R, {
1820
- className: t("sxl-format-fill-panel", c),
1821
- sx: Le,
1822
- ...l,
1823
- children: [
1824
- I(Re, { children: L(B, {
1825
- size: "small",
1826
- fullWidth: !0,
1827
- children: [I(U, {
1828
- shrink: !0,
1829
- children: u("fill.type")
1830
- }), L(ne, {
1831
- label: u("fill.type"),
1832
- notched: !0,
1833
- disabled: b,
1834
- value: w,
1835
- onChange: (e) => H(e.target.value),
1836
- children: [
1837
- I(G, {
1838
- value: o.Type.Solid,
1839
- onClick: Fe(w, o.Type.Solid, W),
1840
- children: u("fill.typeSolid")
1841
- }),
1842
- I(G, {
1843
- value: o.Type.Pattern,
1844
- onClick: Fe(w, o.Type.Pattern, W),
1845
- children: u("fill.typePattern")
1846
- }),
1847
- I(G, {
1848
- value: o.Type.Gradient,
1849
- onClick: Fe(w, o.Type.Gradient, W),
1850
- children: u("fill.typeGradient")
1851
- }),
1852
- S === o.Type.Image ? I(G, {
1853
- value: o.Type.Image,
1854
- disabled: !0,
1855
- children: u("fill.typeImage")
1856
- }) : null
1857
- ]
1858
- })]
1859
- }) }),
1860
- w === o.Type.Solid ? I(Re, {
1861
- label: u("fill.backgroundColor"),
1862
- children: I(ze, { children: I(X, {
1863
- icon: "fill.colored",
1864
- disabled: b,
1865
- darkMode: y,
1866
- compareRGB: !0,
1867
- selectedColor: ee,
1868
- onSelectColor: te,
1869
- propsPanel: {
1870
- disableAlpha: !0,
1871
- autoColor: He,
1872
- autoColorLabelKey: q("color.noFill"),
1873
- autoColorPosition: J.End,
1874
- schemeLookup: _,
1875
- recentColors: j
1876
- }
1877
- }) })
1878
- }) : null,
1879
- S === o.Type.Pattern ? L(F, { children: [
1880
- I(Re, {
1881
- label: u("fill.patternStyle"),
1882
- children: I(ze, { children: I(Se, {
1883
- disabled: b,
1884
- darkMode: y,
1885
- selectedPattern: E,
1886
- foreground: k.toString(),
1887
- background: A.toString(),
1888
- createCell: h,
1889
- onSelectPattern: (e) => z({ patternType: e })
1890
- }) })
1891
- }),
1892
- I(Re, {
1893
- label: u("fill.patternForeground"),
1894
- children: I(ze, { children: I(X, {
1895
- disabled: b,
1896
- darkMode: y,
1897
- selectedColor: k,
1898
- onSelectColor: (e) => {
1899
- z({ foreground: (e ?? O).toString() });
1900
- },
1901
- propsPanel: {
1902
- disableAlpha: !0,
1903
- autoColor: O,
1904
- schemeLookup: _,
1905
- recentColors: j
1906
- }
1907
- }) })
1908
- }),
1909
- I(Re, {
1910
- label: u("fill.patternBackground"),
1911
- children: I(ze, { children: I(X, {
1912
- disabled: b,
1913
- darkMode: y,
1914
- selectedColor: A,
1915
- onSelectColor: (e) => {
1916
- z({ background: (e ?? He).toString() });
1917
- },
1918
- propsPanel: {
1919
- disableAlpha: !0,
1920
- autoColor: He,
1921
- autoColorLabelKey: q("color.noFill"),
1922
- schemeLookup: _,
1923
- recentColors: j
1924
- }
1925
- }) })
1926
- })
1927
- ] }) : null,
1928
- S === o.Type.Gradient ? I(Re, { children: I(Me, {
1929
- disabled: b,
1930
- maxStops: s,
1931
- darkMode: y,
1932
- schemeLookup: _,
1933
- recentColors: j,
1934
- value: Ne(d),
1935
- onChange: V
1936
- }) }) : null
1937
- ]
1938
- });
1939
- });
1940
- We.displayName = "FillPanel";
1941
- export { de as C, ce as E, fe as S, J as T, ve as _, ze as a, X as b, Le as c, Ne as d, je as f, ye as g, be as h, Ie as i, Pe as l, xe as m, Ue as n, Re as o, Se as p, Be as r, Fe as s, We as t, Me as u, _e as v, ue as w, me as x, ge as y };