mage-engine 3.23.26 → 3.23.27

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.
Files changed (2) hide show
  1. package/dist/mage.js +108 -74
  2. package/package.json +1 -1
package/dist/mage.js CHANGED
@@ -55428,7 +55428,76 @@ var Universe$1 = new Universe();var generateUUID = function generateUUID() {
55428
55428
  };
55429
55429
  var generateRandomName = function generateRandomName(prefix) {
55430
55430
  return "".concat(prefix, "_").concat(generateUUID());
55431
- };var uuid$1=/*#__PURE__*/Object.freeze({__proto__:null,generateUUID:generateUUID,generateRandomName:generateRandomName});var _MATERIAL_PROPERTIES_, _MATERIAL_PROPERTIES_2, _MATERIAL_TEXTURE_MAP$1;
55431
+ };var uuid$1=/*#__PURE__*/Object.freeze({__proto__:null,generateUUID:generateUUID,generateRandomName:generateRandomName});/**
55432
+ * Environment configuration module for mage-engine.
55433
+ * Centralizes all environment variables and their default values.
55434
+ *
55435
+ * Usage:
55436
+ * import env from './env';
55437
+ * const baseUrl = env.MAGE_ASSETS_BASE_URL;
55438
+ */
55439
+
55440
+ /**
55441
+ * Safe window access - returns undefined in non-browser environments
55442
+ */
55443
+ var getWindow = function getWindow() {
55444
+ return typeof window !== "undefined" ? window : undefined;
55445
+ };
55446
+ /**
55447
+ * Gets an environment variable from the window object with a fallback default.
55448
+ * @param {string} key - The environment variable name
55449
+ * @param {any} defaultValue - Default value if not set
55450
+ * @returns {any} - The environment variable value or default
55451
+ */
55452
+
55453
+
55454
+ var getEnv = function getEnv(key) {
55455
+ var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
55456
+ var win = getWindow();
55457
+ return win && win[key] !== undefined ? win[key] : defaultValue;
55458
+ };
55459
+ /**
55460
+ * Environment variables with their default values.
55461
+ * These are accessed as getters so they're evaluated at access time,
55462
+ * not at module load time (important for variables set after page load).
55463
+ */
55464
+
55465
+
55466
+ var env = {
55467
+ /**
55468
+ * Base URL for loading assets (textures, models, audio).
55469
+ * Set by mage-studio editor or deployed builds.
55470
+ * Default: empty string (paths used as-is for backwards compatibility)
55471
+ */
55472
+ get MAGE_ASSETS_BASE_URL() {
55473
+ return getEnv("MAGE_ASSETS_BASE_URL", "");
55474
+ },
55475
+
55476
+ /**
55477
+ * Enable debug mode for verbose logging.
55478
+ * Default: false
55479
+ */
55480
+ get MAGE_DEBUG() {
55481
+ return getEnv("MAGE_DEBUG", false);
55482
+ },
55483
+
55484
+ /**
55485
+ * Current project ID (set by mage-studio).
55486
+ * Default: empty string
55487
+ */
55488
+ get MAGE_PROJECT_ID() {
55489
+ return getEnv("MAGE_PROJECT_ID", "");
55490
+ },
55491
+
55492
+ /**
55493
+ * Current build ID (set by deployed builds).
55494
+ * Default: empty string
55495
+ */
55496
+ get MAGE_BUILD_ID() {
55497
+ return getEnv("MAGE_BUILD_ID", "");
55498
+ }
55499
+
55500
+ };var _MATERIAL_PROPERTIES_, _MATERIAL_PROPERTIES_2, _MATERIAL_TEXTURE_MAP$1;
55432
55501
  var ALMOST_ZERO = 0.00001;
55433
55502
  var UP$1 = "UP";
55434
55503
  var DOWN$1 = "DOWN";
@@ -55722,7 +55791,39 @@ var TAGS = {
55722
55791
  };
