@ibodr/draw 0.1.0 → 0.1.2
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/index.d.ts +409 -409
- package/dist/index.mjs +228 -296
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMaybeEditor, uniqueId, useValue, assert, useReactor, unsafe__withoutCapture, useContainer, debugFlags, objectMapValues, WeakCache, tltime, tlenv, track, useEditor, usePassThroughWheelEvents, useEditorComponents, preventDefault, PageRecordType, setPointerCapture, releasePointerCapture, usePresence, USER_COLORS, modulate, isEqual, approximately, Box, debounce, isEqualAllowingForFloatingPointErrors, createComputedCache as createComputedCache$1, useUniqueSafeId, useEvent, toRichText, Vec, getChangedKeys, useSharedSafeId, useIsEditing, toDomPrecision, LruCache, HTMLContainer, MediaHelpers, Image, getGlobalDocument,
|
|
1
|
+
import { useMaybeEditor, uniqueId, useValue, assert, useReactor, unsafe__withoutCapture, useContainer, debugFlags, objectMapValues, WeakCache, tltime, tlenv, track, useEditor, usePassThroughWheelEvents, useEditorComponents, preventDefault, PageRecordType, setPointerCapture, releasePointerCapture, usePresence, USER_COLORS, modulate, isEqual, approximately, Box, debounce, isEqualAllowingForFloatingPointErrors, createComputedCache as createComputedCache$1, useUniqueSafeId, useEvent, toRichText, Vec, getChangedKeys, useSharedSafeId, useIsEditing, toDomPrecision, LruCache, HTMLContainer, MediaHelpers, Image, getGlobalDocument, defaultUserPreferences, useShallowArrayIdentity, mergeArraysAndReplaceDefaults, useDrStore, Editor as Editor$1, T, registerDrawLibraryVersion, safeParseUrl, useGlobalMenuIsOpen, getFromLocalStorage, setInLocalStorage, getIndexAbove, getIndexBelow, getIndexBetween, exhaustiveSwitchError, getOwnerWindow, DefaultColorStyle, getColorValue, tlmenus, SharedStyleMap, DefaultDashStyle, DefaultFillStyle, DefaultSizeStyle, kickoutOccludedShapes, usePassThroughMouseOverEvents, useAtom, react, lerp, isSafeFloat, Mat, isAccelKey, openWindow, Polyline2d, Arc2d, Edge2d, useSvgExportContext, useColorMode, getVerticesCountForArcLength, Group2d, assertExists, clamp, rng, canonicalizeRotation, getPolygonVertices, useDelaySvgExport, noop, getGlobalWindow, useShallowObjectIdentity, objectMapEntries, GeoShapeGeoStyle, ShapeUtil, textShapeProps, textShapeMigrations, Rectangle2d, getFontsFromRichText, resizeScaled, BaseBoxShapeUtil, bookmarkShapeProps, bookmarkShapeMigrations, drawShapeProps, drawShapeMigrations, Circle2d, Polygon2d, SVGContainer, last, geoShapeProps, geoShapeMigrations, EMPTY_ARRAY, noteShapeProps, noteShapeMigrations, DefaultFontFamilies, lineShapeProps, lineShapeMigrations, getIndices, sortByIndex, mapObjectMapValues, maybeSnapToGrid, ZERO_INDEX_KEY, BaseFrameLikeShapeUtil, frameShapeProps, frameShapeMigrations, compact, arrowShapeProps, arrowShapeMigrations, invLerp, structuredClone, highlightShapeProps, highlightShapeMigrations, tlenvReactive, embedShapeProps, embedShapeMigrations, resizeBox, imageShapeProps, imageShapeMigrations, createShapeId, Ellipse2d, videoShapeProps, videoShapeMigrations, BindingUtil, arrowBindingProps, arrowBindingMigrations, getOwnProperty, atom, DefaultSpinner, elementShouldCaptureKeys, minBy, DefaultFontStyle, DefaultTextAlignStyle, DefaultHorizontalAlignStyle, DefaultVerticalAlignStyle, ArrowShapeKindStyle, ArrowShapeArrowheadEndStyle, ArrowShapeArrowheadStartStyle, LineShapeSplineStyle, activeElementShouldCaptureKeys, Geometry2dFilters, pointInPolygon, intersectLineSegmentPolygon, centerOfCircleFromThreePoints, clockwiseAngleDist, counterClockwiseAngleDist, PI, getPointerInfo, intersectCircleCircle, HALF_PI, suffixSafeId, getPerfectDashProps, Geometry2d, CubicBezier2d, LANGUAGES, usePeerIds, normalizeWheel, getIndicesBetween, AssetRecordType, getHashForString, precise, average, b64Vecs, computed, objectMapKeys, intersectLineSegmentCircle, EASINGS, fetch, FileHelpers, isFontEntry, PI2, isDefined, hardResetEditor, sanitizeId, Result, transact, isShapeId, richTextValidator, featureFlags, useQuickReactor, objectMapFromEntries, uniq, ShapeIndicatorOverlayUtil, createBindingId, getHashForBuffer, bind, getPointOnCircle, AssetUtil, bookmarkAssetProps, bookmarkAssetMigrations, clampToBrowserMaxCanvasSize, imageAssetProps, imageAssetMigrations, DEFAULT_SUPPORTED_IMAGE_TYPES, videoAssetProps, videoAssetMigrations, DEFAULT_SUPPORT_VIDEO_TYPES, OverlayUtil, getOverlayDisplayValues, getSvgPathFromPoints, strokeShapeIndicators, SIDES, rangeIntersection, StateNode, BaseBoxShapeTool, DrawEditor, useOnMount, createDrStore, MigrationFailureReason, toFixed, snapAngle, isPageId, polygonsIntersect, areAnglesCompatible, getRotationSnapshot, applyRotationToSnapshotShapes, shortAngleDist, degreesToRadians, warnOnce, LoadingScreen as LoadingScreen$1, SIN, throttle } from '@ibodr/editor';
|
|
2
2
|
export * from '@ibodr/editor';
|
|
3
3
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import * as React4 from 'react';
|
|
@@ -1560,36 +1560,6 @@ function useA11y() {
|
|
|
1560
1560
|
}
|
|
1561
1561
|
return ctx;
|
|
1562
1562
|
}
|
|
1563
|
-
var AssetUrlsContext = createContext(null);
|
|
1564
|
-
function AssetUrlsProvider({
|
|
1565
|
-
assetUrls,
|
|
1566
|
-
children
|
|
1567
|
-
}) {
|
|
1568
|
-
useEffect(() => {
|
|
1569
|
-
for (const src of Object.values(assetUrls.icons)) {
|
|
1570
|
-
if (!src) continue;
|
|
1571
|
-
const image = Image();
|
|
1572
|
-
image.crossOrigin = "anonymous";
|
|
1573
|
-
image.src = src;
|
|
1574
|
-
image.decode().catch(noop);
|
|
1575
|
-
}
|
|
1576
|
-
for (const src of Object.values(assetUrls.embedIcons)) {
|
|
1577
|
-
if (!src) continue;
|
|
1578
|
-
const image = Image();
|
|
1579
|
-
image.crossOrigin = "anonymous";
|
|
1580
|
-
image.src = src;
|
|
1581
|
-
image.decode().catch(noop);
|
|
1582
|
-
}
|
|
1583
|
-
}, [assetUrls]);
|
|
1584
|
-
return /* @__PURE__ */ jsx(AssetUrlsContext.Provider, { value: assetUrls, children });
|
|
1585
|
-
}
|
|
1586
|
-
function useAssetUrls() {
|
|
1587
|
-
const assetUrls = useContext(AssetUrlsContext);
|
|
1588
|
-
if (!assetUrls) {
|
|
1589
|
-
throw new Error("useAssetUrls must be used within an AssetUrlsProvider");
|
|
1590
|
-
}
|
|
1591
|
-
return assetUrls;
|
|
1592
|
-
}
|
|
1593
1563
|
|
|
1594
1564
|
// src/lib/ui/hooks/useTranslation/defaultTranslation.ts
|
|
1595
1565
|
var DEFAULT_TRANSLATION = {
|
|
@@ -2096,41 +2066,19 @@ var EN_TRANSLATION = {
|
|
|
2096
2066
|
messages: DEFAULT_TRANSLATION,
|
|
2097
2067
|
dir: "ltr"
|
|
2098
2068
|
};
|
|
2099
|
-
|
|
2100
|
-
const mainRes = await fetch(assetUrls.translations.en);
|
|
2101
|
-
if (!mainRes.ok) {
|
|
2102
|
-
console.warn(`No main translations found.`);
|
|
2103
|
-
return EN_TRANSLATION;
|
|
2104
|
-
}
|
|
2069
|
+
function getTranslation(locale) {
|
|
2105
2070
|
if (locale === "en") {
|
|
2106
2071
|
return EN_TRANSLATION;
|
|
2107
2072
|
}
|
|
2108
2073
|
const language = LANGUAGES.find((t2) => t2.locale === locale);
|
|
2109
2074
|
if (!language) {
|
|
2110
|
-
console.warn(`No translation found for locale ${locale}`);
|
|
2111
|
-
return EN_TRANSLATION;
|
|
2112
|
-
}
|
|
2113
|
-
const res = await fetch(assetUrls.translations[language.locale]);
|
|
2114
|
-
const messages = await res.json();
|
|
2115
|
-
if (!messages) {
|
|
2116
|
-
console.warn(`No messages found for locale ${locale}`);
|
|
2117
2075
|
return EN_TRANSLATION;
|
|
2118
2076
|
}
|
|
2119
|
-
const missing = [];
|
|
2120
|
-
for (const key in EN_TRANSLATION.messages) {
|
|
2121
|
-
if (!messages[key]) {
|
|
2122
|
-
missing.push(key);
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
if (missing.length > 0 && true) {
|
|
2126
|
-
console.warn(`Language ${locale}: missing messages for keys:
|
|
2127
|
-
${missing.join("\n")}`);
|
|
2128
|
-
}
|
|
2129
2077
|
return {
|
|
2130
2078
|
locale,
|
|
2131
2079
|
label: language.label,
|
|
2132
2080
|
dir: RTL_LANGUAGES.has(language.locale) ? "rtl" : "ltr",
|
|
2133
|
-
messages:
|
|
2081
|
+
messages: EN_TRANSLATION.messages
|
|
2134
2082
|
};
|
|
2135
2083
|
}
|
|
2136
2084
|
var TranslationsContext = React4.createContext(null);
|
|
@@ -2146,43 +2094,16 @@ function DrawUiTranslationProvider({
|
|
|
2146
2094
|
locale,
|
|
2147
2095
|
children
|
|
2148
2096
|
}) {
|
|
2149
|
-
const
|
|
2150
|
-
|
|
2151
|
-
if (overrides
|
|
2097
|
+
const currentTranslation = React4.useMemo(() => {
|
|
2098
|
+
const translation = getTranslation(locale);
|
|
2099
|
+
if (overrides?.[locale]) {
|
|
2152
2100
|
return {
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
dir: "ltr",
|
|
2156
|
-
messages: { ...DEFAULT_TRANSLATION, ...overrides["en"] }
|
|
2101
|
+
...translation,
|
|
2102
|
+
messages: { ...translation.messages, ...overrides[locale] }
|
|
2157
2103
|
};
|
|
2158
2104
|
}
|
|
2159
|
-
return
|
|
2160
|
-
|
|
2161
|
-
label: "English",
|
|
2162
|
-
dir: "ltr",
|
|
2163
|
-
messages: DEFAULT_TRANSLATION
|
|
2164
|
-
};
|
|
2165
|
-
});
|
|
2166
|
-
React4.useEffect(() => {
|
|
2167
|
-
let isCancelled = false;
|
|
2168
|
-
async function loadTranslation() {
|
|
2169
|
-
const translation = await fetchTranslation(locale, getAssetUrl);
|
|
2170
|
-
if (translation && !isCancelled) {
|
|
2171
|
-
if (overrides && overrides[locale]) {
|
|
2172
|
-
setCurrentTranslation({
|
|
2173
|
-
...translation,
|
|
2174
|
-
messages: { ...translation.messages, ...overrides[locale] }
|
|
2175
|
-
});
|
|
2176
|
-
} else {
|
|
2177
|
-
setCurrentTranslation(translation);
|
|
2178
|
-
}
|
|
2179
|
-
}
|
|
2180
|
-
}
|
|
2181
|
-
loadTranslation();
|
|
2182
|
-
return () => {
|
|
2183
|
-
isCancelled = true;
|
|
2184
|
-
};
|
|
2185
|
-
}, [getAssetUrl, locale, overrides]);
|
|
2105
|
+
return translation;
|
|
2106
|
+
}, [locale, overrides]);
|
|
2186
2107
|
return /* @__PURE__ */ jsx(TranslationsContext.Provider, { value: currentTranslation, children });
|
|
2187
2108
|
}
|
|
2188
2109
|
function useTranslation() {
|
|
@@ -4737,6 +4658,36 @@ function fitFrameToContent(editor, id, opts = {}) {
|
|
|
4737
4658
|
function DrawUiButtonLabel({ children }) {
|
|
4738
4659
|
return /* @__PURE__ */ jsx("span", { className: "tlui-button__label", children });
|
|
4739
4660
|
}
|
|
4661
|
+
var AssetUrlsContext = createContext(null);
|
|
4662
|
+
function AssetUrlsProvider({
|
|
4663
|
+
assetUrls,
|
|
4664
|
+
children
|
|
4665
|
+
}) {
|
|
4666
|
+
useEffect(() => {
|
|
4667
|
+
for (const src of Object.values(assetUrls.icons)) {
|
|
4668
|
+
if (!src) continue;
|
|
4669
|
+
const image = Image();
|
|
4670
|
+
image.crossOrigin = "anonymous";
|
|
4671
|
+
image.src = src;
|
|
4672
|
+
image.decode().catch(noop);
|
|
4673
|
+
}
|
|
4674
|
+
for (const src of Object.values(assetUrls.embedIcons)) {
|
|
4675
|
+
if (!src) continue;
|
|
4676
|
+
const image = Image();
|
|
4677
|
+
image.crossOrigin = "anonymous";
|
|
4678
|
+
image.src = src;
|
|
4679
|
+
image.decode().catch(noop);
|
|
4680
|
+
}
|
|
4681
|
+
}, [assetUrls]);
|
|
4682
|
+
return /* @__PURE__ */ jsx(AssetUrlsContext.Provider, { value: assetUrls, children });
|
|
4683
|
+
}
|
|
4684
|
+
function useAssetUrls() {
|
|
4685
|
+
const assetUrls = useContext(AssetUrlsContext);
|
|
4686
|
+
if (!assetUrls) {
|
|
4687
|
+
throw new Error("useAssetUrls must be used within an AssetUrlsProvider");
|
|
4688
|
+
}
|
|
4689
|
+
return assetUrls;
|
|
4690
|
+
}
|
|
4740
4691
|
var DrawUiIcon = memo(function DrawUiIcon2({
|
|
4741
4692
|
label,
|
|
4742
4693
|
small,
|
|
@@ -35047,25 +34998,13 @@ var PlainTextLabel = React4__default.memo(function PlainTextLabel2({
|
|
|
35047
34998
|
);
|
|
35048
34999
|
});
|
|
35049
35000
|
var defaultEditorAssetUrls = {
|
|
35050
|
-
fonts: {
|
|
35051
|
-
draw_mono: `${getDefaultCdnBaseUrl()}/fonts/IBMPlexMono-Medium.woff2`,
|
|
35052
|
-
draw_mono_italic: `${getDefaultCdnBaseUrl()}/fonts/IBMPlexMono-MediumItalic.woff2`,
|
|
35053
|
-
draw_mono_bold: `${getDefaultCdnBaseUrl()}/fonts/IBMPlexMono-Bold.woff2`,
|
|
35054
|
-
draw_mono_italic_bold: `${getDefaultCdnBaseUrl()}/fonts/IBMPlexMono-BoldItalic.woff2`,
|
|
35055
|
-
draw_serif: `${getDefaultCdnBaseUrl()}/fonts/IBMPlexSerif-Medium.woff2`,
|
|
35056
|
-
draw_serif_italic: `${getDefaultCdnBaseUrl()}/fonts/IBMPlexSerif-MediumItalic.woff2`,
|
|
35057
|
-
draw_serif_bold: `${getDefaultCdnBaseUrl()}/fonts/IBMPlexSerif-Bold.woff2`,
|
|
35058
|
-
draw_serif_italic_bold: `${getDefaultCdnBaseUrl()}/fonts/IBMPlexSerif-BoldItalic.woff2`,
|
|
35059
|
-
draw_sans: `${getDefaultCdnBaseUrl()}/fonts/IBMPlexSans-Medium.woff2`,
|
|
35060
|
-
draw_sans_italic: `${getDefaultCdnBaseUrl()}/fonts/IBMPlexSans-MediumItalic.woff2`,
|
|
35061
|
-
draw_sans_bold: `${getDefaultCdnBaseUrl()}/fonts/IBMPlexSans-Bold.woff2`,
|
|
35062
|
-
draw_sans_italic_bold: `${getDefaultCdnBaseUrl()}/fonts/IBMPlexSans-BoldItalic.woff2`,
|
|
35063
|
-
draw_draw: `${getDefaultCdnBaseUrl()}/fonts/Shantell_Sans-Informal_Regular.woff2`,
|
|
35064
|
-
draw_draw_italic: `${getDefaultCdnBaseUrl()}/fonts/Shantell_Sans-Informal_Regular_Italic.woff2`,
|
|
35065
|
-
draw_draw_bold: `${getDefaultCdnBaseUrl()}/fonts/Shantell_Sans-Informal_Bold.woff2`,
|
|
35066
|
-
draw_draw_italic_bold: `${getDefaultCdnBaseUrl()}/fonts/Shantell_Sans-Informal_Bold_Italic.woff2`
|
|
35067
|
-
}
|
|
35001
|
+
fonts: {}
|
|
35068
35002
|
};
|
|
35003
|
+
function hasExternalFontUrls(fonts) {
|
|
35004
|
+
return Object.values(fonts ?? {}).some(
|
|
35005
|
+
(url) => typeof url === "string" && (url.startsWith("http://") || url.startsWith("https://"))
|
|
35006
|
+
);
|
|
35007
|
+
}
|
|
35069
35008
|
function setDefaultEditorAssetUrls(assetUrls) {
|
|
35070
35009
|
defaultEditorAssetUrls = assetUrls;
|
|
35071
35010
|
}
|
|
@@ -35078,190 +35017,12 @@ function useDefaultEditorAssetsWithOverrides(overrides) {
|
|
|
35078
35017
|
}, [overrides]);
|
|
35079
35018
|
}
|
|
35080
35019
|
|
|
35081
|
-
// src/lib/ui/icon-types.ts
|
|
35082
|
-
var iconTypes = [
|
|
35083
|
-
"align-bottom",
|
|
35084
|
-
"align-center-horizontal",
|
|
35085
|
-
"align-center-vertical",
|
|
35086
|
-
"align-left",
|
|
35087
|
-
"align-right",
|
|
35088
|
-
"align-top",
|
|
35089
|
-
"alt",
|
|
35090
|
-
"arrow-arc",
|
|
35091
|
-
"arrow-cycle",
|
|
35092
|
-
"arrow-elbow",
|
|
35093
|
-
"arrow-left",
|
|
35094
|
-
"arrowhead-arrow",
|
|
35095
|
-
"arrowhead-bar",
|
|
35096
|
-
"arrowhead-diamond",
|
|
35097
|
-
"arrowhead-dot",
|
|
35098
|
-
"arrowhead-none",
|
|
35099
|
-
"arrowhead-square",
|
|
35100
|
-
"arrowhead-triangle-inverted",
|
|
35101
|
-
"arrowhead-triangle",
|
|
35102
|
-
"blob",
|
|
35103
|
-
"bold",
|
|
35104
|
-
"bookmark",
|
|
35105
|
-
"bring-forward",
|
|
35106
|
-
"bring-to-front",
|
|
35107
|
-
"broken",
|
|
35108
|
-
"bulletList",
|
|
35109
|
-
"check-circle",
|
|
35110
|
-
"check",
|
|
35111
|
-
"chevron-down",
|
|
35112
|
-
"chevron-left",
|
|
35113
|
-
"chevron-right",
|
|
35114
|
-
"chevron-up",
|
|
35115
|
-
"chevrons-ne",
|
|
35116
|
-
"chevrons-sw",
|
|
35117
|
-
"clipboard-copied",
|
|
35118
|
-
"clipboard-copy",
|
|
35119
|
-
"code",
|
|
35120
|
-
"color",
|
|
35121
|
-
"comment",
|
|
35122
|
-
"corners",
|
|
35123
|
-
"crop",
|
|
35124
|
-
"cross-2",
|
|
35125
|
-
"cross-circle",
|
|
35126
|
-
"dash-dashed",
|
|
35127
|
-
"dash-dotted",
|
|
35128
|
-
"dash-draw",
|
|
35129
|
-
"dash-solid",
|
|
35130
|
-
"disconnected",
|
|
35131
|
-
"discord",
|
|
35132
|
-
"distribute-horizontal",
|
|
35133
|
-
"distribute-vertical",
|
|
35134
|
-
"dot",
|
|
35135
|
-
"dots-horizontal",
|
|
35136
|
-
"dots-vertical",
|
|
35137
|
-
"download",
|
|
35138
|
-
"drag-handle-dots",
|
|
35139
|
-
"duplicate",
|
|
35140
|
-
"edit",
|
|
35141
|
-
"external-link",
|
|
35142
|
-
"fill-fill",
|
|
35143
|
-
"fill-lined-fill",
|
|
35144
|
-
"fill-none",
|
|
35145
|
-
"fill-pattern",
|
|
35146
|
-
"fill-semi",
|
|
35147
|
-
"fill-solid",
|
|
35148
|
-
"follow",
|
|
35149
|
-
"following",
|
|
35150
|
-
"font-draw",
|
|
35151
|
-
"font-mono",
|
|
35152
|
-
"font-sans",
|
|
35153
|
-
"font-serif",
|
|
35154
|
-
"geo-arrow-down",
|
|
35155
|
-
"geo-arrow-left",
|
|
35156
|
-
"geo-arrow-right",
|
|
35157
|
-
"geo-arrow-up",
|
|
35158
|
-
"geo-check-box",
|
|
35159
|
-
"geo-cloud",
|
|
35160
|
-
"geo-diamond",
|
|
35161
|
-
"geo-ellipse",
|
|
35162
|
-
"geo-heart",
|
|
35163
|
-
"geo-hexagon",
|
|
35164
|
-
"geo-octagon",
|
|
35165
|
-
"geo-oval",
|
|
35166
|
-
"geo-pentagon",
|
|
35167
|
-
"geo-rectangle",
|
|
35168
|
-
"geo-rhombus-2",
|
|
35169
|
-
"geo-rhombus",
|
|
35170
|
-
"geo-star",
|
|
35171
|
-
"geo-trapezoid",
|
|
35172
|
-
"geo-triangle",
|
|
35173
|
-
"geo-x-box",
|
|
35174
|
-
"github",
|
|
35175
|
-
"group",
|
|
35176
|
-
"heading",
|
|
35177
|
-
"help-circle",
|
|
35178
|
-
"highlight",
|
|
35179
|
-
"horizontal-align-end",
|
|
35180
|
-
"horizontal-align-middle",
|
|
35181
|
-
"horizontal-align-start",
|
|
35182
|
-
"info-circle",
|
|
35183
|
-
"italic",
|
|
35184
|
-
"leading",
|
|
35185
|
-
"link",
|
|
35186
|
-
"list",
|
|
35187
|
-
"lock",
|
|
35188
|
-
"manual",
|
|
35189
|
-
"menu",
|
|
35190
|
-
"minus",
|
|
35191
|
-
"mixed",
|
|
35192
|
-
"pack",
|
|
35193
|
-
"plus",
|
|
35194
|
-
"question-mark-circle",
|
|
35195
|
-
"question-mark",
|
|
35196
|
-
"redo",
|
|
35197
|
-
"reset-zoom",
|
|
35198
|
-
"rotate-ccw",
|
|
35199
|
-
"rotate-cw",
|
|
35200
|
-
"send-backward",
|
|
35201
|
-
"send-to-back",
|
|
35202
|
-
"share-1",
|
|
35203
|
-
"size-extra-large",
|
|
35204
|
-
"size-large",
|
|
35205
|
-
"size-medium",
|
|
35206
|
-
"size-small",
|
|
35207
|
-
"spline-cubic",
|
|
35208
|
-
"spline-line",
|
|
35209
|
-
"stack-horizontal",
|
|
35210
|
-
"stack-vertical",
|
|
35211
|
-
"status-offline",
|
|
35212
|
-
"stretch-horizontal",
|
|
35213
|
-
"stretch-vertical",
|
|
35214
|
-
"strike",
|
|
35215
|
-
"text-align-center",
|
|
35216
|
-
"text-align-left",
|
|
35217
|
-
"text-align-right",
|
|
35218
|
-
"toggle-off",
|
|
35219
|
-
"toggle-on",
|
|
35220
|
-
"tool-arrow",
|
|
35221
|
-
"tool-eraser",
|
|
35222
|
-
"tool-frame",
|
|
35223
|
-
"tool-hand",
|
|
35224
|
-
"tool-highlight",
|
|
35225
|
-
"tool-laser",
|
|
35226
|
-
"tool-line",
|
|
35227
|
-
"tool-media",
|
|
35228
|
-
"tool-note",
|
|
35229
|
-
"tool-pencil",
|
|
35230
|
-
"tool-pointer",
|
|
35231
|
-
"tool-screenshot",
|
|
35232
|
-
"tool-text",
|
|
35233
|
-
"trash",
|
|
35234
|
-
"twitter",
|
|
35235
|
-
"underline",
|
|
35236
|
-
"undo",
|
|
35237
|
-
"ungroup",
|
|
35238
|
-
"unlock",
|
|
35239
|
-
"vertical-align-end",
|
|
35240
|
-
"vertical-align-middle",
|
|
35241
|
-
"vertical-align-start",
|
|
35242
|
-
"warning-triangle",
|
|
35243
|
-
"zoom-in",
|
|
35244
|
-
"zoom-out"
|
|
35245
|
-
];
|
|
35246
|
-
|
|
35247
35020
|
// src/lib/ui/assetUrls.ts
|
|
35248
35021
|
var defaultUiAssetUrls = {
|
|
35249
35022
|
...defaultEditorAssetUrls,
|
|
35250
|
-
icons:
|
|
35251
|
-
|
|
35252
|
-
|
|
35253
|
-
translations: Object.fromEntries(
|
|
35254
|
-
LANGUAGES.map((lang) => [
|
|
35255
|
-
lang.locale,
|
|
35256
|
-
`${getDefaultCdnBaseUrl()}/translations/${lang.locale}.json`
|
|
35257
|
-
])
|
|
35258
|
-
),
|
|
35259
|
-
embedIcons: Object.fromEntries(
|
|
35260
|
-
DEFAULT_EMBED_DEFINITIONS.map((def) => [
|
|
35261
|
-
def.type,
|
|
35262
|
-
`${getDefaultCdnBaseUrl()}/embed-icons/${def.type}.png`
|
|
35263
|
-
])
|
|
35264
|
-
)
|
|
35023
|
+
icons: {},
|
|
35024
|
+
translations: {},
|
|
35025
|
+
embedIcons: {}
|
|
35265
35026
|
};
|
|
35266
35027
|
function setDefaultUiAssetUrls(urls) {
|
|
35267
35028
|
defaultUiAssetUrls = urls;
|
|
@@ -35602,6 +35363,7 @@ function Draw(props) {
|
|
|
35602
35363
|
[_imageMimeTypes, _videoMimeTypes]
|
|
35603
35364
|
);
|
|
35604
35365
|
const assets = useDefaultEditorAssetsWithOverrides(rest.assetUrls);
|
|
35366
|
+
const preloadDefaultFonts = hasExternalFontUrls(assets.fonts);
|
|
35605
35367
|
const embedShapeUtil = shapeUtilsWithDefaults.find((util) => util.type === "embed");
|
|
35606
35368
|
if (embedShapeUtil && embeds) {
|
|
35607
35369
|
EmbedShapeUtil.setEmbedDefinitions(embeds);
|
|
@@ -35636,6 +35398,7 @@ function Draw(props) {
|
|
|
35636
35398
|
maxAssetSize,
|
|
35637
35399
|
acceptedImageMimeTypes: _imageMimeTypes,
|
|
35638
35400
|
acceptedVideoMimeTypes: _videoMimeTypes,
|
|
35401
|
+
preloadDefaultFonts,
|
|
35639
35402
|
onMount
|
|
35640
35403
|
}
|
|
35641
35404
|
),
|
|
@@ -35652,6 +35415,7 @@ function InsideOfEditorAndUiContext({
|
|
|
35652
35415
|
maxAssetSize,
|
|
35653
35416
|
acceptedImageMimeTypes,
|
|
35654
35417
|
acceptedVideoMimeTypes,
|
|
35418
|
+
preloadDefaultFonts,
|
|
35655
35419
|
onMount
|
|
35656
35420
|
}) {
|
|
35657
35421
|
const editor = useEditor();
|
|
@@ -35661,13 +35425,15 @@ function InsideOfEditorAndUiContext({
|
|
|
35661
35425
|
useOnMount(() => {
|
|
35662
35426
|
const unsubs = [];
|
|
35663
35427
|
unsubs.push(registerDefaultSideEffects(editor));
|
|
35664
|
-
|
|
35665
|
-
|
|
35666
|
-
|
|
35667
|
-
for (const
|
|
35668
|
-
const
|
|
35669
|
-
|
|
35670
|
-
|
|
35428
|
+
if (preloadDefaultFonts) {
|
|
35429
|
+
editor.fonts.requestFonts(allDefaultFontFaces);
|
|
35430
|
+
const themes = editor.getThemes();
|
|
35431
|
+
for (const theme of Object.values(themes)) {
|
|
35432
|
+
for (const key of Object.keys(theme.fonts)) {
|
|
35433
|
+
const font = theme.fonts[key];
|
|
35434
|
+
if (font.faces?.length) {
|
|
35435
|
+
editor.fonts.requestFonts(font.faces);
|
|
35436
|
+
}
|
|
35671
35437
|
}
|
|
35672
35438
|
}
|
|
35673
35439
|
}
|
|
@@ -35984,6 +35750,172 @@ function CenteredTopPanelContainer({
|
|
|
35984
35750
|
});
|
|
35985
35751
|
return /* @__PURE__ */ jsx("div", { ref, className: "tlui-top-panel__container", children });
|
|
35986
35752
|
}
|
|
35753
|
+
|
|
35754
|
+
// src/lib/ui/icon-types.ts
|
|
35755
|
+
var iconTypes = [
|
|
35756
|
+
"align-bottom",
|
|
35757
|
+
"align-center-horizontal",
|
|
35758
|
+
"align-center-vertical",
|
|
35759
|
+
"align-left",
|
|
35760
|
+
"align-right",
|
|
35761
|
+
"align-top",
|
|
35762
|
+
"alt",
|
|
35763
|
+
"arrow-arc",
|
|
35764
|
+
"arrow-cycle",
|
|
35765
|
+
"arrow-elbow",
|
|
35766
|
+
"arrow-left",
|
|
35767
|
+
"arrowhead-arrow",
|
|
35768
|
+
"arrowhead-bar",
|
|
35769
|
+
"arrowhead-diamond",
|
|
35770
|
+
"arrowhead-dot",
|
|
35771
|
+
"arrowhead-none",
|
|
35772
|
+
"arrowhead-square",
|
|
35773
|
+
"arrowhead-triangle-inverted",
|
|
35774
|
+
"arrowhead-triangle",
|
|
35775
|
+
"blob",
|
|
35776
|
+
"bold",
|
|
35777
|
+
"bookmark",
|
|
35778
|
+
"bring-forward",
|
|
35779
|
+
"bring-to-front",
|
|
35780
|
+
"broken",
|
|
35781
|
+
"bulletList",
|
|
35782
|
+
"check-circle",
|
|
35783
|
+
"check",
|
|
35784
|
+
"chevron-down",
|
|
35785
|
+
"chevron-left",
|
|
35786
|
+
"chevron-right",
|
|
35787
|
+
"chevron-up",
|
|
35788
|
+
"chevrons-ne",
|
|
35789
|
+
"chevrons-sw",
|
|
35790
|
+
"clipboard-copied",
|
|
35791
|
+
"clipboard-copy",
|
|
35792
|
+
"code",
|
|
35793
|
+
"color",
|
|
35794
|
+
"comment",
|
|
35795
|
+
"corners",
|
|
35796
|
+
"crop",
|
|
35797
|
+
"cross-2",
|
|
35798
|
+
"cross-circle",
|
|
35799
|
+
"dash-dashed",
|
|
35800
|
+
"dash-dotted",
|
|
35801
|
+
"dash-draw",
|
|
35802
|
+
"dash-solid",
|
|
35803
|
+
"disconnected",
|
|
35804
|
+
"discord",
|
|
35805
|
+
"distribute-horizontal",
|
|
35806
|
+
"distribute-vertical",
|
|
35807
|
+
"dot",
|
|
35808
|
+
"dots-horizontal",
|
|
35809
|
+
"dots-vertical",
|
|
35810
|
+
"download",
|
|
35811
|
+
"drag-handle-dots",
|
|
35812
|
+
"duplicate",
|
|
35813
|
+
"edit",
|
|
35814
|
+
"external-link",
|
|
35815
|
+
"fill-fill",
|
|
35816
|
+
"fill-lined-fill",
|
|
35817
|
+
"fill-none",
|
|
35818
|
+
"fill-pattern",
|
|
35819
|
+
"fill-semi",
|
|
35820
|
+
"fill-solid",
|
|
35821
|
+
"follow",
|
|
35822
|
+
"following",
|
|
35823
|
+
"font-draw",
|
|
35824
|
+
"font-mono",
|
|
35825
|
+
"font-sans",
|
|
35826
|
+
"font-serif",
|
|
35827
|
+
"geo-arrow-down",
|
|
35828
|
+
"geo-arrow-left",
|
|
35829
|
+
"geo-arrow-right",
|
|
35830
|
+
"geo-arrow-up",
|
|
35831
|
+
"geo-check-box",
|
|
35832
|
+
"geo-cloud",
|
|
35833
|
+
"geo-diamond",
|
|
35834
|
+
"geo-ellipse",
|
|
35835
|
+
"geo-heart",
|
|
35836
|
+
"geo-hexagon",
|
|
35837
|
+
"geo-octagon",
|
|
35838
|
+
"geo-oval",
|
|
35839
|
+
"geo-pentagon",
|
|
35840
|
+
"geo-rectangle",
|
|
35841
|
+
"geo-rhombus-2",
|
|
35842
|
+
"geo-rhombus",
|
|
35843
|
+
"geo-star",
|
|
35844
|
+
"geo-trapezoid",
|
|
35845
|
+
"geo-triangle",
|
|
35846
|
+
"geo-x-box",
|
|
35847
|
+
"github",
|
|
35848
|
+
"group",
|
|
35849
|
+
"heading",
|
|
35850
|
+
"help-circle",
|
|
35851
|
+
"highlight",
|
|
35852
|
+
"horizontal-align-end",
|
|
35853
|
+
"horizontal-align-middle",
|
|
35854
|
+
"horizontal-align-start",
|
|
35855
|
+
"info-circle",
|
|
35856
|
+
"italic",
|
|
35857
|
+
"leading",
|
|
35858
|
+
"link",
|
|
35859
|
+
"list",
|
|
35860
|
+
"lock",
|
|
35861
|
+
"manual",
|
|
35862
|
+
"menu",
|
|
35863
|
+
"minus",
|
|
35864
|
+
"mixed",
|
|
35865
|
+
"pack",
|
|
35866
|
+
"plus",
|
|
35867
|
+
"question-mark-circle",
|
|
35868
|
+
"question-mark",
|
|
35869
|
+
"redo",
|
|
35870
|
+
"reset-zoom",
|
|
35871
|
+
"rotate-ccw",
|
|
35872
|
+
"rotate-cw",
|
|
35873
|
+
"send-backward",
|
|
35874
|
+
"send-to-back",
|
|
35875
|
+
"share-1",
|
|
35876
|
+
"size-extra-large",
|
|
35877
|
+
"size-large",
|
|
35878
|
+
"size-medium",
|
|
35879
|
+
"size-small",
|
|
35880
|
+
"spline-cubic",
|
|
35881
|
+
"spline-line",
|
|
35882
|
+
"stack-horizontal",
|
|
35883
|
+
"stack-vertical",
|
|
35884
|
+
"status-offline",
|
|
35885
|
+
"stretch-horizontal",
|
|
35886
|
+
"stretch-vertical",
|
|
35887
|
+
"strike",
|
|
35888
|
+
"text-align-center",
|
|
35889
|
+
"text-align-left",
|
|
35890
|
+
"text-align-right",
|
|
35891
|
+
"toggle-off",
|
|
35892
|
+
"toggle-on",
|
|
35893
|
+
"tool-arrow",
|
|
35894
|
+
"tool-eraser",
|
|
35895
|
+
"tool-frame",
|
|
35896
|
+
"tool-hand",
|
|
35897
|
+
"tool-highlight",
|
|
35898
|
+
"tool-laser",
|
|
35899
|
+
"tool-line",
|
|
35900
|
+
"tool-media",
|
|
35901
|
+
"tool-note",
|
|
35902
|
+
"tool-pencil",
|
|
35903
|
+
"tool-pointer",
|
|
35904
|
+
"tool-screenshot",
|
|
35905
|
+
"tool-text",
|
|
35906
|
+
"trash",
|
|
35907
|
+
"twitter",
|
|
35908
|
+
"underline",
|
|
35909
|
+
"undo",
|
|
35910
|
+
"ungroup",
|
|
35911
|
+
"unlock",
|
|
35912
|
+
"vertical-align-end",
|
|
35913
|
+
"vertical-align-middle",
|
|
35914
|
+
"vertical-align-start",
|
|
35915
|
+
"warning-triangle",
|
|
35916
|
+
"zoom-in",
|
|
35917
|
+
"zoom-out"
|
|
35918
|
+
];
|
|
35987
35919
|
async function preloadFont(id, font, targetDocument) {
|
|
35988
35920
|
const {
|
|
35989
35921
|
url,
|
|
@@ -37026,7 +36958,7 @@ async function extractAssets(editor, snapshot, msg, addToast) {
|
|
|
37026
36958
|
// src/index.ts
|
|
37027
36959
|
registerDrawLibraryVersion(
|
|
37028
36960
|
"@ibodr/draw",
|
|
37029
|
-
"0.1.
|
|
36961
|
+
"0.1.2",
|
|
37030
36962
|
"esm"
|
|
37031
36963
|
);
|
|
37032
36964
|
/*!
|