oasis-editor 0.0.20 → 0.0.22
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/{OasisEditorApp-YuR1PFAE.js → OasisEditorApp-BD3WQQO5.js} +7 -3
- package/dist/assets/{importDocxWorker-D4P4_drI.js → importDocxWorker-DcrboJNQ.js} +1 -1
- package/dist/core/plugin.d.ts +2 -1
- package/dist/{index-CBXD1ygJ.js → index-N6EX-tEW.js} +1498 -91
- package/dist/layoutProjection/presetGeometry/catalog.d.ts +2 -0
- package/dist/layoutProjection/presetGeometry/dispatcher.d.ts +3 -0
- package/dist/layoutProjection/presetGeometry/families.d.ts +37 -0
- package/dist/layoutProjection/presetGeometry/primitives.d.ts +13 -0
- package/dist/layoutProjection/presetGeometry/types.d.ts +20 -0
- package/dist/layoutProjection/presetGeometry.d.ts +3 -24
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/components/Toolbar/groups/SectionGroup.d.ts +2 -1
- package/dist/ui/components/Toolbar/presets/builtinToolbarIds.d.ts +1 -0
- package/dist/ui/components/Toolbar/primitives/Button.d.ts +1 -0
- package/dist/ui/components/Toolbar/primitives/Menu.d.ts +1 -0
- package/dist/ui/components/Toolbar/ribbon/RibbonGroup.d.ts +2 -1
- package/dist/ui/components/Toolbar/ribbon/ribbonModel.d.ts +2 -0
- package/dist/ui/components/Toolbar/schema/items.d.ts +3 -0
- package/package.json +1 -1
|
@@ -2366,7 +2366,7 @@ function OasisBrandMark(props) {
|
|
|
2366
2366
|
return _el$;
|
|
2367
2367
|
})();
|
|
2368
2368
|
}
|
|
2369
|
-
var _tmpl$$R = /* @__PURE__ */ template(`<div class=oasis-editor-import-progress-label>`), _tmpl$2$
|
|
2369
|
+
var _tmpl$$R = /* @__PURE__ */ template(`<div class=oasis-editor-import-progress-label>`), _tmpl$2$z = /* @__PURE__ */ template(`<div role=status aria-live=polite><div class=oasis-editor-import-card><div class=oasis-editor-import-title></div><div class=oasis-editor-import-progress-track><div>`), _tmpl$3$m = /* @__PURE__ */ template(`<span class=oasis-editor-import-done-icon>Done`);
|
|
2370
2370
|
function OasisEditorLoading(props) {
|
|
2371
2371
|
const variant = () => props.variant ?? "overlay";
|
|
2372
2372
|
const pct = () => {
|
|
@@ -2375,7 +2375,7 @@ function OasisEditorLoading(props) {
|
|
|
2375
2375
|
};
|
|
2376
2376
|
const isDone = () => (pct() ?? 0) >= 100;
|
|
2377
2377
|
return (() => {
|
|
2378
|
-
var _el$ = _tmpl$2$
|
|
2378
|
+
var _el$ = _tmpl$2$z(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$4.firstChild;
|
|
2379
2379
|
insert(_el$2, createComponent(OasisBrandMark, {
|
|
2380
2380
|
height: 40,
|
|
2381
2381
|
"class": "oasis-editor-loading-mark"
|
|
@@ -2438,7 +2438,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2438
2438
|
onCleanup(() => {
|
|
2439
2439
|
cancelled = true;
|
|
2440
2440
|
});
|
|
2441
|
-
import("./OasisEditorApp-
|
|
2441
|
+
import("./OasisEditorApp-BD3WQQO5.js").then((m) => {
|
|
2442
2442
|
cancelled = true;
|
|
2443
2443
|
setProgress(1);
|
|
2444
2444
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -4511,9 +4511,9 @@ class MenuRegistry {
|
|
|
4511
4511
|
}
|
|
4512
4512
|
}
|
|
4513
4513
|
const defaultMenuRegistry = new MenuRegistry();
|
|
4514
|
-
var _tmpl$$Q = /* @__PURE__ */ template(`<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none aria-hidden=true><text x=2 y=18 font-family="'Segoe UI', Arial, sans-serif"font-size=14 font-weight=700 fill=currentColor>ab</text><text x=15.5 y=11 font-family="'Segoe UI', Arial, sans-serif"font-size=10 font-weight=700 fill=#c00000>1`), _tmpl$2$
|
|
4514
|
+
var _tmpl$$Q = /* @__PURE__ */ template(`<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none aria-hidden=true><text x=2 y=18 font-family="'Segoe UI', Arial, sans-serif"font-size=14 font-weight=700 fill=currentColor>ab</text><text x=15.5 y=11 font-family="'Segoe UI', Arial, sans-serif"font-size=10 font-weight=700 fill=#c00000>1`), _tmpl$2$y = /* @__PURE__ */ template(`<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"aria-hidden=true><g fill=currentColor><path d="M3.375 4.875 L7.125 8.625 L3.375 12.375 L2.25 11.25 L4.875 8.625 L2.25 6 Z"></path><rect x=10.125 y=6 width=9 height=1.6875 rx=0.25></rect><rect x=5.625 y=10.875 width=13.5 height=1.6875 rx=0.25></rect><rect x=5.625 y=15.75 width=13.5 height=1.6875 rx=0.25>`), _tmpl$3$l = /* @__PURE__ */ template(`<i>`);
|
|
4515
4515
|
const FootnoteIcon = () => _tmpl$$Q();
|
|
4516
|
-
const SpecialIndentFirstLineIcon = () => _tmpl$2$
|
|
4516
|
+
const SpecialIndentFirstLineIcon = () => _tmpl$2$y();
|
|
4517
4517
|
const CUSTOM_ICONS = {
|
|
4518
4518
|
footnote: FootnoteIcon,
|
|
4519
4519
|
specialIndentFirstLine: SpecialIndentFirstLineIcon
|
|
@@ -4878,7 +4878,7 @@ const defaultMenuItems = [
|
|
|
4878
4878
|
}
|
|
4879
4879
|
];
|
|
4880
4880
|
defaultMenuItems.forEach((item) => defaultMenuRegistry.register(item));
|
|
4881
|
-
var _tmpl$$P = /* @__PURE__ */ template(`<div class=oasis-menubar role=menubar>`), _tmpl$2$
|
|
4881
|
+
var _tmpl$$P = /* @__PURE__ */ template(`<div class=oasis-menubar role=menubar>`), _tmpl$2$x = /* @__PURE__ */ template(`<div class=oasis-menubar-dropdown role=menu>`), _tmpl$3$k = /* @__PURE__ */ template(`<div class=oasis-menubar-menu><div class=oasis-menubar-button role=menuitem aria-haspopup=true>`), _tmpl$4$f = /* @__PURE__ */ template(`<div class=oasis-menubar-separator role=separator>`), _tmpl$5$e = /* @__PURE__ */ template(`<span class=oasis-menubar-item-icon aria-hidden=true>`), _tmpl$6$7 = /* @__PURE__ */ template(`<span class=oasis-menubar-shortcut>`), _tmpl$7$3 = /* @__PURE__ */ template(`<i class=oasis-menubar-submenu-icon data-lucide=chevron-right>`), _tmpl$8$2 = /* @__PURE__ */ template(`<div class=oasis-menubar-submenu role=menu>`), _tmpl$9$1 = /* @__PURE__ */ template(`<div class=oasis-menubar-item role=menuitem><span class=oasis-menubar-item-main><span>`);
|
|
4882
4882
|
function Menubar(props) {
|
|
4883
4883
|
const [activeMenu, setActiveMenu] = createSignal(null);
|
|
4884
4884
|
const menuItems = () => (props.registry ?? defaultMenuRegistry).getItems();
|
|
@@ -4971,7 +4971,7 @@ function Menubar(props) {
|
|
|
4971
4971
|
return activeMenu() === topLevel.id;
|
|
4972
4972
|
},
|
|
4973
4973
|
get children() {
|
|
4974
|
-
var _el$4 = _tmpl$2$
|
|
4974
|
+
var _el$4 = _tmpl$2$x();
|
|
4975
4975
|
insert(_el$4, createComponent(For, {
|
|
4976
4976
|
get each() {
|
|
4977
4977
|
return topLevel.children;
|
|
@@ -14805,52 +14805,199 @@ function drawTable(ctx, table, tableSegment, state, originX, originY, contentWid
|
|
|
14805
14805
|
});
|
|
14806
14806
|
}
|
|
14807
14807
|
}
|
|
14808
|
-
const
|
|
14809
|
-
|
|
14810
|
-
|
|
14811
|
-
|
|
14812
|
-
|
|
14813
|
-
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14838
|
-
|
|
14839
|
-
|
|
14840
|
-
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
|
|
14850
|
-
|
|
14851
|
-
|
|
14852
|
-
|
|
14808
|
+
const SUPPORTED_PRESET_GEOMETRIES = /* @__PURE__ */ new Set([
|
|
14809
|
+
"accentBorderCallout1",
|
|
14810
|
+
"accentBorderCallout2",
|
|
14811
|
+
"accentBorderCallout3",
|
|
14812
|
+
"accentCallout1",
|
|
14813
|
+
"accentCallout2",
|
|
14814
|
+
"accentCallout3",
|
|
14815
|
+
"actionButtonBackPrevious",
|
|
14816
|
+
"actionButtonBeginning",
|
|
14817
|
+
"actionButtonBlank",
|
|
14818
|
+
"actionButtonDocument",
|
|
14819
|
+
"actionButtonEnd",
|
|
14820
|
+
"actionButtonForwardNext",
|
|
14821
|
+
"actionButtonHelp",
|
|
14822
|
+
"actionButtonHome",
|
|
14823
|
+
"actionButtonInformation",
|
|
14824
|
+
"actionButtonMovie",
|
|
14825
|
+
"actionButtonReturn",
|
|
14826
|
+
"actionButtonSound",
|
|
14827
|
+
"arc",
|
|
14828
|
+
"bentArrow",
|
|
14829
|
+
"bentConnector2",
|
|
14830
|
+
"bentConnector3",
|
|
14831
|
+
"bentConnector4",
|
|
14832
|
+
"bentConnector5",
|
|
14833
|
+
"bentUpArrow",
|
|
14834
|
+
"bevel",
|
|
14835
|
+
"blockArc",
|
|
14836
|
+
"borderCallout1",
|
|
14837
|
+
"borderCallout2",
|
|
14838
|
+
"borderCallout3",
|
|
14839
|
+
"bracePair",
|
|
14840
|
+
"bracketPair",
|
|
14841
|
+
"callout1",
|
|
14842
|
+
"callout2",
|
|
14843
|
+
"callout3",
|
|
14844
|
+
"can",
|
|
14845
|
+
"chartPlus",
|
|
14846
|
+
"chartStar",
|
|
14847
|
+
"chartX",
|
|
14848
|
+
"chevron",
|
|
14849
|
+
"chord",
|
|
14850
|
+
"circularArrow",
|
|
14851
|
+
"cloud",
|
|
14852
|
+
"cloudCallout",
|
|
14853
|
+
"corner",
|
|
14854
|
+
"cornerTabs",
|
|
14855
|
+
"cube",
|
|
14856
|
+
"curvedConnector2",
|
|
14857
|
+
"curvedConnector3",
|
|
14858
|
+
"curvedConnector4",
|
|
14859
|
+
"curvedConnector5",
|
|
14860
|
+
"curvedDownArrow",
|
|
14861
|
+
"curvedLeftArrow",
|
|
14862
|
+
"curvedRightArrow",
|
|
14863
|
+
"curvedUpArrow",
|
|
14864
|
+
"decagon",
|
|
14865
|
+
"diagStripe",
|
|
14866
|
+
"diamond",
|
|
14867
|
+
"dodecagon",
|
|
14868
|
+
"donut",
|
|
14869
|
+
"doubleWave",
|
|
14870
|
+
"downArrow",
|
|
14871
|
+
"downArrowCallout",
|
|
14872
|
+
"ellipse",
|
|
14873
|
+
"ellipseRibbon",
|
|
14874
|
+
"ellipseRibbon2",
|
|
14875
|
+
"flowChartAlternateProcess",
|
|
14876
|
+
"flowChartCollate",
|
|
14877
|
+
"flowChartConnector",
|
|
14878
|
+
"flowChartDecision",
|
|
14879
|
+
"flowChartDelay",
|
|
14880
|
+
"flowChartDisplay",
|
|
14881
|
+
"flowChartDocument",
|
|
14882
|
+
"flowChartExtract",
|
|
14883
|
+
"flowChartInputOutput",
|
|
14884
|
+
"flowChartInternalStorage",
|
|
14885
|
+
"flowChartMagneticDisk",
|
|
14886
|
+
"flowChartMagneticDrum",
|
|
14887
|
+
"flowChartMagneticTape",
|
|
14888
|
+
"flowChartManualInput",
|
|
14889
|
+
"flowChartManualOperation",
|
|
14890
|
+
"flowChartMerge",
|
|
14891
|
+
"flowChartMultidocument",
|
|
14892
|
+
"flowChartOfflineStorage",
|
|
14893
|
+
"flowChartOffpageConnector",
|
|
14894
|
+
"flowChartOnlineStorage",
|
|
14895
|
+
"flowChartOr",
|
|
14896
|
+
"flowChartPredefinedProcess",
|
|
14897
|
+
"flowChartPreparation",
|
|
14898
|
+
"flowChartProcess",
|
|
14899
|
+
"flowChartPunchedCard",
|
|
14900
|
+
"flowChartPunchedTape",
|
|
14901
|
+
"flowChartSort",
|
|
14902
|
+
"flowChartSummingJunction",
|
|
14903
|
+
"flowChartTerminator",
|
|
14904
|
+
"foldedCorner",
|
|
14905
|
+
"frame",
|
|
14906
|
+
"funnel",
|
|
14907
|
+
"gear6",
|
|
14908
|
+
"gear9",
|
|
14909
|
+
"halfFrame",
|
|
14910
|
+
"heart",
|
|
14911
|
+
"heptagon",
|
|
14912
|
+
"hexagon",
|
|
14913
|
+
"homePlate",
|
|
14914
|
+
"horizontalScroll",
|
|
14915
|
+
"irregularSeal1",
|
|
14916
|
+
"irregularSeal2",
|
|
14917
|
+
"leftArrow",
|
|
14918
|
+
"leftArrowCallout",
|
|
14919
|
+
"leftBrace",
|
|
14920
|
+
"leftBracket",
|
|
14921
|
+
"leftCircularArrow",
|
|
14922
|
+
"leftRightArrow",
|
|
14923
|
+
"leftRightArrowCallout",
|
|
14924
|
+
"leftRightCircularArrow",
|
|
14925
|
+
"leftRightRibbon",
|
|
14926
|
+
"leftRightUpArrow",
|
|
14927
|
+
"leftUpArrow",
|
|
14928
|
+
"lightningBolt",
|
|
14929
|
+
"line",
|
|
14930
|
+
"lineInv",
|
|
14931
|
+
"mathDivide",
|
|
14932
|
+
"mathEqual",
|
|
14933
|
+
"mathMinus",
|
|
14934
|
+
"mathMultiply",
|
|
14935
|
+
"mathNotEqual",
|
|
14936
|
+
"mathPlus",
|
|
14937
|
+
"moon",
|
|
14938
|
+
"nonIsoscelesTrapezoid",
|
|
14939
|
+
"noSmoking",
|
|
14940
|
+
"notchedRightArrow",
|
|
14941
|
+
"octagon",
|
|
14942
|
+
"parallelogram",
|
|
14943
|
+
"pentagon",
|
|
14944
|
+
"pie",
|
|
14945
|
+
"pieWedge",
|
|
14946
|
+
"plaque",
|
|
14947
|
+
"plaqueTabs",
|
|
14948
|
+
"plus",
|
|
14949
|
+
"quadArrow",
|
|
14950
|
+
"quadArrowCallout",
|
|
14951
|
+
"rect",
|
|
14952
|
+
"ribbon",
|
|
14953
|
+
"ribbon2",
|
|
14954
|
+
"rightArrow",
|
|
14955
|
+
"rightArrowCallout",
|
|
14956
|
+
"rightBrace",
|
|
14957
|
+
"rightBracket",
|
|
14958
|
+
"round1Rect",
|
|
14959
|
+
"round2DiagRect",
|
|
14960
|
+
"round2SameRect",
|
|
14961
|
+
"roundRect",
|
|
14962
|
+
"rtTriangle",
|
|
14963
|
+
"smileyFace",
|
|
14964
|
+
"snip1Rect",
|
|
14965
|
+
"snip2DiagRect",
|
|
14966
|
+
"snip2SameRect",
|
|
14967
|
+
"snipRoundRect",
|
|
14968
|
+
"squareTabs",
|
|
14969
|
+
"star10",
|
|
14970
|
+
"star12",
|
|
14971
|
+
"star16",
|
|
14972
|
+
"star24",
|
|
14973
|
+
"star32",
|
|
14974
|
+
"star4",
|
|
14975
|
+
"star5",
|
|
14976
|
+
"star6",
|
|
14977
|
+
"star7",
|
|
14978
|
+
"star8",
|
|
14979
|
+
"straightConnector1",
|
|
14980
|
+
"stripedRightArrow",
|
|
14981
|
+
"sun",
|
|
14982
|
+
"swooshArrow",
|
|
14983
|
+
"teardrop",
|
|
14984
|
+
"trapezoid",
|
|
14985
|
+
"triangle",
|
|
14986
|
+
"upArrow",
|
|
14987
|
+
"upArrowCallout",
|
|
14988
|
+
"upDownArrow",
|
|
14989
|
+
"upDownArrowCallout",
|
|
14990
|
+
"uturnArrow",
|
|
14991
|
+
"verticalScroll",
|
|
14992
|
+
"wave",
|
|
14993
|
+
"wedgeEllipseCallout",
|
|
14994
|
+
"wedgeRectCallout",
|
|
14995
|
+
"wedgeRoundRectCallout"
|
|
14996
|
+
]);
|
|
14997
|
+
function isPresetGeometrySupported(preset) {
|
|
14998
|
+
return Boolean(preset && SUPPORTED_PRESET_GEOMETRIES.has(preset));
|
|
14853
14999
|
}
|
|
15000
|
+
const KAPPA = 0.5522847498307936;
|
|
14854
15001
|
function polygon(points) {
|
|
14855
15002
|
const segments = [];
|
|
14856
15003
|
points.forEach(([px, py], index) => {
|
|
@@ -14861,6 +15008,14 @@ function polygon(points) {
|
|
|
14861
15008
|
segments.push({ type: "close" });
|
|
14862
15009
|
return segments;
|
|
14863
15010
|
}
|
|
15011
|
+
function rectSegments(x, y, width, height) {
|
|
15012
|
+
return polygon([
|
|
15013
|
+
[x, y],
|
|
15014
|
+
[x + width, y],
|
|
15015
|
+
[x + width, y + height],
|
|
15016
|
+
[x, y + height]
|
|
15017
|
+
]);
|
|
15018
|
+
}
|
|
14864
15019
|
function ellipseSegments(cx, cy, rx, ry) {
|
|
14865
15020
|
const ox = rx * KAPPA;
|
|
14866
15021
|
const oy = ry * KAPPA;
|
|
@@ -14905,6 +15060,50 @@ function ellipseSegments(cx, cy, rx, ry) {
|
|
|
14905
15060
|
{ type: "close" }
|
|
14906
15061
|
];
|
|
14907
15062
|
}
|
|
15063
|
+
function pointOnEllipse(cx, cy, rx, ry, degrees) {
|
|
15064
|
+
const radians = degrees * Math.PI / 180;
|
|
15065
|
+
return [cx + Math.cos(radians) * rx, cy + Math.sin(radians) * ry];
|
|
15066
|
+
}
|
|
15067
|
+
function arcSegments(cx, cy, rx, ry, start, end) {
|
|
15068
|
+
const steps = Math.max(4, Math.ceil(Math.abs(end - start) / 30));
|
|
15069
|
+
const points = Array.from(
|
|
15070
|
+
{ length: steps + 1 },
|
|
15071
|
+
(_, index) => pointOnEllipse(cx, cy, rx, ry, start + (end - start) * index / steps)
|
|
15072
|
+
);
|
|
15073
|
+
return points.map(
|
|
15074
|
+
([px, py], index) => index === 0 ? { type: "move", x: px, y: py } : { type: "line", x: px, y: py }
|
|
15075
|
+
);
|
|
15076
|
+
}
|
|
15077
|
+
function pieSegments(cx, cy, rx, ry, start, end) {
|
|
15078
|
+
return [
|
|
15079
|
+
{ type: "move", x: cx, y: cy },
|
|
15080
|
+
...arcSegments(cx, cy, rx, ry, start, end).slice(1),
|
|
15081
|
+
{ type: "close" }
|
|
15082
|
+
];
|
|
15083
|
+
}
|
|
15084
|
+
function regularPolygon(cx, cy, rx, ry, sides, startDegrees) {
|
|
15085
|
+
const points = Array.from(
|
|
15086
|
+
{ length: sides },
|
|
15087
|
+
(_, index) => pointOnEllipse(cx, cy, rx, ry, startDegrees + 360 * index / sides)
|
|
15088
|
+
);
|
|
15089
|
+
return polygon(points);
|
|
15090
|
+
}
|
|
15091
|
+
function starPointCount(preset) {
|
|
15092
|
+
return Number.parseInt(preset.replace("star", ""), 10);
|
|
15093
|
+
}
|
|
15094
|
+
function starSegments(cx, cy, rx, ry, points, innerRatio = 0.45) {
|
|
15095
|
+
const vertices = Array.from({ length: points * 2 }, (_, index) => {
|
|
15096
|
+
const radius = index % 2 === 0 ? 1 : innerRatio;
|
|
15097
|
+
return pointOnEllipse(
|
|
15098
|
+
cx,
|
|
15099
|
+
cy,
|
|
15100
|
+
rx * radius,
|
|
15101
|
+
ry * radius,
|
|
15102
|
+
-90 + 180 * index / points
|
|
15103
|
+
);
|
|
15104
|
+
});
|
|
15105
|
+
return polygon(vertices);
|
|
15106
|
+
}
|
|
14908
15107
|
function roundRectSegments(x, y, width, height, radius) {
|
|
14909
15108
|
const r = Math.min(radius, width / 2, height / 2);
|
|
14910
15109
|
const right = x + width;
|
|
@@ -14947,6 +15146,1163 @@ function roundRectSegments(x, y, width, height, radius) {
|
|
|
14947
15146
|
{ type: "close" }
|
|
14948
15147
|
];
|
|
14949
15148
|
}
|
|
15149
|
+
function mixedRectSegments(x, y, width, height, tl, tr, br, bl) {
|
|
15150
|
+
return snipRoundRectLikeSegments(x, y, width, height, {
|
|
15151
|
+
tlRound: tl,
|
|
15152
|
+
trRound: tr,
|
|
15153
|
+
brRound: br,
|
|
15154
|
+
blRound: bl
|
|
15155
|
+
});
|
|
15156
|
+
}
|
|
15157
|
+
function snipRoundRectSegments(x, y, width, height) {
|
|
15158
|
+
return snipRoundRectLikeSegments(x, y, width, height, {
|
|
15159
|
+
tlSnip: true,
|
|
15160
|
+
brRound: true
|
|
15161
|
+
});
|
|
15162
|
+
}
|
|
15163
|
+
function snipRectSegments(x, y, width, height, tl, tr, br, bl) {
|
|
15164
|
+
return snipRoundRectLikeSegments(x, y, width, height, {
|
|
15165
|
+
tlSnip: tl,
|
|
15166
|
+
trSnip: tr,
|
|
15167
|
+
brSnip: br,
|
|
15168
|
+
blSnip: bl
|
|
15169
|
+
});
|
|
15170
|
+
}
|
|
15171
|
+
function snipRoundRectLikeSegments(x, y, width, height, corners) {
|
|
15172
|
+
const r = Math.min(width, height) * 0.16;
|
|
15173
|
+
const right = x + width;
|
|
15174
|
+
const bottom = y + height;
|
|
15175
|
+
const points = [
|
|
15176
|
+
[x + (corners.tlSnip || corners.tlRound ? r : 0), y],
|
|
15177
|
+
[right - (corners.trSnip || corners.trRound ? r : 0), y],
|
|
15178
|
+
[right, y + (corners.trSnip || corners.trRound ? r : 0)],
|
|
15179
|
+
[right, bottom - (corners.brSnip || corners.brRound ? r : 0)],
|
|
15180
|
+
[right - (corners.brSnip || corners.brRound ? r : 0), bottom],
|
|
15181
|
+
[x + (corners.blSnip || corners.blRound ? r : 0), bottom],
|
|
15182
|
+
[x, bottom - (corners.blSnip || corners.blRound ? r : 0)],
|
|
15183
|
+
[x, y + (corners.tlSnip || corners.tlRound ? r : 0)]
|
|
15184
|
+
];
|
|
15185
|
+
return polygon(points);
|
|
15186
|
+
}
|
|
15187
|
+
function arrowSegments(key, x, y, width, height) {
|
|
15188
|
+
const right = x + width;
|
|
15189
|
+
const bottom = y + height;
|
|
15190
|
+
const cx = x + width / 2;
|
|
15191
|
+
const cy = y + height / 2;
|
|
15192
|
+
if (key === "upDownArrow")
|
|
15193
|
+
return polygon([
|
|
15194
|
+
[cx, y],
|
|
15195
|
+
[right, y + height * 0.28],
|
|
15196
|
+
[x + width * 0.62, y + height * 0.28],
|
|
15197
|
+
[x + width * 0.62, y + height * 0.72],
|
|
15198
|
+
[right, y + height * 0.72],
|
|
15199
|
+
[cx, bottom],
|
|
15200
|
+
[x, y + height * 0.72],
|
|
15201
|
+
[x + width * 0.38, y + height * 0.72],
|
|
15202
|
+
[x + width * 0.38, y + height * 0.28],
|
|
15203
|
+
[x, y + height * 0.28]
|
|
15204
|
+
]);
|
|
15205
|
+
if (key === "leftRightArrow" || key === "leftRightUpArrow")
|
|
15206
|
+
return polygon([
|
|
15207
|
+
[x, cy],
|
|
15208
|
+
[x + width * 0.24, y],
|
|
15209
|
+
[x + width * 0.24, y + height * 0.32],
|
|
15210
|
+
[x + width * 0.76, y + height * 0.32],
|
|
15211
|
+
[x + width * 0.76, y],
|
|
15212
|
+
[right, cy],
|
|
15213
|
+
[x + width * 0.76, bottom],
|
|
15214
|
+
[x + width * 0.76, y + height * 0.68],
|
|
15215
|
+
[x + width * 0.24, y + height * 0.68],
|
|
15216
|
+
[x + width * 0.24, bottom]
|
|
15217
|
+
]);
|
|
15218
|
+
if (key === "quadArrow")
|
|
15219
|
+
return starSegments(cx, cy, width * 0.5, height * 0.5, 4, 0.38);
|
|
15220
|
+
if (key === "leftArrow" || key === "leftCircularArrow")
|
|
15221
|
+
return polygon([
|
|
15222
|
+
[x, cy],
|
|
15223
|
+
[x + width * 0.38, y],
|
|
15224
|
+
[x + width * 0.38, y + height * 0.28],
|
|
15225
|
+
[right, y + height * 0.28],
|
|
15226
|
+
[right, y + height * 0.72],
|
|
15227
|
+
[x + width * 0.38, y + height * 0.72],
|
|
15228
|
+
[x + width * 0.38, bottom]
|
|
15229
|
+
]);
|
|
15230
|
+
if (key === "upArrow" || key === "bentUpArrow" || key === "curvedUpArrow")
|
|
15231
|
+
return polygon([
|
|
15232
|
+
[cx, y],
|
|
15233
|
+
[right, y + height * 0.38],
|
|
15234
|
+
[x + width * 0.68, y + height * 0.38],
|
|
15235
|
+
[x + width * 0.68, bottom],
|
|
15236
|
+
[x + width * 0.32, bottom],
|
|
15237
|
+
[x + width * 0.32, y + height * 0.38],
|
|
15238
|
+
[x, y + height * 0.38]
|
|
15239
|
+
]);
|
|
15240
|
+
if (key === "downArrow" || key === "curvedDownArrow")
|
|
15241
|
+
return polygon([
|
|
15242
|
+
[x + width * 0.32, y],
|
|
15243
|
+
[x + width * 0.68, y],
|
|
15244
|
+
[x + width * 0.68, y + height * 0.62],
|
|
15245
|
+
[right, y + height * 0.62],
|
|
15246
|
+
[cx, bottom],
|
|
15247
|
+
[x, y + height * 0.62],
|
|
15248
|
+
[x + width * 0.32, y + height * 0.62]
|
|
15249
|
+
]);
|
|
15250
|
+
if (key === "circularArrow" || key === "leftRightCircularArrow")
|
|
15251
|
+
return blockArcSegments(cx, cy, width / 2, height / 2);
|
|
15252
|
+
if (key === "uturnArrow")
|
|
15253
|
+
return polygon([
|
|
15254
|
+
[x + width * 0.2, bottom],
|
|
15255
|
+
[x + width * 0.2, y + height * 0.35],
|
|
15256
|
+
[x + width * 0.62, y + height * 0.35],
|
|
15257
|
+
[x + width * 0.62, y],
|
|
15258
|
+
[right, y + height * 0.5],
|
|
15259
|
+
[x + width * 0.62, bottom],
|
|
15260
|
+
[x + width * 0.62, y + height * 0.65],
|
|
15261
|
+
[x + width * 0.38, y + height * 0.65],
|
|
15262
|
+
[x + width * 0.38, bottom]
|
|
15263
|
+
]);
|
|
15264
|
+
if (key === "notchedRightArrow")
|
|
15265
|
+
return polygon([
|
|
15266
|
+
[x, y],
|
|
15267
|
+
[right - width * 0.28, y],
|
|
15268
|
+
[right, cy],
|
|
15269
|
+
[right - width * 0.28, bottom],
|
|
15270
|
+
[x, bottom],
|
|
15271
|
+
[x + width * 0.18, cy]
|
|
15272
|
+
]);
|
|
15273
|
+
if (key === "stripedRightArrow")
|
|
15274
|
+
return polygon([
|
|
15275
|
+
[x + width * 0.16, y],
|
|
15276
|
+
[right - width * 0.28, y],
|
|
15277
|
+
[right, cy],
|
|
15278
|
+
[right - width * 0.28, bottom],
|
|
15279
|
+
[x + width * 0.16, bottom],
|
|
15280
|
+
[x + width * 0.34, cy]
|
|
15281
|
+
]);
|
|
15282
|
+
return polygon([
|
|
15283
|
+
[x, y + height * 0.28],
|
|
15284
|
+
[right - width * 0.38, y + height * 0.28],
|
|
15285
|
+
[right - width * 0.38, y],
|
|
15286
|
+
[right, cy],
|
|
15287
|
+
[right - width * 0.38, bottom],
|
|
15288
|
+
[right - width * 0.38, y + height * 0.72],
|
|
15289
|
+
[x, y + height * 0.72]
|
|
15290
|
+
]);
|
|
15291
|
+
}
|
|
15292
|
+
function calloutSegments(key, x, y, width, height) {
|
|
15293
|
+
if (key.startsWith("wedgeEllipse")) {
|
|
15294
|
+
return [
|
|
15295
|
+
...ellipseSegments(
|
|
15296
|
+
x + width / 2,
|
|
15297
|
+
y + height / 2,
|
|
15298
|
+
width / 2,
|
|
15299
|
+
height * 0.42
|
|
15300
|
+
),
|
|
15301
|
+
{ type: "move", x: x + width * 0.55, y: y + height * 0.82 },
|
|
15302
|
+
{ type: "line", x: x + width * 0.24, y: y + height },
|
|
15303
|
+
{ type: "line", x: x + width * 0.45, y: y + height * 0.75 }
|
|
15304
|
+
];
|
|
15305
|
+
}
|
|
15306
|
+
const r = key.startsWith("wedgeRound") ? Math.min(width, height) * 0.08 : 0;
|
|
15307
|
+
const body = r > 0 ? roundRectSegments(x, y, width, height * 0.82, r) : rectSegments(x, y, width, height * 0.82);
|
|
15308
|
+
return [
|
|
15309
|
+
...body,
|
|
15310
|
+
{ type: "move", x: x + width * 0.58, y: y + height * 0.82 },
|
|
15311
|
+
{ type: "line", x: x + width * 0.26, y: y + height },
|
|
15312
|
+
{ type: "line", x: x + width * 0.44, y: y + height * 0.82 },
|
|
15313
|
+
{ type: "close" }
|
|
15314
|
+
];
|
|
15315
|
+
}
|
|
15316
|
+
function connectorSegments(key, x, y, width, height) {
|
|
15317
|
+
const right = x + width;
|
|
15318
|
+
const bottom = y + height;
|
|
15319
|
+
if (key.startsWith("curved")) {
|
|
15320
|
+
return [
|
|
15321
|
+
{ type: "move", x, y },
|
|
15322
|
+
{
|
|
15323
|
+
type: "cubic",
|
|
15324
|
+
x1: x + width * 0.7,
|
|
15325
|
+
y1: y,
|
|
15326
|
+
x2: x + width * 0.3,
|
|
15327
|
+
y2: bottom,
|
|
15328
|
+
x: right,
|
|
15329
|
+
y: bottom
|
|
15330
|
+
}
|
|
15331
|
+
];
|
|
15332
|
+
}
|
|
15333
|
+
if (key === "bentConnector2")
|
|
15334
|
+
return [
|
|
15335
|
+
{ type: "move", x, y },
|
|
15336
|
+
{ type: "line", x: right, y: bottom }
|
|
15337
|
+
];
|
|
15338
|
+
if (key === "bentConnector3")
|
|
15339
|
+
return [
|
|
15340
|
+
{ type: "move", x, y },
|
|
15341
|
+
{ type: "line", x: right, y },
|
|
15342
|
+
{ type: "line", x: right, y: bottom }
|
|
15343
|
+
];
|
|
15344
|
+
if (key === "bentConnector4")
|
|
15345
|
+
return [
|
|
15346
|
+
{ type: "move", x, y },
|
|
15347
|
+
{ type: "line", x: x + width * 0.5, y },
|
|
15348
|
+
{ type: "line", x: x + width * 0.5, y: bottom },
|
|
15349
|
+
{ type: "line", x: right, y: bottom }
|
|
15350
|
+
];
|
|
15351
|
+
if (key === "bentConnector5")
|
|
15352
|
+
return [
|
|
15353
|
+
{ type: "move", x, y },
|
|
15354
|
+
{ type: "line", x: x + width * 0.34, y },
|
|
15355
|
+
{ type: "line", x: x + width * 0.34, y: bottom },
|
|
15356
|
+
{ type: "line", x: x + width * 0.66, y: bottom },
|
|
15357
|
+
{ type: "line", x: x + width * 0.66, y },
|
|
15358
|
+
{ type: "line", x: right, y }
|
|
15359
|
+
];
|
|
15360
|
+
return [
|
|
15361
|
+
{ type: "move", x, y },
|
|
15362
|
+
{ type: "line", x: right, y: bottom }
|
|
15363
|
+
];
|
|
15364
|
+
}
|
|
15365
|
+
function flowChartSegments(key, x, y, width, height, resolvePreset) {
|
|
15366
|
+
if (key.includes("Decision"))
|
|
15367
|
+
return resolvePreset("diamond", x, y, width, height);
|
|
15368
|
+
if (key.includes("Connector") || key.includes("SummingJunction") || key.includes("Or")) {
|
|
15369
|
+
return ellipseSegments(
|
|
15370
|
+
x + width / 2,
|
|
15371
|
+
y + height / 2,
|
|
15372
|
+
width / 2,
|
|
15373
|
+
height / 2
|
|
15374
|
+
);
|
|
15375
|
+
}
|
|
15376
|
+
if (key.includes("Terminator")) {
|
|
15377
|
+
return roundRectSegments(
|
|
15378
|
+
x,
|
|
15379
|
+
y,
|
|
15380
|
+
width,
|
|
15381
|
+
height,
|
|
15382
|
+
Math.min(width, height) * 0.28
|
|
15383
|
+
);
|
|
15384
|
+
}
|
|
15385
|
+
if (key.includes("Delay")) {
|
|
15386
|
+
return [
|
|
15387
|
+
...rectSegments(x, y, width * 0.65, height).slice(0, -1),
|
|
15388
|
+
...arcSegments(
|
|
15389
|
+
x + width * 0.65,
|
|
15390
|
+
y + height / 2,
|
|
15391
|
+
width * 0.35,
|
|
15392
|
+
height / 2,
|
|
15393
|
+
-90,
|
|
15394
|
+
90
|
|
15395
|
+
),
|
|
15396
|
+
{ type: "close" }
|
|
15397
|
+
];
|
|
15398
|
+
}
|
|
15399
|
+
if (key.includes("Document")) return waveBottomRect(x, y, width, height);
|
|
15400
|
+
if (key.includes("Data") || key.includes("InputOutput") || key.includes("ManualInput")) {
|
|
15401
|
+
return resolvePreset("parallelogram", x, y, width, height);
|
|
15402
|
+
}
|
|
15403
|
+
if (key.includes("Preparation")) {
|
|
15404
|
+
return resolvePreset("hexagon", x, y, width, height);
|
|
15405
|
+
}
|
|
15406
|
+
if (key.includes("OffpageConnector")) {
|
|
15407
|
+
return resolvePreset("homePlate", x, y, width, height);
|
|
15408
|
+
}
|
|
15409
|
+
if (key.includes("PunchedCard")) {
|
|
15410
|
+
return snipRectSegments(x, y, width, height, true, false, false, false);
|
|
15411
|
+
}
|
|
15412
|
+
if (key.includes("Magnetic")) return canSegments(x, y, width, height);
|
|
15413
|
+
if (key.includes("Collate")) {
|
|
15414
|
+
return polygon([
|
|
15415
|
+
[x, y],
|
|
15416
|
+
[x + width, y],
|
|
15417
|
+
[x, y + height],
|
|
15418
|
+
[x + width, y + height]
|
|
15419
|
+
]);
|
|
15420
|
+
}
|
|
15421
|
+
if (key.includes("Sort"))
|
|
15422
|
+
return resolvePreset("diamond", x, y, width, height);
|
|
15423
|
+
return rectSegments(x, y, width, height);
|
|
15424
|
+
}
|
|
15425
|
+
function actionButtonSegments(key, x, y, width, height, resolvePreset) {
|
|
15426
|
+
const base = roundRectSegments(
|
|
15427
|
+
x,
|
|
15428
|
+
y,
|
|
15429
|
+
width,
|
|
15430
|
+
height,
|
|
15431
|
+
Math.min(width, height) * 0.08
|
|
15432
|
+
);
|
|
15433
|
+
if (key === "actionButtonBlank") return base;
|
|
15434
|
+
return [...base, ...symbolSegments(key, x, y, width, height, resolvePreset)];
|
|
15435
|
+
}
|
|
15436
|
+
function symbolSegments(key, x, y, width, height, resolvePreset) {
|
|
15437
|
+
const cx = x + width / 2;
|
|
15438
|
+
const cy = y + height / 2;
|
|
15439
|
+
if (key.includes("Home"))
|
|
15440
|
+
return polygon([
|
|
15441
|
+
[cx, y + height * 0.25],
|
|
15442
|
+
[x + width * 0.72, cy],
|
|
15443
|
+
[x + width * 0.72, y + height * 0.75],
|
|
15444
|
+
[x + width * 0.28, y + height * 0.75],
|
|
15445
|
+
[x + width * 0.28, cy]
|
|
15446
|
+
]);
|
|
15447
|
+
if (key.includes("Help")) {
|
|
15448
|
+
return ellipseSegments(cx, cy, width * 0.12, height * 0.12);
|
|
15449
|
+
}
|
|
15450
|
+
if (key.includes("Information")) {
|
|
15451
|
+
return rectSegments(
|
|
15452
|
+
cx - width * 0.04,
|
|
15453
|
+
y + height * 0.34,
|
|
15454
|
+
width * 0.08,
|
|
15455
|
+
height * 0.38
|
|
15456
|
+
);
|
|
15457
|
+
}
|
|
15458
|
+
if (key.includes("Sound"))
|
|
15459
|
+
return polygon([
|
|
15460
|
+
[x + width * 0.3, cy],
|
|
15461
|
+
[x + width * 0.45, y + height * 0.35],
|
|
15462
|
+
[x + width * 0.45, y + height * 0.65]
|
|
15463
|
+
]);
|
|
15464
|
+
if (key.includes("Back") || key.includes("Beginning") || key.includes("Return")) {
|
|
15465
|
+
return resolvePreset(
|
|
15466
|
+
"leftArrow",
|
|
15467
|
+
x + width * 0.28,
|
|
15468
|
+
y + height * 0.3,
|
|
15469
|
+
width * 0.45,
|
|
15470
|
+
height * 0.4
|
|
15471
|
+
);
|
|
15472
|
+
}
|
|
15473
|
+
return resolvePreset(
|
|
15474
|
+
"rightArrow",
|
|
15475
|
+
x + width * 0.28,
|
|
15476
|
+
y + height * 0.3,
|
|
15477
|
+
width * 0.45,
|
|
15478
|
+
height * 0.4
|
|
15479
|
+
);
|
|
15480
|
+
}
|
|
15481
|
+
function blockArcSegments(cx, cy, rx, ry) {
|
|
15482
|
+
const outer = arcSegments(cx, cy, rx, ry, -45, 250);
|
|
15483
|
+
const inner = arcSegments(cx, cy, rx * 0.58, ry * 0.58, 250, -45).reverse();
|
|
15484
|
+
return [...outer, ...inner.slice(1), { type: "close" }];
|
|
15485
|
+
}
|
|
15486
|
+
function plusSegments(x, y, width, height) {
|
|
15487
|
+
return polygon([
|
|
15488
|
+
[x + width * 0.38, y],
|
|
15489
|
+
[x + width * 0.62, y],
|
|
15490
|
+
[x + width * 0.62, y + height * 0.38],
|
|
15491
|
+
[x + width, y + height * 0.38],
|
|
15492
|
+
[x + width, y + height * 0.62],
|
|
15493
|
+
[x + width * 0.62, y + height * 0.62],
|
|
15494
|
+
[x + width * 0.62, y + height],
|
|
15495
|
+
[x + width * 0.38, y + height],
|
|
15496
|
+
[x + width * 0.38, y + height * 0.62],
|
|
15497
|
+
[x, y + height * 0.62],
|
|
15498
|
+
[x, y + height * 0.38],
|
|
15499
|
+
[x + width * 0.38, y + height * 0.38]
|
|
15500
|
+
]);
|
|
15501
|
+
}
|
|
15502
|
+
function xSegments(x, y, width, height) {
|
|
15503
|
+
return polygon([
|
|
15504
|
+
[x + width * 0.18, y],
|
|
15505
|
+
[x + width * 0.5, y + height * 0.32],
|
|
15506
|
+
[x + width * 0.82, y],
|
|
15507
|
+
[x + width, y + height * 0.18],
|
|
15508
|
+
[x + width * 0.68, y + height * 0.5],
|
|
15509
|
+
[x + width, y + height * 0.82],
|
|
15510
|
+
[x + width * 0.82, y + height],
|
|
15511
|
+
[x + width * 0.5, y + height * 0.68],
|
|
15512
|
+
[x + width * 0.18, y + height],
|
|
15513
|
+
[x, y + height * 0.82],
|
|
15514
|
+
[x + width * 0.32, y + height * 0.5],
|
|
15515
|
+
[x, y + height * 0.18]
|
|
15516
|
+
]);
|
|
15517
|
+
}
|
|
15518
|
+
function mathDivideSegments(x, y, width, height) {
|
|
15519
|
+
return [
|
|
15520
|
+
...ellipseSegments(
|
|
15521
|
+
x + width / 2,
|
|
15522
|
+
y + height * 0.22,
|
|
15523
|
+
width * 0.07,
|
|
15524
|
+
height * 0.07
|
|
15525
|
+
),
|
|
15526
|
+
...rectSegments(
|
|
15527
|
+
x + width * 0.18,
|
|
15528
|
+
y + height * 0.46,
|
|
15529
|
+
width * 0.64,
|
|
15530
|
+
height * 0.08
|
|
15531
|
+
),
|
|
15532
|
+
...ellipseSegments(
|
|
15533
|
+
x + width / 2,
|
|
15534
|
+
y + height * 0.78,
|
|
15535
|
+
width * 0.07,
|
|
15536
|
+
height * 0.07
|
|
15537
|
+
)
|
|
15538
|
+
];
|
|
15539
|
+
}
|
|
15540
|
+
function mathEqualSegments(x, y, width, height) {
|
|
15541
|
+
return [
|
|
15542
|
+
...rectSegments(x, y + height * 0.3, width, height * 0.12),
|
|
15543
|
+
...rectSegments(x, y + height * 0.58, width, height * 0.12)
|
|
15544
|
+
];
|
|
15545
|
+
}
|
|
15546
|
+
function mathNotEqualSegments(x, y, width, height) {
|
|
15547
|
+
return [
|
|
15548
|
+
...mathEqualSegments(x, y, width, height),
|
|
15549
|
+
...polygon([
|
|
15550
|
+
[x + width * 0.62, y],
|
|
15551
|
+
[x + width * 0.74, y],
|
|
15552
|
+
[x + width * 0.38, y + height],
|
|
15553
|
+
[x + width * 0.26, y + height]
|
|
15554
|
+
])
|
|
15555
|
+
];
|
|
15556
|
+
}
|
|
15557
|
+
function heartSegments(x, y, width, height) {
|
|
15558
|
+
const cx = x + width / 2;
|
|
15559
|
+
return [
|
|
15560
|
+
{ type: "move", x: cx, y: y + height * 0.9 },
|
|
15561
|
+
{
|
|
15562
|
+
type: "cubic",
|
|
15563
|
+
x1: x - width * 0.12,
|
|
15564
|
+
y1: y + height * 0.45,
|
|
15565
|
+
x2: x + width * 0.08,
|
|
15566
|
+
y2: y,
|
|
15567
|
+
x: cx,
|
|
15568
|
+
y: y + height * 0.28
|
|
15569
|
+
},
|
|
15570
|
+
{
|
|
15571
|
+
type: "cubic",
|
|
15572
|
+
x1: x + width * 0.92,
|
|
15573
|
+
y1: y,
|
|
15574
|
+
x2: x + width * 1.12,
|
|
15575
|
+
y2: y + height * 0.45,
|
|
15576
|
+
x: cx,
|
|
15577
|
+
y: y + height * 0.9
|
|
15578
|
+
},
|
|
15579
|
+
{ type: "close" }
|
|
15580
|
+
];
|
|
15581
|
+
}
|
|
15582
|
+
function cloudSegments(x, y, width, height) {
|
|
15583
|
+
return [
|
|
15584
|
+
...ellipseSegments(
|
|
15585
|
+
x + width * 0.28,
|
|
15586
|
+
y + height * 0.58,
|
|
15587
|
+
width * 0.24,
|
|
15588
|
+
height * 0.23
|
|
15589
|
+
),
|
|
15590
|
+
...ellipseSegments(
|
|
15591
|
+
x + width * 0.48,
|
|
15592
|
+
y + height * 0.42,
|
|
15593
|
+
width * 0.28,
|
|
15594
|
+
height * 0.28
|
|
15595
|
+
),
|
|
15596
|
+
...ellipseSegments(
|
|
15597
|
+
x + width * 0.7,
|
|
15598
|
+
y + height * 0.58,
|
|
15599
|
+
width * 0.25,
|
|
15600
|
+
height * 0.24
|
|
15601
|
+
)
|
|
15602
|
+
];
|
|
15603
|
+
}
|
|
15604
|
+
function moonSegments(x, y, width, height) {
|
|
15605
|
+
return [
|
|
15606
|
+
{ type: "move", x: x + width * 0.68, y },
|
|
15607
|
+
{
|
|
15608
|
+
type: "cubic",
|
|
15609
|
+
x1: x + width * 0.22,
|
|
15610
|
+
y1: y + height * 0.06,
|
|
15611
|
+
x2: x + width * 0.18,
|
|
15612
|
+
y2: y + height * 0.94,
|
|
15613
|
+
x: x + width * 0.68,
|
|
15614
|
+
y: y + height
|
|
15615
|
+
},
|
|
15616
|
+
{
|
|
15617
|
+
type: "cubic",
|
|
15618
|
+
x1: x + width * 0.42,
|
|
15619
|
+
y1: y + height * 0.72,
|
|
15620
|
+
x2: x + width * 0.42,
|
|
15621
|
+
y2: y + height * 0.28,
|
|
15622
|
+
x: x + width * 0.68,
|
|
15623
|
+
y
|
|
15624
|
+
},
|
|
15625
|
+
{ type: "close" }
|
|
15626
|
+
];
|
|
15627
|
+
}
|
|
15628
|
+
function smileySegments(x, y, width, height) {
|
|
15629
|
+
return [
|
|
15630
|
+
...ellipseSegments(x + width / 2, y + height / 2, width / 2, height / 2),
|
|
15631
|
+
...ellipseSegments(
|
|
15632
|
+
x + width * 0.35,
|
|
15633
|
+
y + height * 0.38,
|
|
15634
|
+
width * 0.05,
|
|
15635
|
+
height * 0.05
|
|
15636
|
+
),
|
|
15637
|
+
...ellipseSegments(
|
|
15638
|
+
x + width * 0.65,
|
|
15639
|
+
y + height * 0.38,
|
|
15640
|
+
width * 0.05,
|
|
15641
|
+
height * 0.05
|
|
15642
|
+
),
|
|
15643
|
+
...arcSegments(
|
|
15644
|
+
x + width / 2,
|
|
15645
|
+
y + height * 0.52,
|
|
15646
|
+
width * 0.24,
|
|
15647
|
+
height * 0.18,
|
|
15648
|
+
20,
|
|
15649
|
+
160
|
|
15650
|
+
)
|
|
15651
|
+
];
|
|
15652
|
+
}
|
|
15653
|
+
function teardropSegments(x, y, width, height) {
|
|
15654
|
+
return [
|
|
15655
|
+
{ type: "move", x: x + width * 0.55, y },
|
|
15656
|
+
{
|
|
15657
|
+
type: "cubic",
|
|
15658
|
+
x1: x + width,
|
|
15659
|
+
y1: y + height * 0.22,
|
|
15660
|
+
x2: x + width * 0.95,
|
|
15661
|
+
y2: y + height,
|
|
15662
|
+
x: x + width * 0.35,
|
|
15663
|
+
y: y + height
|
|
15664
|
+
},
|
|
15665
|
+
{
|
|
15666
|
+
type: "cubic",
|
|
15667
|
+
x1: x - width * 0.1,
|
|
15668
|
+
y1: y + height * 0.66,
|
|
15669
|
+
x2: x + width * 0.16,
|
|
15670
|
+
y2: y + height * 0.12,
|
|
15671
|
+
x: x + width * 0.55,
|
|
15672
|
+
y
|
|
15673
|
+
},
|
|
15674
|
+
{ type: "close" }
|
|
15675
|
+
];
|
|
15676
|
+
}
|
|
15677
|
+
function noSmokingSegments(x, y, width, height) {
|
|
15678
|
+
return [
|
|
15679
|
+
...ellipseSegments(x + width / 2, y + height / 2, width / 2, height / 2),
|
|
15680
|
+
...polygon([
|
|
15681
|
+
[x + width * 0.18, y + height * 0.1],
|
|
15682
|
+
[x + width * 0.28, y],
|
|
15683
|
+
[x + width * 0.82, y + height * 0.9],
|
|
15684
|
+
[x + width * 0.72, y + height]
|
|
15685
|
+
])
|
|
15686
|
+
];
|
|
15687
|
+
}
|
|
15688
|
+
function donutSegments(cx, cy, rx, ry) {
|
|
15689
|
+
return [
|
|
15690
|
+
...ellipseSegments(cx, cy, rx, ry),
|
|
15691
|
+
...ellipseSegments(cx, cy, rx * 0.52, ry * 0.52)
|
|
15692
|
+
];
|
|
15693
|
+
}
|
|
15694
|
+
function canSegments(x, y, width, height) {
|
|
15695
|
+
return [
|
|
15696
|
+
...rectSegments(x, y + height * 0.14, width, height * 0.72),
|
|
15697
|
+
...ellipseSegments(
|
|
15698
|
+
x + width / 2,
|
|
15699
|
+
y + height * 0.14,
|
|
15700
|
+
width / 2,
|
|
15701
|
+
height * 0.14
|
|
15702
|
+
),
|
|
15703
|
+
...arcSegments(
|
|
15704
|
+
x + width / 2,
|
|
15705
|
+
y + height * 0.86,
|
|
15706
|
+
width / 2,
|
|
15707
|
+
height * 0.14,
|
|
15708
|
+
0,
|
|
15709
|
+
180
|
|
15710
|
+
)
|
|
15711
|
+
];
|
|
15712
|
+
}
|
|
15713
|
+
function cubeSegments(x, y, width, height) {
|
|
15714
|
+
return polygon([
|
|
15715
|
+
[x + width * 0.22, y],
|
|
15716
|
+
[x + width, y],
|
|
15717
|
+
[x + width, y + height * 0.78],
|
|
15718
|
+
[x + width * 0.78, y + height],
|
|
15719
|
+
[x, y + height],
|
|
15720
|
+
[x, y + height * 0.22]
|
|
15721
|
+
]);
|
|
15722
|
+
}
|
|
15723
|
+
function bevelSegments(x, y, width, height) {
|
|
15724
|
+
const inset = Math.min(width, height) * 0.16;
|
|
15725
|
+
return polygon([
|
|
15726
|
+
[x + inset, y],
|
|
15727
|
+
[x + width - inset, y],
|
|
15728
|
+
[x + width, y + inset],
|
|
15729
|
+
[x + width, y + height - inset],
|
|
15730
|
+
[x + width - inset, y + height],
|
|
15731
|
+
[x + inset, y + height],
|
|
15732
|
+
[x, y + height - inset],
|
|
15733
|
+
[x, y + inset]
|
|
15734
|
+
]);
|
|
15735
|
+
}
|
|
15736
|
+
function foldedCornerSegments(x, y, width, height) {
|
|
15737
|
+
return polygon([
|
|
15738
|
+
[x, y],
|
|
15739
|
+
[x + width * 0.78, y],
|
|
15740
|
+
[x + width, y + height * 0.22],
|
|
15741
|
+
[x + width, y + height],
|
|
15742
|
+
[x, y + height]
|
|
15743
|
+
]);
|
|
15744
|
+
}
|
|
15745
|
+
function frameSegments(x, y, width, height) {
|
|
15746
|
+
return [
|
|
15747
|
+
...rectSegments(x, y, width, height),
|
|
15748
|
+
...rectSegments(
|
|
15749
|
+
x + width * 0.18,
|
|
15750
|
+
y + height * 0.18,
|
|
15751
|
+
width * 0.64,
|
|
15752
|
+
height * 0.64
|
|
15753
|
+
)
|
|
15754
|
+
];
|
|
15755
|
+
}
|
|
15756
|
+
function halfFrameSegments(x, y, width, height) {
|
|
15757
|
+
return polygon([
|
|
15758
|
+
[x, y],
|
|
15759
|
+
[x + width, y],
|
|
15760
|
+
[x + width, y + height * 0.22],
|
|
15761
|
+
[x + width * 0.22, y + height * 0.22],
|
|
15762
|
+
[x + width * 0.22, y + height],
|
|
15763
|
+
[x, y + height]
|
|
15764
|
+
]);
|
|
15765
|
+
}
|
|
15766
|
+
function cornerSegments(x, y, width, height) {
|
|
15767
|
+
return polygon([
|
|
15768
|
+
[x, y],
|
|
15769
|
+
[x + width, y],
|
|
15770
|
+
[x + width, y + height * 0.22],
|
|
15771
|
+
[x + width * 0.22, y + height * 0.22],
|
|
15772
|
+
[x + width * 0.22, y + height],
|
|
15773
|
+
[x, y + height]
|
|
15774
|
+
]);
|
|
15775
|
+
}
|
|
15776
|
+
function plaqueSegments(x, y, width, height) {
|
|
15777
|
+
return polygon([
|
|
15778
|
+
[x + width * 0.18, y],
|
|
15779
|
+
[x + width * 0.82, y],
|
|
15780
|
+
[x + width, y + height * 0.18],
|
|
15781
|
+
[x + width, y + height * 0.82],
|
|
15782
|
+
[x + width * 0.82, y + height],
|
|
15783
|
+
[x + width * 0.18, y + height],
|
|
15784
|
+
[x, y + height * 0.82],
|
|
15785
|
+
[x, y + height * 0.18]
|
|
15786
|
+
]);
|
|
15787
|
+
}
|
|
15788
|
+
function tabbedRectSegments(key, x, y, width, height) {
|
|
15789
|
+
const tab = Math.min(width, height) * 0.18;
|
|
15790
|
+
if (key === "cornerTabs")
|
|
15791
|
+
return polygon([
|
|
15792
|
+
[x, y + tab],
|
|
15793
|
+
[x + tab, y + tab],
|
|
15794
|
+
[x + tab, y],
|
|
15795
|
+
[x + width - tab, y],
|
|
15796
|
+
[x + width - tab, y + tab],
|
|
15797
|
+
[x + width, y + tab],
|
|
15798
|
+
[x + width, y + height - tab],
|
|
15799
|
+
[x + width - tab, y + height - tab],
|
|
15800
|
+
[x + width - tab, y + height],
|
|
15801
|
+
[x + tab, y + height],
|
|
15802
|
+
[x + tab, y + height - tab],
|
|
15803
|
+
[x, y + height - tab]
|
|
15804
|
+
]);
|
|
15805
|
+
if (key === "plaqueTabs")
|
|
15806
|
+
return polygon([
|
|
15807
|
+
[x, y + tab],
|
|
15808
|
+
[x + width * 0.35, y + tab],
|
|
15809
|
+
[x + width * 0.35, y],
|
|
15810
|
+
[x + width * 0.65, y],
|
|
15811
|
+
[x + width * 0.65, y + tab],
|
|
15812
|
+
[x + width, y + tab],
|
|
15813
|
+
[x + width, y + height - tab],
|
|
15814
|
+
[x + width * 0.65, y + height - tab],
|
|
15815
|
+
[x + width * 0.65, y + height],
|
|
15816
|
+
[x + width * 0.35, y + height],
|
|
15817
|
+
[x + width * 0.35, y + height - tab],
|
|
15818
|
+
[x, y + height - tab]
|
|
15819
|
+
]);
|
|
15820
|
+
return polygon([
|
|
15821
|
+
[x + tab, y],
|
|
15822
|
+
[x + width - tab, y],
|
|
15823
|
+
[x + width - tab, y + tab],
|
|
15824
|
+
[x + width, y + tab],
|
|
15825
|
+
[x + width, y + height - tab],
|
|
15826
|
+
[x + width - tab, y + height - tab],
|
|
15827
|
+
[x + width - tab, y + height],
|
|
15828
|
+
[x + tab, y + height],
|
|
15829
|
+
[x + tab, y + height - tab],
|
|
15830
|
+
[x, y + height - tab],
|
|
15831
|
+
[x, y + tab],
|
|
15832
|
+
[x + tab, y + tab]
|
|
15833
|
+
]);
|
|
15834
|
+
}
|
|
15835
|
+
function braceSegments(key, x, y, width, height) {
|
|
15836
|
+
if (key === "rightBrace")
|
|
15837
|
+
return [
|
|
15838
|
+
{ type: "move", x, y },
|
|
15839
|
+
{
|
|
15840
|
+
type: "cubic",
|
|
15841
|
+
x1: x + width,
|
|
15842
|
+
y1: y,
|
|
15843
|
+
x2: x,
|
|
15844
|
+
y2: y + height * 0.5,
|
|
15845
|
+
x: x + width,
|
|
15846
|
+
y: y + height * 0.5
|
|
15847
|
+
},
|
|
15848
|
+
{
|
|
15849
|
+
type: "cubic",
|
|
15850
|
+
x1: x,
|
|
15851
|
+
y1: y + height * 0.5,
|
|
15852
|
+
x2: x + width,
|
|
15853
|
+
y2: y + height,
|
|
15854
|
+
x,
|
|
15855
|
+
y: y + height
|
|
15856
|
+
}
|
|
15857
|
+
];
|
|
15858
|
+
if (key === "bracePair")
|
|
15859
|
+
return [
|
|
15860
|
+
...braceSegments("leftBrace", x, y, width * 0.45, height),
|
|
15861
|
+
...braceSegments("rightBrace", x + width * 0.55, y, width * 0.45, height)
|
|
15862
|
+
];
|
|
15863
|
+
return [
|
|
15864
|
+
{ type: "move", x: x + width, y },
|
|
15865
|
+
{
|
|
15866
|
+
type: "cubic",
|
|
15867
|
+
x1: x,
|
|
15868
|
+
y1: y,
|
|
15869
|
+
x2: x + width,
|
|
15870
|
+
y2: y + height * 0.5,
|
|
15871
|
+
x,
|
|
15872
|
+
y: y + height * 0.5
|
|
15873
|
+
},
|
|
15874
|
+
{
|
|
15875
|
+
type: "cubic",
|
|
15876
|
+
x1: x + width,
|
|
15877
|
+
y1: y + height * 0.5,
|
|
15878
|
+
x2: x,
|
|
15879
|
+
y2: y + height,
|
|
15880
|
+
x: x + width,
|
|
15881
|
+
y: y + height
|
|
15882
|
+
}
|
|
15883
|
+
];
|
|
15884
|
+
}
|
|
15885
|
+
function bracketSegments(key, x, y, width, height) {
|
|
15886
|
+
if (key === "rightBracket")
|
|
15887
|
+
return [
|
|
15888
|
+
{ type: "move", x, y },
|
|
15889
|
+
{ type: "line", x: x + width, y },
|
|
15890
|
+
{ type: "line", x: x + width, y: y + height },
|
|
15891
|
+
{ type: "line", x, y: y + height }
|
|
15892
|
+
];
|
|
15893
|
+
if (key === "bracketPair")
|
|
15894
|
+
return [
|
|
15895
|
+
...bracketSegments("leftBracket", x, y, width * 0.45, height),
|
|
15896
|
+
...bracketSegments(
|
|
15897
|
+
"rightBracket",
|
|
15898
|
+
x + width * 0.55,
|
|
15899
|
+
y,
|
|
15900
|
+
width * 0.45,
|
|
15901
|
+
height
|
|
15902
|
+
)
|
|
15903
|
+
];
|
|
15904
|
+
return [
|
|
15905
|
+
{ type: "move", x: x + width, y },
|
|
15906
|
+
{ type: "line", x, y },
|
|
15907
|
+
{ type: "line", x, y: y + height },
|
|
15908
|
+
{ type: "line", x: x + width, y: y + height }
|
|
15909
|
+
];
|
|
15910
|
+
}
|
|
15911
|
+
function ribbonSegments(key, x, y, width, height) {
|
|
15912
|
+
const mid = y + height * 0.5;
|
|
15913
|
+
if (key.includes("Ellipse"))
|
|
15914
|
+
return [
|
|
15915
|
+
...ellipseSegments(x + width / 2, mid, width * 0.42, height * 0.28),
|
|
15916
|
+
...polygon([
|
|
15917
|
+
[x, mid],
|
|
15918
|
+
[x + width * 0.18, y + height * 0.3],
|
|
15919
|
+
[x + width * 0.18, y + height * 0.7]
|
|
15920
|
+
]),
|
|
15921
|
+
...polygon([
|
|
15922
|
+
[x + width, mid],
|
|
15923
|
+
[x + width * 0.82, y + height * 0.3],
|
|
15924
|
+
[x + width * 0.82, y + height * 0.7]
|
|
15925
|
+
])
|
|
15926
|
+
];
|
|
15927
|
+
return polygon([
|
|
15928
|
+
[x, y + height * 0.25],
|
|
15929
|
+
[x + width, y + height * 0.25],
|
|
15930
|
+
[x + width * 0.82, mid],
|
|
15931
|
+
[x + width, y + height * 0.75],
|
|
15932
|
+
[x, y + height * 0.75],
|
|
15933
|
+
[x + width * 0.18, mid]
|
|
15934
|
+
]);
|
|
15935
|
+
}
|
|
15936
|
+
function scrollSegments(key, x, y, width, height) {
|
|
15937
|
+
if (key === "horizontalScroll")
|
|
15938
|
+
return [
|
|
15939
|
+
...rectSegments(
|
|
15940
|
+
x + width * 0.1,
|
|
15941
|
+
y + height * 0.2,
|
|
15942
|
+
width * 0.8,
|
|
15943
|
+
height * 0.6
|
|
15944
|
+
),
|
|
15945
|
+
...ellipseSegments(
|
|
15946
|
+
x + width * 0.1,
|
|
15947
|
+
y + height * 0.5,
|
|
15948
|
+
width * 0.1,
|
|
15949
|
+
height * 0.3
|
|
15950
|
+
),
|
|
15951
|
+
...ellipseSegments(
|
|
15952
|
+
x + width * 0.9,
|
|
15953
|
+
y + height * 0.5,
|
|
15954
|
+
width * 0.1,
|
|
15955
|
+
height * 0.3
|
|
15956
|
+
)
|
|
15957
|
+
];
|
|
15958
|
+
return [
|
|
15959
|
+
...rectSegments(
|
|
15960
|
+
x + width * 0.2,
|
|
15961
|
+
y + height * 0.1,
|
|
15962
|
+
width * 0.6,
|
|
15963
|
+
height * 0.8
|
|
15964
|
+
),
|
|
15965
|
+
...ellipseSegments(
|
|
15966
|
+
x + width * 0.5,
|
|
15967
|
+
y + height * 0.1,
|
|
15968
|
+
width * 0.3,
|
|
15969
|
+
height * 0.1
|
|
15970
|
+
),
|
|
15971
|
+
...ellipseSegments(
|
|
15972
|
+
x + width * 0.5,
|
|
15973
|
+
y + height * 0.9,
|
|
15974
|
+
width * 0.3,
|
|
15975
|
+
height * 0.1
|
|
15976
|
+
)
|
|
15977
|
+
];
|
|
15978
|
+
}
|
|
15979
|
+
function waveSegments(key, x, y, width, height) {
|
|
15980
|
+
const first = [
|
|
15981
|
+
{ type: "move", x, y: y + height * 0.5 },
|
|
15982
|
+
{
|
|
15983
|
+
type: "cubic",
|
|
15984
|
+
x1: x + width * 0.25,
|
|
15985
|
+
y1: y,
|
|
15986
|
+
x2: x + width * 0.25,
|
|
15987
|
+
y2: y + height,
|
|
15988
|
+
x: x + width * 0.5,
|
|
15989
|
+
y: y + height * 0.5
|
|
15990
|
+
},
|
|
15991
|
+
{
|
|
15992
|
+
type: "cubic",
|
|
15993
|
+
x1: x + width * 0.75,
|
|
15994
|
+
y1: y,
|
|
15995
|
+
x2: x + width * 0.75,
|
|
15996
|
+
y2: y + height,
|
|
15997
|
+
x: x + width,
|
|
15998
|
+
y: y + height * 0.5
|
|
15999
|
+
}
|
|
16000
|
+
];
|
|
16001
|
+
return key === "doubleWave" ? [
|
|
16002
|
+
...first,
|
|
16003
|
+
...first.map(
|
|
16004
|
+
(segment) => "y" in segment ? { ...segment, y: segment.y + height * 0.18 } : segment
|
|
16005
|
+
)
|
|
16006
|
+
] : first;
|
|
16007
|
+
}
|
|
16008
|
+
function waveBottomRect(x, y, width, height) {
|
|
16009
|
+
return [
|
|
16010
|
+
{ type: "move", x, y },
|
|
16011
|
+
{ type: "line", x: x + width, y },
|
|
16012
|
+
{ type: "line", x: x + width, y: y + height * 0.82 },
|
|
16013
|
+
{
|
|
16014
|
+
type: "cubic",
|
|
16015
|
+
x1: x + width * 0.75,
|
|
16016
|
+
y1: y + height,
|
|
16017
|
+
x2: x + width * 0.25,
|
|
16018
|
+
y2: y + height * 0.64,
|
|
16019
|
+
x,
|
|
16020
|
+
y: y + height * 0.82
|
|
16021
|
+
},
|
|
16022
|
+
{ type: "close" }
|
|
16023
|
+
];
|
|
16024
|
+
}
|
|
16025
|
+
function resolvePresetPathSegments(preset, x, y, width, height) {
|
|
16026
|
+
const right = x + width;
|
|
16027
|
+
const bottom = y + height;
|
|
16028
|
+
const cx = x + width / 2;
|
|
16029
|
+
const cy = y + height / 2;
|
|
16030
|
+
if (/Connector\d$/.test(preset) || preset === "straightConnector1") {
|
|
16031
|
+
return connectorSegments(preset, x, y, width, height);
|
|
16032
|
+
}
|
|
16033
|
+
if (/Callout\d$/.test(preset) || /Callout$/.test(preset)) {
|
|
16034
|
+
return calloutSegments(preset, x, y, width, height);
|
|
16035
|
+
}
|
|
16036
|
+
if (/Arrow/.test(preset) || preset === "swooshArrow") {
|
|
16037
|
+
return arrowSegments(preset, x, y, width, height);
|
|
16038
|
+
}
|
|
16039
|
+
if (/^star\d+$/.test(preset)) {
|
|
16040
|
+
return starSegments(
|
|
16041
|
+
cx,
|
|
16042
|
+
cy,
|
|
16043
|
+
width * 0.48,
|
|
16044
|
+
height * 0.48,
|
|
16045
|
+
starPointCount(preset)
|
|
16046
|
+
);
|
|
16047
|
+
}
|
|
16048
|
+
if (/^flowChart/.test(preset)) {
|
|
16049
|
+
return flowChartSegments(
|
|
16050
|
+
preset,
|
|
16051
|
+
x,
|
|
16052
|
+
y,
|
|
16053
|
+
width,
|
|
16054
|
+
height,
|
|
16055
|
+
resolvePresetPathSegments
|
|
16056
|
+
);
|
|
16057
|
+
}
|
|
16058
|
+
if (/^actionButton/.test(preset)) {
|
|
16059
|
+
return actionButtonSegments(
|
|
16060
|
+
preset,
|
|
16061
|
+
x,
|
|
16062
|
+
y,
|
|
16063
|
+
width,
|
|
16064
|
+
height,
|
|
16065
|
+
resolvePresetPathSegments
|
|
16066
|
+
);
|
|
16067
|
+
}
|
|
16068
|
+
switch (preset) {
|
|
16069
|
+
case "line":
|
|
16070
|
+
return [
|
|
16071
|
+
{ type: "move", x, y },
|
|
16072
|
+
{ type: "line", x: right, y: bottom }
|
|
16073
|
+
];
|
|
16074
|
+
case "lineInv":
|
|
16075
|
+
return [
|
|
16076
|
+
{ type: "move", x, y: bottom },
|
|
16077
|
+
{ type: "line", x: right, y }
|
|
16078
|
+
];
|
|
16079
|
+
case "arc":
|
|
16080
|
+
return arcSegments(cx, cy, width / 2, height / 2, 200, 340);
|
|
16081
|
+
case "blockArc":
|
|
16082
|
+
return blockArcSegments(cx, cy, width / 2, height / 2);
|
|
16083
|
+
case "chord":
|
|
16084
|
+
return [
|
|
16085
|
+
...arcSegments(cx, cy, width / 2, height / 2, 210, 330),
|
|
16086
|
+
{ type: "close" }
|
|
16087
|
+
];
|
|
16088
|
+
case "pie":
|
|
16089
|
+
return pieSegments(cx, cy, width / 2, height / 2, -90, 45);
|
|
16090
|
+
case "pieWedge":
|
|
16091
|
+
return pieSegments(cx, cy, width / 2, height / 2, -35, 55);
|
|
16092
|
+
case "roundRect":
|
|
16093
|
+
return roundRectSegments(
|
|
16094
|
+
x,
|
|
16095
|
+
y,
|
|
16096
|
+
width,
|
|
16097
|
+
height,
|
|
16098
|
+
Math.min(width, height) * 0.12
|
|
16099
|
+
);
|
|
16100
|
+
case "round1Rect":
|
|
16101
|
+
return mixedRectSegments(x, y, width, height, true, false, false, false);
|
|
16102
|
+
case "round2SameRect":
|
|
16103
|
+
return mixedRectSegments(x, y, width, height, true, false, true, false);
|
|
16104
|
+
case "round2DiagRect":
|
|
16105
|
+
return mixedRectSegments(x, y, width, height, true, false, false, true);
|
|
16106
|
+
case "snipRoundRect":
|
|
16107
|
+
return snipRoundRectSegments(x, y, width, height);
|
|
16108
|
+
case "snip1Rect":
|
|
16109
|
+
return snipRectSegments(x, y, width, height, true, false, false, false);
|
|
16110
|
+
case "snip2SameRect":
|
|
16111
|
+
return snipRectSegments(x, y, width, height, true, true, false, false);
|
|
16112
|
+
case "snip2DiagRect":
|
|
16113
|
+
return snipRectSegments(x, y, width, height, true, false, true, false);
|
|
16114
|
+
case "ellipse":
|
|
16115
|
+
return ellipseSegments(cx, cy, width / 2, height / 2);
|
|
16116
|
+
case "triangle":
|
|
16117
|
+
return polygon([
|
|
16118
|
+
[cx, y],
|
|
16119
|
+
[right, bottom],
|
|
16120
|
+
[x, bottom]
|
|
16121
|
+
]);
|
|
16122
|
+
case "rtTriangle":
|
|
16123
|
+
return polygon([
|
|
16124
|
+
[x, y],
|
|
16125
|
+
[x, bottom],
|
|
16126
|
+
[right, bottom]
|
|
16127
|
+
]);
|
|
16128
|
+
case "diamond":
|
|
16129
|
+
return polygon([
|
|
16130
|
+
[cx, y],
|
|
16131
|
+
[right, cy],
|
|
16132
|
+
[cx, bottom],
|
|
16133
|
+
[x, cy]
|
|
16134
|
+
]);
|
|
16135
|
+
case "parallelogram":
|
|
16136
|
+
return polygon([
|
|
16137
|
+
[x + width * 0.22, y],
|
|
16138
|
+
[right, y],
|
|
16139
|
+
[right - width * 0.22, bottom],
|
|
16140
|
+
[x, bottom]
|
|
16141
|
+
]);
|
|
16142
|
+
case "trapezoid":
|
|
16143
|
+
return polygon([
|
|
16144
|
+
[x + width * 0.2, y],
|
|
16145
|
+
[right - width * 0.2, y],
|
|
16146
|
+
[right, bottom],
|
|
16147
|
+
[x, bottom]
|
|
16148
|
+
]);
|
|
16149
|
+
case "nonIsoscelesTrapezoid":
|
|
16150
|
+
return polygon([
|
|
16151
|
+
[x + width * 0.08, y],
|
|
16152
|
+
[right - width * 0.28, y],
|
|
16153
|
+
[right, bottom],
|
|
16154
|
+
[x, bottom]
|
|
16155
|
+
]);
|
|
16156
|
+
case "pentagon":
|
|
16157
|
+
return regularPolygon(cx, cy, width * 0.48, height * 0.48, 5, -90);
|
|
16158
|
+
case "hexagon":
|
|
16159
|
+
return regularPolygon(cx, cy, width * 0.48, height * 0.48, 6, 0);
|
|
16160
|
+
case "heptagon":
|
|
16161
|
+
return regularPolygon(cx, cy, width * 0.48, height * 0.48, 7, -90);
|
|
16162
|
+
case "octagon":
|
|
16163
|
+
return regularPolygon(cx, cy, width * 0.48, height * 0.48, 8, 22.5);
|
|
16164
|
+
case "decagon":
|
|
16165
|
+
return regularPolygon(cx, cy, width * 0.48, height * 0.48, 10, -90);
|
|
16166
|
+
case "dodecagon":
|
|
16167
|
+
return regularPolygon(cx, cy, width * 0.48, height * 0.48, 12, -90);
|
|
16168
|
+
case "homePlate":
|
|
16169
|
+
return polygon([
|
|
16170
|
+
[x, y],
|
|
16171
|
+
[right - width * 0.22, y],
|
|
16172
|
+
[right, cy],
|
|
16173
|
+
[right - width * 0.22, bottom],
|
|
16174
|
+
[x, bottom]
|
|
16175
|
+
]);
|
|
16176
|
+
case "chevron":
|
|
16177
|
+
return polygon([
|
|
16178
|
+
[x, y],
|
|
16179
|
+
[right - width * 0.28, y],
|
|
16180
|
+
[right, cy],
|
|
16181
|
+
[right - width * 0.28, bottom],
|
|
16182
|
+
[x, bottom],
|
|
16183
|
+
[x + width * 0.28, cy]
|
|
16184
|
+
]);
|
|
16185
|
+
case "heart":
|
|
16186
|
+
return heartSegments(x, y, width, height);
|
|
16187
|
+
case "cloud":
|
|
16188
|
+
return cloudSegments(x, y, width, height);
|
|
16189
|
+
case "sun":
|
|
16190
|
+
return starSegments(cx, cy, width * 0.48, height * 0.48, 16, 0.72);
|
|
16191
|
+
case "moon":
|
|
16192
|
+
return moonSegments(x, y, width, height);
|
|
16193
|
+
case "smileyFace":
|
|
16194
|
+
return smileySegments(x, y, width, height);
|
|
16195
|
+
case "lightningBolt":
|
|
16196
|
+
return polygon([
|
|
16197
|
+
[x + width * 0.58, y],
|
|
16198
|
+
[x + width * 0.28, y + height * 0.44],
|
|
16199
|
+
[x + width * 0.48, y + height * 0.44],
|
|
16200
|
+
[x + width * 0.36, bottom],
|
|
16201
|
+
[x + width * 0.74, y + height * 0.36],
|
|
16202
|
+
[x + width * 0.52, y + height * 0.36]
|
|
16203
|
+
]);
|
|
16204
|
+
case "teardrop":
|
|
16205
|
+
return teardropSegments(x, y, width, height);
|
|
16206
|
+
case "noSmoking":
|
|
16207
|
+
return noSmokingSegments(x, y, width, height);
|
|
16208
|
+
case "donut":
|
|
16209
|
+
return donutSegments(cx, cy, width / 2, height / 2);
|
|
16210
|
+
case "can":
|
|
16211
|
+
return canSegments(x, y, width, height);
|
|
16212
|
+
case "cube":
|
|
16213
|
+
return cubeSegments(x, y, width, height);
|
|
16214
|
+
case "bevel":
|
|
16215
|
+
return bevelSegments(x, y, width, height);
|
|
16216
|
+
case "foldedCorner":
|
|
16217
|
+
return foldedCornerSegments(x, y, width, height);
|
|
16218
|
+
case "frame":
|
|
16219
|
+
return frameSegments(x, y, width, height);
|
|
16220
|
+
case "halfFrame":
|
|
16221
|
+
return halfFrameSegments(x, y, width, height);
|
|
16222
|
+
case "corner":
|
|
16223
|
+
return cornerSegments(x, y, width, height);
|
|
16224
|
+
case "diagStripe":
|
|
16225
|
+
return polygon([
|
|
16226
|
+
[x + width * 0.25, y],
|
|
16227
|
+
[right, y],
|
|
16228
|
+
[right - width * 0.25, bottom],
|
|
16229
|
+
[x, bottom]
|
|
16230
|
+
]);
|
|
16231
|
+
case "plaque":
|
|
16232
|
+
return plaqueSegments(x, y, width, height);
|
|
16233
|
+
case "plaqueTabs":
|
|
16234
|
+
case "squareTabs":
|
|
16235
|
+
case "cornerTabs":
|
|
16236
|
+
return tabbedRectSegments(preset, x, y, width, height);
|
|
16237
|
+
case "irregularSeal1":
|
|
16238
|
+
return starSegments(cx, cy, width * 0.48, height * 0.48, 18, 0.78);
|
|
16239
|
+
case "irregularSeal2":
|
|
16240
|
+
return starSegments(cx, cy, width * 0.48, height * 0.48, 14, 0.68);
|
|
16241
|
+
case "gear6":
|
|
16242
|
+
return starSegments(cx, cy, width * 0.48, height * 0.48, 12, 0.76);
|
|
16243
|
+
case "gear9":
|
|
16244
|
+
return starSegments(cx, cy, width * 0.48, height * 0.48, 18, 0.76);
|
|
16245
|
+
case "funnel":
|
|
16246
|
+
return polygon([
|
|
16247
|
+
[x, y],
|
|
16248
|
+
[right, y],
|
|
16249
|
+
[x + width * 0.6, y + height * 0.56],
|
|
16250
|
+
[x + width * 0.6, bottom],
|
|
16251
|
+
[x + width * 0.4, bottom],
|
|
16252
|
+
[x + width * 0.4, y + height * 0.56]
|
|
16253
|
+
]);
|
|
16254
|
+
case "leftBrace":
|
|
16255
|
+
case "rightBrace":
|
|
16256
|
+
case "bracePair":
|
|
16257
|
+
return braceSegments(preset, x, y, width, height);
|
|
16258
|
+
case "leftBracket":
|
|
16259
|
+
case "rightBracket":
|
|
16260
|
+
case "bracketPair":
|
|
16261
|
+
return bracketSegments(preset, x, y, width, height);
|
|
16262
|
+
case "mathPlus":
|
|
16263
|
+
return plusSegments(x, y, width, height);
|
|
16264
|
+
case "mathMinus":
|
|
16265
|
+
return polygon([
|
|
16266
|
+
[x, y + height * 0.42],
|
|
16267
|
+
[right, y + height * 0.42],
|
|
16268
|
+
[right, y + height * 0.58],
|
|
16269
|
+
[x, y + height * 0.58]
|
|
16270
|
+
]);
|
|
16271
|
+
case "mathMultiply":
|
|
16272
|
+
return xSegments(x, y, width, height);
|
|
16273
|
+
case "mathDivide":
|
|
16274
|
+
return mathDivideSegments(x, y, width, height);
|
|
16275
|
+
case "mathEqual":
|
|
16276
|
+
return mathEqualSegments(x, y, width, height);
|
|
16277
|
+
case "mathNotEqual":
|
|
16278
|
+
return mathNotEqualSegments(x, y, width, height);
|
|
16279
|
+
case "chartPlus":
|
|
16280
|
+
return plusSegments(x, y, width, height);
|
|
16281
|
+
case "chartX":
|
|
16282
|
+
return xSegments(x, y, width, height);
|
|
16283
|
+
case "chartStar":
|
|
16284
|
+
return starSegments(cx, cy, width * 0.48, height * 0.48, 5);
|
|
16285
|
+
case "ribbon":
|
|
16286
|
+
case "ribbon2":
|
|
16287
|
+
case "ellipseRibbon":
|
|
16288
|
+
case "ellipseRibbon2":
|
|
16289
|
+
case "leftRightRibbon":
|
|
16290
|
+
return ribbonSegments(preset, x, y, width, height);
|
|
16291
|
+
case "verticalScroll":
|
|
16292
|
+
case "horizontalScroll":
|
|
16293
|
+
return scrollSegments(preset, x, y, width, height);
|
|
16294
|
+
case "wave":
|
|
16295
|
+
case "doubleWave":
|
|
16296
|
+
return waveSegments(preset, x, y, width, height);
|
|
16297
|
+
case "rect":
|
|
16298
|
+
default:
|
|
16299
|
+
return rectSegments(x, y, width, height);
|
|
16300
|
+
}
|
|
16301
|
+
}
|
|
16302
|
+
function getPresetPathSegments(preset, x, y, width, height) {
|
|
16303
|
+
const key = isPresetGeometrySupported(preset) ? preset : "rect";
|
|
16304
|
+
return resolvePresetPathSegments(key, x, y, width, height);
|
|
16305
|
+
}
|
|
14950
16306
|
function buildPresetPath(preset, x, y, width, height) {
|
|
14951
16307
|
const path = new Path2D();
|
|
14952
16308
|
for (const segment of getPresetPathSegments(preset, x, y, width, height)) {
|
|
@@ -17160,7 +18516,7 @@ function getCaretRectFromSnapshot(snapshot, position2, paragraphOffset) {
|
|
|
17160
18516
|
);
|
|
17161
18517
|
return rectFromBox(slot.left, slot.top, 1, slot.height || line.height);
|
|
17162
18518
|
}
|
|
17163
|
-
var _tmpl$$N = /* @__PURE__ */ template(`<span class=oasis-outline-title>`), _tmpl$2$
|
|
18519
|
+
var _tmpl$$N = /* @__PURE__ */ template(`<span class=oasis-outline-title>`), _tmpl$2$w = /* @__PURE__ */ template(`<div class=oasis-outline-list>`), _tmpl$3$j = /* @__PURE__ */ template(`<div class=oasis-outline-panel><div class=oasis-outline-header><button class=oasis-outline-toggle><i>`), _tmpl$4$e = /* @__PURE__ */ template(`<div class=oasis-outline-empty>`), _tmpl$5$d = /* @__PURE__ */ template(`<div class=oasis-outline-item>`);
|
|
17164
18520
|
function OutlinePanel(props) {
|
|
17165
18521
|
const [collapsed, setCollapsed] = createSignal(props.defaultCollapsed ?? false);
|
|
17166
18522
|
const [items, setItems] = createSignal([]);
|
|
@@ -17245,7 +18601,7 @@ function OutlinePanel(props) {
|
|
|
17245
18601
|
return !collapsed();
|
|
17246
18602
|
},
|
|
17247
18603
|
get children() {
|
|
17248
|
-
var _el$6 = _tmpl$2$
|
|
18604
|
+
var _el$6 = _tmpl$2$w();
|
|
17249
18605
|
insert(_el$6, createComponent(Show, {
|
|
17250
18606
|
get when() {
|
|
17251
18607
|
return items().length > 0;
|
|
@@ -17302,7 +18658,7 @@ function OutlinePanel(props) {
|
|
|
17302
18658
|
})();
|
|
17303
18659
|
}
|
|
17304
18660
|
delegateEvents(["click"]);
|
|
17305
|
-
var _tmpl$$M = /* @__PURE__ */ template(`<div class=oasis-editor-toolbar-overflow-manager style="display:flex;align-items:center;flex:1 1 0%;min-width:0;position:relative;margin-right:8px"><button type=button class="oasis-editor-tool-button oasis-editor-tool-button-dropdown oasis-editor-toolbar-more-measure"aria-hidden=true tabindex=-1 style=position:absolute;visibility:hidden;pointer-events:none;right:0><i data-lucide=ellipsis></i></button><div style="display:flex;align-items:center;gap:8px;flex:1 1 0;min-width:0;overflow:hidden"></div><div style=flex-shrink:0;padding-left:8px;padding-right:16px;align-items:center><button type=button class="oasis-editor-tool-button oasis-editor-tool-button-dropdown"data-testid=editor-toolbar-overflow-dropdown><i data-lucide=ellipsis></i></button></div><div class="oasis-editor-toolbar-overflow-dropdown-menu oasis-editor-toolbar-overflow-menu"style="flex-direction:row;flex-wrap:wrap;align-items:center;gap:4px;padding:8px;background:var(--oasis-paper);border:1px solid var(--oasis-toolbar-border);border-radius:var(--oasis-radius);box-shadow:0 4px 12px rgba(0, 0, 0, 0.15);max-width:calc(100vw - 16px);overflow-x:hidden;overflow-y:auto">`), _tmpl$2$
|
|
18661
|
+
var _tmpl$$M = /* @__PURE__ */ template(`<div class=oasis-editor-toolbar-overflow-manager style="display:flex;align-items:center;flex:1 1 0%;min-width:0;position:relative;margin-right:8px"><button type=button class="oasis-editor-tool-button oasis-editor-tool-button-dropdown oasis-editor-toolbar-more-measure"aria-hidden=true tabindex=-1 style=position:absolute;visibility:hidden;pointer-events:none;right:0><i data-lucide=ellipsis></i></button><div style="display:flex;align-items:center;gap:8px;flex:1 1 0;min-width:0;overflow:hidden"></div><div style=flex-shrink:0;padding-left:8px;padding-right:16px;align-items:center><button type=button class="oasis-editor-tool-button oasis-editor-tool-button-dropdown"data-testid=editor-toolbar-overflow-dropdown><i data-lucide=ellipsis></i></button></div><div class="oasis-editor-toolbar-overflow-dropdown-menu oasis-editor-toolbar-overflow-menu"style="flex-direction:row;flex-wrap:wrap;align-items:center;gap:4px;padding:8px;background:var(--oasis-paper);border:1px solid var(--oasis-toolbar-border);border-radius:var(--oasis-radius);box-shadow:0 4px 12px rgba(0, 0, 0, 0.15);max-width:calc(100vw - 16px);overflow-x:hidden;overflow-y:auto">`), _tmpl$2$v = /* @__PURE__ */ template(`<div class=oasis-editor-toolbar-item-wrapper style=display:flex;align-items:center;flex-shrink:0>`);
|
|
17306
18662
|
function ToolbarOverflowManager(props) {
|
|
17307
18663
|
const [overflowCount, setOverflowCount] = createSignal(0);
|
|
17308
18664
|
const [menuOpen, setMenuOpen] = createSignal(false);
|
|
@@ -17457,7 +18813,7 @@ function ToolbarOverflowManager(props) {
|
|
|
17457
18813
|
return items();
|
|
17458
18814
|
},
|
|
17459
18815
|
children: (item) => (() => {
|
|
17460
|
-
var _el$7 = _tmpl$2$
|
|
18816
|
+
var _el$7 = _tmpl$2$v();
|
|
17461
18817
|
insert(_el$7, item);
|
|
17462
18818
|
return _el$7;
|
|
17463
18819
|
})()
|
|
@@ -17533,12 +18889,12 @@ function resolveLabel(item, api) {
|
|
|
17533
18889
|
if (item.labelKey) return api.t(item.labelKey);
|
|
17534
18890
|
return void 0;
|
|
17535
18891
|
}
|
|
17536
|
-
var _tmpl$$L = /* @__PURE__ */ template(`<span>`), _tmpl$2$
|
|
18892
|
+
var _tmpl$$L = /* @__PURE__ */ template(`<span>`), _tmpl$2$u = /* @__PURE__ */ template(`<button type=button>`);
|
|
17537
18893
|
function Button$1(props) {
|
|
17538
|
-
const [local, others] = splitProps(props, ["icon", "label", "active", "tooltip", "wide", "aria-label", "class", "classList"]);
|
|
18894
|
+
const [local, others] = splitProps(props, ["icon", "label", "active", "tooltip", "wide", "ribbonSize", "aria-label", "class", "classList"]);
|
|
17539
18895
|
const ariaLabel = () => local["aria-label"] || local.tooltip || local.label || "";
|
|
17540
18896
|
return (() => {
|
|
17541
|
-
var _el$ = _tmpl$2$
|
|
18897
|
+
var _el$ = _tmpl$2$u();
|
|
17542
18898
|
spread(_el$, mergeProps({
|
|
17543
18899
|
get ["class"]() {
|
|
17544
18900
|
return `oasis-editor-tool-button ${local.class || ""}`;
|
|
@@ -17547,6 +18903,7 @@ function Button$1(props) {
|
|
|
17547
18903
|
return {
|
|
17548
18904
|
"oasis-editor-tool-button-active": local.active,
|
|
17549
18905
|
"oasis-editor-tool-button-wide": local.wide,
|
|
18906
|
+
"oasis-editor-tool-button-ribbon-large": local.ribbonSize === "large",
|
|
17550
18907
|
...local.classList
|
|
17551
18908
|
};
|
|
17552
18909
|
},
|
|
@@ -17725,12 +19082,12 @@ function Popover(props) {
|
|
|
17725
19082
|
}
|
|
17726
19083
|
})];
|
|
17727
19084
|
}
|
|
17728
|
-
var _tmpl$$J = /* @__PURE__ */ template(`<div>`), _tmpl$2$
|
|
19085
|
+
var _tmpl$$J = /* @__PURE__ */ template(`<div>`), _tmpl$2$t = /* @__PURE__ */ template(`<div class=oasis-editor-toolbar-dropdown>`), _tmpl$3$i = /* @__PURE__ */ template(`<i>`), _tmpl$4$d = /* @__PURE__ */ template(`<span class=oasis-editor-tool-button-label>`), _tmpl$5$c = /* @__PURE__ */ template(`<i data-lucide=chevron-down class=oasis-editor-dropdown-chevron>`), _tmpl$6$6 = /* @__PURE__ */ template(`<button type=button class="oasis-editor-tool-button oasis-editor-tool-button-dropdown"aria-haspopup=menu>`);
|
|
17729
19086
|
function Menu(props) {
|
|
17730
19087
|
const [open, setOpen] = createSignal(false);
|
|
17731
19088
|
const ariaLabel = () => props.tooltip || props.label || "";
|
|
17732
19089
|
return (() => {
|
|
17733
|
-
var _el$ = _tmpl$2$
|
|
19090
|
+
var _el$ = _tmpl$2$t();
|
|
17734
19091
|
insert(_el$, createComponent(Popover, {
|
|
17735
19092
|
get open() {
|
|
17736
19093
|
return open();
|
|
@@ -17777,13 +19134,14 @@ function Menu(props) {
|
|
|
17777
19134
|
}
|
|
17778
19135
|
}), null);
|
|
17779
19136
|
createRenderEffect((_p$) => {
|
|
17780
|
-
var _v$ = !!(props.active || api.open), _v$2 = props.
|
|
19137
|
+
var _v$ = !!(props.active || api.open), _v$2 = !!(props.ribbonSize === "large"), _v$3 = props.disabled, _v$4 = props.tooltip, _v$5 = ariaLabel(), _v$6 = api.open, _v$7 = props.testId;
|
|
17781
19138
|
_v$ !== _p$.e && _el$3.classList.toggle("oasis-editor-tool-button-active", _p$.e = _v$);
|
|
17782
|
-
_v$2 !== _p$.t &&
|
|
17783
|
-
_v$3 !== _p$.a &&
|
|
17784
|
-
_v$4 !== _p$.o && setAttribute(_el$3, "
|
|
17785
|
-
_v$5 !== _p$.i && setAttribute(_el$3, "aria-
|
|
17786
|
-
_v$6 !== _p$.n && setAttribute(_el$3, "
|
|
19139
|
+
_v$2 !== _p$.t && _el$3.classList.toggle("oasis-editor-tool-button-ribbon-large", _p$.t = _v$2);
|
|
19140
|
+
_v$3 !== _p$.a && (_el$3.disabled = _p$.a = _v$3);
|
|
19141
|
+
_v$4 !== _p$.o && setAttribute(_el$3, "title", _p$.o = _v$4);
|
|
19142
|
+
_v$5 !== _p$.i && setAttribute(_el$3, "aria-label", _p$.i = _v$5);
|
|
19143
|
+
_v$6 !== _p$.n && setAttribute(_el$3, "aria-expanded", _p$.n = _v$6);
|
|
19144
|
+
_v$7 !== _p$.s && setAttribute(_el$3, "data-testid", _p$.s = _v$7);
|
|
17787
19145
|
return _p$;
|
|
17788
19146
|
}, {
|
|
17789
19147
|
e: void 0,
|
|
@@ -17791,7 +19149,8 @@ function Menu(props) {
|
|
|
17791
19149
|
a: void 0,
|
|
17792
19150
|
o: void 0,
|
|
17793
19151
|
i: void 0,
|
|
17794
|
-
n: void 0
|
|
19152
|
+
n: void 0,
|
|
19153
|
+
s: void 0
|
|
17795
19154
|
});
|
|
17796
19155
|
return _el$3;
|
|
17797
19156
|
})(),
|
|
@@ -17919,7 +19278,7 @@ function SplitButton(props) {
|
|
|
17919
19278
|
});
|
|
17920
19279
|
}
|
|
17921
19280
|
delegateEvents(["click"]);
|
|
17922
|
-
var _tmpl$$F = /* @__PURE__ */ template(`<i data-lucide=type>`), _tmpl$2$
|
|
19281
|
+
var _tmpl$$F = /* @__PURE__ */ template(`<i data-lucide=type>`), _tmpl$2$s = /* @__PURE__ */ template(`<button type=button class=oasis-editor-color-menu-action role=menuitem><span class=oasis-editor-color-menu-action-swatch></span><span>`), _tmpl$3$h = /* @__PURE__ */ template(`<div class=oasis-editor-color-menu-section><div class=oasis-editor-color-menu-heading></div><div class=oasis-editor-color-theme-grid>`), _tmpl$4$c = /* @__PURE__ */ template(`<div class=oasis-editor-color-menu-section><div class=oasis-editor-color-menu-heading></div><div class=oasis-editor-color-standard-grid>`), _tmpl$5$b = /* @__PURE__ */ template(`<button type=button class=oasis-editor-color-menu-action role=menuitem><span class="oasis-editor-color-menu-action-swatch oasis-editor-color-menu-more-swatch"></span><span>`), _tmpl$6$5 = /* @__PURE__ */ template(`<input type=color class=oasis-editor-color-custom-input>`), _tmpl$7$2 = /* @__PURE__ */ template(`<span class=oasis-editor-color-split-icon><i></i><span class=oasis-editor-color-split-indicator>`), _tmpl$8$1 = /* @__PURE__ */ template(`<i data-lucide=slash>`), _tmpl$9 = /* @__PURE__ */ template(`<div class=oasis-editor-color-theme-column>`), _tmpl$0 = /* @__PURE__ */ template(`<button type=button class=oasis-editor-color-swatch>`);
|
|
17923
19282
|
const normalizeColor = (value) => (value == null ? void 0 : value.trim().toLowerCase()) ?? "";
|
|
17924
19283
|
function ColorPicker(props) {
|
|
17925
19284
|
const [isOpen, setIsOpen] = createSignal(false);
|
|
@@ -17984,7 +19343,7 @@ function ColorPicker(props) {
|
|
|
17984
19343
|
return clearLabel();
|
|
17985
19344
|
},
|
|
17986
19345
|
get children() {
|
|
17987
|
-
var _el$ = _tmpl$2$
|
|
19346
|
+
var _el$ = _tmpl$2$s(), _el$2 = _el$.firstChild, _el$4 = _el$2.nextSibling;
|
|
17988
19347
|
_el$.$$click = () => applyColor(null);
|
|
17989
19348
|
insert(_el$2, createComponent(Show, {
|
|
17990
19349
|
get when() {
|
|
@@ -18107,7 +19466,7 @@ function ColorPicker(props) {
|
|
|
18107
19466
|
});
|
|
18108
19467
|
}
|
|
18109
19468
|
delegateEvents(["click", "input"]);
|
|
18110
|
-
var _tmpl$$E = /* @__PURE__ */ template(`<div class=oasis-editor-table-grid-picker-status>`), _tmpl$2$
|
|
19469
|
+
var _tmpl$$E = /* @__PURE__ */ template(`<div class=oasis-editor-table-grid-picker-status>`), _tmpl$2$r = /* @__PURE__ */ template(`<div class=oasis-editor-table-grid-picker-grid>`), _tmpl$3$g = /* @__PURE__ */ template(`<div class=oasis-editor-toolbar-dropdown>`), _tmpl$4$b = /* @__PURE__ */ template(`<button type=button class=oasis-editor-tool-button><i>`), _tmpl$5$a = /* @__PURE__ */ template(`<button type=button class=oasis-editor-table-grid-picker-cell>`);
|
|
18111
19470
|
function GridPicker(props) {
|
|
18112
19471
|
const [isOpen, setIsOpen] = createSignal(false);
|
|
18113
19472
|
const [hover, setHover] = createSignal({
|
|
@@ -18219,7 +19578,7 @@ function GridPicker(props) {
|
|
|
18219
19578
|
insert(_el$2, statusLabel);
|
|
18220
19579
|
return _el$2;
|
|
18221
19580
|
})(), (() => {
|
|
18222
|
-
var _el$3 = _tmpl$2$
|
|
19581
|
+
var _el$3 = _tmpl$2$r();
|
|
18223
19582
|
insert(_el$3, createComponent(For, {
|
|
18224
19583
|
get each() {
|
|
18225
19584
|
return rows();
|
|
@@ -18319,7 +19678,7 @@ const DEFAULT_PALETTE = {
|
|
|
18319
19678
|
standardColors: STANDARD_COLORS,
|
|
18320
19679
|
allowCustom: true
|
|
18321
19680
|
};
|
|
18322
|
-
var _tmpl$$D = /* @__PURE__ */ template(`<option value>`), _tmpl$2$
|
|
19681
|
+
var _tmpl$$D = /* @__PURE__ */ template(`<option value>`), _tmpl$2$q = /* @__PURE__ */ template(`<option>`);
|
|
18323
19682
|
function renderMenuContent(content, api) {
|
|
18324
19683
|
if (content.kind === "custom") {
|
|
18325
19684
|
return content.render(api);
|
|
@@ -18346,6 +19705,9 @@ function RenderButton(props) {
|
|
|
18346
19705
|
get wide() {
|
|
18347
19706
|
return props.item.wide;
|
|
18348
19707
|
},
|
|
19708
|
+
get ribbonSize() {
|
|
19709
|
+
return props.item.ribbonSize;
|
|
19710
|
+
},
|
|
18349
19711
|
get active() {
|
|
18350
19712
|
return b.active();
|
|
18351
19713
|
},
|
|
@@ -18373,6 +19735,9 @@ function RenderToggle(props) {
|
|
|
18373
19735
|
get wide() {
|
|
18374
19736
|
return props.item.wide;
|
|
18375
19737
|
},
|
|
19738
|
+
get ribbonSize() {
|
|
19739
|
+
return props.item.ribbonSize;
|
|
19740
|
+
},
|
|
18376
19741
|
get active() {
|
|
18377
19742
|
return b.active();
|
|
18378
19743
|
},
|
|
@@ -18412,6 +19777,9 @@ function RenderMenu(props) {
|
|
|
18412
19777
|
get hideChevron() {
|
|
18413
19778
|
return props.item.hideChevron;
|
|
18414
19779
|
},
|
|
19780
|
+
get ribbonSize() {
|
|
19781
|
+
return props.item.ribbonSize;
|
|
19782
|
+
},
|
|
18415
19783
|
get panelClass() {
|
|
18416
19784
|
return props.item.panelClass;
|
|
18417
19785
|
},
|
|
@@ -18501,7 +19869,7 @@ function RenderSelect(props) {
|
|
|
18501
19869
|
return props.item.options(props.api);
|
|
18502
19870
|
},
|
|
18503
19871
|
children: (option) => (() => {
|
|
18504
|
-
var _el$2 = _tmpl$2$
|
|
19872
|
+
var _el$2 = _tmpl$2$q();
|
|
18505
19873
|
insert(_el$2, () => option.label);
|
|
18506
19874
|
createRenderEffect(() => _el$2.value = option.value);
|
|
18507
19875
|
return _el$2;
|
|
@@ -18646,7 +20014,15 @@ function ToolbarItemRenderer(props) {
|
|
|
18646
20014
|
}
|
|
18647
20015
|
})
|
|
18648
20016
|
}));
|
|
18649
|
-
createRenderEffect((
|
|
20017
|
+
createRenderEffect((_p$) => {
|
|
20018
|
+
var _v$ = !!("ribbonSize" in props.item && props.item.ribbonSize === "large"), _v$2 = binding.visible() ? "flex" : "none";
|
|
20019
|
+
_v$ !== _p$.e && _el$.classList.toggle("oasis-editor-toolbar-item-ribbon-large", _p$.e = _v$);
|
|
20020
|
+
_v$2 !== _p$.t && setStyleProperty(_el$, "display", _p$.t = _v$2);
|
|
20021
|
+
return _p$;
|
|
20022
|
+
}, {
|
|
20023
|
+
e: void 0,
|
|
20024
|
+
t: void 0
|
|
20025
|
+
});
|
|
18650
20026
|
return _el$;
|
|
18651
20027
|
})();
|
|
18652
20028
|
}
|
|
@@ -18742,8 +20118,12 @@ function normalizeRibbonGroup(group) {
|
|
|
18742
20118
|
function normalizeRibbonRow(row) {
|
|
18743
20119
|
return row === 2 ? 2 : DEFAULT_RIBBON_ROW;
|
|
18744
20120
|
}
|
|
20121
|
+
function isLargeRibbonItem(item) {
|
|
20122
|
+
return "ribbonSize" in item && item.ribbonSize === "large";
|
|
20123
|
+
}
|
|
18745
20124
|
function ribbonGroupLabel(group) {
|
|
18746
|
-
|
|
20125
|
+
const key = GROUP_LABEL_KEYS[group];
|
|
20126
|
+
return key ? t(key) : group;
|
|
18747
20127
|
}
|
|
18748
20128
|
function buildRibbonGroups(items, tab) {
|
|
18749
20129
|
const groups = /* @__PURE__ */ new Map();
|
|
@@ -18760,17 +20140,22 @@ function buildRibbonGroups(items, tab) {
|
|
|
18760
20140
|
group = {
|
|
18761
20141
|
id: groupId,
|
|
18762
20142
|
label: ribbonGroupLabel(groupId),
|
|
20143
|
+
largeItems: [],
|
|
18763
20144
|
rows: { 1: [], 2: [] },
|
|
18764
20145
|
order: groupOrder
|
|
18765
20146
|
};
|
|
18766
20147
|
groups.set(groupId, group);
|
|
18767
20148
|
}
|
|
18768
20149
|
group.order = Math.min(group.order, groupOrder);
|
|
18769
|
-
|
|
20150
|
+
if (isLargeRibbonItem(item)) {
|
|
20151
|
+
group.largeItems.push(item);
|
|
20152
|
+
} else {
|
|
20153
|
+
group.rows[row].push(item);
|
|
20154
|
+
}
|
|
18770
20155
|
});
|
|
18771
20156
|
return Array.from(groups.values()).sort((a, b) => a.order - b.order);
|
|
18772
20157
|
}
|
|
18773
|
-
var _tmpl$$B = /* @__PURE__ */ template(`<div class=oasis-editor-ribbon-tabs role=tablist>`), _tmpl$2$
|
|
20158
|
+
var _tmpl$$B = /* @__PURE__ */ template(`<div class=oasis-editor-ribbon-tabs role=tablist>`), _tmpl$2$p = /* @__PURE__ */ template(`<button type=button class=oasis-editor-ribbon-tab role=tab>`);
|
|
18774
20159
|
function RibbonTabs(props) {
|
|
18775
20160
|
const tabs = RIBBON_TAB_DEFINITIONS;
|
|
18776
20161
|
const moveTab = (current, delta) => {
|
|
@@ -18783,7 +20168,7 @@ function RibbonTabs(props) {
|
|
|
18783
20168
|
insert(_el$, createComponent(For, {
|
|
18784
20169
|
each: tabs,
|
|
18785
20170
|
children: (tab) => (() => {
|
|
18786
|
-
var _el$2 = _tmpl$2$
|
|
20171
|
+
var _el$2 = _tmpl$2$p();
|
|
18787
20172
|
_el$2.$$keydown = (event) => {
|
|
18788
20173
|
if (event.key === "ArrowRight") {
|
|
18789
20174
|
event.preventDefault();
|
|
@@ -18843,11 +20228,31 @@ function RibbonRow(props) {
|
|
|
18843
20228
|
return _el$;
|
|
18844
20229
|
})();
|
|
18845
20230
|
}
|
|
18846
|
-
var _tmpl$$z = /* @__PURE__ */ template(`<section class=oasis-editor-ribbon-group><div class=oasis-editor-ribbon-group-rows></div><div class=oasis-editor-ribbon-group-label>`);
|
|
20231
|
+
var _tmpl$$z = /* @__PURE__ */ template(`<div class=oasis-editor-ribbon-large-items>`), _tmpl$2$o = /* @__PURE__ */ template(`<section class=oasis-editor-ribbon-group><div class=oasis-editor-ribbon-group-rows><div class=oasis-editor-ribbon-normal-rows></div></div><div class=oasis-editor-ribbon-group-label>`);
|
|
18847
20232
|
function RibbonGroup(props) {
|
|
18848
20233
|
return (() => {
|
|
18849
|
-
var _el$ = _tmpl
|
|
18850
|
-
insert(_el$2, createComponent(
|
|
20234
|
+
var _el$ = _tmpl$2$o(), _el$2 = _el$.firstChild, _el$4 = _el$2.firstChild, _el$5 = _el$2.nextSibling;
|
|
20235
|
+
insert(_el$2, createComponent(Show, {
|
|
20236
|
+
get when() {
|
|
20237
|
+
return props.group.largeItems.length > 0;
|
|
20238
|
+
},
|
|
20239
|
+
get children() {
|
|
20240
|
+
var _el$3 = _tmpl$$z();
|
|
20241
|
+
insert(_el$3, createComponent(For, {
|
|
20242
|
+
get each() {
|
|
20243
|
+
return props.group.largeItems;
|
|
20244
|
+
},
|
|
20245
|
+
children: (item) => createComponent(ToolbarItemRenderer, {
|
|
20246
|
+
item,
|
|
20247
|
+
get api() {
|
|
20248
|
+
return props.api;
|
|
20249
|
+
}
|
|
20250
|
+
})
|
|
20251
|
+
}));
|
|
20252
|
+
return _el$3;
|
|
20253
|
+
}
|
|
20254
|
+
}), _el$4);
|
|
20255
|
+
insert(_el$4, createComponent(RibbonRow, {
|
|
18851
20256
|
get items() {
|
|
18852
20257
|
return props.group.rows[1];
|
|
18853
20258
|
},
|
|
@@ -18855,7 +20260,7 @@ function RibbonGroup(props) {
|
|
|
18855
20260
|
return props.api;
|
|
18856
20261
|
}
|
|
18857
20262
|
}), null);
|
|
18858
|
-
insert(_el$
|
|
20263
|
+
insert(_el$4, createComponent(RibbonRow, {
|
|
18859
20264
|
get items() {
|
|
18860
20265
|
return props.group.rows[2];
|
|
18861
20266
|
},
|
|
@@ -18863,7 +20268,7 @@ function RibbonGroup(props) {
|
|
|
18863
20268
|
return props.api;
|
|
18864
20269
|
}
|
|
18865
20270
|
}), null);
|
|
18866
|
-
insert(_el$
|
|
20271
|
+
insert(_el$5, () => props.group.label);
|
|
18867
20272
|
createRenderEffect((_p$) => {
|
|
18868
20273
|
var _v$ = props.group.id, _v$2 = props.group.label;
|
|
18869
20274
|
_v$ !== _p$.e && setAttribute(_el$, "data-ribbon-group", _p$.e = _v$);
|
|
@@ -32017,10 +33422,6 @@ async function parseTextBox(drawing, parseNestedBlocks) {
|
|
|
32017
33422
|
if (!wsp) {
|
|
32018
33423
|
return void 0;
|
|
32019
33424
|
}
|
|
32020
|
-
const txbxContent = findElementDeep(wsp, "txbxContent");
|
|
32021
|
-
if (!txbxContent) {
|
|
32022
|
-
return void 0;
|
|
32023
|
-
}
|
|
32024
33425
|
const container = findDrawingContainer(drawing);
|
|
32025
33426
|
const drawingBox = (container == null ? void 0 : container.element) ?? drawing;
|
|
32026
33427
|
const extent = findElementDeep(drawingBox, "extent");
|
|
@@ -32030,7 +33431,8 @@ async function parseTextBox(drawing, parseNestedBlocks) {
|
|
|
32030
33431
|
const name = docPr ? getAttributeValue(docPr, "name") : null;
|
|
32031
33432
|
const alt = docPr ? getAttributeValue(docPr, "descr") ?? getAttributeValue(docPr, "title") : null;
|
|
32032
33433
|
const floating = (container == null ? void 0 : container.kind) === "anchor" ? parseFloatingLayout(container.element) : void 0;
|
|
32033
|
-
const
|
|
33434
|
+
const txbxContent = findElementDeep(wsp, "txbxContent");
|
|
33435
|
+
const blocks = txbxContent && parseNestedBlocks ? await parseNestedBlocks(txbxContent) : [];
|
|
32034
33436
|
const shape = parseTextBoxShape(wsp);
|
|
32035
33437
|
const body = parseTextBoxBody(wsp);
|
|
32036
33438
|
const rotation = parseTextBoxRotation(wsp);
|
|
@@ -34388,7 +35790,7 @@ function importDocxInWorker(buffer, options = {}) {
|
|
|
34388
35790
|
const worker = new Worker(
|
|
34389
35791
|
new URL(
|
|
34390
35792
|
/* @vite-ignore */
|
|
34391
|
-
"" + new URL("assets/importDocxWorker-
|
|
35793
|
+
"" + new URL("assets/importDocxWorker-DcrboJNQ.js", import.meta.url).href,
|
|
34392
35794
|
import.meta.url
|
|
34393
35795
|
),
|
|
34394
35796
|
{
|
|
@@ -37580,11 +38982,13 @@ function SectionGroup(props) {
|
|
|
37580
38982
|
const api = props.api;
|
|
37581
38983
|
return createComponent(Menu, {
|
|
37582
38984
|
icon: "layout-template",
|
|
38985
|
+
get label() {
|
|
38986
|
+
return t("section.orientation");
|
|
38987
|
+
},
|
|
37583
38988
|
testId: "editor-toolbar-section-dropdown",
|
|
37584
38989
|
get tooltip() {
|
|
37585
38990
|
return t("section.pageSetup");
|
|
37586
38991
|
},
|
|
37587
|
-
hideChevron: true,
|
|
37588
38992
|
panelClass: "oasis-editor-toolbar-panel",
|
|
37589
38993
|
keepMounted: true,
|
|
37590
38994
|
get children() {
|
|
@@ -38487,11 +39891,13 @@ function createDefaultToolbarPreset() {
|
|
|
38487
39891
|
items.push({
|
|
38488
39892
|
type: "custom",
|
|
38489
39893
|
id: "editor-toolbar-margins",
|
|
39894
|
+
ribbonSize: "large",
|
|
38490
39895
|
render: (api) => MarginsGroup({ api })
|
|
38491
39896
|
});
|
|
38492
39897
|
items.push({
|
|
38493
39898
|
type: "custom",
|
|
38494
39899
|
id: "editor-toolbar-section",
|
|
39900
|
+
ribbonSize: "large",
|
|
38495
39901
|
render: (api) => SectionGroup({ api })
|
|
38496
39902
|
});
|
|
38497
39903
|
return withDefaultRibbonPlacement(items);
|
|
@@ -38535,6 +39941,7 @@ const OASIS_TOOLBAR_ITEMS = {
|
|
|
38535
39941
|
lineSpacing: "editor-toolbar-line-spacing-control",
|
|
38536
39942
|
metrics: "editor-toolbar-metrics",
|
|
38537
39943
|
table: "editor-toolbar-table",
|
|
39944
|
+
margins: "editor-toolbar-margins",
|
|
38538
39945
|
section: "editor-toolbar-section"
|
|
38539
39946
|
};
|
|
38540
39947
|
const OASIS_MENU_ITEMS = {
|