@antscorp/antsomi-ui 1.3.5-beta.752 → 1.3.5-beta.753

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.
@@ -1,17 +1,43 @@
1
1
  var _a;
2
- // Preload all images in the 96x96 directory
3
- const images = import.meta.glob('../../../assets/images/viber/96x96/*.png', {
4
- eager: true,
5
- });
6
- // Map the imported images to a usable format
2
+ // Utility function to determine if running in Vite environment
3
+ function isVite() {
4
+ console.log('import meta', import.meta);
5
+ return typeof import.meta !== 'undefined';
6
+ }
7
+ // Utility function to determine if running in Webpack environment
8
+ function isWebpack() {
9
+ console.log('typeof require', typeof require);
10
+ return typeof require !== 'undefined' && typeof require.context === 'function';
11
+ }
12
+ // Create an image map based on the detected environment
7
13
  const imageMap = {};
8
- // Populate imageMap with filenames as keys
9
- for (const path in images) {
10
- const fileName = (_a = path.split('/').pop()) === null || _a === void 0 ? void 0 : _a.split('.').shift(); // Extract the file name without extension
11
- if (fileName) {
12
- imageMap[fileName] = path; // Map fileName to the correct path
14
+ if (isVite()) {
15
+ // Vite environment: Use import.meta.glob to preload images
16
+ const images = import.meta.glob('../../../assets/images/viber/96x96/*.png', {
17
+ eager: true,
18
+ import: 'default',
19
+ });
20
+ for (const path in images) {
21
+ const fileName = (_a = path.split('/').pop()) === null || _a === void 0 ? void 0 : _a.split('.').shift();
22
+ if (fileName) {
23
+ imageMap[fileName] = images[path];
24
+ }
13
25
  }
14
26
  }
27
+ else if (isWebpack()) {
28
+ // Webpack environment: Use require.context to preload images
29
+ const images = require.context('../../../assets/images/viber/96x96', false, /\.png$/);
30
+ images.keys().forEach(key => {
31
+ var _a;
32
+ const fileName = (_a = key.split('/').pop()) === null || _a === void 0 ? void 0 : _a.split('.').shift();
33
+ if (fileName) {
34
+ imageMap[fileName] = images(key).default || images(key);
35
+ }
36
+ });
37
+ }
38
+ else {
39
+ console.error('Unsupported environment: This code must run in either Vite or Webpack.');
40
+ }
15
41
  export function getImagePath(fileName) {
16
42
  return imageMap[fileName]; // Return the correct image path
17
43
  }
@@ -191,7 +191,7 @@
191
191
  "_BLOCK_DEVICE_CUS": "Devices",
192
192
  "_BLOCK_IDENTITY_GRAPH_CUS": "Identity Graph",
193
193
  "_BLOCK_INTEREST_CUS": "Interests",
194
- "_BLOCK_PRODUCT_RECOMMEND_CUS": "Item recommendation",
194
+ "_BLOCK_PRODUCT_RECOMMEND_CUS": "Recommendations",
195
195
  "_BLOCK_REVENUE_CUS": "Revenue",
196
196
  "_BLOCK_SEARCHES_CUS": "Searches",
197
197
  "_BLOCK_SUCCESS_ORDER_CUS": "Success orders",
@@ -191,7 +191,7 @@
191
191
  "_BLOCK_DEVICE_CUS": "デバイス",
192
192
  "_BLOCK_IDENTITY_GRAPH_CUS": "アイデンティティグラフ",
193
193
  "_BLOCK_INTEREST_CUS": "興味のあること",
194
- "_BLOCK_PRODUCT_RECOMMEND_CUS": "アイテムのおすすめ",
194
+ "_BLOCK_PRODUCT_RECOMMEND_CUS": "推奨事項",
195
195
  "_BLOCK_REVENUE_CUS": "収益",
196
196
  "_BLOCK_SEARCHES_CUS": "検索",
197
197
  "_BLOCK_SUCCESS_ORDER_CUS": "成功した注文",
@@ -191,7 +191,7 @@
191
191
  "_BLOCK_DEVICE_CUS": "Thiết bị",
192
192
  "_BLOCK_IDENTITY_GRAPH_CUS": "Biểu đồ nhận dạng",
193
193
  "_BLOCK_INTEREST_CUS": "Sở thích",
194
- "_BLOCK_PRODUCT_RECOMMEND_CUS": "Đề xuất sản phẩm",
194
+ "_BLOCK_PRODUCT_RECOMMEND_CUS": "Đề xuất",
195
195
  "_BLOCK_REVENUE_CUS": "Doanh thu",
196
196
  "_BLOCK_SEARCHES_CUS": "Tìm kiếm",
197
197
  "_BLOCK_SUCCESS_ORDER_CUS": "Đơn hàng thành công",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.752",
3
+ "version": "1.3.5-beta.753",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",