labellife-design-tool 2.4.5 → 2.5.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/README.md +14 -0
- package/dist/cjs/canvas/workspace.js +33 -9
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/index.js +274 -132
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/store.js +112 -15
- package/dist/cjs/model/store.js.map +1 -1
- package/dist/cjs/toolbar/toolbar.js +26 -5
- package/dist/cjs/toolbar/toolbar.js.map +1 -1
- package/dist/esm/canvas/workspace.js +33 -9
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/index.js +274 -132
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/store.js +112 -15
- package/dist/esm/model/store.js.map +1 -1
- package/dist/esm/toolbar/toolbar.js +26 -5
- package/dist/esm/toolbar/toolbar.js.map +1 -1
- package/package.json +3 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1657,6 +1657,152 @@ var History = mobxStateTree.types.model('History', {
|
|
|
1657
1657
|
};
|
|
1658
1658
|
});
|
|
1659
1659
|
|
|
1660
|
+
var GOOGLE_FONTS_API = 'https://www.googleapis.com/webfonts/v1/webfonts';
|
|
1661
|
+
var cachedFonts = null;
|
|
1662
|
+
function fetchGoogleFonts(_x) {
|
|
1663
|
+
return _fetchGoogleFonts.apply(this, arguments);
|
|
1664
|
+
}
|
|
1665
|
+
function _fetchGoogleFonts() {
|
|
1666
|
+
_fetchGoogleFonts = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(apiKey) {
|
|
1667
|
+
var url, response, data, _t;
|
|
1668
|
+
return _regenerator().w(function (_context) {
|
|
1669
|
+
while (1) switch (_context.p = _context.n) {
|
|
1670
|
+
case 0:
|
|
1671
|
+
if (!cachedFonts) {
|
|
1672
|
+
_context.n = 1;
|
|
1673
|
+
break;
|
|
1674
|
+
}
|
|
1675
|
+
return _context.a(2, cachedFonts);
|
|
1676
|
+
case 1:
|
|
1677
|
+
_context.p = 1;
|
|
1678
|
+
url = apiKey ? "".concat(GOOGLE_FONTS_API, "?key=").concat(apiKey, "&sort=popularity") : "".concat(GOOGLE_FONTS_API, "?sort=popularity");
|
|
1679
|
+
_context.n = 2;
|
|
1680
|
+
return fetch(url);
|
|
1681
|
+
case 2:
|
|
1682
|
+
response = _context.v;
|
|
1683
|
+
_context.n = 3;
|
|
1684
|
+
return response.json();
|
|
1685
|
+
case 3:
|
|
1686
|
+
data = _context.v;
|
|
1687
|
+
cachedFonts = (data.items || []).map(function (font) {
|
|
1688
|
+
return {
|
|
1689
|
+
fontFamily: font.family,
|
|
1690
|
+
variants: font.variants || [],
|
|
1691
|
+
category: font.category,
|
|
1692
|
+
url: "https://fonts.googleapis.com/css2?family=".concat(encodeURIComponent(font.family), "&display=swap")
|
|
1693
|
+
};
|
|
1694
|
+
});
|
|
1695
|
+
return _context.a(2, cachedFonts);
|
|
1696
|
+
case 4:
|
|
1697
|
+
_context.p = 4;
|
|
1698
|
+
_t = _context.v;
|
|
1699
|
+
console.warn('Failed to fetch Google Fonts list', _t);
|
|
1700
|
+
return _context.a(2, []);
|
|
1701
|
+
}
|
|
1702
|
+
}, _callee, null, [[1, 4]]);
|
|
1703
|
+
}));
|
|
1704
|
+
return _fetchGoogleFonts.apply(this, arguments);
|
|
1705
|
+
}
|
|
1706
|
+
function loadGoogleFont(_x2) {
|
|
1707
|
+
return _loadGoogleFont.apply(this, arguments);
|
|
1708
|
+
}
|
|
1709
|
+
function _loadGoogleFont() {
|
|
1710
|
+
_loadGoogleFont = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(fontFamily) {
|
|
1711
|
+
var id, existing, _t2;
|
|
1712
|
+
return _regenerator().w(function (_context2) {
|
|
1713
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
1714
|
+
case 0:
|
|
1715
|
+
id = "google-font-".concat(fontFamily.replace(/\s+/g, '-').toLowerCase());
|
|
1716
|
+
existing = document.getElementById(id);
|
|
1717
|
+
if (existing) {
|
|
1718
|
+
_context2.n = 1;
|
|
1719
|
+
break;
|
|
1720
|
+
}
|
|
1721
|
+
_context2.n = 1;
|
|
1722
|
+
return new Promise(function (resolve) {
|
|
1723
|
+
var link = document.createElement('link');
|
|
1724
|
+
link.id = id;
|
|
1725
|
+
link.href = "https://fonts.googleapis.com/css2?family=".concat(encodeURIComponent(fontFamily), ":wght@100;200;300;400;500;600;700;800;900&display=swap");
|
|
1726
|
+
link.rel = 'stylesheet';
|
|
1727
|
+
link.onload = function () {
|
|
1728
|
+
return resolve();
|
|
1729
|
+
};
|
|
1730
|
+
link.onerror = function () {
|
|
1731
|
+
return resolve();
|
|
1732
|
+
};
|
|
1733
|
+
document.head.appendChild(link);
|
|
1734
|
+
});
|
|
1735
|
+
case 1:
|
|
1736
|
+
_context2.p = 1;
|
|
1737
|
+
_context2.n = 2;
|
|
1738
|
+
return document.fonts.load("16px \"".concat(fontFamily, "\""));
|
|
1739
|
+
case 2:
|
|
1740
|
+
_context2.n = 3;
|
|
1741
|
+
return document.fonts.load("bold 16px \"".concat(fontFamily, "\""));
|
|
1742
|
+
case 3:
|
|
1743
|
+
_context2.n = 4;
|
|
1744
|
+
return document.fonts.ready;
|
|
1745
|
+
case 4:
|
|
1746
|
+
_context2.n = 6;
|
|
1747
|
+
break;
|
|
1748
|
+
case 5:
|
|
1749
|
+
_context2.p = 5;
|
|
1750
|
+
_t2 = _context2.v;
|
|
1751
|
+
console.warn("Font \"".concat(fontFamily, "\" may not have loaded correctly."), _t2);
|
|
1752
|
+
case 6:
|
|
1753
|
+
return _context2.a(2);
|
|
1754
|
+
}
|
|
1755
|
+
}, _callee2, null, [[1, 5]]);
|
|
1756
|
+
}));
|
|
1757
|
+
return _loadGoogleFont.apply(this, arguments);
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
// Infers the @font-face format() hint from a font file URL's extension.
|
|
1761
|
+
function inferFontFormat(url) {
|
|
1762
|
+
var ext = (url.split('?')[0].split('.').pop() || '').toLowerCase();
|
|
1763
|
+
var map = {
|
|
1764
|
+
woff2: 'woff2',
|
|
1765
|
+
woff: 'woff',
|
|
1766
|
+
ttf: 'truetype',
|
|
1767
|
+
otf: 'opentype'
|
|
1768
|
+
};
|
|
1769
|
+
return map[ext] || 'woff2';
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
// Neutralizes characters that could let a font `name` break out of the
|
|
1773
|
+
// single-quoted `font-family: '...'` CSS value (or the surrounding rule
|
|
1774
|
+
// block) when interpolated into injected CSS. This is defense-in-depth for
|
|
1775
|
+
// a published, general-purpose library that cannot assume every consumer
|
|
1776
|
+
// only ever passes trusted, admin-managed catalog data.
|
|
1777
|
+
function sanitizeFontFamilyName(name) {
|
|
1778
|
+
return String(name)
|
|
1779
|
+
// eslint-disable-next-line no-control-regex
|
|
1780
|
+
.replace(/['"\\{};\r\n\u0000-\u001f]/g, '').trim();
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
// Neutralizes characters that could let a font `file` URL break out of the
|
|
1784
|
+
// `url('...')` CSS value, and requires it to at least look like an
|
|
1785
|
+
// absolute http(s) URL or a relative path (not a full URL parser — this is
|
|
1786
|
+
// a simple guard, not the primary trust boundary).
|
|
1787
|
+
function sanitizeFontFileUrl(file) {
|
|
1788
|
+
var cleaned = String(file).replace(/['"()\s\r\n]/g, '');
|
|
1789
|
+
var looksSafe = /^(https?:\/\/|\.{0,2}\/)/i.test(cleaned);
|
|
1790
|
+
return looksSafe ? cleaned : '';
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
// Builds the @font-face CSS text for a custom font's uploaded variants.
|
|
1794
|
+
// `customFont` shape: { name: string, variants: [{ weight, style, file }] }
|
|
1795
|
+
function buildFontFaceCss(customFont) {
|
|
1796
|
+
var safeName = sanitizeFontFamilyName(customFont.name);
|
|
1797
|
+
return customFont.variants.map(function (v) {
|
|
1798
|
+
var safeFile = sanitizeFontFileUrl(v.file);
|
|
1799
|
+
return "@font-face {\n font-family: '".concat(safeName, "';\n font-weight: ").concat(v.weight, ";\n font-style: ").concat(v.style, ";\n src: url('").concat(safeFile, "') format('").concat(inferFontFormat(safeFile), "');\n font-display: swap;\n}");
|
|
1800
|
+
}).join('\n');
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
// Comprehensive list of Google Fonts matching Polotno's font library
|
|
1804
|
+
var DEFAULT_FONTS = ['ABeeZee', 'Abel', 'Abhaya Libre', 'Abril Fatface', 'Aclonica', 'Acme', 'Actor', 'Adamina', 'Advent Pro', 'Aguafina Script', 'Akronim', 'Aladin', 'Alata', 'Alatsi', 'Albert Sans', 'Aldrich', 'Alef', 'Alegreya', 'Alegreya Sans', 'Alegreya Sans SC', 'Alegreya SC', 'Aleo', 'Alex Brush', 'Alfa Slab One', 'Alice', 'Alike', 'Alike Angular', 'Allan', 'Allerta', 'Allerta Stencil', 'Allison', 'Allura', 'Almarai', 'Almendra', 'Almendra Display', 'Almendra SC', 'Alumni Sans', 'Alumni Sans Inline One', 'Amarante', 'Amaranth', 'Amatic SC', 'Amethysta', 'Amiko', 'Amiri', 'Amita', 'Anaheim', 'Andada Pro', 'Andika', 'Anek Bangla', 'Anek Devanagari', 'Anek Gujarati', 'Anek Gurmukhi', 'Anek Kannada', 'Anek Latin', 'Anek Malayalam', 'Anek Odia', 'Anek Tamil', 'Anek Telugu', 'Angkor', 'Annie Use Your Telescope', 'Anonymous Pro', 'Antic', 'Antic Didone', 'Antic Slab', 'Anton', 'Antonio', 'Anybody', 'Arapey', 'Arbutus', 'Arbutus Slab', 'Architects Daughter', 'Archivo', 'Archivo Black', 'Archivo Narrow', 'Are You Serious', 'Aref Ruqaa', 'Arima', 'Arimo', 'Arizonia', 'Armata', 'Arsenal', 'Artifika', 'Arvo', 'Arya', 'Asap', 'Asap Condensed', 'Asar', 'Asset', 'Assistant', 'Astloch', 'Asul', 'Athiti', 'Atkinson Hyperlegible', 'Atma', 'Atomic Age', 'Aubrey', 'Audiowide', 'Autour One', 'Average', 'Average Sans', 'Averia Gruesa Libre', 'Averia Libre', 'Averia Sans Libre', 'Averia Serif Libre', 'Azeret Mono', 'B612', 'B612 Mono', 'Bad Script', 'Bahiana', 'Bahianita', 'Bai Jamjuree', 'Bakbak One', 'Ballet', 'Baloo 2', 'Baloo Bhai 2', 'Baloo Bhaijaan 2', 'Baloo Bhaina 2', 'Baloo Chettan 2', 'Baloo Da 2', 'Baloo Paaji 2', 'Baloo Tamma 2', 'Baloo Tammudu 2', 'Baloo Thambi 2', 'Balsamiq Sans', 'Balthazar', 'Bangers', 'Barlow', 'Barlow Condensed', 'Barlow Semi Condensed', 'Barriecito', 'Barrio', 'Basic', 'Baskervville', 'Battambang', 'Baumans', 'Bayon', 'Be Vietnam Pro', 'Beau Rivage', 'Bebas Neue', 'Belgrano', 'Bellefair', 'Belleza', 'Bellota', 'Bellota Text', 'BenchNine', 'Benne', 'Bentham', 'Berkshire Swash', 'Besley', 'Beth Ellen', 'Bevan', 'BIZ UDGothic', 'BIZ UDMincho', 'BIZ UDPGothic', 'BIZ UDPMincho', 'Big Shoulders Display', 'Big Shoulders Inline Display', 'Big Shoulders Inline Text', 'Big Shoulders Stencil Display', 'Big Shoulders Stencil Text', 'Big Shoulders Text', 'Bigelow Rules', 'Bigshot One', 'Bilbo', 'Bilbo Swash Caps', 'BioRhyme', 'BioRhyme Expanded', 'Birthstone', 'Birthstone Bounce', 'Bitter', 'Black And White Picture', 'Black Han Sans', 'Black Ops One', 'Blaka', 'Blaka Hollow', 'Blaka Ink', 'Blinker', 'Bodoni Moda', 'Bokor', 'Bona Nova', 'Bonbon', 'Bonheur Royale', 'Boogaloo', 'Bowlby One', 'Bowlby One SC', 'Brawler', 'Bree Serif', 'Brygada 1918', 'Bubblegum Sans', 'Bubbler One', 'Buda', 'Buenard', 'Bungee', 'Bungee Hairline', 'Bungee Inline', 'Bungee Outline', 'Bungee Shade', 'Bungee Spice', 'Butcherman', 'Butterfly Kids', 'Cabin', 'Cabin Condensed', 'Cabin Sketch', 'Caesar Dressing', 'Cagliostro', 'Cairo', 'Cairo Play', 'Caladea', 'Calistoga', 'Calligraffitti', 'Cambay', 'Cambo', 'Candal', 'Cantarell', 'Cantata One', 'Cantora One', 'Caprasimo', 'Capriola', 'Caramel', 'Carattere', 'Cardo', 'Carlito', 'Carme', 'Carrois Gothic', 'Carrois Gothic SC', 'Carter One', 'Castoro', 'Catamaran', 'Caudex', 'Caveat', 'Caveat Brush', 'Cedarville Cursive', 'Ceviche One', 'Chakra Petch', 'Changa', 'Changa One', 'Chango', 'Charis SIL', 'Charm', 'Charmonman', 'Chathura', 'Chau Philomene One', 'Chela One', 'Chelsea Market', 'Chenla', 'Cherry Bomb One', 'Cherry Cream Soda', 'Cherry Swash', 'Chewy', 'Chicle', 'Chilanka', 'Chivo', 'Chivo Mono', 'Chonburi', 'Cinzel', 'Cinzel Decorative', 'Clicker Script', 'Coda', 'Coda Caption', 'Codystar', 'Coiny', 'Combo', 'Comfortaa', 'Comforter', 'Comforter Brush', 'Comic Neue', 'Coming Soon', 'Commissioner', 'Concert One', 'Condiment', 'Content', 'Contrail One', 'Convergence', 'Cookie', 'Copse', 'Corben', 'Corinthia', 'Cormorant', 'Cormorant Garamond', 'Cormorant Infant', 'Cormorant SC', 'Cormorant Unicase', 'Cormorant Upright', 'Courgette', 'Courier Prime', 'Cousine', 'Coustard', 'Covered By Your Grace', 'Crafty Girls', 'Creepster', 'Crete Round', 'Crimson Pro', 'Crimson Text', 'Croissant One', 'Crushed', 'Cuprum', 'Cute Font', 'Cutive', 'Cutive Mono', 'DM Mono', 'DM Sans', 'DM Serif Display', 'DM Serif Text', 'Damion', 'Dancing Script', 'Dangrek', 'Darker Grotesque', 'David Libre', 'Dawning of a New Day', 'Days One', 'Dekko', 'Dela Gothic One', 'Delius', 'Delius Swash Caps', 'Delius Unicase', 'Della Respira', 'Denk One', 'Devonshire', 'Dhurjati', 'Didact Gothic', 'Diplomata', 'Diplomata SC', 'Do Hyeon', 'Dokdo', 'Domine', 'Donegal One', 'Dongle', 'Doppio One', 'Dorsa', 'Dosis', 'DotGothic16', 'Dr Sugiyama', 'Duru Sans', 'DynaPuff', 'Dynalight', 'EB Garamond', 'Eagle Lake', 'East Sea Dokdo', 'Eater', 'Economica', 'Eczar', 'El Messiri', 'Electrolize', 'Elsie', 'Elsie Swash Caps', 'Emblema One', 'Emilys Candy', 'Encode Sans', 'Encode Sans Condensed', 'Encode Sans Expanded', 'Encode Sans SC', 'Encode Sans Semi Condensed', 'Encode Sans Semi Expanded', 'Engagement', 'Englebert', 'Enriqueta', 'Ephesis', 'Epilogue', 'Erica One', 'Esteban', 'Estonia', 'Euphoria Script', 'Ewert', 'Exo', 'Exo 2', 'Expletus Sans', 'Explora', 'Fahkwang', 'Familjen Grotesk', 'Fanwood Text', 'Farro', 'Farsan', 'Fascinate', 'Fascinate Inline', 'Faster One', 'Fasthand', 'Fauna One', 'Faustina', 'Federant', 'Federo', 'Felipa', 'Fenix', 'Festive', 'Finger Paint', 'Finlandica', 'Fira Code', 'Fira Mono', 'Fira Sans', 'Fira Sans Condensed', 'Fira Sans Extra Condensed', 'Fjalla One', 'Fjord One', 'Flamenco', 'Flavors', 'Fleur De Leah', 'Flow Block', 'Flow Circular', 'Flow Rounded', 'Fondamento', 'Fontdiner Swanky', 'Forum', 'Fragment Mono', 'Francois One', 'Frank Ruhl Libre', 'Fraunces', 'Freckle Face', 'Fredericka the Great', 'Fredoka', 'Freehand', 'Fresca', 'Frijole', 'Fruktur', 'Fugaz One', 'Fuggles', 'Fuzzy Bubbles', 'GFS Didot', 'GFS Neohellenic', 'Gabriela', 'Gaegu', 'Gafata', 'Galada', 'Galdeano', 'Galindo', 'Gamja Flower', 'Gantari', 'Gas', 'Gayathri', 'Gelasio', 'Gemunu Libre', 'Genos', 'Gentium Book Plus', 'Gentium Plus', 'Geo', 'Georama', 'Geostar', 'Geostar Fill', 'Germania One', 'Gideon Roman', 'Gidugu', 'Gilda Display', 'Girassol', 'Give You Glory', 'Glass Antiqua', 'Glegoo', 'Gloria Hallelujah', 'Glory', 'Gluten', 'Goblin One', 'Gochi Hand', 'Goldman', 'Goldplay', 'Golos Text', 'Gorditas', 'Gothic A1', 'Gotu', 'Goudy Bookletter 1911', 'Gowun Batang', 'Gowun Dodum', 'Graduate', 'Grand Hotel', 'Grandstander', 'Grape Nuts', 'Gravitas One', 'Great Vibes', 'Grechen Fuemen', 'Grenze', 'Grenze Gotisch', 'Grey Qo', 'Griffy', 'Gruppo', 'Gudea', 'Gugi', 'Gulzar', 'Gupter', 'Gurajada', 'Gwendolyn', 'Habibi', 'Hachi Maru Pop', 'Hahmlet', 'Halant', 'Hammersmith One', 'Hanalei', 'Hanalei Fill', 'Handlee', 'Hanken Grotesk', 'Hanuman', 'Happy Monkey', 'Harmattan', 'Headland One', 'Heebo', 'Henny Penny', 'Hepta Slab', 'Herr Von Muellerhoff', 'Hi Melody', 'Hina Mincho', 'Hind', 'Hind Guntur', 'Hind Madurai', 'Hind Siliguri', 'Hind Vadodara', 'Holtwood One SC', 'Homemade Apple', 'Homenaje', 'Hubballi', 'Hurricane', 'IBM Plex Mono', 'IBM Plex Sans', 'IBM Plex Sans Arabic', 'IBM Plex Sans Condensed', 'IBM Plex Sans Devanagari', 'IBM Plex Sans Hebrew', 'IBM Plex Sans JP', 'IBM Plex Sans KR', 'IBM Plex Sans Thai', 'IBM Plex Sans Thai Looped', 'IBM Plex Serif', 'Iceberg', 'Iceland', 'Imbue', 'Imperial Script', 'Imprima', 'Inconsolata', 'Inder', 'Indie Flower', 'Ingrid Darling', 'Inika', 'Inknut Antiqua', 'Inria Sans', 'Inria Serif', 'Inspiration', 'Inter', 'Inter Tight', 'Irish Grover', 'Island Moments', 'Istok Web', 'Italiana', 'Italianno', 'Itim', 'Jacques Francois', 'Jacques Francois Shadow', 'Jaldi', 'JetBrains Mono', 'Jim Nightshade', 'Joan', 'Jockey One', 'Jolly Lodger', 'Jomhuria', 'Jomolhari', 'Josefin Sans', 'Josefin Slab', 'Jost', 'Joti One', 'Jua', 'Judson', 'Julee', 'Julius Sans One', 'Junge', 'Jura', 'K2D', 'Kadwa', 'Kaisei Decol', 'Kaisei HarunoUmi', 'Kaisei Opti', 'Kaisei Tokumin', 'Kalam', 'Kameron', 'Kanit', 'Kantumruy Pro', 'Karantina', 'Karla', 'Karma', 'Katibeh', 'Kaushan Script', 'Kavivanar', 'Kavoon', 'Kdam Thmor Pro', 'Keania One', 'Kelly Slab', 'Kenia', 'Khand', 'Khmer', 'Khula', 'Kings', 'Kirang Haerang', 'Kite One', 'Kiwi Maru', 'Klee One', 'Knewave', 'KoHo', 'Kodchasan', 'Koh Santepheap', 'Kolker Brush', 'Konkhmer Sleokchher', 'Kosugi', 'Kosugi Maru', 'Kotta One', 'Koulen', 'Kranky', 'Kreon', 'Kristi', 'Krona One', 'Krub', 'Kufam', 'Kulim Park', 'Kumar One', 'Kumar One Outline', 'Kumbh Sans', 'Kurale', 'La Belle Aurore', 'Lacquer', 'Laila', 'Lakki Reddy', 'Lalezar', 'Lancelot', 'Langar', 'Lango', 'Lateef', 'Lato', 'Lavishly Yours', 'League Gothic', 'League Script', 'League Spartan', 'Leckerli One', 'Ledger', 'Lekton', 'Lemon', 'Lemonada', 'Lexend', 'Lexend Deca', 'Lexend Exa', 'Lexend Giga', 'Lexend Mega', 'Lexend Peta', 'Lexend Tera', 'Lexend Zetta', 'Libre Barcode 128', 'Libre Barcode 128 Text', 'Libre Barcode 39', 'Libre Barcode 39 Extended', 'Libre Barcode 39 Extended Text', 'Libre Barcode 39 Text', 'Libre Barcode EAN13 Text', 'Libre Baskerville', 'Libre Bodoni', 'Libre Caslon Display', 'Libre Caslon Text', 'Libre Franklin', 'Licorice', 'Life Savers', 'Lilita One', 'Lily Script One', 'Limelight', 'Linden Hill', 'Lingua Franca', 'Literata', 'Liu Jian Mao Cao', 'Livvic', 'Lobster', 'Lobster Two', 'Londrina Outline', 'Londrina Shadow', 'Londrina Sketch', 'Londrina Solid', 'Long Cang', 'Lora', 'Love Light', 'Love Ya Like A Sister', 'Loved by the King', 'Lovers Quarrel', 'Luckiest Guy', 'Lusitana', 'Lustria', 'Luxurious Roman', 'Luxurious Script', 'M PLUS 1', 'M PLUS 1 Code', 'M PLUS 1p', 'M PLUS 2', 'M PLUS Code Latin', 'M PLUS Rounded 1c', 'Ma Shan Zheng', 'Macondo', 'Macondo Swash Caps', 'Mada', 'Magra', 'Maiden Orange', 'Maitree', 'Major Mono Display', 'Mako', 'Mali', 'Mallanna', 'Mandali', 'Manjari', 'Manrope', 'Mansalva', 'Manuale', 'Marcellus', 'Marcellus SC', 'Marck Script', 'Margarine', 'Marhey', 'Markazi Text', 'Marko One', 'Marmelad', 'Martel', 'Martel Sans', 'Marvel', 'Mate', 'Mate SC', 'Maven Pro', 'McLaren', 'Mea Culpa', 'Meddon', 'MedievalSharp', 'Medula One', 'Meera Inimai', 'Megrim', 'Meie Script', 'Meow Script', 'Merienda', 'Merriweather', 'Merriweather Sans', 'Metal', 'Metal Mania', 'Metamorphous', 'Metrophobic', 'Michroma', 'Milonga', 'Miltonian', 'Miltonian Tattoo', 'Mina', 'Miniver', 'Miriam Libre', 'Mirza', 'Miss Fajardose', 'Mitr', 'Mochiy Pop One', 'Mochiy Pop P One', 'Modak', 'Modern Antiqua', 'Mogra', 'Mohave', 'Moirai One', 'Molengo', 'Molle', 'Monda', 'Monofett', 'Monoton', 'Monsieur La Doulaise', 'Montaga', 'Montagu Slab', 'MonteCarlo', 'Montez', 'Montserrat', 'Montserrat Alternates', 'Montserrat Subrayada', 'Moon Dance', 'Moul', 'Moulpali', 'Mountains of Christmas', 'Mouse Memoirs', 'Mr Bedfort', 'Mr Dafoe', 'Mr De Haviland', 'Mrs Saint Delafield', 'Mrs Sheppards', 'Mukta', 'Mukta Mahee', 'Mukta Malar', 'Mukta Vaani', 'Mulish', 'Murecho', 'MuseoModerno', 'My Soul', 'Mynerve', 'Mystery Quest', 'NTR', 'Nabla', 'Nanum Brush Script', 'Nanum Gothic', 'Nanum Gothic Coding', 'Nanum Myeongjo', 'Nanum Pen Script', 'Neonderthaw', 'Nerko One', 'Neucha', 'Neuton', 'New Rocker', 'New Tegomin', 'News Cycle', 'Newsreader', 'Niconne', 'Niramit', 'Nixie One', 'Nobile', 'Nokora', 'Norican', 'Nosifer', 'Notable', 'Nothing You Could Do', 'Noticia Text', 'Noto Color Emoji', 'Noto Emoji', 'Noto Kufi Arabic', 'Noto Music', 'Noto Naskh Arabic', 'Noto Nastaliq Urdu', 'Noto Sans', 'Noto Sans Arabic', 'Noto Sans Display', 'Noto Sans Mono', 'Noto Serif', 'Noto Serif Display', 'Nova Cut', 'Nova Flat', 'Nova Mono', 'Nova Oval', 'Nova Round', 'Nova Script', 'Nova Slim', 'Nova Square', 'Numans', 'Nunito', 'Nunito Sans', 'Odibee Sans', 'Odor Mean Chey', 'Offside', 'Oi', 'Old Standard TT', 'Oldenburg', 'Ole', 'Oleo Script', 'Oleo Script Swash Caps', 'Oooh Baby', 'Open Sans', 'Oranienbaum', 'Orbit', 'Orbitron', 'Oregano', 'Orelega One', 'Orienta', 'Original Surfer', 'Oswald', 'Outfit', 'Over the Rainbow', 'Overlock', 'Overlock SC', 'Overpass', 'Overpass Mono', 'Ovo', 'Oxanium', 'Oxygen', 'Oxygen Mono', 'PT Mono', 'PT Sans', 'PT Sans Caption', 'PT Sans Narrow', 'PT Serif', 'PT Serif Caption', 'Pacifico', 'Padauk', 'Padyakke Expanded One', 'Palanquin', 'Palanquin Dark', 'Palette Mosaic', 'Pangolin', 'Paprika', 'Parisienne', 'Passero One', 'Passion One', 'Passions Conflict', 'Pathway Extreme', 'Pathway Gothic One', 'Patrick Hand', 'Patrick Hand SC', 'Pattaya', 'Patua One', 'Pavanam', 'Paytone One', 'Peddana', 'Peralta', 'Permanent Marker', 'Petit Formal Script', 'Petrona', 'Philosopher', 'Phudu', 'Piazzolla', 'Piedra', 'Pinyon Script', 'Pirata One', 'Plaster', 'Play', 'Playball', 'Playfair Display', 'Playfair Display SC', 'Playpen Sans', 'Plus Jakarta Sans', 'Podkova', 'Poiret One', 'Poller One', 'Poltawski Nowy', 'Poly', 'Pompiere', 'Pontano Sans', 'Poor Story', 'Poppins', 'Port Lligat Sans', 'Port Lligat Slab', 'Potta One', 'Pragati Narrow', 'Praise', 'Prata', 'Preahvihear', 'Press Start 2P', 'Pridi', 'Princess Sofia', 'Prociono', 'Prompt', 'Prosto One', 'Proza Libre', 'Public Sans', 'Puppies Play', 'Puritan', 'Purple Purse', 'Pushster', 'Quando', 'Quantico', 'Quattrocento', 'Quattrocento Sans', 'Questrial', 'Quicksand', 'Quintessential', 'Qwigley', 'Qwitcher Grypen', 'REM', 'Racing Sans One', 'Radio Canada', 'Radley', 'Rajdhani', 'Rakkas', 'Raleway', 'Raleway Dots', 'Ramabhadra', 'Ramaraja', 'Rambla', 'Rammetto One', 'Rampart One', 'Ranchers', 'Rancho', 'Ranga', 'Rasa', 'Rationale', 'Ravi Prakash', 'Readex Pro', 'Recursive', 'Red Hat Display', 'Red Hat Mono', 'Red Hat Text', 'Red Rose', 'Redacted', 'Redacted Script', 'Redressed', 'Reem Kufi', 'Reem Kufi Fun', 'Reem Kufi Ink', 'Reenie Beanie', 'Reggae One', 'Revalia', 'Rhodium Libre', 'Ribeye', 'Ribeye Marrow', 'Righteous', 'Risque', 'Road Rage', 'RocknRoll One', 'Rokkitt', 'Romanesco', 'Ropa Sans', 'Rosario', 'Rosarivo', 'Rouge Script', 'Rowdies', 'Rozha One', 'Rubik', 'Rubik Beastly', 'Rubik Bubbles', 'Rubik Burned', 'Rubik Dirt', 'Rubik Distressed', 'Rubik Gemstones', 'Rubik Glitch', 'Rubik Iso', 'Rubik Marker Hatch', 'Rubik Maze', 'Rubik Microbe', 'Rubik Mono One', 'Rubik Moonrocks', 'Rubik Pixels', 'Rubik Puddles', 'Rubik Spray Paint', 'Rubik Storm', 'Rubik Vinyl', 'Rubik Wet Paint', 'Ruda', 'Rufina', 'Ruge Boogie', 'Ruluko', 'Rum Raisin', 'Ruslan Display', 'Russo One', 'Ruthie', 'Rye', 'STIX Two Text', 'Sacramento', 'Sahitya', 'Sail', 'Saira', 'Saira Condensed', 'Saira Extra Condensed', 'Saira Semi Condensed', 'Saira Stencil One', 'Salsa', 'Sanchez', 'Sancreek', 'Sansita', 'Sansita Swashed', 'Sarabun', 'Sarala', 'Sarina', 'Sarpanch', 'Sassybold', 'Satisfy', 'Sawarabi Gothic', 'Sawarabi Mincho', 'Scada', 'Scheherazade New', 'Schoolbell', 'Scope One', 'Seaweed Script', 'Secular One', 'Sedgwick Ave', 'Sedgwick Ave Display', 'Sen', 'Send Flowers', 'Sevillana', 'Seymour One', 'Shadows Into Light', 'Shadows Into Light Two', 'Shalimar', 'Shanti', 'Share', 'Share Tech', 'Share Tech Mono', 'Shippori Antique', 'Shippori Antique B1', 'Shippori Mincho', 'Shippori Mincho B1', 'Shizuru', 'Shojumaru', 'Short Stack', 'Shrikhand', 'Siemreap', 'Sigmar One', 'Signika', 'Signika Negative', 'Silkscreen', 'Simonetta', 'Single Day', 'Sintony', 'Sirin Stencil', 'Six Caps', 'Skranji', 'Slabo 13px', 'Slabo 27px', 'Slackey', 'Smokum', 'Smooch', 'Smooch Sans', 'Smythe', 'Sniglet', 'Snippet', 'Snowburst One', 'Sofadi One', 'Sofia', 'Sofia Sans', 'Sofia Sans Condensed', 'Sofia Sans Extra Condensed', 'Sofia Sans Semi Condensed', 'Solitreo', 'Solway', 'Song Myung', 'Sono', 'Sonsie One', 'Sora', 'Sorts Mill Goudy', 'Source Code Pro', 'Source Sans 3', 'Source Sans Pro', 'Source Serif 4', 'Source Serif Pro', 'Space Grotesk', 'Space Mono', 'Special Elite', 'Spectral', 'Spectral SC', 'Spicy Rice', 'Spinnaker', 'Spirax', 'Splash', 'Spline Sans', 'Spline Sans Mono', 'Squada One', 'Square Peg', 'Sree Krushnadevaraya', 'Sriracha', 'Srisakdi', 'Staatliches', 'Stalemate', 'Stalinist One', 'Stardos Stencil', 'Stick', 'Stick No Bills', 'Stint Ultra Condensed', 'Stint Ultra Expanded', 'Stoke', 'Strait', 'Style Script', 'Stylish', 'Sue Ellen Francisco', 'Suez One', 'Sulphur Point', 'Sumana', 'Sunflower', 'Sunshiney', 'Supermercado One', 'Sura', 'Suranna', 'Suravaram', 'Suwannaphum', 'Swanky and Moo Moo', 'Syncopate', 'Syne', 'Syne Mono', 'Syne Tactile', 'Tac One', 'Tai Heritage Pro', 'Tajawal', 'Tangerine', 'Tapestry', 'Taprom', 'Tauri', 'Taviraj', 'Teko', 'Telex', 'Tenali Ramakrishna', 'Tenor Sans', 'Text Me One', 'Texturina', 'Thasadith', 'The Girl Next Door', 'The Nautigal', 'Tienne', 'Tillana', 'Tilt Neon', 'Tilt Prism', 'Tilt Warp', 'Timmana', 'Tinos', 'Tiro Bangla', 'Tiro Devanagari Marathi', 'Tiro Devanagari Sanskrit', 'Tiro Gurmukhi', 'Tiro Kannada', 'Tiro Tamil', 'Tiro Telugu', 'Titan One', 'Titillium Web', 'Tomorrow', 'Tourney', 'Trade Winds', 'Train One', 'Trirong', 'Trispace', 'Trocchi', 'Trochut', 'Truculenta', 'Trykker', 'Tsukimi Rounded', 'Tulpen One', 'Turret Road', 'Twinkle Star', 'Ubuntu', 'Ubuntu Condensed', 'Ubuntu Mono', 'Uchen', 'Ultra', 'Unbounded', 'Uncial Antiqua', 'Underdog', 'Unica One', 'UnifrakturCook', 'UnifrakturMaguntia', 'Unkempt', 'Unlock', 'Unna', 'Updock', 'Urbanist', 'Vast Shadow', 'Vazirmatn', 'Vesper Libre', 'Viaoda Libre', 'Vibes', 'Vibur', 'Vidaloka', 'Viga', 'Voces', 'Volkhov', 'Vollkorn', 'Vollkorn SC', 'Voltaire', 'Vujahday Script', 'Waiting for the Sunrise', 'Wallpoet', 'Walter Turncoat', 'Warnes', 'Waterfall', 'Wavefont', 'Wellfleet', 'Wendy One', 'Whisper', 'WindSong', 'Wire One', 'Work Sans', 'Wix Madefor Display', 'Wix Madefor Text', 'Xanh Mono', 'Yaldevi', 'Yanone Kaffeesatz', 'Yantramanav', 'Yatra One', 'Yellowtail', 'Yeon Sung', 'Yeseva One', 'Yesteryear', 'Yomogi', 'Yrsa', 'Ysabeau', 'Ysabeau Infant', 'Ysabeau Office', 'Ysabeau SC', 'Yuji Boku', 'Yuji Hentaigana Akari', 'Yuji Hentaigana Akebono', 'Yuji Mai', 'Yuji Syuku', 'Yusei Magic', 'ZCOOL KuaiLe', 'ZCOOL QingKe HuangYou', 'ZCOOL XiaoWei', 'Zen Antique', 'Zen Antique Soft', 'Zen Dots', 'Zen Kaku Gothic Antique', 'Zen Kaku Gothic New', 'Zen Kurenaido', 'Zen Loop', 'Zen Maru Gothic', 'Zen Old Mincho', 'Zen Tokyo Zoo', 'Zeyada', 'Zhi Mang Xing', 'Zilla Slab', 'Zilla Slab Highlight'];
|
|
1805
|
+
|
|
1660
1806
|
var _excluded$5 = ["mimeType", "quality", "dpi", "dpiMetadata"],
|
|
1661
1807
|
_excluded2$1 = ["mimeType", "quality"],
|
|
1662
1808
|
_excluded3$1 = ["fileName"],
|
|
@@ -1771,7 +1917,9 @@ var Store = mobxStateTree.types.model('Store', {
|
|
|
1771
1917
|
// null | { type: 'effects'|'mask', elementId: string }
|
|
1772
1918
|
_fontVersion: 0,
|
|
1773
1919
|
// incremented after each font load to trigger canvas re-render
|
|
1774
|
-
_pendingInputFields: []
|
|
1920
|
+
_pendingInputFields: [],
|
|
1921
|
+
// elements awaiting user input after loadJSON
|
|
1922
|
+
customFonts: [] // host-injected custom font catalog: [{ name, variants: [{weight,style,file}] }]
|
|
1775
1923
|
};
|
|
1776
1924
|
}).views(function (self) {
|
|
1777
1925
|
return {
|
|
@@ -2633,6 +2781,11 @@ var Store = mobxStateTree.types.model('Store', {
|
|
|
2633
2781
|
self.fonts.splice(idx, 1);
|
|
2634
2782
|
}
|
|
2635
2783
|
},
|
|
2784
|
+
// Full replace, mirroring `_setStageRef`'s plain-assignment style for volatile state.
|
|
2785
|
+
// Host app calls this with the complete active font list — no incremental add/remove.
|
|
2786
|
+
setCustomFonts: function setCustomFonts(fonts) {
|
|
2787
|
+
self.customFonts = fonts || [];
|
|
2788
|
+
},
|
|
2636
2789
|
addAudio: function addAudio(data) {
|
|
2637
2790
|
self.audios.push(_objectSpread2({
|
|
2638
2791
|
id: uuid.v4()
|
|
@@ -2648,15 +2801,24 @@ var Store = mobxStateTree.types.model('Store', {
|
|
|
2648
2801
|
},
|
|
2649
2802
|
loadFont: function loadFont(fontFamily) {
|
|
2650
2803
|
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
2651
|
-
var id, link, _t;
|
|
2804
|
+
var customFont, id, link, _t;
|
|
2652
2805
|
return _regenerator().w(function (_context8) {
|
|
2653
2806
|
while (1) switch (_context8.p = _context8.n) {
|
|
2654
2807
|
case 0:
|
|
2808
|
+
_context8.p = 1;
|
|
2809
|
+
customFont = self.customFonts.find(function (f) {
|
|
2810
|
+
return f.name === fontFamily;
|
|
2811
|
+
});
|
|
2812
|
+
if (!customFont) {
|
|
2813
|
+
_context8.n = 2;
|
|
2814
|
+
break;
|
|
2815
|
+
}
|
|
2816
|
+
return _context8.a(2, self._loadCustomFont(customFont));
|
|
2817
|
+
case 2:
|
|
2655
2818
|
// Load font via Google Fonts CSS API
|
|
2656
2819
|
id = "google-font-".concat(fontFamily.replace(/\s+/g, '-').toLowerCase());
|
|
2657
|
-
_context8.p = 1;
|
|
2658
2820
|
if (document.getElementById(id)) {
|
|
2659
|
-
_context8.n =
|
|
2821
|
+
_context8.n = 3;
|
|
2660
2822
|
break;
|
|
2661
2823
|
}
|
|
2662
2824
|
link = document.createElement('link');
|
|
@@ -2665,38 +2827,76 @@ var Store = mobxStateTree.types.model('Store', {
|
|
|
2665
2827
|
link.rel = 'stylesheet';
|
|
2666
2828
|
|
|
2667
2829
|
// Wait for the CSS stylesheet to load so @font-face rules are parsed
|
|
2668
|
-
_context8.n =
|
|
2830
|
+
_context8.n = 3;
|
|
2669
2831
|
return new Promise(function (resolve) {
|
|
2670
2832
|
link.onload = resolve;
|
|
2671
2833
|
link.onerror = resolve; // don't block on network errors
|
|
2672
2834
|
document.head.appendChild(link);
|
|
2673
2835
|
});
|
|
2674
|
-
case 2:
|
|
2675
|
-
_context8.n = 3;
|
|
2676
|
-
return document.fonts.load("16px \"".concat(fontFamily, "\""));
|
|
2677
2836
|
case 3:
|
|
2678
2837
|
_context8.n = 4;
|
|
2679
|
-
return document.fonts.load("
|
|
2838
|
+
return document.fonts.load("16px \"".concat(fontFamily, "\""));
|
|
2680
2839
|
case 4:
|
|
2681
2840
|
_context8.n = 5;
|
|
2682
|
-
return document.fonts.
|
|
2841
|
+
return document.fonts.load("bold 16px \"".concat(fontFamily, "\""));
|
|
2683
2842
|
case 5:
|
|
2843
|
+
_context8.n = 6;
|
|
2844
|
+
return document.fonts.ready;
|
|
2845
|
+
case 6:
|
|
2684
2846
|
// Bump version so MobX observers re-render with the real font
|
|
2685
2847
|
self._fontVersion += 1;
|
|
2686
2848
|
// Force Konva to redraw all text nodes with the newly loaded font
|
|
2687
2849
|
if (self._stageRef) {
|
|
2688
2850
|
self._stageRef.batchDraw();
|
|
2689
2851
|
}
|
|
2690
|
-
_context8.n =
|
|
2852
|
+
_context8.n = 8;
|
|
2691
2853
|
break;
|
|
2692
|
-
case
|
|
2693
|
-
_context8.p =
|
|
2854
|
+
case 7:
|
|
2855
|
+
_context8.p = 7;
|
|
2694
2856
|
_t = _context8.v;
|
|
2695
2857
|
console.warn("Failed to load font: ".concat(fontFamily), _t);
|
|
2696
|
-
case
|
|
2858
|
+
case 8:
|
|
2697
2859
|
return _context8.a(2);
|
|
2698
2860
|
}
|
|
2699
|
-
}, _callee8, null, [[1,
|
|
2861
|
+
}, _callee8, null, [[1, 7]]);
|
|
2862
|
+
}))();
|
|
2863
|
+
},
|
|
2864
|
+
_loadCustomFont: function _loadCustomFont(customFont) {
|
|
2865
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
2866
|
+
var id, styleEl, _t2;
|
|
2867
|
+
return _regenerator().w(function (_context9) {
|
|
2868
|
+
while (1) switch (_context9.p = _context9.n) {
|
|
2869
|
+
case 0:
|
|
2870
|
+
_context9.p = 0;
|
|
2871
|
+
id = "custom-font-".concat(customFont.name.replace(/\s+/g, '-').toLowerCase());
|
|
2872
|
+
if (!document.getElementById(id)) {
|
|
2873
|
+
styleEl = document.createElement('style');
|
|
2874
|
+
styleEl.id = id;
|
|
2875
|
+
styleEl.textContent = buildFontFaceCss(customFont);
|
|
2876
|
+
document.head.appendChild(styleEl);
|
|
2877
|
+
}
|
|
2878
|
+
_context9.n = 1;
|
|
2879
|
+
return Promise.all(customFont.variants.map(function (v) {
|
|
2880
|
+
return document.fonts.load("".concat(v.style === 'italic' ? 'italic ' : '').concat(v.weight, " 16px \"").concat(customFont.name, "\""));
|
|
2881
|
+
}));
|
|
2882
|
+
case 1:
|
|
2883
|
+
_context9.n = 2;
|
|
2884
|
+
return document.fonts.ready;
|
|
2885
|
+
case 2:
|
|
2886
|
+
self._fontVersion += 1;
|
|
2887
|
+
if (self._stageRef) {
|
|
2888
|
+
self._stageRef.batchDraw();
|
|
2889
|
+
}
|
|
2890
|
+
_context9.n = 4;
|
|
2891
|
+
break;
|
|
2892
|
+
case 3:
|
|
2893
|
+
_context9.p = 3;
|
|
2894
|
+
_t2 = _context9.v;
|
|
2895
|
+
console.warn("Failed to load custom font: ".concat(customFont.name), _t2);
|
|
2896
|
+
case 4:
|
|
2897
|
+
return _context9.a(2);
|
|
2898
|
+
}
|
|
2899
|
+
}, _callee9, null, [[0, 3]]);
|
|
2700
2900
|
}))();
|
|
2701
2901
|
},
|
|
2702
2902
|
_autoLoadFonts: function _autoLoadFonts(data) {
|
|
@@ -8714,110 +8914,7 @@ mobxReactLite.observer(function (_ref2) {
|
|
|
8714
8914
|
});
|
|
8715
8915
|
});
|
|
8716
8916
|
|
|
8717
|
-
var
|
|
8718
|
-
var cachedFonts = null;
|
|
8719
|
-
function fetchGoogleFonts(_x) {
|
|
8720
|
-
return _fetchGoogleFonts.apply(this, arguments);
|
|
8721
|
-
}
|
|
8722
|
-
function _fetchGoogleFonts() {
|
|
8723
|
-
_fetchGoogleFonts = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(apiKey) {
|
|
8724
|
-
var url, response, data, _t;
|
|
8725
|
-
return _regenerator().w(function (_context) {
|
|
8726
|
-
while (1) switch (_context.p = _context.n) {
|
|
8727
|
-
case 0:
|
|
8728
|
-
if (!cachedFonts) {
|
|
8729
|
-
_context.n = 1;
|
|
8730
|
-
break;
|
|
8731
|
-
}
|
|
8732
|
-
return _context.a(2, cachedFonts);
|
|
8733
|
-
case 1:
|
|
8734
|
-
_context.p = 1;
|
|
8735
|
-
url = apiKey ? "".concat(GOOGLE_FONTS_API, "?key=").concat(apiKey, "&sort=popularity") : "".concat(GOOGLE_FONTS_API, "?sort=popularity");
|
|
8736
|
-
_context.n = 2;
|
|
8737
|
-
return fetch(url);
|
|
8738
|
-
case 2:
|
|
8739
|
-
response = _context.v;
|
|
8740
|
-
_context.n = 3;
|
|
8741
|
-
return response.json();
|
|
8742
|
-
case 3:
|
|
8743
|
-
data = _context.v;
|
|
8744
|
-
cachedFonts = (data.items || []).map(function (font) {
|
|
8745
|
-
return {
|
|
8746
|
-
fontFamily: font.family,
|
|
8747
|
-
variants: font.variants || [],
|
|
8748
|
-
category: font.category,
|
|
8749
|
-
url: "https://fonts.googleapis.com/css2?family=".concat(encodeURIComponent(font.family), "&display=swap")
|
|
8750
|
-
};
|
|
8751
|
-
});
|
|
8752
|
-
return _context.a(2, cachedFonts);
|
|
8753
|
-
case 4:
|
|
8754
|
-
_context.p = 4;
|
|
8755
|
-
_t = _context.v;
|
|
8756
|
-
console.warn('Failed to fetch Google Fonts list', _t);
|
|
8757
|
-
return _context.a(2, []);
|
|
8758
|
-
}
|
|
8759
|
-
}, _callee, null, [[1, 4]]);
|
|
8760
|
-
}));
|
|
8761
|
-
return _fetchGoogleFonts.apply(this, arguments);
|
|
8762
|
-
}
|
|
8763
|
-
function loadGoogleFont(_x2) {
|
|
8764
|
-
return _loadGoogleFont.apply(this, arguments);
|
|
8765
|
-
}
|
|
8766
|
-
function _loadGoogleFont() {
|
|
8767
|
-
_loadGoogleFont = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(fontFamily) {
|
|
8768
|
-
var id, existing, _t2;
|
|
8769
|
-
return _regenerator().w(function (_context2) {
|
|
8770
|
-
while (1) switch (_context2.p = _context2.n) {
|
|
8771
|
-
case 0:
|
|
8772
|
-
id = "google-font-".concat(fontFamily.replace(/\s+/g, '-').toLowerCase());
|
|
8773
|
-
existing = document.getElementById(id);
|
|
8774
|
-
if (existing) {
|
|
8775
|
-
_context2.n = 1;
|
|
8776
|
-
break;
|
|
8777
|
-
}
|
|
8778
|
-
_context2.n = 1;
|
|
8779
|
-
return new Promise(function (resolve) {
|
|
8780
|
-
var link = document.createElement('link');
|
|
8781
|
-
link.id = id;
|
|
8782
|
-
link.href = "https://fonts.googleapis.com/css2?family=".concat(encodeURIComponent(fontFamily), ":wght@100;200;300;400;500;600;700;800;900&display=swap");
|
|
8783
|
-
link.rel = 'stylesheet';
|
|
8784
|
-
link.onload = function () {
|
|
8785
|
-
return resolve();
|
|
8786
|
-
};
|
|
8787
|
-
link.onerror = function () {
|
|
8788
|
-
return resolve();
|
|
8789
|
-
};
|
|
8790
|
-
document.head.appendChild(link);
|
|
8791
|
-
});
|
|
8792
|
-
case 1:
|
|
8793
|
-
_context2.p = 1;
|
|
8794
|
-
_context2.n = 2;
|
|
8795
|
-
return document.fonts.load("16px \"".concat(fontFamily, "\""));
|
|
8796
|
-
case 2:
|
|
8797
|
-
_context2.n = 3;
|
|
8798
|
-
return document.fonts.load("bold 16px \"".concat(fontFamily, "\""));
|
|
8799
|
-
case 3:
|
|
8800
|
-
_context2.n = 4;
|
|
8801
|
-
return document.fonts.ready;
|
|
8802
|
-
case 4:
|
|
8803
|
-
_context2.n = 6;
|
|
8804
|
-
break;
|
|
8805
|
-
case 5:
|
|
8806
|
-
_context2.p = 5;
|
|
8807
|
-
_t2 = _context2.v;
|
|
8808
|
-
console.warn("Font \"".concat(fontFamily, "\" may not have loaded correctly."), _t2);
|
|
8809
|
-
case 6:
|
|
8810
|
-
return _context2.a(2);
|
|
8811
|
-
}
|
|
8812
|
-
}, _callee2, null, [[1, 5]]);
|
|
8813
|
-
}));
|
|
8814
|
-
return _loadGoogleFont.apply(this, arguments);
|
|
8815
|
-
}
|
|
8816
|
-
|
|
8817
|
-
// Comprehensive list of Google Fonts matching Polotno's font library
|
|
8818
|
-
var DEFAULT_FONTS = ['ABeeZee', 'Abel', 'Abhaya Libre', 'Abril Fatface', 'Aclonica', 'Acme', 'Actor', 'Adamina', 'Advent Pro', 'Aguafina Script', 'Akronim', 'Aladin', 'Alata', 'Alatsi', 'Albert Sans', 'Aldrich', 'Alef', 'Alegreya', 'Alegreya Sans', 'Alegreya Sans SC', 'Alegreya SC', 'Aleo', 'Alex Brush', 'Alfa Slab One', 'Alice', 'Alike', 'Alike Angular', 'Allan', 'Allerta', 'Allerta Stencil', 'Allison', 'Allura', 'Almarai', 'Almendra', 'Almendra Display', 'Almendra SC', 'Alumni Sans', 'Alumni Sans Inline One', 'Amarante', 'Amaranth', 'Amatic SC', 'Amethysta', 'Amiko', 'Amiri', 'Amita', 'Anaheim', 'Andada Pro', 'Andika', 'Anek Bangla', 'Anek Devanagari', 'Anek Gujarati', 'Anek Gurmukhi', 'Anek Kannada', 'Anek Latin', 'Anek Malayalam', 'Anek Odia', 'Anek Tamil', 'Anek Telugu', 'Angkor', 'Annie Use Your Telescope', 'Anonymous Pro', 'Antic', 'Antic Didone', 'Antic Slab', 'Anton', 'Antonio', 'Anybody', 'Arapey', 'Arbutus', 'Arbutus Slab', 'Architects Daughter', 'Archivo', 'Archivo Black', 'Archivo Narrow', 'Are You Serious', 'Aref Ruqaa', 'Arima', 'Arimo', 'Arizonia', 'Armata', 'Arsenal', 'Artifika', 'Arvo', 'Arya', 'Asap', 'Asap Condensed', 'Asar', 'Asset', 'Assistant', 'Astloch', 'Asul', 'Athiti', 'Atkinson Hyperlegible', 'Atma', 'Atomic Age', 'Aubrey', 'Audiowide', 'Autour One', 'Average', 'Average Sans', 'Averia Gruesa Libre', 'Averia Libre', 'Averia Sans Libre', 'Averia Serif Libre', 'Azeret Mono', 'B612', 'B612 Mono', 'Bad Script', 'Bahiana', 'Bahianita', 'Bai Jamjuree', 'Bakbak One', 'Ballet', 'Baloo 2', 'Baloo Bhai 2', 'Baloo Bhaijaan 2', 'Baloo Bhaina 2', 'Baloo Chettan 2', 'Baloo Da 2', 'Baloo Paaji 2', 'Baloo Tamma 2', 'Baloo Tammudu 2', 'Baloo Thambi 2', 'Balsamiq Sans', 'Balthazar', 'Bangers', 'Barlow', 'Barlow Condensed', 'Barlow Semi Condensed', 'Barriecito', 'Barrio', 'Basic', 'Baskervville', 'Battambang', 'Baumans', 'Bayon', 'Be Vietnam Pro', 'Beau Rivage', 'Bebas Neue', 'Belgrano', 'Bellefair', 'Belleza', 'Bellota', 'Bellota Text', 'BenchNine', 'Benne', 'Bentham', 'Berkshire Swash', 'Besley', 'Beth Ellen', 'Bevan', 'BIZ UDGothic', 'BIZ UDMincho', 'BIZ UDPGothic', 'BIZ UDPMincho', 'Big Shoulders Display', 'Big Shoulders Inline Display', 'Big Shoulders Inline Text', 'Big Shoulders Stencil Display', 'Big Shoulders Stencil Text', 'Big Shoulders Text', 'Bigelow Rules', 'Bigshot One', 'Bilbo', 'Bilbo Swash Caps', 'BioRhyme', 'BioRhyme Expanded', 'Birthstone', 'Birthstone Bounce', 'Bitter', 'Black And White Picture', 'Black Han Sans', 'Black Ops One', 'Blaka', 'Blaka Hollow', 'Blaka Ink', 'Blinker', 'Bodoni Moda', 'Bokor', 'Bona Nova', 'Bonbon', 'Bonheur Royale', 'Boogaloo', 'Bowlby One', 'Bowlby One SC', 'Brawler', 'Bree Serif', 'Brygada 1918', 'Bubblegum Sans', 'Bubbler One', 'Buda', 'Buenard', 'Bungee', 'Bungee Hairline', 'Bungee Inline', 'Bungee Outline', 'Bungee Shade', 'Bungee Spice', 'Butcherman', 'Butterfly Kids', 'Cabin', 'Cabin Condensed', 'Cabin Sketch', 'Caesar Dressing', 'Cagliostro', 'Cairo', 'Cairo Play', 'Caladea', 'Calistoga', 'Calligraffitti', 'Cambay', 'Cambo', 'Candal', 'Cantarell', 'Cantata One', 'Cantora One', 'Caprasimo', 'Capriola', 'Caramel', 'Carattere', 'Cardo', 'Carlito', 'Carme', 'Carrois Gothic', 'Carrois Gothic SC', 'Carter One', 'Castoro', 'Catamaran', 'Caudex', 'Caveat', 'Caveat Brush', 'Cedarville Cursive', 'Ceviche One', 'Chakra Petch', 'Changa', 'Changa One', 'Chango', 'Charis SIL', 'Charm', 'Charmonman', 'Chathura', 'Chau Philomene One', 'Chela One', 'Chelsea Market', 'Chenla', 'Cherry Bomb One', 'Cherry Cream Soda', 'Cherry Swash', 'Chewy', 'Chicle', 'Chilanka', 'Chivo', 'Chivo Mono', 'Chonburi', 'Cinzel', 'Cinzel Decorative', 'Clicker Script', 'Coda', 'Coda Caption', 'Codystar', 'Coiny', 'Combo', 'Comfortaa', 'Comforter', 'Comforter Brush', 'Comic Neue', 'Coming Soon', 'Commissioner', 'Concert One', 'Condiment', 'Content', 'Contrail One', 'Convergence', 'Cookie', 'Copse', 'Corben', 'Corinthia', 'Cormorant', 'Cormorant Garamond', 'Cormorant Infant', 'Cormorant SC', 'Cormorant Unicase', 'Cormorant Upright', 'Courgette', 'Courier Prime', 'Cousine', 'Coustard', 'Covered By Your Grace', 'Crafty Girls', 'Creepster', 'Crete Round', 'Crimson Pro', 'Crimson Text', 'Croissant One', 'Crushed', 'Cuprum', 'Cute Font', 'Cutive', 'Cutive Mono', 'DM Mono', 'DM Sans', 'DM Serif Display', 'DM Serif Text', 'Damion', 'Dancing Script', 'Dangrek', 'Darker Grotesque', 'David Libre', 'Dawning of a New Day', 'Days One', 'Dekko', 'Dela Gothic One', 'Delius', 'Delius Swash Caps', 'Delius Unicase', 'Della Respira', 'Denk One', 'Devonshire', 'Dhurjati', 'Didact Gothic', 'Diplomata', 'Diplomata SC', 'Do Hyeon', 'Dokdo', 'Domine', 'Donegal One', 'Dongle', 'Doppio One', 'Dorsa', 'Dosis', 'DotGothic16', 'Dr Sugiyama', 'Duru Sans', 'DynaPuff', 'Dynalight', 'EB Garamond', 'Eagle Lake', 'East Sea Dokdo', 'Eater', 'Economica', 'Eczar', 'El Messiri', 'Electrolize', 'Elsie', 'Elsie Swash Caps', 'Emblema One', 'Emilys Candy', 'Encode Sans', 'Encode Sans Condensed', 'Encode Sans Expanded', 'Encode Sans SC', 'Encode Sans Semi Condensed', 'Encode Sans Semi Expanded', 'Engagement', 'Englebert', 'Enriqueta', 'Ephesis', 'Epilogue', 'Erica One', 'Esteban', 'Estonia', 'Euphoria Script', 'Ewert', 'Exo', 'Exo 2', 'Expletus Sans', 'Explora', 'Fahkwang', 'Familjen Grotesk', 'Fanwood Text', 'Farro', 'Farsan', 'Fascinate', 'Fascinate Inline', 'Faster One', 'Fasthand', 'Fauna One', 'Faustina', 'Federant', 'Federo', 'Felipa', 'Fenix', 'Festive', 'Finger Paint', 'Finlandica', 'Fira Code', 'Fira Mono', 'Fira Sans', 'Fira Sans Condensed', 'Fira Sans Extra Condensed', 'Fjalla One', 'Fjord One', 'Flamenco', 'Flavors', 'Fleur De Leah', 'Flow Block', 'Flow Circular', 'Flow Rounded', 'Fondamento', 'Fontdiner Swanky', 'Forum', 'Fragment Mono', 'Francois One', 'Frank Ruhl Libre', 'Fraunces', 'Freckle Face', 'Fredericka the Great', 'Fredoka', 'Freehand', 'Fresca', 'Frijole', 'Fruktur', 'Fugaz One', 'Fuggles', 'Fuzzy Bubbles', 'GFS Didot', 'GFS Neohellenic', 'Gabriela', 'Gaegu', 'Gafata', 'Galada', 'Galdeano', 'Galindo', 'Gamja Flower', 'Gantari', 'Gas', 'Gayathri', 'Gelasio', 'Gemunu Libre', 'Genos', 'Gentium Book Plus', 'Gentium Plus', 'Geo', 'Georama', 'Geostar', 'Geostar Fill', 'Germania One', 'Gideon Roman', 'Gidugu', 'Gilda Display', 'Girassol', 'Give You Glory', 'Glass Antiqua', 'Glegoo', 'Gloria Hallelujah', 'Glory', 'Gluten', 'Goblin One', 'Gochi Hand', 'Goldman', 'Goldplay', 'Golos Text', 'Gorditas', 'Gothic A1', 'Gotu', 'Goudy Bookletter 1911', 'Gowun Batang', 'Gowun Dodum', 'Graduate', 'Grand Hotel', 'Grandstander', 'Grape Nuts', 'Gravitas One', 'Great Vibes', 'Grechen Fuemen', 'Grenze', 'Grenze Gotisch', 'Grey Qo', 'Griffy', 'Gruppo', 'Gudea', 'Gugi', 'Gulzar', 'Gupter', 'Gurajada', 'Gwendolyn', 'Habibi', 'Hachi Maru Pop', 'Hahmlet', 'Halant', 'Hammersmith One', 'Hanalei', 'Hanalei Fill', 'Handlee', 'Hanken Grotesk', 'Hanuman', 'Happy Monkey', 'Harmattan', 'Headland One', 'Heebo', 'Henny Penny', 'Hepta Slab', 'Herr Von Muellerhoff', 'Hi Melody', 'Hina Mincho', 'Hind', 'Hind Guntur', 'Hind Madurai', 'Hind Siliguri', 'Hind Vadodara', 'Holtwood One SC', 'Homemade Apple', 'Homenaje', 'Hubballi', 'Hurricane', 'IBM Plex Mono', 'IBM Plex Sans', 'IBM Plex Sans Arabic', 'IBM Plex Sans Condensed', 'IBM Plex Sans Devanagari', 'IBM Plex Sans Hebrew', 'IBM Plex Sans JP', 'IBM Plex Sans KR', 'IBM Plex Sans Thai', 'IBM Plex Sans Thai Looped', 'IBM Plex Serif', 'Iceberg', 'Iceland', 'Imbue', 'Imperial Script', 'Imprima', 'Inconsolata', 'Inder', 'Indie Flower', 'Ingrid Darling', 'Inika', 'Inknut Antiqua', 'Inria Sans', 'Inria Serif', 'Inspiration', 'Inter', 'Inter Tight', 'Irish Grover', 'Island Moments', 'Istok Web', 'Italiana', 'Italianno', 'Itim', 'Jacques Francois', 'Jacques Francois Shadow', 'Jaldi', 'JetBrains Mono', 'Jim Nightshade', 'Joan', 'Jockey One', 'Jolly Lodger', 'Jomhuria', 'Jomolhari', 'Josefin Sans', 'Josefin Slab', 'Jost', 'Joti One', 'Jua', 'Judson', 'Julee', 'Julius Sans One', 'Junge', 'Jura', 'K2D', 'Kadwa', 'Kaisei Decol', 'Kaisei HarunoUmi', 'Kaisei Opti', 'Kaisei Tokumin', 'Kalam', 'Kameron', 'Kanit', 'Kantumruy Pro', 'Karantina', 'Karla', 'Karma', 'Katibeh', 'Kaushan Script', 'Kavivanar', 'Kavoon', 'Kdam Thmor Pro', 'Keania One', 'Kelly Slab', 'Kenia', 'Khand', 'Khmer', 'Khula', 'Kings', 'Kirang Haerang', 'Kite One', 'Kiwi Maru', 'Klee One', 'Knewave', 'KoHo', 'Kodchasan', 'Koh Santepheap', 'Kolker Brush', 'Konkhmer Sleokchher', 'Kosugi', 'Kosugi Maru', 'Kotta One', 'Koulen', 'Kranky', 'Kreon', 'Kristi', 'Krona One', 'Krub', 'Kufam', 'Kulim Park', 'Kumar One', 'Kumar One Outline', 'Kumbh Sans', 'Kurale', 'La Belle Aurore', 'Lacquer', 'Laila', 'Lakki Reddy', 'Lalezar', 'Lancelot', 'Langar', 'Lango', 'Lateef', 'Lato', 'Lavishly Yours', 'League Gothic', 'League Script', 'League Spartan', 'Leckerli One', 'Ledger', 'Lekton', 'Lemon', 'Lemonada', 'Lexend', 'Lexend Deca', 'Lexend Exa', 'Lexend Giga', 'Lexend Mega', 'Lexend Peta', 'Lexend Tera', 'Lexend Zetta', 'Libre Barcode 128', 'Libre Barcode 128 Text', 'Libre Barcode 39', 'Libre Barcode 39 Extended', 'Libre Barcode 39 Extended Text', 'Libre Barcode 39 Text', 'Libre Barcode EAN13 Text', 'Libre Baskerville', 'Libre Bodoni', 'Libre Caslon Display', 'Libre Caslon Text', 'Libre Franklin', 'Licorice', 'Life Savers', 'Lilita One', 'Lily Script One', 'Limelight', 'Linden Hill', 'Lingua Franca', 'Literata', 'Liu Jian Mao Cao', 'Livvic', 'Lobster', 'Lobster Two', 'Londrina Outline', 'Londrina Shadow', 'Londrina Sketch', 'Londrina Solid', 'Long Cang', 'Lora', 'Love Light', 'Love Ya Like A Sister', 'Loved by the King', 'Lovers Quarrel', 'Luckiest Guy', 'Lusitana', 'Lustria', 'Luxurious Roman', 'Luxurious Script', 'M PLUS 1', 'M PLUS 1 Code', 'M PLUS 1p', 'M PLUS 2', 'M PLUS Code Latin', 'M PLUS Rounded 1c', 'Ma Shan Zheng', 'Macondo', 'Macondo Swash Caps', 'Mada', 'Magra', 'Maiden Orange', 'Maitree', 'Major Mono Display', 'Mako', 'Mali', 'Mallanna', 'Mandali', 'Manjari', 'Manrope', 'Mansalva', 'Manuale', 'Marcellus', 'Marcellus SC', 'Marck Script', 'Margarine', 'Marhey', 'Markazi Text', 'Marko One', 'Marmelad', 'Martel', 'Martel Sans', 'Marvel', 'Mate', 'Mate SC', 'Maven Pro', 'McLaren', 'Mea Culpa', 'Meddon', 'MedievalSharp', 'Medula One', 'Meera Inimai', 'Megrim', 'Meie Script', 'Meow Script', 'Merienda', 'Merriweather', 'Merriweather Sans', 'Metal', 'Metal Mania', 'Metamorphous', 'Metrophobic', 'Michroma', 'Milonga', 'Miltonian', 'Miltonian Tattoo', 'Mina', 'Miniver', 'Miriam Libre', 'Mirza', 'Miss Fajardose', 'Mitr', 'Mochiy Pop One', 'Mochiy Pop P One', 'Modak', 'Modern Antiqua', 'Mogra', 'Mohave', 'Moirai One', 'Molengo', 'Molle', 'Monda', 'Monofett', 'Monoton', 'Monsieur La Doulaise', 'Montaga', 'Montagu Slab', 'MonteCarlo', 'Montez', 'Montserrat', 'Montserrat Alternates', 'Montserrat Subrayada', 'Moon Dance', 'Moul', 'Moulpali', 'Mountains of Christmas', 'Mouse Memoirs', 'Mr Bedfort', 'Mr Dafoe', 'Mr De Haviland', 'Mrs Saint Delafield', 'Mrs Sheppards', 'Mukta', 'Mukta Mahee', 'Mukta Malar', 'Mukta Vaani', 'Mulish', 'Murecho', 'MuseoModerno', 'My Soul', 'Mynerve', 'Mystery Quest', 'NTR', 'Nabla', 'Nanum Brush Script', 'Nanum Gothic', 'Nanum Gothic Coding', 'Nanum Myeongjo', 'Nanum Pen Script', 'Neonderthaw', 'Nerko One', 'Neucha', 'Neuton', 'New Rocker', 'New Tegomin', 'News Cycle', 'Newsreader', 'Niconne', 'Niramit', 'Nixie One', 'Nobile', 'Nokora', 'Norican', 'Nosifer', 'Notable', 'Nothing You Could Do', 'Noticia Text', 'Noto Color Emoji', 'Noto Emoji', 'Noto Kufi Arabic', 'Noto Music', 'Noto Naskh Arabic', 'Noto Nastaliq Urdu', 'Noto Sans', 'Noto Sans Arabic', 'Noto Sans Display', 'Noto Sans Mono', 'Noto Serif', 'Noto Serif Display', 'Nova Cut', 'Nova Flat', 'Nova Mono', 'Nova Oval', 'Nova Round', 'Nova Script', 'Nova Slim', 'Nova Square', 'Numans', 'Nunito', 'Nunito Sans', 'Odibee Sans', 'Odor Mean Chey', 'Offside', 'Oi', 'Old Standard TT', 'Oldenburg', 'Ole', 'Oleo Script', 'Oleo Script Swash Caps', 'Oooh Baby', 'Open Sans', 'Oranienbaum', 'Orbit', 'Orbitron', 'Oregano', 'Orelega One', 'Orienta', 'Original Surfer', 'Oswald', 'Outfit', 'Over the Rainbow', 'Overlock', 'Overlock SC', 'Overpass', 'Overpass Mono', 'Ovo', 'Oxanium', 'Oxygen', 'Oxygen Mono', 'PT Mono', 'PT Sans', 'PT Sans Caption', 'PT Sans Narrow', 'PT Serif', 'PT Serif Caption', 'Pacifico', 'Padauk', 'Padyakke Expanded One', 'Palanquin', 'Palanquin Dark', 'Palette Mosaic', 'Pangolin', 'Paprika', 'Parisienne', 'Passero One', 'Passion One', 'Passions Conflict', 'Pathway Extreme', 'Pathway Gothic One', 'Patrick Hand', 'Patrick Hand SC', 'Pattaya', 'Patua One', 'Pavanam', 'Paytone One', 'Peddana', 'Peralta', 'Permanent Marker', 'Petit Formal Script', 'Petrona', 'Philosopher', 'Phudu', 'Piazzolla', 'Piedra', 'Pinyon Script', 'Pirata One', 'Plaster', 'Play', 'Playball', 'Playfair Display', 'Playfair Display SC', 'Playpen Sans', 'Plus Jakarta Sans', 'Podkova', 'Poiret One', 'Poller One', 'Poltawski Nowy', 'Poly', 'Pompiere', 'Pontano Sans', 'Poor Story', 'Poppins', 'Port Lligat Sans', 'Port Lligat Slab', 'Potta One', 'Pragati Narrow', 'Praise', 'Prata', 'Preahvihear', 'Press Start 2P', 'Pridi', 'Princess Sofia', 'Prociono', 'Prompt', 'Prosto One', 'Proza Libre', 'Public Sans', 'Puppies Play', 'Puritan', 'Purple Purse', 'Pushster', 'Quando', 'Quantico', 'Quattrocento', 'Quattrocento Sans', 'Questrial', 'Quicksand', 'Quintessential', 'Qwigley', 'Qwitcher Grypen', 'REM', 'Racing Sans One', 'Radio Canada', 'Radley', 'Rajdhani', 'Rakkas', 'Raleway', 'Raleway Dots', 'Ramabhadra', 'Ramaraja', 'Rambla', 'Rammetto One', 'Rampart One', 'Ranchers', 'Rancho', 'Ranga', 'Rasa', 'Rationale', 'Ravi Prakash', 'Readex Pro', 'Recursive', 'Red Hat Display', 'Red Hat Mono', 'Red Hat Text', 'Red Rose', 'Redacted', 'Redacted Script', 'Redressed', 'Reem Kufi', 'Reem Kufi Fun', 'Reem Kufi Ink', 'Reenie Beanie', 'Reggae One', 'Revalia', 'Rhodium Libre', 'Ribeye', 'Ribeye Marrow', 'Righteous', 'Risque', 'Road Rage', 'RocknRoll One', 'Rokkitt', 'Romanesco', 'Ropa Sans', 'Rosario', 'Rosarivo', 'Rouge Script', 'Rowdies', 'Rozha One', 'Rubik', 'Rubik Beastly', 'Rubik Bubbles', 'Rubik Burned', 'Rubik Dirt', 'Rubik Distressed', 'Rubik Gemstones', 'Rubik Glitch', 'Rubik Iso', 'Rubik Marker Hatch', 'Rubik Maze', 'Rubik Microbe', 'Rubik Mono One', 'Rubik Moonrocks', 'Rubik Pixels', 'Rubik Puddles', 'Rubik Spray Paint', 'Rubik Storm', 'Rubik Vinyl', 'Rubik Wet Paint', 'Ruda', 'Rufina', 'Ruge Boogie', 'Ruluko', 'Rum Raisin', 'Ruslan Display', 'Russo One', 'Ruthie', 'Rye', 'STIX Two Text', 'Sacramento', 'Sahitya', 'Sail', 'Saira', 'Saira Condensed', 'Saira Extra Condensed', 'Saira Semi Condensed', 'Saira Stencil One', 'Salsa', 'Sanchez', 'Sancreek', 'Sansita', 'Sansita Swashed', 'Sarabun', 'Sarala', 'Sarina', 'Sarpanch', 'Sassybold', 'Satisfy', 'Sawarabi Gothic', 'Sawarabi Mincho', 'Scada', 'Scheherazade New', 'Schoolbell', 'Scope One', 'Seaweed Script', 'Secular One', 'Sedgwick Ave', 'Sedgwick Ave Display', 'Sen', 'Send Flowers', 'Sevillana', 'Seymour One', 'Shadows Into Light', 'Shadows Into Light Two', 'Shalimar', 'Shanti', 'Share', 'Share Tech', 'Share Tech Mono', 'Shippori Antique', 'Shippori Antique B1', 'Shippori Mincho', 'Shippori Mincho B1', 'Shizuru', 'Shojumaru', 'Short Stack', 'Shrikhand', 'Siemreap', 'Sigmar One', 'Signika', 'Signika Negative', 'Silkscreen', 'Simonetta', 'Single Day', 'Sintony', 'Sirin Stencil', 'Six Caps', 'Skranji', 'Slabo 13px', 'Slabo 27px', 'Slackey', 'Smokum', 'Smooch', 'Smooch Sans', 'Smythe', 'Sniglet', 'Snippet', 'Snowburst One', 'Sofadi One', 'Sofia', 'Sofia Sans', 'Sofia Sans Condensed', 'Sofia Sans Extra Condensed', 'Sofia Sans Semi Condensed', 'Solitreo', 'Solway', 'Song Myung', 'Sono', 'Sonsie One', 'Sora', 'Sorts Mill Goudy', 'Source Code Pro', 'Source Sans 3', 'Source Sans Pro', 'Source Serif 4', 'Source Serif Pro', 'Space Grotesk', 'Space Mono', 'Special Elite', 'Spectral', 'Spectral SC', 'Spicy Rice', 'Spinnaker', 'Spirax', 'Splash', 'Spline Sans', 'Spline Sans Mono', 'Squada One', 'Square Peg', 'Sree Krushnadevaraya', 'Sriracha', 'Srisakdi', 'Staatliches', 'Stalemate', 'Stalinist One', 'Stardos Stencil', 'Stick', 'Stick No Bills', 'Stint Ultra Condensed', 'Stint Ultra Expanded', 'Stoke', 'Strait', 'Style Script', 'Stylish', 'Sue Ellen Francisco', 'Suez One', 'Sulphur Point', 'Sumana', 'Sunflower', 'Sunshiney', 'Supermercado One', 'Sura', 'Suranna', 'Suravaram', 'Suwannaphum', 'Swanky and Moo Moo', 'Syncopate', 'Syne', 'Syne Mono', 'Syne Tactile', 'Tac One', 'Tai Heritage Pro', 'Tajawal', 'Tangerine', 'Tapestry', 'Taprom', 'Tauri', 'Taviraj', 'Teko', 'Telex', 'Tenali Ramakrishna', 'Tenor Sans', 'Text Me One', 'Texturina', 'Thasadith', 'The Girl Next Door', 'The Nautigal', 'Tienne', 'Tillana', 'Tilt Neon', 'Tilt Prism', 'Tilt Warp', 'Timmana', 'Tinos', 'Tiro Bangla', 'Tiro Devanagari Marathi', 'Tiro Devanagari Sanskrit', 'Tiro Gurmukhi', 'Tiro Kannada', 'Tiro Tamil', 'Tiro Telugu', 'Titan One', 'Titillium Web', 'Tomorrow', 'Tourney', 'Trade Winds', 'Train One', 'Trirong', 'Trispace', 'Trocchi', 'Trochut', 'Truculenta', 'Trykker', 'Tsukimi Rounded', 'Tulpen One', 'Turret Road', 'Twinkle Star', 'Ubuntu', 'Ubuntu Condensed', 'Ubuntu Mono', 'Uchen', 'Ultra', 'Unbounded', 'Uncial Antiqua', 'Underdog', 'Unica One', 'UnifrakturCook', 'UnifrakturMaguntia', 'Unkempt', 'Unlock', 'Unna', 'Updock', 'Urbanist', 'Vast Shadow', 'Vazirmatn', 'Vesper Libre', 'Viaoda Libre', 'Vibes', 'Vibur', 'Vidaloka', 'Viga', 'Voces', 'Volkhov', 'Vollkorn', 'Vollkorn SC', 'Voltaire', 'Vujahday Script', 'Waiting for the Sunrise', 'Wallpoet', 'Walter Turncoat', 'Warnes', 'Waterfall', 'Wavefont', 'Wellfleet', 'Wendy One', 'Whisper', 'WindSong', 'Wire One', 'Work Sans', 'Wix Madefor Display', 'Wix Madefor Text', 'Xanh Mono', 'Yaldevi', 'Yanone Kaffeesatz', 'Yantramanav', 'Yatra One', 'Yellowtail', 'Yeon Sung', 'Yeseva One', 'Yesteryear', 'Yomogi', 'Yrsa', 'Ysabeau', 'Ysabeau Infant', 'Ysabeau Office', 'Ysabeau SC', 'Yuji Boku', 'Yuji Hentaigana Akari', 'Yuji Hentaigana Akebono', 'Yuji Mai', 'Yuji Syuku', 'Yusei Magic', 'ZCOOL KuaiLe', 'ZCOOL QingKe HuangYou', 'ZCOOL XiaoWei', 'Zen Antique', 'Zen Antique Soft', 'Zen Dots', 'Zen Kaku Gothic Antique', 'Zen Kaku Gothic New', 'Zen Kurenaido', 'Zen Loop', 'Zen Maru Gothic', 'Zen Old Mincho', 'Zen Tokyo Zoo', 'Zeyada', 'Zhi Mang Xing', 'Zilla Slab', 'Zilla Slab Highlight'];
|
|
8819
|
-
|
|
8820
|
-
var _excluded$1 = ["fontFamily"];
|
|
8917
|
+
var _excluded$1 = ["fontFamily", "store"];
|
|
8821
8918
|
var _positionMenuItemSx = {
|
|
8822
8919
|
textTransform: 'none',
|
|
8823
8920
|
fontSize: 12,
|
|
@@ -8844,6 +8941,7 @@ function loadFontPreview(fontFamily) {
|
|
|
8844
8941
|
}
|
|
8845
8942
|
var FontPreviewOption = /*#__PURE__*/React.memo(function FontPreviewOption(_ref) {
|
|
8846
8943
|
var fontFamily = _ref.fontFamily,
|
|
8944
|
+
store = _ref.store,
|
|
8847
8945
|
liProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
8848
8946
|
var ref = React.useRef(null);
|
|
8849
8947
|
React.useEffect(function () {
|
|
@@ -8853,7 +8951,15 @@ var FontPreviewOption = /*#__PURE__*/React.memo(function FontPreviewOption(_ref)
|
|
|
8853
8951
|
var _ref3 = _slicedToArray(_ref2, 1),
|
|
8854
8952
|
entry = _ref3[0];
|
|
8855
8953
|
if (entry.isIntersecting) {
|
|
8856
|
-
|
|
8954
|
+
var _store$customFonts;
|
|
8955
|
+
var isCustom = store === null || store === void 0 || (_store$customFonts = store.customFonts) === null || _store$customFonts === void 0 ? void 0 : _store$customFonts.some(function (f) {
|
|
8956
|
+
return f.name === fontFamily;
|
|
8957
|
+
});
|
|
8958
|
+
if (isCustom) {
|
|
8959
|
+
store.loadFont(fontFamily);
|
|
8960
|
+
} else {
|
|
8961
|
+
loadFontPreview(fontFamily);
|
|
8962
|
+
}
|
|
8857
8963
|
io.disconnect();
|
|
8858
8964
|
}
|
|
8859
8965
|
}, {
|
|
@@ -8863,7 +8969,7 @@ var FontPreviewOption = /*#__PURE__*/React.memo(function FontPreviewOption(_ref)
|
|
|
8863
8969
|
return function () {
|
|
8864
8970
|
return io.disconnect();
|
|
8865
8971
|
};
|
|
8866
|
-
}, [fontFamily]);
|
|
8972
|
+
}, [fontFamily, store]);
|
|
8867
8973
|
return /*#__PURE__*/jsxRuntime.jsx("li", _objectSpread2(_objectSpread2({
|
|
8868
8974
|
ref: ref
|
|
8869
8975
|
}, liProps), {}, {
|
|
@@ -8929,6 +9035,7 @@ var TextToolbar = mobxReactLite.observer(function (_ref4) {
|
|
|
8929
9035
|
});
|
|
8930
9036
|
store.history.addUndoState();
|
|
8931
9037
|
};
|
|
9038
|
+
var customFonts = store.customFonts || [];
|
|
8932
9039
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
8933
9040
|
children: [/*#__PURE__*/jsxRuntime.jsx(material.Autocomplete, {
|
|
8934
9041
|
size: "small",
|
|
@@ -8943,16 +9050,27 @@ var TextToolbar = mobxReactLite.observer(function (_ref4) {
|
|
|
8943
9050
|
}
|
|
8944
9051
|
},
|
|
8945
9052
|
options: function () {
|
|
8946
|
-
var
|
|
9053
|
+
var customFontNames = customFonts.map(function (f) {
|
|
9054
|
+
return f.name;
|
|
9055
|
+
});
|
|
9056
|
+
var fonts = [].concat(_toConsumableArray(DEFAULT_FONTS.filter(function (f) {
|
|
9057
|
+
return !customFontNames.includes(f);
|
|
9058
|
+
})), _toConsumableArray(customFontNames));
|
|
8947
9059
|
if (element.fontFamily && !fonts.includes(element.fontFamily)) {
|
|
8948
9060
|
fonts.unshift(element.fontFamily);
|
|
8949
9061
|
}
|
|
8950
9062
|
return fonts;
|
|
8951
9063
|
}(),
|
|
9064
|
+
groupBy: customFonts.length > 0 ? function (option) {
|
|
9065
|
+
return customFonts.some(function (f) {
|
|
9066
|
+
return f.name === option;
|
|
9067
|
+
}) ? 'Custom Fonts' : 'Google Fonts';
|
|
9068
|
+
} : undefined,
|
|
8952
9069
|
disableClearable: true,
|
|
8953
9070
|
renderOption: function renderOption(props, option) {
|
|
8954
9071
|
return /*#__PURE__*/jsxRuntime.jsx(FontPreviewOption, _objectSpread2({
|
|
8955
|
-
fontFamily: option
|
|
9072
|
+
fontFamily: option,
|
|
9073
|
+
store: store
|
|
8956
9074
|
}, props), option);
|
|
8957
9075
|
},
|
|
8958
9076
|
renderInput: function renderInput(params) {
|
|
@@ -11324,6 +11442,18 @@ function computeCurvedCacheBounds(element) {
|
|
|
11324
11442
|
height: declaredHeight + maxSagitta * 2
|
|
11325
11443
|
};
|
|
11326
11444
|
}
|
|
11445
|
+
|
|
11446
|
+
// Sync a newly measured/computed height onto the element while keeping its
|
|
11447
|
+
// vertical center fixed — grows/shrinks equally above and below the original
|
|
11448
|
+
// position, instead of anchoring the top edge and only ever expanding downward.
|
|
11449
|
+
function syncHeightKeepingCenter(element, newHeight) {
|
|
11450
|
+
if (Math.abs(newHeight - element.height) <= 1) return;
|
|
11451
|
+
var deltaY = (newHeight - element.height) / 2;
|
|
11452
|
+
element.set({
|
|
11453
|
+
height: newHeight,
|
|
11454
|
+
y: element.y - deltaY
|
|
11455
|
+
});
|
|
11456
|
+
}
|
|
11327
11457
|
var TextElementComponent = mobxReactLite.observer(function (_ref) {
|
|
11328
11458
|
var _element$backgroundOp;
|
|
11329
11459
|
var element = _ref.element;
|
|
@@ -11334,6 +11464,7 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
|
|
|
11334
11464
|
groupChild = _ref.groupChild;
|
|
11335
11465
|
var groupRef = React.useRef(null);
|
|
11336
11466
|
var textRef = React.useRef(null);
|
|
11467
|
+
var textareaRef = React.useRef(null);
|
|
11337
11468
|
var _useState = React.useState(element.height || 50),
|
|
11338
11469
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11339
11470
|
textHeight = _useState2[0],
|
|
@@ -11362,9 +11493,7 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
|
|
|
11362
11493
|
var h = node.height();
|
|
11363
11494
|
if (h > 0) {
|
|
11364
11495
|
setTextHeight(h);
|
|
11365
|
-
|
|
11366
|
-
height: h
|
|
11367
|
-
});
|
|
11496
|
+
syncHeightKeepingCenter(element, h);
|
|
11368
11497
|
}
|
|
11369
11498
|
// Re-cache if blur is active
|
|
11370
11499
|
if (element.blurEnabled && node) {
|
|
@@ -11389,9 +11518,7 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
|
|
|
11389
11518
|
var h = node.height();
|
|
11390
11519
|
if (h > 0) {
|
|
11391
11520
|
setTextHeight(h);
|
|
11392
|
-
|
|
11393
|
-
height: h
|
|
11394
|
-
});
|
|
11521
|
+
syncHeightKeepingCenter(element, h);
|
|
11395
11522
|
}
|
|
11396
11523
|
});
|
|
11397
11524
|
return function () {
|
|
@@ -11407,11 +11534,24 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
|
|
|
11407
11534
|
var lineHeightMultiplier = typeof element.lineHeight === 'number' ? element.lineHeight : parseFloat(element.lineHeight) || 1.2;
|
|
11408
11535
|
var h = lineCount * element.fontSize * lineHeightMultiplier;
|
|
11409
11536
|
setTextHeight(h);
|
|
11410
|
-
|
|
11411
|
-
height: h
|
|
11412
|
-
});
|
|
11537
|
+
syncHeightKeepingCenter(element, h);
|
|
11413
11538
|
}, [element.text, element.placeholder, element.fontSize, element.lineHeight, element.curveEnabled, element.curvePower]);
|
|
11414
11539
|
|
|
11540
|
+
// While the live-typing textarea overlay is open, keep it aligned with the
|
|
11541
|
+
// Konva text node as syncHeightKeepingCenter adjusts element.y/height during
|
|
11542
|
+
// auto-grow — otherwise the invisible textarea (and its caret) stays at its
|
|
11543
|
+
// original position while the visible Konva text re-centers around it.
|
|
11544
|
+
React.useEffect(function () {
|
|
11545
|
+
if (!element._editModeEnabled) return;
|
|
11546
|
+
var node = textRef.current;
|
|
11547
|
+
var textarea = textareaRef.current;
|
|
11548
|
+
if (!node || !textarea) return;
|
|
11549
|
+
var pos = node.absolutePosition();
|
|
11550
|
+
var scaleY = node.getAbsoluteScale().y;
|
|
11551
|
+
textarea.style.top = "".concat(pos.y, "px");
|
|
11552
|
+
textarea.style.height = "".concat(element.height * scaleY, "px");
|
|
11553
|
+
}, [element._editModeEnabled, element.y, element.height]);
|
|
11554
|
+
|
|
11415
11555
|
// Apply blur filter: cache the text node when blur is enabled
|
|
11416
11556
|
React.useEffect(function () {
|
|
11417
11557
|
var _node$getLayer3;
|
|
@@ -11531,6 +11671,7 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
|
|
|
11531
11671
|
textarea.style.minHeight = '0';
|
|
11532
11672
|
textarea.style.minWidth = '0';
|
|
11533
11673
|
stageContainer.appendChild(textarea);
|
|
11674
|
+
textareaRef.current = textarea;
|
|
11534
11675
|
textarea.focus();
|
|
11535
11676
|
var caretPos = textarea.value.length;
|
|
11536
11677
|
textarea.setSelectionRange(caretPos, caretPos);
|
|
@@ -11548,6 +11689,7 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
|
|
|
11548
11689
|
text: cancel ? originalText : textarea.value
|
|
11549
11690
|
});
|
|
11550
11691
|
element.toggleEditMode(false);
|
|
11692
|
+
if (textareaRef.current === textarea) textareaRef.current = null;
|
|
11551
11693
|
if (textarea.parentNode) {
|
|
11552
11694
|
textarea.parentNode.removeChild(textarea);
|
|
11553
11695
|
}
|