@finesoft/front 0.1.2 → 0.1.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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // ../core/dist/index.js
1
+ // ../core/src/actions/types.ts
2
2
  var ACTION_KINDS = {
3
3
  FLOW: "flow",
4
4
  EXTERNAL_URL: "externalUrl",
@@ -19,6 +19,8 @@ function makeFlowAction(url, presentationContext) {
19
19
  function makeExternalUrlAction(url) {
20
20
  return { kind: ACTION_KINDS.EXTERNAL_URL, url };
21
21
  }
22
+
23
+ // ../core/src/actions/dispatcher.ts
22
24
  var ActionDispatcher = class {
23
25
  handlers = /* @__PURE__ */ new Map();
24
26
  wiredActions = /* @__PURE__ */ new Set();
@@ -51,6 +53,8 @@ var ActionDispatcher = class {
51
53
  await handler(action);
52
54
  }
53
55
  };
56
+
57
+ // ../core/src/intents/dispatcher.ts
54
58
  var IntentDispatcher = class {
55
59
  controllers = /* @__PURE__ */ new Map();
56
60
  /** 注册一个 IntentController */
@@ -72,6 +76,8 @@ var IntentDispatcher = class {
72
76
  return this.controllers.has(intentId);
73
77
  }
74
78
  };
79
+
80
+ // ../core/src/dependencies/container.ts
75
81
  var Container = class {
76
82
  registrations = /* @__PURE__ */ new Map();
77
83
  /** 注册依赖(默认单例) */
@@ -105,12 +111,16 @@ var Container = class {
105
111
  this.registrations.clear();
106
112
  }
107
113
  };
114
+
115
+ // ../core/src/logger/base.ts
108
116
  var BaseLogger = class {
109
117
  category;
110
118
  constructor(category) {
111
119
  this.category = category;
112
120
  }
113
121
  };
122
+
123
+ // ../core/src/logger/local-storage-filter.ts
114
124
  var LEVEL_TO_NUM = {
115
125
  "*": 4,
116
126
  debug: 4,
@@ -170,6 +180,8 @@ function resetFilterCache() {
170
180
  cachedRules = void 0;
171
181
  cachedRaw = void 0;
172
182
  }
183
+
184
+ // ../core/src/logger/console.ts
173
185
  var ConsoleLogger = class extends BaseLogger {
174
186
  debug(...args) {
175
187
  if (shouldLog(this.category, "debug")) {
@@ -199,6 +211,8 @@ var ConsoleLoggerFactory = class {
199
211
  return new ConsoleLogger(category);
200
212
  }
201
213
  };
214
+
215
+ // ../core/src/dependencies/make-dependencies.ts
202
216
  var DEP_KEYS = {
203
217
  LOGGER: "logger",
204
218
  LOGGER_FACTORY: "loggerFactory",
@@ -289,6 +303,8 @@ function makeDependencies(container, options = {}) {
289
303
  );
290
304
  container.register(DEP_KEYS.FETCH, () => fetchFn);
291
305
  }
306
+
307
+ // ../core/src/router/router.ts
292
308
  var Router = class {
293
309
  routes = [];
294
310
  /** 添加路由规则 */
@@ -357,6 +373,8 @@ var Router = class {
357
373
  }
358
374
  }
359
375
  };
376
+
377
+ // ../core/src/logger/composite.ts
360
378
  var CompositeLoggerFactory = class {
361
379
  constructor(factories) {
362
380
  this.factories = factories;
@@ -390,6 +408,8 @@ var CompositeLogger = class {
390
408
  return "";
391
409
  }
392
410
  };
411
+
412
+ // ../core/src/prefetched-intents/stable-stringify.ts
393
413
  function stableStringify(obj) {
394
414
  if (obj === null || obj === void 0) return String(obj);
395
415
  if (typeof obj !== "object") return JSON.stringify(obj);
@@ -402,6 +422,8 @@ function stableStringify(obj) {
402
422
  );
403
423
  return "{" + parts.join(",") + "}";
404
424
  }
425
+
426
+ // ../core/src/prefetched-intents/prefetched-intents.ts
405
427
  var PrefetchedIntents = class _PrefetchedIntents {
406
428
  intents;
407
429
  constructor(intents) {
@@ -444,6 +466,8 @@ var PrefetchedIntents = class _PrefetchedIntents {
444
466
  return this.intents.size;
445
467
  }
446
468
  };
469
+
470
+ // ../core/src/framework.ts
447
471
  var Framework = class _Framework {
448
472
  container;
449
473
  intentDispatcher;
@@ -518,6 +542,8 @@ var Framework = class _Framework {
518
542
  this.container.dispose();
519
543
  }
520
544
  };
545
+
546
+ // ../core/src/http/client.ts
521
547
  var HttpError = class extends Error {
522
548
  constructor(status, statusText, body) {
523
549
  super(`HTTP ${status}: ${statusText}`);
@@ -596,6 +622,8 @@ var HttpClient = class {
596
622
  return `${url.pathname}${url.search}`;
597
623
  }
598
624
  };
625
+
626
+ // ../core/src/intents/base-controller.ts
599
627
  var BaseController = class {
600
628
  /**
601
629
  * 错误回退 — 子类可选覆写
@@ -627,6 +655,8 @@ var BaseController = class {
627
655
  }
628
656
  }
629
657
  };
658
+
659
+ // ../core/src/data/mapper.ts
630
660
  function pipe(...mappers) {
631
661
  return (input) => mappers.reduce((acc, mapper) => mapper(acc), input);
632
662
  }
@@ -642,6 +672,8 @@ function pipeAsync(...mappers) {
642
672
  function mapEach(mapper) {
643
673
  return (items) => items.map(mapper);
644
674
  }
675
+
676
+ // ../core/src/bootstrap/define-routes.ts
645
677
  function defineRoutes(framework, definitions) {
646
678
  const registeredIntents = /* @__PURE__ */ new Set();
647
679
  for (const def of definitions) {
@@ -652,6 +684,8 @@ function defineRoutes(framework, definitions) {
652
684
  framework.router.add(def.path, def.intentId);
653
685
  }
654
686
  }
687
+
688
+ // ../core/src/utils/lru-map.ts
655
689
  var LruMap = class {
656
690
  map = /* @__PURE__ */ new Map();
657
691
  capacity;
@@ -690,12 +724,16 @@ var LruMap = class {
690
724
  this.map.clear();
691
725
  }
692
726
  };
727
+
728
+ // ../core/src/utils/optional.ts
693
729
  function isSome(value) {
694
730
  return value !== null && value !== void 0;
695
731
  }
696
732
  function isNone(value) {
697
733
  return value === null || value === void 0;
698
734
  }
735
+
736
+ // ../core/src/utils/url.ts
699
737
  function removeScheme(url) {
700
738
  return url.replace(/^https?:\/\//, "");
701
739
  }
@@ -724,6 +762,8 @@ function buildUrl(path, params) {
724
762
  const qs = searchParams.toString();
725
763
  return qs ? `${path}?${qs}` : path;
726
764
  }
765
+
766
+ // ../core/src/utils/uuid.ts
727
767
  function generateUuid() {
728
768
  if (typeof crypto !== "undefined" && crypto.randomUUID) {
729
769
  return crypto.randomUUID();
@@ -735,7 +775,7 @@ function generateUuid() {
735
775
  });
736
776
  }
737
777
 
738
- // ../browser/dist/index.js
778
+ // ../browser/src/action-handlers/external-url-action.ts
739
779
  function registerExternalUrlHandler(deps) {
740
780
  const { framework, log } = deps;
741
781
  framework.onAction(
@@ -746,6 +786,8 @@ function registerExternalUrlHandler(deps) {
746
786
  }
747
787
  );
748
788
  }
789
+
790
+ // ../browser/src/utils/try-scroll.ts
749
791
  var MAX_TRIES = 100;
750
792
  var FUDGE = 16;
751
793
  var pendingFrame = null;
@@ -785,6 +827,8 @@ function tryScroll(log, getScrollableElement, scrollY) {
785
827
  pendingFrame = null;
786
828
  });
787
829
  }
830
+
831
+ // ../browser/src/utils/history.ts
788
832
  var HISTORY_SIZE_LIMIT = 10;
789
833
  var History = class {
790
834
  entries;
@@ -871,6 +915,8 @@ var History = class {
871
915
  }
872
916
  }
873
917
  };
918
+
919
+ // ../browser/src/action-handlers/flow-action.ts
874
920
  function registerFlowActionHandler(deps) {
875
921
  const { framework, log, callbacks, updateApp } = deps;
876
922
  let isFirstPage = true;
@@ -975,6 +1021,8 @@ function registerFlowActionHandler(deps) {
975
1021
  })();
976
1022
  }
977
1023
  }
1024
+
1025
+ // ../browser/src/action-handlers/register.ts
978
1026
  function registerActionHandlers(deps) {
979
1027
  const { framework, log, callbacks, updateApp } = deps;
980
1028
  registerFlowActionHandler({
@@ -985,6 +1033,8 @@ function registerActionHandlers(deps) {
985
1033
  });
986
1034
  registerExternalUrlHandler({ framework, log });
987
1035
  }
1036
+
1037
+ // ../browser/src/server-data.ts
988
1038
  var SERVER_DATA_ID = "serialized-server-data";
989
1039
  function deserializeServerData() {
990
1040
  const script = document.getElementById(SERVER_DATA_ID);
@@ -1003,6 +1053,8 @@ function createPrefetchedIntentsFromDom() {
1003
1053
  }
1004
1054
  return PrefetchedIntents.fromArray(data);
1005
1055
  }
1056
+
1057
+ // ../browser/src/start-app.ts
1006
1058
  async function startBrowserApp(config) {
1007
1059
  const { bootstrap, defaultLocale = "en", mount, callbacks } = config;
1008
1060
  const prefetchedIntents = createPrefetchedIntentsFromDom();
@@ -1034,7 +1086,7 @@ async function startBrowserApp(config) {
1034
1086
  }
1035
1087
  }
1036
1088
 
1037
- // ../ssr/dist/index.js
1089
+ // ../ssr/src/render.ts
1038
1090
  async function ssrRender(options) {
1039
1091
  const { url, frameworkConfig, bootstrap, getErrorPage, renderApp } = options;
1040
1092
  const framework = Framework.create(frameworkConfig);
@@ -1063,6 +1115,8 @@ async function ssrRender(options) {
1063
1115
  serverData
1064
1116
  };
1065
1117
  }
1118
+
1119
+ // ../ssr/src/create-render.ts
1066
1120
  function createSSRRender(config) {
1067
1121
  const { bootstrap, getErrorPage, renderApp, frameworkConfig } = config;
1068
1122
  return (url, locale) => ssrRender({
@@ -1073,12 +1127,16 @@ function createSSRRender(config) {
1073
1127
  renderApp: (page) => renderApp(page, locale)
1074
1128
  });
1075
1129
  }
1130
+
1131
+ // ../ssr/src/inject.ts
1076
1132
  function injectSSRContent(options) {
1077
1133
  const { template, locale, head, css, html, serializedData } = options;
1078
1134
  const cssTag = css ? `<style>${css}</style>` : "";
1079
1135
  return template.replace("<!--ssr-lang-->", locale).replace("<!--ssr-head-->", `${head}
1080
1136
  ${cssTag}`).replace("<!--ssr-body-->", html).replace("<!--ssr-data-->", serializedData);
1081
1137
  }
1138
+
1139
+ // ../ssr/src/server-data.ts
1082
1140
  var HTML_REPLACEMENTS = {
1083
1141
  "<": "\\u003C",
1084
1142
  ">": "\\u003E",
@@ -1095,10 +1153,10 @@ function serializeServerData(data) {
1095
1153
  );
1096
1154
  }
1097
1155
 
1098
- // ../server/dist/index.js
1156
+ // ../server/src/app.ts
1099
1157
  import { Hono } from "hono";
1100
- import { Hono as Hono3 } from "hono";
1101
- import { Hono as Hono2 } from "hono";
1158
+
1159
+ // ../server/src/locale.ts
1102
1160
  var DEFAULT_SUPPORTED = ["zh", "en"];
1103
1161
  var DEFAULT_LOCALE = "en";
1104
1162
  function parseAcceptLanguage(header, supported = DEFAULT_SUPPORTED, fallback = DEFAULT_LOCALE) {
@@ -1118,6 +1176,8 @@ function parseAcceptLanguage(header, supported = DEFAULT_SUPPORTED, fallback = D
1118
1176
  }
1119
1177
  return fallback;
1120
1178
  }
1179
+
1180
+ // ../server/src/app.ts
1121
1181
  function createSSRApp(options) {
1122
1182
  const {
1123
1183
  root,
@@ -1189,6 +1249,11 @@ function createSSRApp(options) {
1189
1249
  });
1190
1250
  return app;
1191
1251
  }
1252
+
1253
+ // ../server/src/create-server.ts
1254
+ import { Hono as Hono3 } from "hono";
1255
+
1256
+ // ../server/src/runtime.ts
1192
1257
  function detectRuntime() {
1193
1258
  return {
1194
1259
  isDeno: typeof globalThis.Deno !== "undefined",
@@ -1214,6 +1279,9 @@ async function resolveRoot(importMetaUrl, levelsUp = 0) {
1214
1279
  }
1215
1280
  return dir;
1216
1281
  }
1282
+
1283
+ // ../server/src/start.ts
1284
+ import { Hono as Hono2 } from "hono";
1217
1285
  async function startServer(options) {
1218
1286
  const { app, root, port = 3e3, isProduction, vite } = options;
1219
1287
  const { isDeno, isBun, isVercel } = options.runtime ?? detectRuntime();
@@ -1261,6 +1329,8 @@ async function startServer(options) {
1261
1329
  }
1262
1330
  return { vite };
1263
1331
  }
1332
+
1333
+ // ../server/src/create-server.ts
1264
1334
  async function createServer(config = {}) {
1265
1335
  const {
1266
1336
  root: rootOverride,