labellife-design-tool 2.5.4 → 2.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/canvas/workspace.js +59 -29
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/config.js +2 -4
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/index.js +77 -36
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/side-panel/index.js +4 -7
- package/dist/cjs/side-panel/index.js.map +1 -1
- package/dist/cjs/side-panel/side-panel.js +4 -7
- package/dist/cjs/side-panel/side-panel.js.map +1 -1
- package/dist/cjs/toolbar/toolbar.js.map +1 -1
- package/dist/esm/canvas/workspace.js +59 -29
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/config.js +2 -4
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/index.js +74 -37
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/side-panel/index.js +4 -7
- package/dist/esm/side-panel/index.js.map +1 -1
- package/dist/esm/side-panel/side-panel.js +4 -7
- package/dist/esm/side-panel/side-panel.js.map +1 -1
- package/dist/esm/toolbar/toolbar.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/config.js
CHANGED
|
@@ -186,15 +186,13 @@ function getCustomTheme() {
|
|
|
186
186
|
return _customTheme;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
// ── Unsplash
|
|
189
|
+
// ── Unsplash proxy endpoints (used by background-panel.js) ───────────────────
|
|
190
|
+
// The host app supplies the full endpoint URLs; the library only appends the query string.
|
|
190
191
|
// Window-level singletons, same reasoning as translations/input-fields config above:
|
|
191
192
|
// each Rollup output bundle (index, side-panel, toolbar, canvas...) gets its own copy
|
|
192
193
|
// of this module, so a plain closure variable set from one bundle (e.g. via the host
|
|
193
194
|
// app's top-level `labellife-design-tool/config` import) would never be seen by another
|
|
194
195
|
// bundle (e.g. background-panel.js, built into the side-panel bundle).
|
|
195
|
-
//
|
|
196
|
-
// The host app owns the full endpoint URL (host + path); this lib only ever appends the
|
|
197
|
-
// query string for the search endpoint and uses the track-download URL as given.
|
|
198
196
|
var UNSPLASH_SEARCH_URL_KEY = '__labellife_unsplash_search_url__';
|
|
199
197
|
var UNSPLASH_TRACK_DOWNLOAD_URL_KEY = '__labellife_unsplash_track_download_url__';
|
|
200
198
|
function setUnsplashSearchUrl(url) {
|
package/dist/cjs/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../src/utils/l10n.js","../../src/config.js"],"sourcesContent":["// Use a window-level singleton so that all Rollup bundles (config, toolbar,\n// side-panel, canvas) share the same translations object. Without this each\n// bundle gets its own copy of this module with a separate local variable.\nconst GLOBAL_KEY = '__labellife_translations__';\nif (typeof window !== 'undefined' && !window[GLOBAL_KEY]) {\n window[GLOBAL_KEY] = {};\n}\n\nfunction _get() {\n return (typeof window !== 'undefined' && window[GLOBAL_KEY]) || {};\n}\n\nfunction deepMerge(target, source) {\n const result = { ...target };\n for (const key of Object.keys(source)) {\n if (\n source[key] &&\n typeof source[key] === 'object' &&\n !Array.isArray(source[key]) &&\n target[key] &&\n typeof target[key] === 'object' &&\n !Array.isArray(target[key])\n ) {\n result[key] = deepMerge(target[key], source[key]);\n } else {\n result[key] = source[key];\n }\n }\n return result;\n}\n\nexport function setTranslations(newTranslations) {\n if (typeof window !== 'undefined') {\n window[GLOBAL_KEY] = deepMerge(_get(), newTranslations);\n }\n}\n\nexport function getTranslations() {\n return _get();\n}\n\nexport function t(key, defaultValue) {\n // Support dot-notation paths like 'toolbar.duration'\n const parts = key.split('.');\n let current = _get();\n for (const part of parts) {\n if (current == null || typeof current !== 'object') {\n return defaultValue || key;\n }\n current = current[part];\n }\n if (current !== undefined && current !== null && typeof current !== 'object') {\n return current;\n }\n return defaultValue || key;\n}\n","import { setTranslations as _setTranslations, getTranslations, t } from './utils/l10n';\n\nlet _theme = 'light';\nlet _customTheme = {};\n\nexport function setTranslations(translations) {\n _setTranslations(translations);\n}\n\nexport { getTranslations, t };\n\nexport function setTheme(theme) {\n _theme = theme;\n}\n\nexport function getTheme() {\n return _theme;\n}\n\nexport function setCustomTheme(customTheme) {\n _customTheme = { ..._customTheme, ...customTheme };\n}\n\nexport function getCustomTheme() {\n return _customTheme;\n}\n\n// ── Unsplash
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../src/utils/l10n.js","../../src/config.js"],"sourcesContent":["// Use a window-level singleton so that all Rollup bundles (config, toolbar,\n// side-panel, canvas) share the same translations object. Without this each\n// bundle gets its own copy of this module with a separate local variable.\nconst GLOBAL_KEY = '__labellife_translations__';\nif (typeof window !== 'undefined' && !window[GLOBAL_KEY]) {\n window[GLOBAL_KEY] = {};\n}\n\nfunction _get() {\n return (typeof window !== 'undefined' && window[GLOBAL_KEY]) || {};\n}\n\nfunction deepMerge(target, source) {\n const result = { ...target };\n for (const key of Object.keys(source)) {\n if (\n source[key] &&\n typeof source[key] === 'object' &&\n !Array.isArray(source[key]) &&\n target[key] &&\n typeof target[key] === 'object' &&\n !Array.isArray(target[key])\n ) {\n result[key] = deepMerge(target[key], source[key]);\n } else {\n result[key] = source[key];\n }\n }\n return result;\n}\n\nexport function setTranslations(newTranslations) {\n if (typeof window !== 'undefined') {\n window[GLOBAL_KEY] = deepMerge(_get(), newTranslations);\n }\n}\n\nexport function getTranslations() {\n return _get();\n}\n\nexport function t(key, defaultValue) {\n // Support dot-notation paths like 'toolbar.duration'\n const parts = key.split('.');\n let current = _get();\n for (const part of parts) {\n if (current == null || typeof current !== 'object') {\n return defaultValue || key;\n }\n current = current[part];\n }\n if (current !== undefined && current !== null && typeof current !== 'object') {\n return current;\n }\n return defaultValue || key;\n}\n","import { setTranslations as _setTranslations, getTranslations, t } from './utils/l10n';\n\nlet _theme = 'light';\nlet _customTheme = {};\n\nexport function setTranslations(translations) {\n _setTranslations(translations);\n}\n\nexport { getTranslations, t };\n\nexport function setTheme(theme) {\n _theme = theme;\n}\n\nexport function getTheme() {\n return _theme;\n}\n\nexport function setCustomTheme(customTheme) {\n _customTheme = { ..._customTheme, ...customTheme };\n}\n\nexport function getCustomTheme() {\n return _customTheme;\n}\n\n// ── Unsplash proxy endpoints (used by background-panel.js) ───────────────────\n// The host app supplies the full endpoint URLs; the library only appends the query string.\n// Window-level singletons, same reasoning as translations/input-fields config above:\n// each Rollup output bundle (index, side-panel, toolbar, canvas...) gets its own copy\n// of this module, so a plain closure variable set from one bundle (e.g. via the host\n// app's top-level `labellife-design-tool/config` import) would never be seen by another\n// bundle (e.g. background-panel.js, built into the side-panel bundle).\nconst UNSPLASH_SEARCH_URL_KEY = '__labellife_unsplash_search_url__';\nconst UNSPLASH_TRACK_DOWNLOAD_URL_KEY = '__labellife_unsplash_track_download_url__';\n\nexport function setUnsplashSearchUrl(url) {\n if (typeof window !== 'undefined') {\n window[UNSPLASH_SEARCH_URL_KEY] = url || '';\n }\n}\n\nexport function getUnsplashSearchUrl() {\n return (typeof window !== 'undefined' && window[UNSPLASH_SEARCH_URL_KEY]) || '';\n}\n\nexport function setUnsplashTrackDownloadUrl(url) {\n if (typeof window !== 'undefined') {\n window[UNSPLASH_TRACK_DOWNLOAD_URL_KEY] = url || '';\n }\n}\n\nexport function getUnsplashTrackDownloadUrl() {\n return (typeof window !== 'undefined' && window[UNSPLASH_TRACK_DOWNLOAD_URL_KEY]) || '';\n}\n\n// ── Input Fields Dialog Config ───────────────────────────────────────\nconst INPUT_FIELDS_CONFIG_KEY = '__labellife_input_fields_config__';\nif (typeof window !== 'undefined' && !window[INPUT_FIELDS_CONFIG_KEY]) {\n window[INPUT_FIELDS_CONFIG_KEY] = {};\n}\n\nexport function setInputFieldsConfig(config) {\n if (typeof window !== 'undefined') {\n window[INPUT_FIELDS_CONFIG_KEY] = { ...window[INPUT_FIELDS_CONFIG_KEY], ...config };\n }\n}\n\nexport function getInputFieldsConfig() {\n return (typeof window !== 'undefined' && window[INPUT_FIELDS_CONFIG_KEY]) || {};\n}\n"],"names":["GLOBAL_KEY","window","_get","deepMerge","target","source","result","_objectSpread","_i","_Object$keys","Object","keys","length","key","_typeof","Array","isArray","setTranslations","newTranslations","getTranslations","t","defaultValue","parts","split","current","_iterator","_createForOfIteratorHelper","_step","s","n","done","part","value","err","e","f","undefined","_theme","_customTheme","translations","_setTranslations","setTheme","theme","getTheme","setCustomTheme","customTheme","getCustomTheme","UNSPLASH_SEARCH_URL_KEY","UNSPLASH_TRACK_DOWNLOAD_URL_KEY","setUnsplashSearchUrl","url","getUnsplashSearchUrl","setUnsplashTrackDownloadUrl","getUnsplashTrackDownloadUrl","INPUT_FIELDS_CONFIG_KEY","setInputFieldsConfig","config","getInputFieldsConfig"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA,IAAMA,UAAU,GAAG,4BAA4B;AAC/C,IAAI,OAAOC,MAAM,KAAK,WAAW,IAAI,CAACA,MAAM,CAACD,UAAU,CAAC,EAAE;AACxDC,EAAAA,MAAM,CAACD,UAAU,CAAC,GAAG,EAAE;AACzB;AAEA,SAASE,IAAIA,GAAG;EACd,OAAQ,OAAOD,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACD,UAAU,CAAC,IAAK,EAAE;AACpE;AAEA,SAASG,SAASA,CAACC,MAAM,EAAEC,MAAM,EAAE;AACjC,EAAA,IAAMC,MAAM,GAAAC,cAAA,CAAA,EAAA,EAAQH,MAAM,CAAE;AAC5B,EAAA,KAAA,IAAAI,EAAA,GAAA,CAAA,EAAAC,YAAA,GAAkBC,MAAM,CAACC,IAAI,CAACN,MAAM,CAAC,EAAAG,EAAA,GAAAC,YAAA,CAAAG,MAAA,EAAAJ,EAAA,EAAA,EAAE;AAAlC,IAAA,IAAMK,GAAG,GAAAJ,YAAA,CAAAD,EAAA,CAAA;IACZ,IACEH,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unsplash
|
|
3144
|
+
// ── Unsplash proxy endpoints (used by background-panel.js) ───────────────────
|
|
3145
|
+
// The host app supplies the full endpoint URLs; the library only appends the query string.
|
|
3145
3146
|
// Window-level singletons, same reasoning as translations/input-fields config above:
|
|
3146
3147
|
// each Rollup output bundle (index, side-panel, toolbar, canvas...) gets its own copy
|
|
3147
3148
|
// of this module, so a plain closure variable set from one bundle (e.g. via the host
|
|
3148
3149
|
// app's top-level `labellife-design-tool/config` import) would never be seen by another
|
|
3149
3150
|
// bundle (e.g. background-panel.js, built into the side-panel bundle).
|
|
3150
|
-
//
|
|
3151
|
-
// The host app owns the full endpoint URL (host + path); this lib only ever appends the
|
|
3152
|
-
// query string for the search endpoint and uses the track-download URL as given.
|
|
3153
3151
|
var UNSPLASH_SEARCH_URL_KEY = '__labellife_unsplash_search_url__';
|
|
3154
3152
|
var UNSPLASH_TRACK_DOWNLOAD_URL_KEY = '__labellife_unsplash_track_download_url__';
|
|
3153
|
+
function setUnsplashSearchUrl(url) {
|
|
3154
|
+
if (typeof window !== 'undefined') {
|
|
3155
|
+
window[UNSPLASH_SEARCH_URL_KEY] = url || '';
|
|
3156
|
+
}
|
|
3157
|
+
}
|
|
3155
3158
|
function getUnsplashSearchUrl() {
|
|
3156
3159
|
return typeof window !== 'undefined' && window[UNSPLASH_SEARCH_URL_KEY] || '';
|
|
3157
3160
|
}
|
|
3161
|
+
function setUnsplashTrackDownloadUrl(url) {
|
|
3162
|
+
if (typeof window !== 'undefined') {
|
|
3163
|
+
window[UNSPLASH_TRACK_DOWNLOAD_URL_KEY] = url || '';
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3158
3166
|
function getUnsplashTrackDownloadUrl() {
|
|
3159
3167
|
return typeof window !== 'undefined' && window[UNSPLASH_TRACK_DOWNLOAD_URL_KEY] || '';
|
|
3160
3168
|
}
|
|
@@ -3757,11 +3765,10 @@ var TextSection = {
|
|
|
3757
3765
|
// labellife backend (see labellifeBackendRepo's UnsplashBackgroundSearchView /
|
|
3758
3766
|
// UnsplashTrackDownloadView). Deliberately has no internal imports so it can be unit-tested
|
|
3759
3767
|
// with plain `node`, following the same convention as ./fonts.js.
|
|
3760
|
-
//
|
|
3761
|
-
// The host app owns the full endpoint URL (via setUnsplashSearchUrl/setUnsplashTrackDownloadUrl
|
|
3762
|
-
// in ../config) — this module only ever appends the search query string onto it.
|
|
3763
3768
|
|
|
3764
3769
|
var UNSPLASH_UTM_SOURCE = 'labellife';
|
|
3770
|
+
|
|
3771
|
+
// `searchUrl` is the full endpoint supplied by the host app; only the query string is appended.
|
|
3765
3772
|
function buildUnsplashSearchUrl(searchUrl, query) {
|
|
3766
3773
|
var page = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
3767
3774
|
var perPage = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 20;
|
|
@@ -11591,35 +11598,46 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
|
|
|
11591
11598
|
setTextHeight = _useState2[1];
|
|
11592
11599
|
var isCurved = element.curveEnabled && element.curvePower !== 0;
|
|
11593
11600
|
|
|
11594
|
-
//
|
|
11601
|
+
// Konva.Text measures per-line widths only when a text attribute changes, and
|
|
11602
|
+
// uses those stored widths for align (center/right). If the text was laid out
|
|
11603
|
+
// with a fallback font, the real font's glyphs get painted against stale
|
|
11604
|
+
// widths and the text sits off-center. Re-measure once the font is usable.
|
|
11605
|
+
// Kept in a ref so the effects below always call the latest closure.
|
|
11606
|
+
var relayoutRef = React.useRef(null);
|
|
11607
|
+
relayoutRef.current = function () {
|
|
11608
|
+
var _node$getLayer2;
|
|
11609
|
+
var node = textRef.current;
|
|
11610
|
+
if (!node) return;
|
|
11611
|
+
|
|
11612
|
+
// CurvedText's sceneFunc re-measures glyphs via ctx.measureText on
|
|
11613
|
+
// every draw (no internal cached layout like Konva.Text has), so
|
|
11614
|
+
// there's no stale-layout workaround needed — just repaint.
|
|
11615
|
+
if (element.curveEnabled && element.curvePower !== 0) {
|
|
11616
|
+
var _node$getLayer;
|
|
11617
|
+
if (element.blurEnabled) node.cache(computeCurvedCacheBounds(element));
|
|
11618
|
+
(_node$getLayer = node.getLayer()) === null || _node$getLayer === void 0 || _node$getLayer.batchDraw();
|
|
11619
|
+
return;
|
|
11620
|
+
}
|
|
11621
|
+
var f = node.fontFamily();
|
|
11622
|
+
node.fontFamily('serif');
|
|
11623
|
+
node.fontFamily(f);
|
|
11624
|
+
var h = node.height();
|
|
11625
|
+
if (h > 0) {
|
|
11626
|
+
setTextHeight(h);
|
|
11627
|
+
syncHeightKeepingCenter(element, h);
|
|
11628
|
+
}
|
|
11629
|
+
// Re-cache if blur is active
|
|
11630
|
+
if (element.blurEnabled) {
|
|
11631
|
+
node.cache();
|
|
11632
|
+
}
|
|
11633
|
+
(_node$getLayer2 = node.getLayer()) === null || _node$getLayer2 === void 0 || _node$getLayer2.batchDraw();
|
|
11634
|
+
};
|
|
11635
|
+
|
|
11636
|
+
// Any font finishing a load (covers fonts requested elsewhere, e.g. store.loadFont).
|
|
11595
11637
|
React.useEffect(function () {
|
|
11596
11638
|
var onFontLoaded = function onFontLoaded() {
|
|
11597
|
-
var
|
|
11598
|
-
|
|
11599
|
-
if (!node) return;
|
|
11600
|
-
|
|
11601
|
-
// CurvedText's sceneFunc re-measures glyphs via ctx.measureText on
|
|
11602
|
-
// every draw (no internal cached layout like Konva.Text has), so
|
|
11603
|
-
// there's no stale-layout workaround needed — just repaint.
|
|
11604
|
-
if (element.curveEnabled && element.curvePower !== 0) {
|
|
11605
|
-
var _node$getLayer;
|
|
11606
|
-
if (element.blurEnabled) node.cache(computeCurvedCacheBounds(element));
|
|
11607
|
-
(_node$getLayer = node.getLayer()) === null || _node$getLayer === void 0 || _node$getLayer.batchDraw();
|
|
11608
|
-
return;
|
|
11609
|
-
}
|
|
11610
|
-
var f = node.fontFamily();
|
|
11611
|
-
node.fontFamily('serif');
|
|
11612
|
-
node.fontFamily(f);
|
|
11613
|
-
var h = node.height();
|
|
11614
|
-
if (h > 0) {
|
|
11615
|
-
setTextHeight(h);
|
|
11616
|
-
syncHeightKeepingCenter(element, h);
|
|
11617
|
-
}
|
|
11618
|
-
// Re-cache if blur is active
|
|
11619
|
-
if (element.blurEnabled && node) {
|
|
11620
|
-
node.cache();
|
|
11621
|
-
}
|
|
11622
|
-
(_node$getLayer2 = node.getLayer()) === null || _node$getLayer2 === void 0 || _node$getLayer2.batchDraw();
|
|
11639
|
+
var _relayoutRef$current;
|
|
11640
|
+
return (_relayoutRef$current = relayoutRef.current) === null || _relayoutRef$current === void 0 ? void 0 : _relayoutRef$current.call(relayoutRef);
|
|
11623
11641
|
};
|
|
11624
11642
|
document.fonts.addEventListener('loadingdone', onFontLoaded);
|
|
11625
11643
|
return function () {
|
|
@@ -11627,6 +11645,24 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
|
|
|
11627
11645
|
};
|
|
11628
11646
|
}, []);
|
|
11629
11647
|
|
|
11648
|
+
// This element's exact font face. Covers the cases the global event misses:
|
|
11649
|
+
// the font finished loading before this element mounted, or only a different
|
|
11650
|
+
// weight/style batch has fired so far.
|
|
11651
|
+
React.useEffect(function () {
|
|
11652
|
+
var _document$fonts;
|
|
11653
|
+
if (!element.fontFamily || !((_document$fonts = document.fonts) !== null && _document$fonts !== void 0 && _document$fonts.load)) return;
|
|
11654
|
+
var cancelled = false;
|
|
11655
|
+
var style = element.fontStyle === 'italic' ? 'italic ' : '';
|
|
11656
|
+
var weight = element.fontWeight && element.fontWeight !== 'normal' ? "".concat(element.fontWeight, " ") : '';
|
|
11657
|
+
document.fonts.load("".concat(style).concat(weight, "16px \"").concat(element.fontFamily, "\""), element.text || element.placeholder || '').then(function () {
|
|
11658
|
+
var _relayoutRef$current2;
|
|
11659
|
+
if (!cancelled) (_relayoutRef$current2 = relayoutRef.current) === null || _relayoutRef$current2 === void 0 || _relayoutRef$current2.call(relayoutRef);
|
|
11660
|
+
})["catch"](function () {});
|
|
11661
|
+
return function () {
|
|
11662
|
+
cancelled = true;
|
|
11663
|
+
};
|
|
11664
|
+
}, [element.fontFamily, element.fontWeight, element.fontStyle]);
|
|
11665
|
+
|
|
11630
11666
|
// Sync Konva auto-sized height back to element model after text reflows
|
|
11631
11667
|
// (straight text only — curved text's height is computed synchronously
|
|
11632
11668
|
// below, since it doesn't width-wrap and doesn't need a measured node).
|
|
@@ -13552,7 +13588,8 @@ var PageBackground = mobxReactLite.observer(function (_ref3) {
|
|
|
13552
13588
|
});
|
|
13553
13589
|
});
|
|
13554
13590
|
|
|
13555
|
-
// Semi-transparent overlay that dims everything outside the page boundary
|
|
13591
|
+
// Semi-transparent dark overlay that dims everything outside the page boundary
|
|
13592
|
+
// (dark rather than light so pale images stay distinguishable when they overflow).
|
|
13556
13593
|
// Draws a huge rectangle with a rectangular hole cut out for the page area.
|
|
13557
13594
|
var PageOverlayFrame = mobxReactLite.observer(function (_ref4) {
|
|
13558
13595
|
var store = _ref4.store;
|
|
@@ -13577,7 +13614,7 @@ var PageOverlayFrame = mobxReactLite.observer(function (_ref4) {
|
|
|
13577
13614
|
ctx.closePath();
|
|
13578
13615
|
ctx.fillStrokeShape(shape);
|
|
13579
13616
|
},
|
|
13580
|
-
fill: "rgba(
|
|
13617
|
+
fill: "rgba(0,0,0,0.8)",
|
|
13581
13618
|
listening: false,
|
|
13582
13619
|
name: "display-only"
|
|
13583
13620
|
});
|
|
@@ -14087,6 +14124,8 @@ exports.getImageSize = getImageSize;
|
|
|
14087
14124
|
exports.getInputFieldsConfig = getInputFieldsConfig;
|
|
14088
14125
|
exports.getTheme = getTheme;
|
|
14089
14126
|
exports.getTranslations = getTranslations;
|
|
14127
|
+
exports.getUnsplashSearchUrl = getUnsplashSearchUrl;
|
|
14128
|
+
exports.getUnsplashTrackDownloadUrl = getUnsplashTrackDownloadUrl;
|
|
14090
14129
|
exports.loadGoogleFont = loadGoogleFont;
|
|
14091
14130
|
exports.loadImage = loadImage;
|
|
14092
14131
|
exports.popupActionButtonSx = popupActionButtonSx;
|
|
@@ -14094,6 +14133,8 @@ exports.pxToUnit = pxToUnit;
|
|
|
14094
14133
|
exports.setInputFieldsConfig = setInputFieldsConfig;
|
|
14095
14134
|
exports.setTheme = setTheme;
|
|
14096
14135
|
exports.setTranslations = setTranslations;
|
|
14136
|
+
exports.setUnsplashSearchUrl = setUnsplashSearchUrl;
|
|
14137
|
+
exports.setUnsplashTrackDownloadUrl = setUnsplashTrackDownloadUrl;
|
|
14097
14138
|
exports.t = t;
|
|
14098
14139
|
exports.unitToPx = unitToPx;
|
|
14099
14140
|
//# sourceMappingURL=index.js.map
|