55723
55792
  var isLevelName = function isLevelName(level) {
55724
55793
  return level.startsWith(DIVIDER);
55725
- };var Images = /*#__PURE__*/function () {
55794
+ };/**
55795
+ * Checks if a path is an absolute URL.
55796
+ */
55797
+
55798
+ var isURL$2 = function isURL(path) {
55799
+ try {
55800
+ new URL(path);
55801
+ return true;
55802
+ } catch (_) {
55803
+ return false;
55804
+ }
55805
+ };
55806
+ /**
55807
+ * Resolves an asset path to a full URL using MAGE_ASSETS_BASE_URL.
55808
+ */
55809
+
55810
+
55811
+ var resolveAssetPath$2 = function resolveAssetPath(path) {
55812
+ if (isURL$2(path)) {
55813
+ return path;
55814
+ }
55815
+
55816
+ var baseUrl = env.MAGE_ASSETS_BASE_URL;
55817
+
55818
+ if (baseUrl) {
55819
+ var cleanPath = path.startsWith("/") ? path.slice(1) : path;
55820
+ return "".concat(baseUrl, "/").concat(cleanPath);
55821
+ }
55822
+
55823
+ return path;
55824
+ };
55825
+
55826
+ var Images = /*#__PURE__*/function () {
55726
55827
  function Images() {
55727
55828
  var _this = this;
55728
55829
 
@@ -55801,11 +55902,13 @@ var isLevelName = function isLevelName(level) {
55801
55902
  var loaderType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _this.LOADERS.TEXTURE;
55802
55903
  var id = buildAssetId(name, level);
55803
55904
 
55804
- var loader = _this.getLoaderByType(loaderType);
55905
+ var loader = _this.getLoaderByType(loaderType); // Resolve the path using MAGE_ASSETS_BASE_URL if available
55906
+
55805
55907
 
55908
+ var resolvedPath = resolveAssetPath$2(path);
55806
55909
  return new Promise(function (resolve) {
55807
55910
  try {
55808
- loader.load(path, function (asset) {
55911
+ loader.load(resolvedPath, function (asset) {
55809
55912
  _this.add(id, asset);
55810
55913
 
55811
55914
  resolve(asset);
@@ -58297,7 +58400,7 @@ function applyMiddleware() {
58297
58400
 
58298
58401
  var thunk = createThunkMiddleware();
58299
58402
  thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
58300
- var version$1 = "3.23.26";
58403
+ var version$1 = "3.23.27";
58301
58404
  var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
58302
58405
  var main = "dist/mage.js";
58303
58406
  var author$1 = {
@@ -70214,75 +70317,6 @@ var createConnect = function (ref) {
70214
70317
  };
70215
70318
  var connect = createConnect();var BaseUI = function BaseUI() {
70216
70319
  return null;
70217
- };/**
70218
- * Environment configuration module for mage-engine.
70219
- * Centralizes all environment variables and their default values.
70220
- *
70221
- * Usage:
70222
- * import env from './env';
70223
- * const baseUrl = env.MAGE_ASSETS_BASE_URL;
70224
- */
70225
-
70226
- /**
70227
- * Safe window access - returns undefined in non-browser environments
70228
- */
70229
- var getWindow = function getWindow() {
70230
- return typeof window !== "undefined" ? window : undefined;
70231
- };
70232
- /**
70233
- * Gets an environment variable from the window object with a fallback default.
70234
- * @param {string} key - The environment variable name
70235
- * @param {any} defaultValue - Default value if not set
70236
- * @returns {any} - The environment variable value or default
70237
- */
70238
-
70239
-
70240
- var getEnv = function getEnv(key) {
70241
- var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
70242
- var win = getWindow();
70243
- return win && win[key] !== undefined ? win[key] : defaultValue;
70244
- };
70245
- /**
70246
- * Environment variables with their default values.
70247
- * These are accessed as getters so they're evaluated at access time,
70248
- * not at module load time (important for variables set after page load).
70249
- */
70250
-
70251
-
70252
- var env = {
70253
- /**
70254
- * Base URL for loading assets (textures, models, audio).
70255
- * Set by mage-studio editor or deployed builds.
70256
- * Default: empty string (paths used as-is for backwards compatibility)
70257
- */
70258
- get MAGE_ASSETS_BASE_URL() {
70259
- return getEnv("MAGE_ASSETS_BASE_URL", "");
70260
- },
70261
-
70262
- /**
70263
- * Enable debug mode for verbose logging.
70264
- * Default: false
70265
- */
70266
- get MAGE_DEBUG() {
70267
- return getEnv("MAGE_DEBUG", false);
70268
- },
70269
-
70270
- /**
70271
- * Current project ID (set by mage-studio).
70272
- * Default: empty string
70273
- */
70274
- get MAGE_PROJECT_ID() {
70275
- return getEnv("MAGE_PROJECT_ID", "");
70276
- },
70277
-
70278
- /**
70279
- * Current build ID (set by deployed builds).
70280
- * Default: empty string
70281
- */
70282
- get MAGE_BUILD_ID() {
70283
- return getEnv("MAGE_BUILD_ID", "");
70284
- }
70285
-
70286
70320
  };var TIME_FOR_UPDATE = 5;
70287
70321
  var VOLUME = 2;
70288
70322
  var DEFAULT_AUDIO_NODE_VOLUME = 5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mage-engine",
3
- "version": "3.23.26",
3
+ "version": "3.23.27",
4
4
  "description": "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.",
5
5
  "main": "dist/mage.js",
6
6
  "author": {