viewlogic 1.0.2 → 1.0.3
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/viewlogic-router.js +24 -10
- package/dist/viewlogic-router.js.map +2 -2
- package/dist/viewlogic-router.min.js +3 -3
- package/dist/viewlogic-router.min.js.map +3 -3
- package/package.json +1 -1
- package/src/core/RouteLoader.js +7 -4
- package/src/plugins/I18nManager.js +3 -2
- package/src/viewlogic-router.js +20 -8
package/dist/viewlogic-router.js
CHANGED
|
@@ -151,7 +151,8 @@ var I18nManager = class {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
try {
|
|
154
|
-
const
|
|
154
|
+
const i18nPath = `${this.router.config.i18nPath}/${language}.json`;
|
|
155
|
+
const response = await fetch(i18nPath);
|
|
155
156
|
if (!response.ok) {
|
|
156
157
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
157
158
|
}
|
|
@@ -1468,7 +1469,8 @@ var RouteLoader = class {
|
|
|
1468
1469
|
*/
|
|
1469
1470
|
async loadTemplate(routeName) {
|
|
1470
1471
|
try {
|
|
1471
|
-
const
|
|
1472
|
+
const templatePath = `${this.config.basePath}/views/${routeName}.html`;
|
|
1473
|
+
const response = await fetch(templatePath);
|
|
1472
1474
|
if (!response.ok) throw new Error(`Template not found: ${response.status}`);
|
|
1473
1475
|
const template = await response.text();
|
|
1474
1476
|
this.log("debug", `Template '${routeName}' loaded successfully`);
|
|
@@ -1483,7 +1485,8 @@ var RouteLoader = class {
|
|
|
1483
1485
|
*/
|
|
1484
1486
|
async loadStyle(routeName) {
|
|
1485
1487
|
try {
|
|
1486
|
-
const
|
|
1488
|
+
const stylePath = `${this.config.basePath}/styles/${routeName}.css`;
|
|
1489
|
+
const response = await fetch(stylePath);
|
|
1487
1490
|
if (!response.ok) throw new Error(`Style not found: ${response.status}`);
|
|
1488
1491
|
const style = await response.text();
|
|
1489
1492
|
this.log("debug", `Style '${routeName}' loaded successfully`);
|
|
@@ -1498,7 +1501,8 @@ var RouteLoader = class {
|
|
|
1498
1501
|
*/
|
|
1499
1502
|
async loadLayout(layoutName) {
|
|
1500
1503
|
try {
|
|
1501
|
-
const
|
|
1504
|
+
const layoutPath = `${this.config.basePath}/layouts/${layoutName}.html`;
|
|
1505
|
+
const response = await fetch(layoutPath);
|
|
1502
1506
|
if (!response.ok) throw new Error(`Layout not found: ${response.status}`);
|
|
1503
1507
|
const layout = await response.text();
|
|
1504
1508
|
this.log("debug", `Layout '${layoutName}' loaded successfully`);
|
|
@@ -2165,8 +2169,9 @@ var ViewLogicRouter = class {
|
|
|
2165
2169
|
* 설정 빌드 (분리하여 가독성 향상)
|
|
2166
2170
|
*/
|
|
2167
2171
|
_buildConfig(options) {
|
|
2172
|
+
const currentOrigin = window.location.origin;
|
|
2168
2173
|
const defaults = {
|
|
2169
|
-
basePath:
|
|
2174
|
+
basePath: `${currentOrigin}/src`,
|
|
2170
2175
|
mode: "hash",
|
|
2171
2176
|
cacheMode: "memory",
|
|
2172
2177
|
cacheTTL: 3e5,
|
|
@@ -2174,12 +2179,13 @@ var ViewLogicRouter = class {
|
|
|
2174
2179
|
useLayout: true,
|
|
2175
2180
|
defaultLayout: "default",
|
|
2176
2181
|
environment: "development",
|
|
2177
|
-
routesPath:
|
|
2182
|
+
routesPath: `${currentOrigin}/routes`,
|
|
2178
2183
|
enableErrorReporting: true,
|
|
2179
2184
|
useComponents: true,
|
|
2180
2185
|
componentNames: ["Button", "Modal", "Card", "Toast", "Input", "Tabs", "Checkbox", "Alert", "DynamicInclude", "HtmlInclude"],
|
|
2181
2186
|
useI18n: true,
|
|
2182
2187
|
defaultLanguage: "ko",
|
|
2188
|
+
i18nPath: `${currentOrigin}/i18n`,
|
|
2183
2189
|
logLevel: "info",
|
|
2184
2190
|
authEnabled: false,
|
|
2185
2191
|
loginRoute: "login",
|
|
@@ -2200,7 +2206,17 @@ var ViewLogicRouter = class {
|
|
|
2200
2206
|
allowedKeyPattern: /^[a-zA-Z0-9_-]+$/,
|
|
2201
2207
|
logSecurityWarnings: true
|
|
2202
2208
|
};
|
|
2203
|
-
|
|
2209
|
+
const config = { ...defaults, ...options };
|
|
2210
|
+
if (options.basePath && !options.basePath.startsWith("http")) {
|
|
2211
|
+
config.basePath = `${currentOrigin}${options.basePath}`;
|
|
2212
|
+
}
|
|
2213
|
+
if (options.routesPath && !options.routesPath.startsWith("http")) {
|
|
2214
|
+
config.routesPath = `${currentOrigin}${options.routesPath}`;
|
|
2215
|
+
}
|
|
2216
|
+
if (options.i18nPath && !options.i18nPath.startsWith("http")) {
|
|
2217
|
+
config.i18nPath = `${currentOrigin}${options.i18nPath}`;
|
|
2218
|
+
}
|
|
2219
|
+
return config;
|
|
2204
2220
|
}
|
|
2205
2221
|
/**
|
|
2206
2222
|
* 로깅 래퍼 메서드
|
|
@@ -2229,11 +2245,9 @@ var ViewLogicRouter = class {
|
|
|
2229
2245
|
this.authManager = new AuthManager(this, this.config);
|
|
2230
2246
|
}
|
|
2231
2247
|
if (this.config.useComponents) {
|
|
2232
|
-
const currentOrigin = window.location.origin;
|
|
2233
|
-
const componentsBasePath = `${currentOrigin}${this.config.basePath}/components`;
|
|
2234
2248
|
this.componentLoader = new ComponentLoader(this, {
|
|
2235
2249
|
...this.config,
|
|
2236
|
-
basePath:
|
|
2250
|
+
basePath: `${this.config.basePath}/components`,
|
|
2237
2251
|
cache: true,
|
|
2238
2252
|
componentNames: this.config.componentNames
|
|
2239
2253
|
});
|