polotno 3.19.0 → 3.20.0
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/LICENSE.md +8 -2
- package/THIRD_PARTY_NOTICES.md +2871 -0
- package/blueprint/canvas/context-menu/context-menu.js +1 -1
- package/blueprint/canvas/page-controls.d.ts +3 -3
- package/blueprint/pages-timeline/pages-timeline.js +2 -2
- package/blueprint/pages-timeline/play-button.js +2 -2
- package/blueprint/side-panel/animations-panel.d.ts +1 -1
- package/blueprint/side-panel/draw-panel.js +2 -2
- package/blueprint/side-panel/effect-card.js +3 -3
- package/blueprint/side-panel/effects-panel.d.ts +1 -1
- package/blueprint/side-panel/effects-panel.js +1 -1
- package/blueprint/side-panel/elements-panel.d.ts +1 -1
- package/blueprint/side-panel/select-video.d.ts +19 -19
- package/blueprint/side-panel/videos-grid.d.ts +4 -4
- package/blueprint/toolbar/animations-picker.d.ts +1 -1
- package/blueprint/toolbar/element-container.d.ts +1 -1
- package/blueprint/toolbar/figure-toolbar.js +1 -1
- package/blueprint/toolbar/filters-picker.d.ts +1 -1
- package/blueprint/toolbar/filters-picker.js +1 -1
- package/blueprint/toolbar/group-button.js +1 -1
- package/blueprint/toolbar/image-remove-background-button.js +1 -1
- package/blueprint/toolbar/image-toolbar.js +1 -1
- package/blueprint/toolbar/line-toolbar.js +1 -1
- package/blueprint/toolbar/page-toolbar.d.ts +1 -1
- package/blueprint/toolbar/position-picker.js +1 -1
- package/blueprint/toolbar/sketch.d.ts +5 -5
- package/blueprint/toolbar/svg-toolbar.js +1 -1
- package/blueprint/toolbar/table-toolbar.js +1 -1
- package/blueprint/toolbar/text-ai-write.js +1 -1
- package/blueprint/toolbar/text-toolbar.d.ts +1 -1
- package/blueprint.polotno.css +164 -153
- package/canvas/apply-filters.d.ts +2 -6
- package/canvas/apply-filters.js +1 -1
- package/canvas/context-menu/context-menu.js +1 -1
- package/canvas/crop-overlay.d.ts +1 -1
- package/canvas/crop-overlay.js +1 -1
- package/canvas/downscale.d.ts +1 -24
- package/canvas/downscale.js +1 -1
- package/canvas/element.d.ts +3 -1
- package/canvas/element.js +1 -1
- package/canvas/fade-overlay.js +1 -1
- package/canvas/figure-element.js +1 -1
- package/canvas/gif-element.d.ts +32 -0
- package/canvas/gif-element.js +1 -1
- package/canvas/hotkeys.d.ts +1 -1
- package/canvas/hotkeys.js +1 -1
- package/canvas/html-element.js +1 -1
- package/canvas/image-element.d.ts +4 -48
- package/canvas/image-element.js +1 -1
- package/canvas/image-tool-controls.js +1 -1
- package/canvas/line-element.js +1 -1
- package/canvas/lottie-element.d.ts +11 -0
- package/canvas/lottie-element.js +1 -0
- package/canvas/lottie-player.d.ts +2 -0
- package/canvas/lottie-player.js +1 -0
- package/canvas/lottie-player.wasm.d.ts +1 -0
- package/canvas/lottie-player.wasm.js +1 -0
- package/canvas/media-placeholders.d.ts +23 -0
- package/canvas/media-placeholders.js +1 -0
- package/canvas/page-controls.d.ts +3 -3
- package/canvas/page.js +1 -1
- package/canvas/quill-font-formats.d.ts +2 -2
- package/canvas/rect-control.js +1 -1
- package/canvas/render-tag-element.js +1 -1
- package/canvas/rich-editor.d.ts +7 -4
- package/canvas/rich-editor.js +5 -5
- package/canvas/rules.js +2 -2
- package/canvas/table-cell-text.d.ts +18 -0
- package/canvas/table-cell-text.js +1 -0
- package/canvas/table-element.js +1 -1
- package/canvas/text-element/caret-color.d.ts +3 -1
- package/canvas/text-element/render-tag-source.d.ts +33 -0
- package/canvas/text-element/render-tag-source.js +1 -0
- package/canvas/text-element.d.ts +1 -1
- package/canvas/text-element.js +1 -1
- package/canvas/use-color.d.ts +5 -5
- package/canvas/use-filtered-source.js +1 -1
- package/canvas/use-mediabunny-video.js +1 -1
- package/canvas/use-transformer-snap.d.ts +2 -2
- package/canvas/video-element.d.ts +4 -2
- package/canvas/video-element.js +1 -1
- package/icons/animation-icons.d.ts +1 -0
- package/icons/animation-icons.js +1 -1
- package/icons/registry.d.ts +35 -32
- package/icons/registry.js +1 -1
- package/image-tools/geometry.d.ts +2 -2
- package/image-tools/target.d.ts +6 -6
- package/image-tools/target.js +1 -1
- package/lib/utils.d.ts +1 -1
- package/model/figure-model.d.ts +10 -10
- package/model/gif-model.d.ts +10 -10
- package/model/group-model.d.ts +393 -84
- package/model/group-model.js +1 -1
- package/model/image-model.d.ts +10 -10
- package/model/image-tools.d.ts +1 -1
- package/model/line-model.d.ts +10 -10
- package/model/lottie-model.d.ts +242 -0
- package/model/lottie-model.js +5 -0
- package/model/node-model.d.ts +8 -8
- package/model/page-model.d.ts +1186 -297
- package/model/page-model.js +1 -1
- package/model/shape-model.d.ts +11 -11
- package/model/shape-model.js +1 -1
- package/model/store.d.ts +30 -26
- package/model/store.js +1 -1
- package/model/svg-model.d.ts +9 -9
- package/model/table-model.d.ts +127 -20
- package/model/table-model.js +1 -1
- package/model/text-model.d.ts +9 -9
- package/model/video-model.d.ts +10 -10
- package/package.json +36 -55
- package/pages-timeline/pages-timeline.js +1 -1
- package/pages-timeline/track-styles.d.ts +12 -12
- package/polotno-app.d.ts +1 -1
- package/polotno.bundle.js +183 -179
- package/primitives/button.d.ts +4 -4
- package/primitives/dialog.d.ts +4 -4
- package/primitives/dropdown-menu.d.ts +18 -18
- package/primitives/input-group.d.ts +1 -1
- package/primitives/popover.d.ts +4 -4
- package/primitives/select.d.ts +5 -5
- package/primitives/tooltip.d.ts +3 -3
- package/side-panel/animations-panel.js +1 -1
- package/side-panel/background-panel.js +1 -1
- package/side-panel/draw-panel.js +1 -1
- package/side-panel/effect-card.js +1 -1
- package/side-panel/effects-panel.js +1 -1
- package/side-panel/photos-panel.js +1 -1
- package/side-panel/select-lottie.d.ts +11 -0
- package/side-panel/select-lottie.js +1 -0
- package/side-panel/select-video.d.ts +19 -19
- package/side-panel/size-panel.js +1 -1
- package/side-panel/unsplash-credit.d.ts +4 -1
- package/side-panel/unsplash-credit.js +1 -1
- package/side-panel/upload-panel.js +1 -1
- package/themes/carbon.css +1 -1
- package/toolbar/gif-toolbar.d.ts +3 -0
- package/toolbar/gif-toolbar.js +1 -1
- package/toolbar/group-button.js +1 -1
- package/toolbar/html-toolbar.d.ts +1 -0
- package/toolbar/html-toolbar.js +3 -3
- package/toolbar/image-remove-background-button.js +1 -1
- package/toolbar/index.d.ts +1 -1
- package/toolbar/index.js +1 -1
- package/toolbar/line-toolbar.js +1 -1
- package/toolbar/position-picker.js +1 -1
- package/toolbar/table-toolbar.js +1 -1
- package/toolbar/text-ai-write.js +1 -1
- package/toolbar/text-toolbar.js +1 -1
- package/toolbar/toolbar-shared.d.ts +15 -4
- package/toolbar/toolbar-shared.js +1 -1
- package/toolbar/toolbar.js +1 -1
- package/ui.css +2 -2
- package/utils/animations.d.ts +47 -44
- package/utils/animations.js +1 -1
- package/utils/base64.d.ts +1 -2
- package/utils/base64.js +1 -1
- package/utils/clipboard.d.ts +19 -18
- package/utils/clipboard.js +1 -1
- package/utils/fade-gradient.d.ts +1 -1
- package/utils/file.d.ts +4 -3
- package/utils/file.js +1 -1
- package/utils/font-metric.d.ts +29 -28
- package/utils/fonts.js +1 -1
- package/utils/gif-lib.d.ts +1 -1
- package/utils/html2canvas.js +1 -1
- package/utils/image-dpi.d.ts +1 -1
- package/utils/image-dpi.js +1 -1
- package/utils/insert-file.js +1 -1
- package/utils/l10n.d.ts +1 -0
- package/utils/l10n.js +1 -1
- package/utils/lottie.d.ts +12 -0
- package/utils/lottie.js +1 -0
- package/utils/math.d.ts +4 -4
- package/utils/px.d.ts +3 -0
- package/utils/px.js +1 -1
- package/utils/react-color/components/common/Checkboard.d.ts +12 -12
- package/utils/react-color/components/common/Swatch.d.ts +6 -6
- package/utils/react-color/helpers/interaction.d.ts +6 -6
- package/utils/reactcss/components/active.d.ts +6 -6
- package/utils/reactcss/components/hover.d.ts +6 -6
- package/utils/rich-text-html.js +1 -1
- package/utils/selection-colors.js +1 -1
- package/utils/selection-transform.d.ts +4 -4
- package/utils/selection-transform.js +1 -1
- package/utils/split-element.js +1 -1
- package/utils/text-format-state.d.ts +1 -0
- package/utils/text-format-state.js +1 -1
- package/utils/text-format.d.ts +2 -2
- package/utils/text-sizing.d.ts +1 -1
- package/utils/timeline.d.ts +30 -2
- package/utils/timeline.js +1 -1
- package/utils/to-html.js +1 -1
- package/utils/to-svg.js +1 -1
- package/utils/validate-key.js +1 -1
- package/canvas/downscale-bands.d.ts +0 -10
- package/canvas/downscale-bands.js +0 -1
- package/canvas/downscale-kernel.d.ts +0 -7
- package/canvas/downscale-kernel.js +0 -1
- package/canvas/downscale-kernel.wasm.d.ts +0 -1
- package/canvas/downscale-kernel.wasm.js +0 -1
- package/canvas/downscale-passes.d.ts +0 -7
- package/canvas/downscale-passes.js +0 -1
package/utils/font-metric.d.ts
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
fontWeight: string;
|
|
10
|
-
fontSize: number;
|
|
11
|
-
capHeight: number;
|
|
12
|
-
baseline: number;
|
|
13
|
-
xHeight: number;
|
|
14
|
-
descent: number;
|
|
15
|
-
bottom: number;
|
|
16
|
-
ascent: number;
|
|
17
|
-
tittle: number;
|
|
18
|
-
top: number;
|
|
19
|
-
};
|
|
20
|
-
settings: {
|
|
21
|
-
chars: {
|
|
22
|
-
capHeight: string;
|
|
23
|
-
baseline: string;
|
|
24
|
-
xHeight: string;
|
|
25
|
-
descent: string;
|
|
26
|
-
ascent: string;
|
|
27
|
-
tittle: string;
|
|
28
|
-
};
|
|
1
|
+
declare const settings: {
|
|
2
|
+
chars: {
|
|
3
|
+
capHeight: string;
|
|
4
|
+
baseline: string;
|
|
5
|
+
xHeight: string;
|
|
6
|
+
descent: string;
|
|
7
|
+
ascent: string;
|
|
8
|
+
tittle: string;
|
|
29
9
|
};
|
|
30
10
|
};
|
|
11
|
+
declare function FontMetrics({ fontFamily, fontWeight, fontSize, origin, }?: {
|
|
12
|
+
fontFamily?: string | undefined;
|
|
13
|
+
fontSize?: number | undefined;
|
|
14
|
+
fontWeight?: string | undefined;
|
|
15
|
+
origin?: string | undefined;
|
|
16
|
+
}): {
|
|
17
|
+
capHeight: number;
|
|
18
|
+
baseline: number;
|
|
19
|
+
xHeight: number;
|
|
20
|
+
descent: number;
|
|
21
|
+
bottom: number;
|
|
22
|
+
ascent: number;
|
|
23
|
+
tittle: number;
|
|
24
|
+
top: number;
|
|
25
|
+
fontFamily: string;
|
|
26
|
+
fontWeight: string;
|
|
27
|
+
fontSize: number;
|
|
28
|
+
};
|
|
29
|
+
declare namespace FontMetrics {
|
|
30
|
+
export { settings };
|
|
31
|
+
}
|
|
31
32
|
export default FontMetrics;
|
package/utils/fonts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as A from"mobx";import{triggerLoadError as t,getFontLoadTimeout as o}from"./loader.js";import{polotnoError as e}from"@polotno/core/errors";import{removeTags as n}from"@polotno/core/text";import{decodeBase64 as r}from"./base64.js";import{DEFAULT_RETRIES as s,retryDelayMs as i}from"@polotno/core/retry";import{getGoogleFontsUrl as c,getGoogleFontsVariants as a}from"@polotno/core/google-fonts-url";import{resolveFontFaceStyles as l,googleFontVariantUrl as u,cssFontFamily as f,
|
|
1
|
+
import*as A from"mobx";import{triggerLoadError as t,getFontLoadTimeout as o}from"./loader.js";import{polotnoError as e}from"@polotno/core/errors";import{removeTags as n}from"@polotno/core/text";import{decodeBase64 as r}from"./base64.js";import{DEFAULT_RETRIES as s,retryDelayMs as i}from"@polotno/core/retry";import{getGoogleFontsUrl as c,getGoogleFontsVariants as a}from"@polotno/core/google-fonts-url";import{resolveFontFaceStyles as l,googleFontVariantUrl as u,cssFontFamily as f,isFontKeyword as d,parseUnicodeRange as m,rangesCover as p,toNumericWeight as g}from"@polotno/core/fonts";export{setGoogleFontsVariants,getGoogleFontsVariants,getGoogleFontsUrl}from"@polotno/core/google-fonts-url";const h=["Roboto","Amatic SC","Press Start 2P","Marck Script","Rubik Mono One"];let F=A.observable([...h]),y=A.observable({value:!1});export function isGoogleFontChanged(){return y.value}export function setGoogleFonts(A){if("default"===A){return F.replace([...h]),void(y.value=!1)}y.value=!0,F.splice(0,F.length),F.push(...A)}export function getFontsList(){return F}export const globalFonts=A.observable([]);export function addGlobalFont(A){globalFonts.push(A)}export function removeGlobalFont(A){const t=globalFonts.findIndex(t=>t.fontFamily===A);-1!==t&&globalFonts.splice(t,1)}export function replaceGlobalFonts(A){globalFonts.replace(A)}const w="BESbswy 0123456789 Il1Ww";function b(A){const t=function(A=""){const t=n(A).replace(/\s+/g," ").trim();return t?Array.from(t).slice(0,10).join(""):""}(A);return t?`${w} ${t}`:w}export function _getFontProbeTextForTesting(A){return b(A)}const x="PolotnoBlank";let B,$;function E(A,t,o,e){null!=$||($=document.createElement("canvas"));const n=$.getContext("2d");if(!n){return!1}const r=(A,e)=>{n.font=`${t} ${o} 40px ${A}`;const r=n.measureText(e);return r.width>0||r.actualBoundingBoxLeft+r.actualBoundingBoxRight>0};if(r(x,w)){return!1}const s=`${f(A)}, ${x}`;return e.some(A=>r(s,A))}export function measureFontDom(A,t="sans-serif",o="normal",e="normal",n=w){if("undefined"==typeof document||!document.body){return 0}const r=document.createElement("span");r.textContent=n,r.style.cssText=`\n position:absolute;\n visibility:hidden;\n white-space:nowrap;\n top:-9999px;\n left:-9999px;\n font:${o} ${e} 90px ${f(A)}, ${t};\n `,document.body.appendChild(r);const s=r.getBoundingClientRect().width;return r.remove(),s}const v={Arial:!0},G={};export const isFontLoaded=(A,t,o,e)=>{if(t&&o){const n=`${A}_${t}_${o}`;if(!v[n]){return!1}const r=textChars(e),s=G[n];return!![...r].every(A=>null==s?void 0:s.has(A))||function(A,t,o,e){if("undefined"==typeof document||!document.fonts){return!1}const n="italic"===t?"italic":"normal",r=g(o),s=Y(A),i=[...e].map(A=>A.codePointAt(0)),c=new Set;let a=!1;for(const u of document.fonts){if(Y(u.family)!==s){continue}if(a=!0,u.style!==n){continue}const[A,t=A]=u.weight.split(/\s+/).map(g);if(r<A||r>t){continue}const o=m(u.unicodeRange),e=i.filter(A=>p(o,A));if(e.length){if("loaded"!==u.status){return!1}e.forEach(A=>c.add(A))}}if(a){return i.every(A=>c.has(A))}try{return document.fonts.check(C(A,t,o),e)}catch(l){return!1}}(A,t,o,r)}return Object.keys(v).some(t=>t.startsWith(A+"_"))||!!v[A]};export function _setFontLoadedForTesting(A,t){t?v[A]=!0:delete v[A]}export async function loadFont(A,t,e,n){var r;const s=performance.now()+o();await loadFontFace(A,t,e,n);const i=textChars(n),c=()=>{var o,n;const r=null!==(o=G[n=`${A}_${t}_${e}`])&&void 0!==o?o:G[n]=new Set;for(const A of i){r.add(A)}};if(!i||!(null===(r=document.fonts)||void 0===r?void 0:r.load)){return c()}let a;await Promise.race([document.fonts.load(C(A,t,e),i).catch(()=>{}).then(c),new Promise(A=>{a=setTimeout(A,Math.max(0,s-performance.now()))})]),clearTimeout(a)}const C=(A,t,o)=>`${t} ${o} 16px ${f(A)}`;export function textChars(A){return[...new Set(n(null!=A?A:"").replace(/\s/g,""))].join("")}export async function loadFontFace(A,n,s,c){var a;const l=`${A}_${n}_${s}`;if(d(A)){return void P(l,A)}if(injectGoogleFontVariant(A,n,s),v[l]&&!N(A,n,s)){return}const u=!!(null===(a=document.fonts)||void 0===a?void 0:a.load),f=b(c),m=[...textChars(c)];await(null!=B||(B=(async()=>{if("undefined"==typeof FontFace){return}const A=new FontFace(x,r("AAEAAAAKAIAAAwAgT1MvMlHNUusAAACsAAAAYGNtYXAAIQA0AAABDAAAAChnbHlmAAAAAAAAATQAAAAKaGVhZF8WQOUAAAFAAAAANmhoZWEDIf87AAABeAAAACRobXR4AAAAAAAAAZwAAAAIbG9jYQAFAAAAAAGkAAAABm1heHAAAwAAAAABrAAAACBuYW1lCUoZTgAAAcwAAACMcG9zdAADAAAAAAJYAAAAIAAEAAABkAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQT0xPAEAAAP//AyD/OAAAAyAAyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAwAKAAAADAANAAAAAAAcAAAAAAAAAAEAAAAAABD//wAAAAEAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAABfDzz1AAMD6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAgAAAAAAAAABAAADIP84AAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAFAAAAAQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQANgADAAEECQABABgAAAADAAEECQACAA4AGAADAAEECQAEABgAJgADAAEECQAGABgAPgBQAG8AbABvAHQAbgBvAEIAbABhAG4AawBSAGUAZwB1AGwAYQByAFAAbwBsAG8AdABuAG8AQgBsAGEAbgBrAFAAbwBsAG8AdABuAG8AQgBsAGEAbgBrAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="),{weight:"1 1000"});document.fonts.add(A),await A.load()})().catch(A=>{console.error("Polotno could not load its blank probe font: no font can be verified as ready.",A)})),B);const p=o()/60;for(let o=0;o<p;o++){const r=!N(A,n,s);let c=[];if(u){try{c=await document.fonts.load(C(A,n,s),f)}catch(g){}}const a=t=>E(A,n,s,t),d=c.length>0&&c.every(A=>"loaded"===A.status);if(r&&(a([f])||d&&a(m))){return void P(l,A)}if("missing"===D[A]){if(Q(A)){const o=`Font "${A}" not found: not registered and no matching Google Font.`;console.error(o),t(e("FONT_FAILED",o,{family:A,reason:"not-found"}))}return}if(A in T&&!T[A]&&"errored"===D[A]&&injectGoogleFont(A),R[A]&&U(A)){const n=_(A);if("wait"===n){await new Promise(A=>setTimeout(A,60));continue}if("spent"!==n){V(A);const t=i(n);await new Promise(A=>setTimeout(A,t)),o+=Math.ceil(t/60);continue}if(Q(A)){const o=`Failed to load font "${A}": its font file could not be fetched.`;console.error(o),t(e("FONT_FAILED",o,{family:A,reason:"fetch-failed"}))}return}await new Promise(A=>setTimeout(A,60))}console.warn(`Timeout for loading font "${A}". Looks like polotno can't load it. Is it a correct font family?`),t(e("FONT_FAILED",`Timeout for loading font "${A}"`,{family:A,reason:"timeout"}))}const T={},D={},I=new Set;function Q(A){return!I.has(A)&&(I.add(A),setTimeout(()=>I.delete(A),o()),!0)}function P(A,t){v[A]=!0,delete D[t],delete k[t]}const k={};function _(A){const t=k[A],e=!t||Date.now()-t.at>o()?0:t.spent;return e>=s-1?"spent":t&&e>0&&Date.now()-t.at<i(e)?"wait":(k[A]={spent:e+1,at:Date.now()},e+1)}const j={};function N(A,t,o){return"loading"===T[A]||"loading"===j[`${A}|${"italic"===t?1:0}|${parseInt(o,10)}`]}export function injectGoogleFontVariant(A,t,o){const e=parseInt(o,10);if(!Number.isFinite(e)){return}if(function(A){const t=new Set;for(const o of a().split(",")){const e=o.trim().match(/^(\d+)(italic|i)?$/);e&&!!e[2]===A&&t.add(parseInt(e[1],10))}return t}("italic"===t).has(e)){return}if(!(A in T)){return}const n="italic"===t,r=`${A}|${n?1:0}|${e}`;if(j[r]){return}j[r]="loading";const s=document.createElement("link");s.type="text/css",s.href=u(A,n,e),s.rel="stylesheet",s.onload=()=>{j[r]=!0},s.onerror=()=>{j[r]=!0,s.remove()},document.getElementsByTagName("head")[0].appendChild(s)}export function injectGoogleFont(A){if(T[A]||d(A)){return}const t=c(A),o=document.createElement("link");o.type="text/css",o.href=t,o.rel="stylesheet",o.onload=()=>{T[A]=!0},o.onerror=()=>{o.remove(),T[A]=!1,"errored"===D[A]?function(A){D[A]="probing",fetch(c(A),{mode:"no-cors"}).then(()=>{D[A]="missing"}).catch(()=>{delete D[A]})}(A):D[A]||(D[A]="errored")},document.getElementsByTagName("head")[0].appendChild(o),T[A]="loading"}const R={};let S;function O(){return S||(S=document.getElementById("polotno-font-style"),S||(S=document.createElement("style"),S.id="polotno-font-style",document.head.appendChild(S)),S)}function L(A){const t=A.fontFamily,o=l(A),e=O().sheet;return o.map(A=>{const o=e.insertRule(`\n @font-face{\n font-family:${f(t)};\n src:${A.src};\n font-style:${A.fontStyle};\n font-weight:${A.fontWeight};\n font-display:swap; /* optional but recommended */\n }`,e.cssRules.length);return e.cssRules[o]})}export function injectCustomFont(A){const t=A.fontFamily;if(!A.url&&!A.styles){return}const o=JSON.stringify(l(A)),e=R[t];if(e){if(e.src===o){return}M(e.rules),W(t)}delete D[t],R[t]={font:A,src:o,rules:L(A)}}function M(A){const t=O().sheet;for(const o of A){const A=Array.prototype.indexOf.call(t.cssRules,o);A>=0&&t.deleteRule(A)}}export function removeCustomFont(A){const t=R[A];t&&(M(t.rules),delete R[A],W(A))}function W(A){delete k[A];for(const t of Object.keys(v)){(t===A||t.startsWith(A+"_"))&&(delete v[t],delete G[t])}}function V(A){const t=R[A];t&&(M(t.rules),t.rules=L(t.font))}const Y=A=>A.trim().replace(/^["']|["']$/g,"").toLowerCase();function U(A){const t=document.fonts;if(!t||"function"!=typeof t.forEach){return!1}const o=Y(A);let e=!1;return t.forEach(A=>{"error"===A.status&&Y(A.family)===o&&(e=!0)}),e}
|
package/utils/gif-lib.d.ts
CHANGED
package/utils/html2canvas.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"@polotno/core/measure-html";import{getGoogleFontsVariants as t}from"@polotno/core/google-fonts-url";import{resolveFontFaceStyles as o,cssFontFamily as e}from"@polotno/core/fonts";import{fetchWithRetry as
|
|
1
|
+
export*from"@polotno/core/measure-html";import{getGoogleFontsVariants as t}from"@polotno/core/google-fonts-url";import{resolveFontFaceStyles as o,cssFontFamily as e,isFontKeyword as n}from"@polotno/core/fonts";import{fetchWithRetry as r}from"@polotno/core/retry";import{optimizeCss as s}from"./css-optimizer.js";import{resetStyle as i}from"@polotno/core/reset-style";import{getHiddenElement as l}from"@polotno/core/measure-html";import{parsePrimaryFontFamily as c}from"@polotno/core/rich-text-html";import{shrinkParagraphStrutForRaster as a}from"./rich-text-html.js";import{htmlToImage as f}from"./html-to-svg/index.js";const m=new Map;export const prerenderFont=async t=>{if(m.has(t)){return m.get(t)}const o=(async()=>{const o=`<div style="font-family: ${e(t)}; font-size: 100px;">${t}<strong>${t}</strong></div>`,n=document.createElement("div");n.innerHTML=o,n.style.visibility="hidden",n.style.position="absolute";const r=l();r.appendChild(n);const s="undefined"!=typeof navigator&&navigator.userAgent.includes("Firefox")?180:50;await new Promise(t=>setTimeout(t,s)),r.removeChild(n)})();return m.set(t,o),o};const p={},h=t=>{if(p[t]){return p[t]}const o=function(t){const o=[];for(let n=0;n<document.styleSheets.length;n++){const r=document.styleSheets[n];try{const e=r.cssRules;if(e){for(let n=0;n<e.length;n++){const r=e[n];r instanceof CSSFontFaceRule&&c(r.style.fontFamily)===t&&o.push(r)}}}catch(e){console.warn(`Could not access stylesheet: ${r.href}`,e)}}return o}(t),e=o.map(t=>({src:t.style.getPropertyValue("src"),fontStyle:t.style.getPropertyValue("font-style")||"normal",fontWeight:t.style.getPropertyValue("font-weight")||"normal"}));return p[t]=e,e},u=new Map;async function y(t,o){if(n(t)){return""}const e=`${t}|${o}`;if(u.has(e)){return u.get(e)}const s=`https://fonts.googleapis.com/css?family=${encodeURIComponent(t)}:${o}&display=swap`;try{const t=await r(s),o=await t.text();return u.set(e,o),o}catch(i){return u.set(e,""),""}}export async function htmlToCanvas({html:n,width:r,height:l,fontFamily:c,fontFamilies:m,padding:p,font:u,resolveFont:d,pixelRatio:g}){n=a(n);const w=(null==m?void 0:m.length)?[...new Set([c,...m])]:[c],v=await async function(n,r,s,i){const l=[...new Set(n.filter(Boolean))];let c="";for(const a of l){if("Arial"===a){continue}const n=a===r&&s||(null==i?void 0:i(a));if(n){(n.styles||n.url?o(n):h(a)).forEach(t=>{c+=`\n @font-face {\n font-family: ${e(a)};\n src: ${t.src};\n font-style: ${t.fontStyle||"normal"};\n font-weight: ${t.fontWeight||"normal"};\n }\n `})}else{const o=t();c+=await y(a,o)}}return c}(w,c,u,d);let $="";return v&&($=s(v,n)),f({html:`<div style="padding: ${p}px;" dir="auto">${n+=$+i}</div>`,width:r+2*p,height:l+2*p,cache:{maxEntries:100},pixelRatio:g})}
|
package/utils/image-dpi.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const addDpiMetadataToImage: (dataURL: string, mimeType:
|
|
1
|
+
export declare const addDpiMetadataToImage: (dataURL: string, mimeType: 'image/png' | 'image/jpeg', dpi: number) => string;
|
package/utils/image-dpi.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{decodeBase64 as
|
|
1
|
+
import{addDpiMetadata as o}from"@polotno/core/image-dpi";import{decodeBase64 as a,encodeBase64 as e}from"./base64.js";export const addDpiMetadataToImage=(t,r,i)=>{const d=t.indexOf(","),m=d>=0?t.slice(d+1):t,p=o(a(m),r,i);return p?`data:${r};base64,${e(p)}`:t};
|
package/utils/insert-file.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{detectMediaType as e,getUploadFunc as t,stripExtension as o}from"./file.js";import{selectImage as r}from"../side-panel/select-image.js";import{selectVideo as s}from"../side-panel/select-video.js";import{selectSvg as a}from"../side-panel/select-svg.js";import{selectGif as i}from"../side-panel/select-gif.js";import{selectLottie as n}from"../side-panel/select-lottie.js";export const insertMediaIntoPage=async({url:e,type:t,store:d,droppedPos:p,targetElement:l,name:m})=>{const c=e;"image"===t?await r({src:c,store:d,droppedPos:p,targetElement:l}):"svg"===t?await a({src:c,store:d,droppedPos:p,targetElement:l}):"gif"===t?await i({src:c,store:d,droppedPos:p,targetElement:l}):"lottie"===t?await n({src:c,store:d,droppedPos:p}):"video"===t?await s({src:c,store:d,droppedPos:p,targetElement:l}):"audio"===t&&d.addAudio({src:c,name:m?o(m):""})};export const insertFileIntoPage=async({file:o,store:r,droppedPos:s})=>{const a=await e(o);if(!a){return void console.warn(`polotno: ignoring "${o.name}" — not an image, video, audio or Lottie file`)}const i=await t()(o);await insertMediaIntoPage({url:i,type:a,store:r,droppedPos:s,name:o.name})};
|
package/utils/l10n.d.ts
CHANGED
package/utils/l10n.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{observable as e,action as o,toJS as a}from"mobx";const r=e({imageEdit:{title:"AI edit",expand:"Expand",upscale:"Upscale",inpaint:"Generative fill",replace:"Replace",remove:"Remove",prompt:"Your prompt",promptPlaceholder:"Describe what should be there",expandPromptPlaceholder:"Describe the new area (optional)",replaceDescription:"Select an area on the image, then describe what you want to change.",replaceHint:"Describe what should replace the selection, such as “plain wall” or “open sky”.",removeDescription:"Select an object to remove. The surrounding image will fill the selected area.",expandDescription:"Drag the frame beyond the image edges to make room for new content.",cropDescription:"Drag the frame to crop the image.",upscaleDescription:"Increase the image resolution.",removeBackgroundDescription:"Remove the image background.",applyCrop:"Apply crop",generate:"Generate",clear:"Clear selection",resetFrame:"Reset frame",processing:"Generating…",loadingImage:"Loading image…",upscaling:"Upscaling…",removingBackground:"Removing background…",failed:"The image could not be edited. Please try again.",rasterFailed:"This device could not prepare the image. Try a smaller image.",selectRegion:"Drag on the image to select an area."},toolbar:{duration:"Duration",opacity:"Opacity",effects:"Effects",blur:"Blur",curvedText:"Curved text",curvePower:"Power",temperature:"Temperature",saturation:"Saturation",contrast:"Contrast",shadows:"Shadows",white:"White",black:"Black",vibrance:"Vibrance",textBackground:"Background",textBox:"Text box",backgroundCornerRadius:"Corner radius",backgroundOpacity:"Opacity",backgroundPadding:"Padding",brightness:"Brightness",filters:"Filters",sepia:"Sepia",grayscale:"Grayscale",cold:"Cold",natural:"Natural",warm:"Warm",textStroke:"Text Stroke",textEffect:{none:"None",shadow:"Shadow",lift:"Lift",glow:"Glow",outline:"Outline",sticker:"Sticker",pop:"Pop",background:"Background"},blendMode:"Blending",blend:{"pass-through":"Pass Through",normal:"Normal",multiply:"Multiply",screen:"Screen",overlay:"Overlay",darken:"Darken",lighten:"Lighten","color-dodge":"Color Dodge","color-burn":"Color Burn","hard-light":"Hard Light","soft-light":"Soft Light",difference:"Difference",exclusion:"Exclusion",hue:"Hue",saturation:"Saturation",color:"Color",luminosity:"Luminosity"},strokeLineJoin:"Corners",joinRound:"Round",joinMiter:"Miter",joinBevel:"Bevel",shadow:"Drop shadow",border:"Border",cornerRadius:"Corner Radius",copyStyle:"Copy style",uppercase:"Uppercase",position:"Position",layering:"Layering",toForward:"To Front",up:"Forward",down:"Backward",toBottom:"To back",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignTop:"Align top",alignMiddle:"Align middle",alignBottom:"Align bottom",flip:"Flip",flipHorizontally:"Flip horizontally",flipVertically:"Flip vertically",fitToBackground:"Fit to page",fitToPage:"Fit to page",widthShort:"W",heightShort:"H",removeBackground:"Remove background",removeBackgroundTitle:"Remove background from image",cancelRemoveBackground:"Cancel",confirmRemoveBackground:"Confirm",crop:"Crop",cropDone:"Done",cropCancel:"Cancel",clip:"Apply mask",removeClip:"Remove mask",removeMask:"Remove mask",transparency:"Transparency",lockedDescription:"Object is locked. Unlock it to allow changes from canvas.",unlockedDescription:"Object is unlocked. Lock it to prevent changes from canvas.",removeElements:"Remove elements",duplicateElements:"Duplicate elements",download:"Download",saveAsImage:"Save as image",saveAsPDF:"Save as PDF",lineHeight:"Line height",letterSpacing:"Letter spacing",offsetX:"Offset X",offsetY:"Offset Y",color:"Color",selectable:"Selectable",draggable:"Draggable",removable:"Removable",resizable:"Resizable",contentEditable:"Can change content",styleEditable:"Can change style",alwaysOnTop:"Always on top",showInExport:"Show in export",ungroupElements:"Ungroup",groupElements:"Group",lineSize:"Line size",fade:"Fade",move:"Move",zoom:"Zoom",animate:"Animate",rotate:"Rotate",none:"None",bounce:"Bounce",blink:"Blink",count:"Count",pop:"Pop",rise:"Rise",flipAnimation:"Flip",growTurn:"Grow & turn",spinAnimation:"Spin",pulse:"Pulse",float:"Float",shake:"Shake",typewriter:"Typewriter",lineRise:"Line rise",wordRise:"Word rise",wordFade:"Word fade",letterPop:"Letter pop",wordBlur:"Word blur",wipe:"Wipe",glow:"Glow",lineWipe:"Line wipe",letterWave:"Letter wave",kenBurns:"Ken Burns",strength:"Strength",spaceEvenly:"Space evenly",horizontalDistribution:"Horizontally",verticalDistribution:"Vertically",strokeWidth:"Stroke Width",strokeSettings:"Stroke settings",spacing:"Spacing",volume:"Volume",speed:"Speed",seconds:"sec",lineStyle:"Line style",lineStartHead:"Line start",lineEndHead:"Line end",textDirection:"Text direction",fontSize:"Font size",fontFamily:"Font family",fontFamilyMixed:"Mixed",fontsInSelection:"Fonts in selection",textAlign:"Text align",verticalAlign:"Vertical align",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",cellBackground:"Cell background",tableBorderSettings:"Border settings",tableBorderColor:"Border color",tableBorderWidth:"Border width",tableBorderStyle:"Border style",borderModeAll:"All borders",borderModeOuter:"Outer borders",borderModeInner:"Inner borders",borderModeBottomOnly:"Bottom only",borderModeTopOnly:"Top only",borderModeLeftOnly:"Left only",borderModeRightOnly:"Right only",borderModeInnerHorizontal:"Inner horizontal",borderModeInnerVertical:"Inner vertical",tableStructure:"Table structure",tableRows:"Rows",tableColumns:"Columns",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnLeft:"Insert column left",insertColumnRight:"Insert column right",deleteColumn:"Delete column",deleteRows:"Delete rows",deleteColumns:"Delete columns",distributeRowsEvenly:"Distribute rows evenly",distributeColumnsEvenly:"Distribute columns evenly",cellPadding:"Cell padding",listFormat:"List",colorPicker:{solid:"Solid",linear:"Linear",angle:"Angle",stops:"Gradient stops",stop:"Stop",addStop:"Add stop",removeStop:"Remove stop",reverse:"Reverse gradient",colors:"Colors",resetColors:"Reset",recolorAll:"Recolor all"},clipFade:{title:"Fade",preparing:"Preparing mask…",shape:"Shape",linear:"Linear",radial:"Radial",stopOpacity:"Stop opacity",stops:"Fade stops",stop:"Stop",start:"Fade start",end:"Fade end",center:"Fade center",radius:"Fade radius",reverse:"Reverse",removeStop:"Remove stop",addStop:"Add stop",reset:"Reset",hint:"Drag the handles on the image to position the fade."},aiText:{aiWrite:"AI write",rewrite:"Rewrite",shorten:"Shorten",continue:"Continue writing",proofread:"Proofread",tones:"Tones",friendly:"Friendly",professional:"Professional",humorous:"Humorous",formal:"Formal",customPrompt:"Custom prompt",generatedResult:"Generated result",cancel:"Cancel",generate:"Generate",back:"Back",tryAgain:"Try Again",insert:"Insert",promptPlaceholder:"Describe what you want to generate"}},workspace:{noPages:"There are no pages yet...",addPage:"Add page",removePage:"Remove page",duplicatePage:"Duplicate page",moveUp:"Move up",moveDown:"Move down",moveLeft:"Move left",moveRight:"Move right"},scale:{reset:"Reset"},error:{removeBackground:"Ops! Something went wrong. Background can not be removed."},sidePanel:{close:"Close",templates:"Templates",searchTemplatesWithSameSize:"Show templates with the same size",searchPlaceholder:"Search...",otherFormats:"Other formats",noResults:"No results",error:"Loading is failed...",text:"Text",uploadFont:"Upload font",myFonts:"My fonts",photos:"Photos",videos:"Videos",animations:"Animations",effects:"Effects",elements:"Elements",shapes:"Shapes",tables:"Tables",lines:"Lines",draw:"Draw",drawTool:"Tool",drawSelection:"Selection",drawBrush:"Brush",drawHighlighter:"Highlighter",upload:"Upload",uploadImage:"Add file",uploadTip:"Upload your assets",uploadUnsupported:"Skipped some files. You can add images, video and audio.",uploadFailed:"Upload failed. Please try again.",background:"Background",resize:"Resize",layers:"Layers",animate:"Animate",animationEnter:"Enter",animationBoth:"Both",animationExit:"Exit",animationLoop:"Loop",animationGeneral:"General",animationTextPresets:"Text",animationDuration:"Duration (s)",animationRepeatEvery:"Repeat every (s)",animationStartAt:"Start at (s)",animationEndAt:"End at (s)",animationDirection:"Direction",animationDirections:{right:"Right",left:"Left",up:"Up",down:"Down","bottom-right":"Bottom right","bottom-left":"Bottom left","top-right":"Top right","top-left":"Top left",none:"None"},zoomIn:"Zoom In",zoomOut:"Zoom Out",layerTypes:{image:"Image",text:"Text",svg:"SVG",line:"Line",figure:"Figure",group:"Group"},layersTip:"Elements on your active page:",noLayers:"No elements on the page...",namePlaceholder:"Type element name...",useMagicResize:"Use magic resize",advanced:"Advanced",bleed:"Bleed",showBleed:"Show bleed",clipImage:"Mask image",width:"Width",height:"Height",units:"Units",magicResizeDescription:"Magic resize will automatically resize and move all elements on the canvas",headerText:"Header",createHeader:"Create header",subHeaderText:"Sub Header",createSubHeader:"Create sub header",bodyText:"Body text",createBody:"Create body text"},pagesTimeline:{pages:"Pages",removePage:"Remove page",addPage:"Add page",duplicatePage:"Duplicate page",removeAudio:"Remove audio",duplicateAudio:"Duplicate audio",renameAudio:"Rename audio",muteAudio:"Mute",unmuteAudio:"Unmute",volume:"Volume",speed:"Speed",rewind:"Rewind to start",editAsVideo:"Edit as video",editAsVideoHint:"On: preview the frame at the playhead — timed elements hide outside their range. Off: show all elements while editing."},contextMenu:{duplicate:"Duplicate",split:"Split at playhead",rename:"Rename",remove:"Remove",lock:"Lock",unlock:"Unlock",copy:"Copy",paste:"Paste",copyStyle:"Copy style",moveUp:"Move up",moveDown:"Move down",moveBack:"Move back",moveForward:"Move forward"}}),n=e=>e&&"object"==typeof e;function i(e,o){Object.keys(o).forEach(a=>{const r=e[a],l=o[a];n(l)&&n(r)?i(r,l):e[a]=l})}function l(e,o,a=""){Object.keys(o).forEach(r=>{const i=o[r],s=a?`${a}.${r}`:r;n(i)?n(e[r])?l(e[r],i,s):console.warn(`Missing nested translation object at '${s}'`):void 0===e[r]&&console.warn(`Missing translation '${s}'`)})}export const setTranslations=o((e,{validate:o=!1}={})=>{o&&l(e,r),i(r,e)});export const getTranslations=()=>a(r);const s={};export const t=e=>{const o=function(e,o){var a,r=o.split("."),n=e;for(a=0;a<r.length;++a){if(null==n[r[a]]){return}n=n[r[a]]}return n}(r,e);if(void 0!==o){return o}s[e]||(s[e]=!0,console.warn(`Missing translation '${e}'`));const a=e.split("."),n=a[a.length-1]||" ";return n.charAt(0).toUpperCase()+n.slice(1)};
|
|
1
|
+
import{observable as e,action as o,toJS as a}from"mobx";const r=e({imageEdit:{title:"AI edit",expand:"Expand",upscale:"Upscale",inpaint:"Generative fill",replace:"Replace",remove:"Remove",prompt:"Your prompt",promptPlaceholder:"Describe what should be there",expandPromptPlaceholder:"Describe the new area (optional)",replaceDescription:"Select an area on the image, then describe what you want to change.",replaceHint:"Describe what should replace the selection, such as “plain wall” or “open sky”.",removeDescription:"Select an object to remove. The surrounding image will fill the selected area.",expandDescription:"Drag the frame beyond the image edges to make room for new content.",cropDescription:"Drag the frame to crop the image.",upscaleDescription:"Increase the image resolution.",removeBackgroundDescription:"Remove the image background.",applyCrop:"Apply crop",generate:"Generate",clear:"Clear selection",resetFrame:"Reset frame",processing:"Generating…",loadingImage:"Loading image…",upscaling:"Upscaling…",removingBackground:"Removing background…",failed:"The image could not be edited. Please try again.",rasterFailed:"This device could not prepare the image. Try a smaller image.",selectRegion:"Drag on the image to select an area."},toolbar:{duration:"Duration",opacity:"Opacity",effects:"Effects",blur:"Blur",curvedText:"Curved text",curvePower:"Power",temperature:"Temperature",saturation:"Saturation",contrast:"Contrast",shadows:"Shadows",white:"White",black:"Black",vibrance:"Vibrance",textBackground:"Background",textBox:"Text box",backgroundCornerRadius:"Corner radius",backgroundOpacity:"Opacity",backgroundPadding:"Padding",brightness:"Brightness",filters:"Filters",sepia:"Sepia",grayscale:"Grayscale",cold:"Cold",natural:"Natural",warm:"Warm",textStroke:"Text Stroke",textEffect:{none:"None",shadow:"Shadow",lift:"Lift",glow:"Glow",outline:"Outline",sticker:"Sticker",pop:"Pop",background:"Background"},blendMode:"Blending",blend:{"pass-through":"Pass Through",normal:"Normal",multiply:"Multiply",screen:"Screen",overlay:"Overlay",darken:"Darken",lighten:"Lighten","color-dodge":"Color Dodge","color-burn":"Color Burn","hard-light":"Hard Light","soft-light":"Soft Light",difference:"Difference",exclusion:"Exclusion",hue:"Hue",saturation:"Saturation",color:"Color",luminosity:"Luminosity"},strokeLineJoin:"Corners",joinRound:"Round",joinMiter:"Miter",joinBevel:"Bevel",shadow:"Drop shadow",border:"Border",cornerRadius:"Corner Radius",copyStyle:"Copy style",uppercase:"Uppercase",position:"Position",layering:"Layering",toForward:"To Front",up:"Forward",down:"Backward",toBottom:"To back",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignTop:"Align top",alignMiddle:"Align middle",alignBottom:"Align bottom",flip:"Flip",flipHorizontally:"Flip horizontally",flipVertically:"Flip vertically",fitToBackground:"Fit to page",fitToPage:"Fit to page",widthShort:"W",heightShort:"H",removeBackground:"Remove background",removeBackgroundTitle:"Remove background from image",cancelRemoveBackground:"Cancel",confirmRemoveBackground:"Confirm",crop:"Crop",cropDone:"Done",cropCancel:"Cancel",clip:"Apply mask",removeClip:"Remove mask",removeMask:"Remove mask",transparency:"Transparency",lockedDescription:"Object is locked. Unlock it to allow changes from canvas.",unlockedDescription:"Object is unlocked. Lock it to prevent changes from canvas.",removeElements:"Remove elements",duplicateElements:"Duplicate elements",download:"Download",saveAsImage:"Save as image",saveAsPDF:"Save as PDF",lineHeight:"Line height",letterSpacing:"Letter spacing",offsetX:"Offset X",offsetY:"Offset Y",color:"Color",selectable:"Selectable",draggable:"Draggable",removable:"Removable",resizable:"Resizable",contentEditable:"Can change content",styleEditable:"Can change style",alwaysOnTop:"Always on top",showInExport:"Show in export",ungroupElements:"Ungroup",groupElements:"Group",lineSize:"Line size",fade:"Fade",move:"Move",zoom:"Zoom",animate:"Animate",rotate:"Rotate",none:"None",bounce:"Bounce",blink:"Blink",count:"Count",pop:"Pop",rise:"Rise",flipAnimation:"Flip",growTurn:"Grow & turn",spinAnimation:"Spin",pulse:"Pulse",float:"Float",shake:"Shake",typewriter:"Typewriter",lineRise:"Line rise",wordRise:"Word rise",wordFade:"Word fade",letterPop:"Letter pop",wordBlur:"Word blur",wipe:"Wipe",glow:"Glow",lineWipe:"Line wipe",linePeek:"Line peek",letterWave:"Letter wave",kenBurns:"Ken Burns",strength:"Strength",spaceEvenly:"Space evenly",horizontalDistribution:"Horizontally",verticalDistribution:"Vertically",strokeWidth:"Stroke Width",strokeSettings:"Stroke settings",spacing:"Spacing",volume:"Volume",speed:"Speed",seconds:"sec",lineStyle:"Line style",lineStartHead:"Line start",lineEndHead:"Line end",textDirection:"Text direction",fontSize:"Font size",fontFamily:"Font family",fontFamilyMixed:"Mixed",fontsInSelection:"Fonts in selection",textAlign:"Text align",verticalAlign:"Vertical align",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",cellBackground:"Cell background",tableBorderSettings:"Border settings",tableBorderColor:"Border color",tableBorderWidth:"Border width",tableBorderStyle:"Border style",borderModeAll:"All borders",borderModeOuter:"Outer borders",borderModeInner:"Inner borders",borderModeBottomOnly:"Bottom only",borderModeTopOnly:"Top only",borderModeLeftOnly:"Left only",borderModeRightOnly:"Right only",borderModeInnerHorizontal:"Inner horizontal",borderModeInnerVertical:"Inner vertical",tableStructure:"Table structure",tableRows:"Rows",tableColumns:"Columns",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnLeft:"Insert column left",insertColumnRight:"Insert column right",deleteColumn:"Delete column",deleteRows:"Delete rows",deleteColumns:"Delete columns",distributeRowsEvenly:"Distribute rows evenly",distributeColumnsEvenly:"Distribute columns evenly",cellPadding:"Cell padding",listFormat:"List",colorPicker:{solid:"Solid",linear:"Linear",angle:"Angle",stops:"Gradient stops",stop:"Stop",addStop:"Add stop",removeStop:"Remove stop",reverse:"Reverse gradient",colors:"Colors",resetColors:"Reset",recolorAll:"Recolor all"},clipFade:{title:"Fade",preparing:"Preparing mask…",shape:"Shape",linear:"Linear",radial:"Radial",stopOpacity:"Stop opacity",stops:"Fade stops",stop:"Stop",start:"Fade start",end:"Fade end",center:"Fade center",radius:"Fade radius",reverse:"Reverse",removeStop:"Remove stop",addStop:"Add stop",reset:"Reset",hint:"Drag the handles on the image to position the fade."},aiText:{aiWrite:"AI write",rewrite:"Rewrite",shorten:"Shorten",continue:"Continue writing",proofread:"Proofread",tones:"Tones",friendly:"Friendly",professional:"Professional",humorous:"Humorous",formal:"Formal",customPrompt:"Custom prompt",generatedResult:"Generated result",cancel:"Cancel",generate:"Generate",back:"Back",tryAgain:"Try Again",insert:"Insert",promptPlaceholder:"Describe what you want to generate"}},workspace:{noPages:"There are no pages yet...",addPage:"Add page",removePage:"Remove page",duplicatePage:"Duplicate page",moveUp:"Move up",moveDown:"Move down",moveLeft:"Move left",moveRight:"Move right"},scale:{reset:"Reset"},error:{removeBackground:"Ops! Something went wrong. Background can not be removed."},sidePanel:{close:"Close",templates:"Templates",searchTemplatesWithSameSize:"Show templates with the same size",searchPlaceholder:"Search...",otherFormats:"Other formats",noResults:"No results",error:"Loading is failed...",text:"Text",uploadFont:"Upload font",myFonts:"My fonts",photos:"Photos",videos:"Videos",animations:"Animations",effects:"Effects",elements:"Elements",shapes:"Shapes",tables:"Tables",lines:"Lines",draw:"Draw",drawTool:"Tool",drawSelection:"Selection",drawBrush:"Brush",drawHighlighter:"Highlighter",upload:"Upload",uploadImage:"Add file",uploadTip:"Upload your assets",uploadUnsupported:"Skipped some files. You can add images, video, audio and Lottie animations.",uploadFailed:"Upload failed. Please try again.",background:"Background",resize:"Resize",layers:"Layers",animate:"Animate",animationEnter:"Enter",animationBoth:"Both",animationExit:"Exit",animationLoop:"Loop",animationGeneral:"General",animationTextPresets:"Text",animationDuration:"Duration (s)",animationRepeatEvery:"Repeat every (s)",animationStartAt:"Start at (s)",animationEndAt:"End at (s)",animationDirection:"Direction",animationDirections:{right:"Right",left:"Left",up:"Up",down:"Down","bottom-right":"Bottom right","bottom-left":"Bottom left","top-right":"Top right","top-left":"Top left",none:"None"},zoomIn:"Zoom In",zoomOut:"Zoom Out",layerTypes:{image:"Image",text:"Text",svg:"SVG",line:"Line",figure:"Figure",group:"Group"},layersTip:"Elements on your active page:",noLayers:"No elements on the page...",namePlaceholder:"Type element name...",useMagicResize:"Use magic resize",advanced:"Advanced",bleed:"Bleed",showBleed:"Show bleed",clipImage:"Mask image",width:"Width",height:"Height",units:"Units",magicResizeDescription:"Magic resize will automatically resize and move all elements on the canvas",headerText:"Header",createHeader:"Create header",subHeaderText:"Sub Header",createSubHeader:"Create sub header",bodyText:"Body text",createBody:"Create body text"},pagesTimeline:{pages:"Pages",removePage:"Remove page",addPage:"Add page",duplicatePage:"Duplicate page",removeAudio:"Remove audio",duplicateAudio:"Duplicate audio",renameAudio:"Rename audio",muteAudio:"Mute",unmuteAudio:"Unmute",volume:"Volume",speed:"Speed",rewind:"Rewind to start",editAsVideo:"Edit as video",editAsVideoHint:"On: preview the frame at the playhead — timed elements hide outside their range. Off: show all elements while editing."},contextMenu:{duplicate:"Duplicate",split:"Split at playhead",rename:"Rename",remove:"Remove",lock:"Lock",unlock:"Unlock",copy:"Copy",paste:"Paste",copyStyle:"Copy style",moveUp:"Move up",moveDown:"Move down",moveBack:"Move back",moveForward:"Move forward"}}),n=e=>e&&"object"==typeof e;function i(e,o){Object.keys(o).forEach(a=>{const r=e[a],l=o[a];n(l)&&n(r)?i(r,l):e[a]=l})}function l(e,o,a=""){Object.keys(o).forEach(r=>{const i=o[r],s=a?`${a}.${r}`:r;n(i)?n(e[r])?l(e[r],i,s):console.warn(`Missing nested translation object at '${s}'`):void 0===e[r]&&console.warn(`Missing translation '${s}'`)})}export const setTranslations=o((e,{validate:o=!1}={})=>{o&&l(e,r),i(r,e)});export const getTranslations=()=>a(r);const s={};export const t=e=>{const o=function(e,o){var a,r=o.split("."),n=e;for(a=0;a<r.length;++a){if(null==n[r[a]]){return}n=n[r[a]]}return n}(r,e);if(void 0!==o){return o}s[e]||(s[e]=!0,console.warn(`Missing translation '${e}'`));const a=e.split("."),n=a[a.length-1]||" ";return n.charAt(0).toUpperCase()+n.slice(1)};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DotLottie } from '@lottiefiles/dotlottie-web';
|
|
2
|
+
export type OpenLottie = {
|
|
3
|
+
player: DotLottie;
|
|
4
|
+
canvas: HTMLCanvasElement;
|
|
5
|
+
};
|
|
6
|
+
export declare function closeLottie({ player, canvas }: OpenLottie): void;
|
|
7
|
+
export declare function openLottie(url: string): Promise<OpenLottie>;
|
|
8
|
+
export declare function getLottieSize(url: string): Promise<{
|
|
9
|
+
height: number;
|
|
10
|
+
width: number;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function getLottiePreview(url: string, size?: number): Promise<string>;
|
package/utils/lottie.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"konva";import{fetchBytesWithRetry as e}from"@polotno/core/retry";import{bytesToDataUri as a,dataUrlToBytes as o}from"@polotno/core/image-bytes";async function n(t){var n;const r=null!==(n=o(t))&&void 0!==n?n:await e(t);return 80===r[0]&&75===r[1]&&3===r[2]&&4===r[3]?new Uint8Array(r).buffer:async function(t,o){var n;const r=JSON.parse(t),i=(null!==(n=r.assets)&&void 0!==n?n:[]).filter(t=>t.w&&t.p&&!t.p.startsWith("data:"));if(!i.length){return t}const s=new URL(o,document.baseURI);return await Promise.all(i.map(async t=>{var o;const n=new URL((null!==(o=t.u)&&void 0!==o?o:"")+t.p,s).href,r=await e(n),i=(t=>137===t[0]&&80===t[1]&&78===t[2]?"png":255===t[0]&&216===t[1]?"jpeg":"WEBP"===String.fromCharCode(...t.subarray(8,12))?"webp":void 0)(r);if(!i){throw new Error(`Not a PNG, JPEG or WebP image: ${n}`)}t.p=a(r,`image/${i}`),t.u="",t.e=1})),JSON.stringify(r)}((new TextDecoder).decode(r),t)}export function closeLottie({player:e,canvas:a}){e.destroy(),t.Util.releaseCanvas(a)}export async function openLottie(t){const[e,a]=await Promise.all([n(t),import("../canvas/lottie-player.js").then(t=>t.loadDotLottie())]),o=document.createElement("canvas");o.width=o.height=1;const r=new a({canvas:o,data:e,layout:{fit:"fill"}});return await new Promise((t,e)=>{r.addEventListener("load",()=>t()),r.addEventListener("loadError",t=>{closeLottie({player:r,canvas:o}),e(t.error)})}),{player:r,canvas:o}}export async function getLottieSize(t){const e=await openLottie(t),a=e.player.animationSize();return closeLottie(e),a}export async function getLottiePreview(t,e=240){const a=await openLottie(t),{player:o,canvas:n}=a,{width:r,height:i}=o.animationSize(),s=e/Math.max(r,i);n.width=Math.max(1,Math.round(r*s)),n.height=Math.max(1,Math.round(i*s)),o.resize(),o.setFrame(o.totalFrames-1);const c=n.toDataURL();return closeLottie(a),c}
|
package/utils/math.d.ts
CHANGED
|
@@ -40,17 +40,17 @@ export declare function getCenter(shape: CenterShape): {
|
|
|
40
40
|
y: number;
|
|
41
41
|
};
|
|
42
42
|
export declare function rotateAroundPoint(shape: Shape, deltaDeg: number, point: Point): {
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
43
45
|
rotation: number;
|
|
44
46
|
x: number;
|
|
45
47
|
y: number;
|
|
46
|
-
width: number;
|
|
47
|
-
height: number;
|
|
48
48
|
};
|
|
49
49
|
export declare function rotateAroundCenter(shape: Shape, deltaDeg: number): {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
50
52
|
rotation: number;
|
|
51
53
|
x: number;
|
|
52
54
|
y: number;
|
|
53
|
-
width: number;
|
|
54
|
-
height: number;
|
|
55
55
|
};
|
|
56
56
|
export {};
|
package/utils/px.d.ts
CHANGED
|
@@ -60,6 +60,9 @@ export declare const roundedFontSizeAttrs: (element: TextStyleSource, fontSize:
|
|
|
60
60
|
shadowOffsetX: number;
|
|
61
61
|
shadowOffsetY: number;
|
|
62
62
|
};
|
|
63
|
+
declare const MEDIA_TYPES: readonly ['image', 'svg', 'gif', 'lottie', 'video'];
|
|
64
|
+
type MediaType = (typeof MEDIA_TYPES)[number];
|
|
65
|
+
export declare const isMedia: (type: string) => type is MediaType;
|
|
63
66
|
export declare const scaledStyleAttrs: (element: {
|
|
64
67
|
type: string;
|
|
65
68
|
}, scale: number) => Record<string, number | string>;
|
package/utils/px.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=this&&this.__rest||function(t,e){var o={};for(var r in t){Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(o[r]=t[r])}if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++){e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(o[r[n]]=t[r[n]])}}return o};import{htmlInflatesMinContentWidth as e,scaleRichTextFontSizesInHtml as o}from"./rich-text-html.js";export const roundEnabledPx=t=>t>0?Math.max(1,Math.round(t)):0;export const MAIN_TRANSFORMER_NAME="main-transformer";export const activeAnchorOf=t=>{var e,o;const r=null===(e=t.getStage())||void 0===e?void 0:e.findOne(".main-transformer");return null!==(o=null==r?void 0:r.getActiveAnchor())&&void 0!==o?o:""};export const isCornerAnchor=t=>!(t.includes("middle")||t.includes("center"));export const isRotateAnchor=t=>t.startsWith("rotater");export const transformScale=t=>Math.abs(t-1)<1e-7?1:t;export const textMinResizeWidth=(t,e)=>t<e?1:e;export const textMinWidthIsMeasured=t=>{var o;return!!t.curveEnabled||0!==(null!==(o=t.letterSpacing)&&void 0!==o?o:0)||e(t.text)};const r=(t,e)=>{var o;return{cornerRadius:(null!==(o=t.cornerRadius)&&void 0!==o?o:0)*e,shadowBlur:t.shadowBlur*e,shadowOffsetX:t.shadowOffsetX*e,shadowOffsetY:t.shadowOffsetY*e}},n=t=>{var e;return{cornerRadius:roundEnabledPx(null!==(e=t.cornerRadius)&&void 0!==e?e:0),shadowBlur:Math.round(t.shadowBlur),shadowOffsetX:Math.round(t.shadowOffsetX),shadowOffsetY:Math.round(t.shadowOffsetY)}};export const scaledFontSizeAttrs=(t,e)=>{const o=t.fontSize>0?e/t.fontSize:1;return{fontSize:e,strokeWidth:t.strokeWidth*o,borderSize:t.borderSize*o,shadowBlur:t.shadowBlur*o,shadowOffsetX:t.shadowOffsetX*o,shadowOffsetY:t.shadowOffsetY*o}};export const scaledFontSizeBounds=(t,e,o=!1)=>{const r=t=>{if(1===e){return t}const r=t*e;return o?Math.round(r):r},n={};return void 0!==t.minFontSize&&(n.minFontSize=r(t.minFontSize)),void 0!==t.maxFontSize&&(n.maxFontSize=r(t.maxFontSize)),n};export const roundedGeometryPx=t=>Math.round(1e6*t)/1e6+0;export const roundedCropFraction=t=>Math.round(1e9*t)/1e9+0;export const roundedPosition=t=>({x:roundedGeometryPx(t.x()),y:roundedGeometryPx(t.y())});export const roundedGeometryAttrs=t=>({x:roundedGeometryPx(t.x),y:roundedGeometryPx(t.y),width:roundedGeometryPx(t.width),height:roundedGeometryPx(t.height),rotation:roundedGeometryPx(t.rotation)});export const roundedFontSizeAttrs=(t,e)=>{const o=scaledFontSizeAttrs(t,e);return{fontSize:Math.round(o.fontSize),strokeWidth:roundEnabledPx(o.strokeWidth),borderSize:roundEnabledPx(o.borderSize),shadowBlur:Math.round(o.shadowBlur),shadowOffsetX:Math.round(o.shadowOffsetX),shadowOffsetY:Math.round(o.shadowOffsetY)}};const s=["image","svg","gif","video"];export const scaledStyleAttrs=(t,e)=>{const n=t;return"text"===n.type?Object.assign(Object.assign({},scaledFontSizeAttrs(n,n.fontSize*e)),{text:o(n.text,e)}):"figure"===n.type?Object.assign(Object.assign({},r(n,e)),{strokeWidth:n.strokeWidth*e}):
|
|
1
|
+
var t=this&&this.__rest||function(t,e){var o={};for(var r in t){Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(o[r]=t[r])}if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++){e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(o[r[n]]=t[r[n]])}}return o};import{htmlInflatesMinContentWidth as e,scaleRichTextFontSizesInHtml as o}from"./rich-text-html.js";export const roundEnabledPx=t=>t>0?Math.max(1,Math.round(t)):0;export const MAIN_TRANSFORMER_NAME="main-transformer";export const activeAnchorOf=t=>{var e,o;const r=null===(e=t.getStage())||void 0===e?void 0:e.findOne(".main-transformer");return null!==(o=null==r?void 0:r.getActiveAnchor())&&void 0!==o?o:""};export const isCornerAnchor=t=>!(t.includes("middle")||t.includes("center"));export const isRotateAnchor=t=>t.startsWith("rotater");export const transformScale=t=>Math.abs(t-1)<1e-7?1:t;export const textMinResizeWidth=(t,e)=>t<e?1:e;export const textMinWidthIsMeasured=t=>{var o;return!!t.curveEnabled||0!==(null!==(o=t.letterSpacing)&&void 0!==o?o:0)||e(t.text)};const r=(t,e)=>{var o;return{cornerRadius:(null!==(o=t.cornerRadius)&&void 0!==o?o:0)*e,shadowBlur:t.shadowBlur*e,shadowOffsetX:t.shadowOffsetX*e,shadowOffsetY:t.shadowOffsetY*e}},n=t=>{var e;return{cornerRadius:roundEnabledPx(null!==(e=t.cornerRadius)&&void 0!==e?e:0),shadowBlur:Math.round(t.shadowBlur),shadowOffsetX:Math.round(t.shadowOffsetX),shadowOffsetY:Math.round(t.shadowOffsetY)}};export const scaledFontSizeAttrs=(t,e)=>{const o=t.fontSize>0?e/t.fontSize:1;return{fontSize:e,strokeWidth:t.strokeWidth*o,borderSize:t.borderSize*o,shadowBlur:t.shadowBlur*o,shadowOffsetX:t.shadowOffsetX*o,shadowOffsetY:t.shadowOffsetY*o}};export const scaledFontSizeBounds=(t,e,o=!1)=>{const r=t=>{if(1===e){return t}const r=t*e;return o?Math.round(r):r},n={};return void 0!==t.minFontSize&&(n.minFontSize=r(t.minFontSize)),void 0!==t.maxFontSize&&(n.maxFontSize=r(t.maxFontSize)),n};export const roundedGeometryPx=t=>Math.round(1e6*t)/1e6+0;export const roundedCropFraction=t=>Math.round(1e9*t)/1e9+0;export const roundedPosition=t=>({x:roundedGeometryPx(t.x()),y:roundedGeometryPx(t.y())});export const roundedGeometryAttrs=t=>({x:roundedGeometryPx(t.x),y:roundedGeometryPx(t.y),width:roundedGeometryPx(t.width),height:roundedGeometryPx(t.height),rotation:roundedGeometryPx(t.rotation)});export const roundedFontSizeAttrs=(t,e)=>{const o=scaledFontSizeAttrs(t,e);return{fontSize:Math.round(o.fontSize),strokeWidth:roundEnabledPx(o.strokeWidth),borderSize:roundEnabledPx(o.borderSize),shadowBlur:Math.round(o.shadowBlur),shadowOffsetX:Math.round(o.shadowOffsetX),shadowOffsetY:Math.round(o.shadowOffsetY)}};const s=["image","svg","gif","lottie","video"];export const isMedia=t=>s.includes(t);export const scaledStyleAttrs=(t,e)=>{const n=t;return"text"===n.type?Object.assign(Object.assign({},scaledFontSizeAttrs(n,n.fontSize*e)),{text:o(n.text,e)}):"figure"===n.type?Object.assign(Object.assign({},r(n,e)),{strokeWidth:n.strokeWidth*e}):isMedia(n.type)?Object.assign(Object.assign({},r(n,e)),{borderSize:n.borderSize*e}):{}};export const roundedStyleAttrs=t=>{const e=t;return"text"===e.type?roundedFontSizeAttrs(e,e.fontSize):"figure"===e.type?Object.assign(Object.assign({},n(e)),{strokeWidth:roundEnabledPx(e.strokeWidth)}):isMedia(e.type)?Object.assign(Object.assign({},n(e)),{borderSize:roundEnabledPx(e.borderSize)}):{}};export const roundedTextDecorationAttrs=e=>{const o=roundedFontSizeAttrs(e,e.fontSize),{fontSize:r}=o;return t(o,["fontSize"])};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
defaultProps: {
|
|
2
|
+
export declare function Checkboard({ white, grey, size, renderers, borderRadius, boxShadow, children, }: {
|
|
3
|
+
white?: string;
|
|
4
|
+
grey?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
renderers?: any;
|
|
7
|
+
borderRadius?: string;
|
|
8
|
+
boxShadow?: string;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
11
|
+
export declare namespace Checkboard {
|
|
12
|
+
var defaultProps: {
|
|
13
13
|
size: number;
|
|
14
14
|
white: string;
|
|
15
15
|
grey: string;
|
|
16
16
|
renderers: {};
|
|
17
17
|
};
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
19
|
export default Checkboard;
|
|
@@ -15,17 +15,17 @@ declare const _default: {
|
|
|
15
15
|
handleBlur: () => void;
|
|
16
16
|
render(): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
17
17
|
context: unknown;
|
|
18
|
-
setState<K extends "focus">(state: {
|
|
18
|
+
setState<K extends "focus">(state: Pick<{
|
|
19
19
|
focus: boolean;
|
|
20
|
-
} | ((prevState: Readonly<{
|
|
20
|
+
}, K> | ((prevState: Readonly<{
|
|
21
21
|
focus: boolean;
|
|
22
|
-
}>, props: Readonly<any>) => {
|
|
22
|
+
}>, props: Readonly<any>) => Pick<{
|
|
23
23
|
focus: boolean;
|
|
24
|
-
} |
|
|
24
|
+
}, K> | {
|
|
25
25
|
focus: boolean;
|
|
26
|
-
}
|
|
26
|
+
} | null) | {
|
|
27
27
|
focus: boolean;
|
|
28
|
-
}
|
|
28
|
+
} | null, callback?: (() => void) | undefined): void;
|
|
29
29
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
30
30
|
readonly props: Readonly<any>;
|
|
31
31
|
state: Readonly<{
|
|
@@ -5,17 +5,17 @@ export declare const handleFocus: (Component: any, Span?: any) => {
|
|
|
5
5
|
handleBlur: () => void;
|
|
6
6
|
render(): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
7
7
|
context: unknown;
|
|
8
|
-
setState<K extends "focus">(state: {
|
|
8
|
+
setState<K extends "focus">(state: Pick<{
|
|
9
9
|
focus: boolean;
|
|
10
|
-
} | ((prevState: Readonly<{
|
|
10
|
+
}, K> | ((prevState: Readonly<{
|
|
11
11
|
focus: boolean;
|
|
12
|
-
}>, props: Readonly<any>) => {
|
|
12
|
+
}>, props: Readonly<any>) => Pick<{
|
|
13
13
|
focus: boolean;
|
|
14
|
-
} |
|
|
14
|
+
}, K> | {
|
|
15
15
|
focus: boolean;
|
|
16
|
-
}
|
|
16
|
+
} | null) | {
|
|
17
17
|
focus: boolean;
|
|
18
|
-
}
|
|
18
|
+
} | null, callback?: (() => void) | undefined): void;
|
|
19
19
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
20
20
|
readonly props: Readonly<any>;
|
|
21
21
|
state: Readonly<{
|
|
@@ -5,17 +5,17 @@ export declare const active: (Component: any, Span?: any) => {
|
|
|
5
5
|
handleMouseUp: () => void;
|
|
6
6
|
render(): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
7
7
|
context: unknown;
|
|
8
|
-
setState<K extends "active">(state: {
|
|
8
|
+
setState<K extends "active">(state: Pick<{
|
|
9
9
|
active: boolean;
|
|
10
|
-
} | ((prevState: Readonly<{
|
|
10
|
+
}, K> | ((prevState: Readonly<{
|
|
11
11
|
active: boolean;
|
|
12
|
-
}>, props: Readonly<any>) => {
|
|
12
|
+
}>, props: Readonly<any>) => Pick<{
|
|
13
13
|
active: boolean;
|
|
14
|
-
} |
|
|
14
|
+
}, K> | {
|
|
15
15
|
active: boolean;
|
|
16
|
-
}
|
|
16
|
+
} | null) | {
|
|
17
17
|
active: boolean;
|
|
18
|
-
}
|
|
18
|
+
} | null, callback?: (() => void) | undefined): void;
|
|
19
19
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
20
20
|
readonly props: Readonly<any>;
|
|
21
21
|
state: Readonly<{
|
|
@@ -5,17 +5,17 @@ export declare const hover: (Component: any, Span?: any) => {
|
|
|
5
5
|
handleMouseOut: () => void;
|
|
6
6
|
render(): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
7
7
|
context: unknown;
|
|
8
|
-
setState<K extends "hover">(state: {
|
|
8
|
+
setState<K extends "hover">(state: Pick<{
|
|
9
9
|
hover: boolean;
|
|
10
|
-
} | ((prevState: Readonly<{
|
|
10
|
+
}, K> | ((prevState: Readonly<{
|
|
11
11
|
hover: boolean;
|
|
12
|
-
}>, props: Readonly<any>) => {
|
|
12
|
+
}>, props: Readonly<any>) => Pick<{
|
|
13
13
|
hover: boolean;
|
|
14
|
-
} |
|
|
14
|
+
}, K> | {
|
|
15
15
|
hover: boolean;
|
|
16
|
-
}
|
|
16
|
+
} | null) | {
|
|
17
17
|
hover: boolean;
|
|
18
|
-
}
|
|
18
|
+
} | null, callback?: (() => void) | undefined): void;
|
|
19
19
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
20
20
|
readonly props: Readonly<any>;
|
|
21
21
|
state: Readonly<{
|
package/utils/rich-text-html.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"@polotno/core/rich-text-html";import{
|
|
1
|
+
export*from"@polotno/core/rich-text-html";import{hasMarkup as t,parseHtmlRoot as e,cleanupInlineWrappers as r,extractFontFamiliesFromHtml as o,normalizeRichTextHtml as n,scaleRichTextFontSizesInHtml as i}from"@polotno/core/rich-text-html";import{containsCmykColor as l,isCmykColor as s,toDisplayColor as c}from"@polotno/core/color";import{buildStyleAttribute as u,mapStyleAttributes as f,parseStyleAttribute as a,stripPriority as p,styleAttributeRanges as y}from"@polotno/core/style-attribute";import{sameColors as d}from"@polotno/core/svg";import{isGradient as m,parseColor as b}from"@polotno/core/gradient";import{LRUCache as v}from"./lru-cache.js";const h="data-native-";export function nativeColorAttribute(t){return h+t}const g=t=>s(t)||m(t)&&l(t);export function readNativeColor(t,e){var r;const o=t.getAttribute(nativeColorAttribute(e));if(null!==o){const n=null===(r=t.style)||void 0===r?void 0:r.getPropertyValue(e);return g(o)&&n&&function(t,e,r){const o=c(r);if(!m(o)){return d(e,o)}const n=function(t,e){if("undefined"==typeof document){return null}const r=document.createElement("span");return r.style.setProperty(t,e),r.style.getPropertyValue(t)||null}(t,o);if(null!==n){return n===e}if(!m(e)){return!1}const i=b(e),l=b(o);return i.rotation===l.rotation&&i.stops.length===l.stops.length&&i.stops.every((t,e)=>Math.abs(t.offset-l.stops[e].offset)<.001&&d(t.color,l.stops[e].color))}(e,n,o)?o:""}const n=a(t.getAttribute("style"))[e];return n&&g(n)?n:""}export function detachNativeColorsInHtml(t){if(!l(t)){return t}const r=e(t);return r?(function(t){for(const e of Array.from(t.querySelectorAll("[style]"))){const t=e.getAttribute("style");if(!l(t)){continue}const r=a(t);for(const[o,n]of Object.entries(r)){g(n)&&(e.setAttribute(nativeColorAttribute(o),n),r[o]=c(n))}e.setAttribute("style",u(r))}}(r),r.innerHTML):t}export function attachNativeColorsInHtml(t){if(!t||!t.includes(h)){return t}const o=e(t);if(!o){return t}let n=!1;for(const e of Array.from(o.querySelectorAll("*"))){for(const{name:t}of Array.from(e.attributes)){if(!t.startsWith(h)){continue}const r=t.slice(12),o=readNativeColor(e,r);if(e.removeAttribute(t),!o){n=!0;continue}const i=a(e.getAttribute("style"));i[r]=o,e.setAttribute("style",u(i))}}return n&&r(o),o.innerHTML}function x(t,e){if(!l(t)){return e(t)}const r=detachNativeColorsInHtml(t),o=e(r);return o===r?t:attachNativeColorsInHtml(o)}export function scaleRichTextFontSizesInHtml(t,e){return x(t,t=>i(t,e))}const A=new v(500);export function htmlInflatesMinContentWidth(t){if(!t||!t.includes("<")){return!1}let r=A.get(t);if(void 0===r){r=!1;const o=e(t);if(o){if(o.querySelector("ol, ul")){r=!0}else{for(const t of o.querySelectorAll("[style]")){if(t.style.fontSize||t.style.letterSpacing){r=!0;break}}}}A.set(t,r)}return r}export function quillHtmlToModelText(t,e){return attachNativeColorsInHtml(n(function(t){const e=(t||"").trim();if("<p><br></p>"===e||"<p></p>"===e){return""}if(e.startsWith("<p>")&&e.endsWith("</p>")){const t=e.slice(3,-4);if(!/(<\/?(p|div|h[1-6]|ul|ol|li|table|thead|tbody|tr|td|blockquote)\b)/i.test(t)){return t}}return t}(t),e))}export function shrinkParagraphStrutForRaster(t){var r;if(!t||!t.includes("<p")){return t}const o=e(t);if(!o){return t}for(const e of Array.from(o.querySelectorAll("p"))){let t=!1;const n=[],i=o.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);let l=i.nextNode();for(;l;){if((l.textContent||"").length>0){let o=l.parentElement,i=null;for(;o&&o!==e;){const t=null===(r=o.style)||void 0===r?void 0:r.fontSize;if(t){const e=parseFloat(t);if(!Number.isNaN(e)){i=e;break}}o=o.parentElement}if(null==i){t=!0;break}n.push(i)}l=i.nextNode()}!t&&n.length>0&&(e.style.fontSize=`${Math.min(...n)}px`)}return o.innerHTML}const S={bold:["STRONG","B"],italic:["EM","I"],underline:["U"],strike:["S","DEL"]};export function isClipGradientSpan(t){return!!(null==t?void 0:t.style)&&("text"===(t.style.getPropertyValue("-webkit-background-clip")||t.style.getPropertyValue("background-clip"))&&(t.style.backgroundImage.includes("gradient")||!!readNativeColor(t,"background-image")))}const C={bold:t=>t.style.removeProperty("font-weight"),italic:t=>t.style.removeProperty("font-style"),color:t=>{!function(t){if(isClipGradientSpan(t)){for(const e of["background-image","background-size","-webkit-background-clip","background-clip","-webkit-text-fill-color"]){t.style.removeProperty(e)}}}(t),t.style.removeProperty("color")},underline:t=>{const e=t.style.textDecoration.replace(/\bunderline\b/g,"").trim();e?t.style.textDecoration=e:t.style.removeProperty("text-decoration")},strike:t=>{const e=t.style.textDecoration.replace(/\bline-through\b/g,"").trim();e?t.style.textDecoration=e:t.style.removeProperty("text-decoration")},"text-transform":t=>t.style.removeProperty("text-transform")};export function stripInlineFormat(o,n){return x(o,o=>function(o,n){var i,l;if(!o||!t(o)){return o}const s=e(o);if(!s){return o}const c=S[n]||[],u=C[n];for(const t of c){let e;for(;e=s.querySelector(t);){const t=e.parentNode;u&&u(e);const r=null===(i=e.getAttribute("style"))||void 0===i?void 0:i.trim();if(r){const o=s.ownerDocument.createElement("span");o.setAttribute("style",r);for(const{name:t,value:r}of Array.from(e.attributes)){t.startsWith(h)&&o.setAttribute(t,r)}for(;e.firstChild;){o.appendChild(e.firstChild)}t.insertBefore(o,e)}else{for(;e.firstChild;){t.insertBefore(e.firstChild,e)}}t.removeChild(e)}}if(u){for(const t of Array.from(s.querySelectorAll("[style]"))){u(t),(null===(l=t.getAttribute("style"))||void 0===l?void 0:l.trim())||t.removeAttribute("style")}}return r(s),s.innerHTML}(o,n))}const k=Symbol("unset");export function isQuillFormatMixed(t,e){var r;let o=k;for(const n of t.ops){if("string"!=typeof n.insert||"\n"===n.insert){continue}const t=null===(r=n.attributes)||void 0===r?void 0:r[e];if(o===k){o=t}else if(t!==o){return!0}}return!1}export function stripInlineFontSizes(t){return x(t,I)}function I(o){var n;if(!o||!o.includes("font-size")||!t(o)){return o}const i=e(o);if(!i){return o}const l=i.querySelectorAll("[style]");for(let t=0;t<l.length;t++){const e=l[t];e.style.fontSize&&(e.style.removeProperty("font-size"),(null===(n=e.getAttribute("style"))||void 0===n?void 0:n.trim())||e.removeAttribute("style"))}return r(i),i.innerHTML}export function stripInlineFontFamilies(t){return x(t,N)}function N(o){var n;if(!o||!o.includes("font-family")&&!o.includes("ql-font-")||!t(o)){return o}const i=e(o);if(!i){return o}for(const t of Array.from(i.querySelectorAll("[style]"))){t.style.fontFamily&&(t.style.removeProperty("font-family"),(null===(n=t.getAttribute("style"))||void 0===n?void 0:n.trim())||t.removeAttribute("style"))}for(const t of Array.from(i.querySelectorAll("[class]"))){const e=t.getAttribute("class")||"",r=e.split(/\s+/).filter(t=>t&&!t.startsWith("ql-font-"));r.length!==e.split(/\s+/).filter(Boolean).length&&(r.length?t.setAttribute("class",r.join(" ")):t.removeAttribute("class"))}return r(i),i.innerHTML}export function hasMultipleDistinctInlineFontSizes(t){if(!t||!t.includes("<")){return!1}const r=e(t);if(!r){return!1}const o=new Set;for(const e of r.querySelectorAll("[style]")){const t=e.style.fontSize;if(t){const e=t.match(/^(\d+(?:\.\d+)?)px$/i);if(e&&(o.add(parseFloat(e[1])),o.size>1)){return!0}}}return!1}export function listEffectiveFontFamilies(t,e){const r=[];e&&r.push(e),r.push(...o(t||""));const n=new Set,i=[];for(const o of r){n.has(o)||(n.add(o),i.push(o))}return i.sort((t,e)=>t.localeCompare(e,void 0,{sensitivity:"base"})),i}const T=t=>t.color&&!(t=>"text"===(t["-webkit-background-clip"]||t["background-clip"])&&!!t["background-image"])(t)?p(t.color):null;export function listInlineTextColors(t){const e=[];return y(t||"").forEach(([r,o],n)=>{const i=T(a(t.slice(r,o)));i&&e.push({index:n,color:i})}),e}export function setInlineTextColor(t,e,r){let o=-1;return f(t||"",t=>{o+=1;const n=a(t);return e.includes(o)&&T(n)?(n.color=r,u(n)):t})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"konva";import*as t from"@polotno/core/svg";import{isGradient as
|
|
1
|
+
import o from"konva";import*as t from"@polotno/core/svg";import{isGradient as r}from"@polotno/core/gradient";import{containsCmykColor as e,formatCmykColor as l,parseCmykColor as s}from"@polotno/core/color";import{isMedia as c}from"./px.js";import{listInlineTextColors as n,setInlineTextColor as p}from"./rich-text-html.js";const a=(o,r)=>Array.from(o.keys()).find(o=>t.sameColors(o,r));export const getColorsReplace=o=>o.colorsReplace;export const getSvgColor=(o,t)=>{const r=a(o,t);return o.get(r||"")||t};export const replaceSvgColor=(o,t,r)=>{const e=a(getColorsReplace(o),t)||t;o.replaceColor(e,r)};export const colorKey=t=>{if(r(t)){return t}if(e(t)){const o=s(t);return o?l(o):t}const c=o.Util.colorToRGBA(t);return c?`${c.r},${c.g},${c.b},${c.a}`:t};export const collectSelectionColors=(o,t)=>{const r=new Map,e=(o,t,e=!0)=>{if(!o){return}const l=colorKey(o),s=r.get(l)||{color:o,slots:[]};s.slots.push({apply:t,gradient:e}),r.set(l,s)},l=(o,t,r=!0)=>{e(o[t],r=>o.set({[t]:r}),r)};return o.forEach(o=>{var r;if(o.styleEditable){if("figure"!==o.type&&"text"!==o.type||(l(o,"fill"),o.strokeWidth>0&&l(o,"stroke")),"line"===o.type&&l(o,"color",!1),(c(o.type)||"text"===o.type)&&o.borderSize>0&&l(o,"borderColor","text"!==o.type),"text"===o.type){const t=o;t.backgroundEnabled&&l(o,"backgroundColor",!1),n(t.text).forEach(({index:o,color:r})=>{e(r,r=>t.set({text:p(t.text,[o],r)}),!1)})}if("svg"===o.type){const l=o;if(l.maskSrc){return}null===(r=t(l.src))||void 0===r||r.forEach(o=>{e(getSvgColor(getColorsReplace(l),o),t=>replaceSvgColor(l,o,t))})}}}),Array.from(r.values()).sort((o,t)=>t.slots.length-o.slots.length)};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { StoreType } from '../model/store.js';
|
|
2
2
|
import type { ShapeType } from '../model/shape-model.js';
|
|
3
3
|
export declare const isAxisAligned: (rotation: number) => boolean;
|
|
4
|
-
export declare const canStretchAxis: (element: ShapeType, axis:
|
|
5
|
-
export declare const leafMinSize: (element: ShapeType, axis:
|
|
4
|
+
export declare const canStretchAxis: (element: ShapeType, axis: 'x' | 'y', boxRotation: number) => boolean;
|
|
5
|
+
export declare const leafMinSize: (element: ShapeType, axis: 'x' | 'y', isEdgeDrag: boolean, startSize: number) => number;
|
|
6
6
|
type Box = {
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
@@ -12,8 +12,8 @@ type Box = {
|
|
|
12
12
|
export declare const getSelectionBox: (store: StoreType) => Box | null;
|
|
13
13
|
export declare const canResizeSelection: (store: StoreType) => boolean;
|
|
14
14
|
export declare const canMoveSelection: (store: StoreType) => boolean;
|
|
15
|
-
export declare const resizeSelection: (store: StoreType, axis:
|
|
16
|
-
export declare const moveSelection: (store: StoreType, axis:
|
|
15
|
+
export declare const resizeSelection: (store: StoreType, axis: 'x' | 'y', size: number) => void;
|
|
16
|
+
export declare const moveSelection: (store: StoreType, axis: 'x' | 'y', value: number) => void;
|
|
17
17
|
export declare const canFitSelectionToPage: (store: StoreType) => boolean;
|
|
18
18
|
export declare const fitSelectionToPage: (store: StoreType) => void;
|
|
19
19
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=this&&this.__rest||function(e,t){var
|
|
1
|
+
var e=this&&this.__rest||function(e,t){var n={};for(var i in e){Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++){t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}}return n};import{getTotalClientRect as t}from"./math.js";import{roundedGeometryAttrs as n,roundedGeometryPx as i,roundedStyleAttrs as o,scaledFontSizeBounds as s,isMedia as r,scaledStyleAttrs as c,textMinResizeWidth as h,textMinWidthIsMeasured as a}from"./px.js";import{textResizeFloorFontSize as l}from"./text-sizing.js";export const isAxisAligned=e=>{const t=(e%180+180)%180;return t<.1||180-t<.1};export const canStretchAxis=(e,t,n)=>{if(!isAxisAligned(e.rotation-n)){return!1}switch(e.type){case"text":return"x"===t&&!a(e);case"figure":case"video":case"table":return!0;case"image":case"svg":case"gif":case"lottie":return!e.keepRatio;default:return!1}};export const leafMinSize=(e,t,n,i)=>{if("table"===e.type){const n=e;return"x"===t?n.minWidth:n.minHeight}return"text"===e.type&&"x"===t&&n?h(i,l(e)):1};const x=e=>{const[t]=e.selectedElements;return 1===e.selectedElements.length&&"group"!==t.type?t:null};export const getSelectionBox=e=>{const n=x(e);if(n){const{x:e,y:t,width:i,height:o}=n;return{x:e,y:t,width:i,height:o}}const i=e.selectedShapes;return i.length?t(i):null};const p=e=>!e.pendingEdit;export const canResizeSelection=e=>{const t=e.selectedShapes;return t.length>0&&t.every(e=>e.resizable&&p(e))};export const canMoveSelection=e=>{const t=e.selectedShapes;return t.length>0&&t.every(e=>e.draggable&&p(e))};const g=(e,t,n)=>{e.set(t),e.setHeightRedistribute(n),e.set({x:i(e.x),y:i(e.y),width:i(e.width)}),e._resetBaseRowHeights()},d=(e,t,i)=>{const r=i.x+(e.x-i.x)*t,h=i.y+(e.y-i.y)*t;if("table"===e.type){return void g(e,{x:r,y:h,width:e.width*t},e.height*t)}const{fontSize:a,minFontSize:l,maxFontSize:x}=e;e.set(Object.assign({x:r,y:h,width:e.width*t,height:e.height*t},c(e,t))),e.set(Object.assign(Object.assign({},n(e)),o(e))),"text"===e.type&&e.set(s({minFontSize:l,maxFontSize:x},e.fontSize/a,!0))};export const resizeSelection=(t,i,o)=>{const s=getSelectionBox(t),c="x"===i?null==s?void 0:s.width:null==s?void 0:s.height;if(!(s&&c&&o>0&&canResizeSelection(t))){return}const h=t.selectedShapes,a=x(t),l=h.every(e=>!r(e.type))&&(a?((e,t)=>"text"===e.type?"x"===t&&!e.curveEnabled:canStretchAxis(e,t,e.rotation))(a,i):h.every(e=>canStretchAxis(e,i,0))),p=Math.max(...h.flatMap(e=>(l?[i]:["x","y"]).map(t=>{const n="x"===t?e.width:e.height,i=leafMinSize(e,t,l,n);return n>=i?i/n:0}))),y=Math.max(o/c,p),u={x:s.x,y:s.y};t.history.transaction(()=>{h.forEach(t=>{l?((t,i,o,s)=>{const[r,c]="x"===i?["x","width"]:["y","height"],h={[r]:s[r]+(t[r]-s[r])*o,[c]:t[c]*o};if("table"===t.type){const{height:n=t.height}=h,i=e(h,["height"]);return void g(t,i,n)}t.set(h),t.set(n(t))})(t,i,y,u):d(t,y,u)})})};const y=(e,t,n)=>{e.forEach(e=>{e.set({x:i(e.x+t),y:i(e.y+n)})})};export const moveSelection=(e,t,n)=>{const i=getSelectionBox(e);if(!i||!Number.isFinite(n)||!canMoveSelection(e)){return}const o=n-("x"===t?i.x:i.y);e.history.transaction(()=>{y(e.selectedShapes,"x"===t?o:0,"y"===t?o:0)})};export const canFitSelectionToPage=e=>canResizeSelection(e)&&canMoveSelection(e);export const fitSelectionToPage=e=>{var n;const i=e.selectedShapes,o=null===(n=i[0])||void 0===n?void 0:n.page;if(!o||!canFitSelectionToPage(e)){return}const s=t(i);if(!s.width||!s.height){return}const r=Math.min(o.computedWidth/s.width,o.computedHeight/s.height);e.history.transaction(()=>{i.forEach(e=>d(e,r,{x:s.x,y:s.y}));const e=t(i);y(i,(o.computedWidth-e.width)/2-e.x,(o.computedHeight-e.height)/2-e.y)})};
|
package/utils/split-element.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getElementTimeRange as t,getVideoRestMs as e,MIN_DURATION as n}from"./timeline.js";import{clamp as i}from"../lib/utils.js";export function canSplitAtPlayhead(e,i){var a;const o=null===(a=e.page)||void 0===a?void 0:a.duration;if(!o){return!1}const{start:r,end:s}=t(e.animations,o);return i>r+n&&i<s-n}export function splitElementAtPlayhead(n,a){if(!canSplitAtPlayhead(n,a)){return null}const o=n.page.duration,{start:r}=t(n.animations,o),s=n.clone({},{skipSelect:!0});if(s.setZIndex(n.zIndex+1),n.setAnimation("exit",{name:"none",delay:o-a,enabled:!0}),s.setAnimation("enter",{name:"none",delay:a,enabled:!0}),"video"===n.type){const t=(n.endTime-n.startTime)*n.duration,o=n.speed||1;if(t>0){const d=e(a,0,r,t,n.startTime*n.duration,o),l=i(d/n.duration,n.startTime,n.endTime);s.set({startTime:l}),(a-r)*o<t&&n.set({endTime:l})}}return s}
|
|
1
|
+
import{getElementTimeRange as t,getVideoRestMs as e,MIN_DURATION as n}from"./timeline.js";import{clamp as i}from"../lib/utils.js";export function canSplitAtPlayhead(e,i){var a;if("lottie"===e.type){return!1}const o=null===(a=e.page)||void 0===a?void 0:a.duration;if(!o){return!1}const{start:r,end:s}=t(e.animations,o);return i>r+n&&i<s-n}export function splitElementAtPlayhead(n,a){if(!canSplitAtPlayhead(n,a)){return null}const o=n.page.duration,{start:r}=t(n.animations,o),s=n.clone({},{skipSelect:!0});if(s.setZIndex(n.zIndex+1),n.setAnimation("exit",{name:"none",delay:o-a,enabled:!0}),s.setAnimation("enter",{name:"none",delay:a,enabled:!0}),"video"===n.type){const t=(n.endTime-n.startTime)*n.duration,o=n.speed||1;if(t>0){const d=e(a,0,r,t,n.startTime*n.duration,o),l=i(d/n.duration,n.startTime,n.endTime);s.set({startTime:l}),(a-r)*o<t&&n.set({endTime:l})}}return s}
|
|
@@ -42,6 +42,7 @@ export type TextFormatState = {
|
|
|
42
42
|
applyTextFormat: (attrs: TextFormatAttrs, opts?: ApplyTextFormatOptions) => void;
|
|
43
43
|
enabled: boolean;
|
|
44
44
|
};
|
|
45
|
+
export declare function activeFor(store: any): ActiveTextEditor | null;
|
|
45
46
|
export declare function restoreEditorSelection(quill: Quill, range: Range): void;
|
|
46
47
|
export declare function resolveSelectionScope(quill: any, fallbackSelection: {
|
|
47
48
|
index: number;
|