miqro 7.3.2 → 7.3.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/build/lib.cjs CHANGED
@@ -1439,7 +1439,7 @@ function getSlashIndex(input) {
1439
1439
  }
1440
1440
  return slashIndex;
1441
1441
  }
1442
- function normalizePath3(path) {
1442
+ function normalizePath2(path) {
1443
1443
  if (typeof path !== "string") {
1444
1444
  throw new Error("path not string");
1445
1445
  }
@@ -1656,7 +1656,7 @@ var init_types = __esm({
1656
1656
  vURL = v;
1657
1657
  const url = newURL2(vURL ? vURL : "/");
1658
1658
  this.searchParams = url.searchParams;
1659
- this.path = normalizePath3(url.pathname);
1659
+ this.path = normalizePath2(url.pathname);
1660
1660
  this.hash = url.hash;
1661
1661
  this.query = parseSearchParams(this.searchParams);
1662
1662
  }
@@ -1779,9 +1779,9 @@ var init_types = __esm({
1779
1779
  }
1780
1780
  async asyncWrite(chunk) {
1781
1781
  return new Promise((resolve24, reject) => {
1782
- this.write(chunk, function(error3) {
1783
- if (error3) {
1784
- reject(error3);
1782
+ this.write(chunk, function(error2) {
1783
+ if (error2) {
1784
+ reject(error2);
1785
1785
  } else {
1786
1786
  resolve24();
1787
1787
  }
@@ -1949,7 +1949,7 @@ function routerDefaultLoggerFactory(uuid, req) {
1949
1949
  try {
1950
1950
  const url = newURL2(req.url ? req.url : "/");
1951
1951
  query = url.searchParams.toString();
1952
- path = normalizePath3(url.pathname);
1952
+ path = normalizePath2(url.pathname);
1953
1953
  method = req.method ? req.method.toUpperCase() : "GET";
1954
1954
  remoteAddress = req.socket.remoteAddress;
1955
1955
  } catch (e) {
@@ -2274,7 +2274,7 @@ var init_common = __esm({
2274
2274
  });
2275
2275
 
2276
2276
  // node_modules/@miqro/core/build/middleware/router.js
2277
- var Router3, RouterHandler;
2277
+ var Router2, RouterHandler;
2278
2278
  var init_router = __esm({
2279
2279
  "node_modules/@miqro/core/build/middleware/router.js"() {
2280
2280
  init_common();
@@ -2283,7 +2283,7 @@ var init_router = __esm({
2283
2283
  init_body_parser();
2284
2284
  init_lib2();
2285
2285
  init_built_in_parsers();
2286
- Router3 = class {
2286
+ Router2 = class {
2287
2287
  constructor(config) {
2288
2288
  this.config = config;
2289
2289
  this.handlers = [];
@@ -2325,7 +2325,7 @@ var init_router = __esm({
2325
2325
  return this.use(handler, path, "options", options);
2326
2326
  }
2327
2327
  use(handler, path, method, options) {
2328
- const nPath = path !== void 0 ? normalizePath3(path) : void 0;
2328
+ const nPath = path !== void 0 ? normalizePath2(path) : void 0;
2329
2329
  const nMethod = method ? method.toLowerCase() : method;
2330
2330
  this.handlers.push(new RouterHandler(handler, nPath, nMethod, options));
2331
2331
  return this;
@@ -2465,7 +2465,7 @@ ${tab}${tab}${methodData.description}` : ""}`;
2465
2465
  this.handler = handlers;
2466
2466
  }
2467
2467
  getJSONDoc(doc = {}, prePath = "") {
2468
- const pp = normalizePath3(removeStartingBackSlashes(this.path ? this.path : "/"));
2468
+ const pp = normalizePath2(removeStartingBackSlashes(this.path ? this.path : "/"));
2469
2469
  const nPath = pp.length > 1 ? pp.substring(1) : "";
2470
2470
  const nMethod = this.method ? this.method : "";
2471
2471
  if (this.isRouter) {
@@ -2566,7 +2566,7 @@ var init_app = __esm({
2566
2566
  init_router();
2567
2567
  init_common();
2568
2568
  import_crypto = require("crypto");
2569
- App = class extends Router3 {
2569
+ App = class extends Router2 {
2570
2570
  constructor(config) {
2571
2571
  super(config);
2572
2572
  this.shouldCloseConnection = false;
@@ -2925,12 +2925,12 @@ var init_websocket = __esm({
2925
2925
  socket.destroy();
2926
2926
  }
2927
2927
  });
2928
- socket.on("error", async (error3) => {
2928
+ socket.on("error", async (error2) => {
2929
2929
  req.logger.debug("upgraded connection error!");
2930
- req.logger.error(error3);
2930
+ req.logger.error(error2);
2931
2931
  if (this.options.onError) {
2932
2932
  try {
2933
- await this.options.onError(client, error3);
2933
+ await this.options.onError(client, error2);
2934
2934
  } catch (e) {
2935
2935
  req.logger.error(e);
2936
2936
  }
@@ -7029,10 +7029,10 @@ __export(restart_api_exports, {
7029
7029
  parseInflateErrors: () => parseInflateErrors
7030
7030
  });
7031
7031
  function parseInflateErrors(errors) {
7032
- return errors?.map((error3) => {
7032
+ return errors?.map((error2) => {
7033
7033
  return {
7034
- filePath: (0, import_node_path24.relative)(BASE_PATH, error3.filePath),
7035
- error: error3.error.message
7034
+ filePath: (0, import_node_path24.relative)(BASE_PATH, error2.filePath),
7035
+ error: error2.error.message
7036
7036
  };
7037
7037
  });
7038
7038
  }
@@ -7087,10 +7087,10 @@ __export(reload_api_exports, {
7087
7087
  parseInflateErrors: () => parseInflateErrors2
7088
7088
  });
7089
7089
  function parseInflateErrors2(errors) {
7090
- return errors?.map((error3) => {
7090
+ return errors?.map((error2) => {
7091
7091
  return {
7092
- filePath: (0, import_node_path25.relative)(BASE_PATH, error3.filePath),
7093
- error: error3.error.message
7092
+ filePath: (0, import_node_path25.relative)(BASE_PATH, error2.filePath),
7093
+ error: error2.error.message
7094
7094
  };
7095
7095
  });
7096
7096
  }
@@ -7188,12 +7188,12 @@ __export(lib_exports3, {
7188
7188
  ClusterCache: () => ClusterCache,
7189
7189
  ClusterWebSocketServer2: () => ClusterWebSocketServer2,
7190
7190
  DBManager: () => DBManager,
7191
- JSX: () => JSX3,
7191
+ JSX: () => JSX2,
7192
7192
  LocalCache: () => LocalCache,
7193
7193
  LogProvider: () => LogProvider,
7194
7194
  LoggerHandler: () => LoggerHandler,
7195
7195
  Miqro: () => Miqro,
7196
- Router: () => Router3,
7196
+ Router: () => Router2,
7197
7197
  ServerRequestHandler: () => ServerRequestHandler,
7198
7198
  WebSocketManager: () => WebSocketManager,
7199
7199
  appendAPIModule: () => appendAPIModule,
@@ -8272,7 +8272,7 @@ function createContainer(element, runtime, args) {
8272
8272
  configurable: false,
8273
8273
  enumerable: true,
8274
8274
  writable: false,
8275
- value: function render3(out) {
8275
+ value: function render2(out) {
8276
8276
  return render(runtime, tree, treeOptions, [out]);
8277
8277
  }
8278
8278
  });
@@ -8291,28 +8291,28 @@ function createContainer(element, runtime, args) {
8291
8291
  // node_modules/@miqro/jsx/build/esm/hooks/runtime.js
8292
8292
  function useRuntime() {
8293
8293
  useConditional("useRuntime");
8294
- const currentContext3 = useRenderContext();
8295
- if (!currentContext3) {
8294
+ const currentContext2 = useRenderContext();
8295
+ if (!currentContext2) {
8296
8296
  throw new Error("useRuntime not in render");
8297
8297
  }
8298
- return currentContext3.runtime;
8298
+ return currentContext2.runtime;
8299
8299
  }
8300
8300
 
8301
8301
  // node_modules/@miqro/jsx/build/esm/hooks/refresh.js
8302
8302
  var REFRESH_TIMEOUT_MS = 0;
8303
8303
  function useRefresh() {
8304
8304
  useConditional("useRefresh");
8305
- const currentContext3 = useRenderContext();
8306
- if (!currentContext3) {
8305
+ const currentContext2 = useRenderContext();
8306
+ if (!currentContext2) {
8307
8307
  throw new Error("useRefresh not in render");
8308
8308
  }
8309
- const meta = currentContext3.node.state;
8309
+ const meta = currentContext2.node.state;
8310
8310
  if (!meta) {
8311
8311
  throw new Error("useRefresh without meta");
8312
8312
  }
8313
8313
  const runtime = useRuntime();
8314
- const options = currentContext3.options;
8315
- const node = currentContext3.node;
8314
+ const options = currentContext2.options;
8315
+ const node = currentContext2.node;
8316
8316
  const component = node.component;
8317
8317
  if (!component) {
8318
8318
  throw new Error("useRefresh without func");
@@ -8338,12 +8338,12 @@ function useRefresh() {
8338
8338
  // node_modules/@miqro/jsx/build/esm/hooks/state.js
8339
8339
  function useState(defaultValue) {
8340
8340
  const key = useConditional("useState");
8341
- const currentContext3 = useRenderContext();
8342
- if (!currentContext3) {
8341
+ const currentContext2 = useRenderContext();
8342
+ if (!currentContext2) {
8343
8343
  throw new Error("useState not in render");
8344
8344
  }
8345
8345
  const refresh = useRefresh();
8346
- const meta = currentContext3.node.state;
8346
+ const meta = currentContext2.node.state;
8347
8347
  const runtime = useRuntime();
8348
8348
  if (!meta) {
8349
8349
  throw new Error("useState without meta");
@@ -8354,7 +8354,7 @@ function useState(defaultValue) {
8354
8354
  if (!meta.state) {
8355
8355
  throw new Error("useState without meta.state");
8356
8356
  }
8357
- const name = currentContext3.node.component?.name;
8357
+ const name = currentContext2.node.component?.name;
8358
8358
  const currentStateItem = meta.state[key];
8359
8359
  if (currentStateItem === void 0) {
8360
8360
  const stateItem = {
@@ -8389,12 +8389,12 @@ function useState(defaultValue) {
8389
8389
 
8390
8390
  // node_modules/@miqro/jsx/build/esm/hooks/effect.js
8391
8391
  function useEffect(effect, condition) {
8392
- const currentContext3 = useRenderContext();
8393
- if (!currentContext3) {
8392
+ const currentContext2 = useRenderContext();
8393
+ if (!currentContext2) {
8394
8394
  throw new Error("useEffect not in render");
8395
8395
  }
8396
8396
  const key = useConditional("useEffect");
8397
- const meta = currentContext3.node.state;
8397
+ const meta = currentContext2.node.state;
8398
8398
  if (!meta) {
8399
8399
  throw new Error("useEffect without meta");
8400
8400
  }
@@ -8620,11 +8620,11 @@ function setQueryValue(runtime, name, value, watch2 = true) {
8620
8620
  // node_modules/@miqro/jsx/build/esm/hooks/useelement.js
8621
8621
  function useElement() {
8622
8622
  useConditional("useElement");
8623
- const currentContext3 = useRenderContext();
8624
- if (!currentContext3) {
8623
+ const currentContext2 = useRenderContext();
8624
+ if (!currentContext2) {
8625
8625
  throw new Error("useElement not in render");
8626
8626
  }
8627
- return currentContext3.node.ref ? currentContext3.node.ref : null;
8627
+ return currentContext2.node.ref ? currentContext2.node.ref : null;
8628
8628
  }
8629
8629
 
8630
8630
  // node_modules/@miqro/jsx/build/esm/hooks/context.js
@@ -8637,11 +8637,11 @@ function createContext(defaultValue) {
8637
8637
  }
8638
8638
  function useContext(context) {
8639
8639
  useConditional("useContext");
8640
- const currentContext3 = useRenderContext();
8641
- if (!currentContext3) {
8640
+ const currentContext2 = useRenderContext();
8641
+ if (!currentContext2) {
8642
8642
  throw new Error("useContext not in render");
8643
8643
  }
8644
- let currentNode = currentContext3.node;
8644
+ let currentNode = currentContext2.node;
8645
8645
  while (currentNode) {
8646
8646
  if (currentNode.type === "ContextProvider" && currentNode.contextKey === context.symbol) {
8647
8647
  return currentNode.contextValue;
@@ -8651,10 +8651,10 @@ function useContext(context) {
8651
8651
  throw new Error("cannot find provider!");
8652
8652
  }
8653
8653
  function createContextProvider(symbol, defaultValue) {
8654
- function ContextProvider3({ value }, ...children) {
8654
+ function ContextProvider2({ value }, ...children) {
8655
8655
  useConditional("ContextProvider");
8656
- const currentContext3 = useRenderContext();
8657
- if (!currentContext3) {
8656
+ const currentContext2 = useRenderContext();
8657
+ if (!currentContext2) {
8658
8658
  throw new Error("ContextProvider not in render");
8659
8659
  }
8660
8660
  return {
@@ -8664,1294 +8664,15 @@ function createContextProvider(symbol, defaultValue) {
8664
8664
  children
8665
8665
  };
8666
8666
  }
8667
- ContextProvider3.asFragment = true;
8668
- ContextProvider3.shadowInit = false;
8669
- return ContextProvider3;
8667
+ ContextProvider2.asFragment = true;
8668
+ ContextProvider2.shadowInit = false;
8669
+ return ContextProvider2;
8670
8670
  }
8671
8671
 
8672
8672
  // node_modules/@miqro/jsx/build/esm/lib.js
8673
8673
  var lib_default = JSX;
8674
8674
 
8675
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/log.js
8676
- var debugLogEnabled2 = false;
8677
- function debug2(runtime, message2, ...args) {
8678
- if (debugLogEnabled2) {
8679
- runtime.consoleLog(message2, ...args);
8680
- }
8681
- }
8682
- function error2(runtime, message2, ...args) {
8683
- runtime.consoleError(message2, ...args);
8684
- }
8685
-
8686
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/actions.js
8687
- function createAppendAction2(node, runtime) {
8688
- return {
8689
- isDestructive: true,
8690
- execute: () => {
8691
- const parent = node.parent;
8692
- const nodeRef = node.ref;
8693
- let changes = 0;
8694
- if (parent) {
8695
- debug2(runtime, "%s.children.add(%s)", parent.getName(), node.getName());
8696
- parent.children.add(node);
8697
- if (nodeRef) {
8698
- let currentParent = parent;
8699
- if (currentParent.ref) {
8700
- debug2(runtime, "%s.appendChild(%s)", currentParent.getName(), node.getName());
8701
- if (currentParent.state?.shadowRoot) {
8702
- currentParent.state.shadowRoot.appendChild(nodeRef);
8703
- } else {
8704
- currentParent.ref.appendChild(nodeRef);
8705
- }
8706
- changes++;
8707
- return changes;
8708
- } else {
8709
- while (currentParent !== null) {
8710
- currentParent = currentParent.parent;
8711
- if (currentParent && currentParent.ref) {
8712
- debug2(runtime, "%s.appendChild(%s)", currentParent.getName(), node.getName());
8713
- if (currentParent.state?.shadowRoot) {
8714
- currentParent.state.shadowRoot.appendChild(nodeRef);
8715
- } else {
8716
- currentParent.ref.appendChild(nodeRef);
8717
- }
8718
- changes++;
8719
- return changes;
8720
- }
8721
- }
8722
- }
8723
- } else {
8724
- return changes;
8725
- }
8726
- }
8727
- throw new Error("cannot find real parent(3)");
8728
- }
8729
- };
8730
- }
8731
- function createRemoveAttributesAction2(node, toRemove, runtime) {
8732
- return {
8733
- execute: () => {
8734
- const ref = node.ref;
8735
- let changes = 0;
8736
- if (ref) {
8737
- const element = ref;
8738
- for (const name of toRemove) {
8739
- debug2(runtime, "%s.removeAttribute(%s)", node.getName(), name);
8740
- element.removeAttribute(name);
8741
- changes++;
8742
- if (name === "checked") {
8743
- debug2(runtime, "%s.%s=...", node.getName(), "checked");
8744
- element.checked = false;
8745
- changes++;
8746
- }
8747
- }
8748
- }
8749
- return changes;
8750
- }
8751
- };
8752
- }
8753
- function createSetAttributesAction2(node, toSet, runtime) {
8754
- return {
8755
- execute: () => {
8756
- const ref = node.ref;
8757
- let changes = 0;
8758
- if (ref) {
8759
- const element = ref;
8760
- for (const s of toSet) {
8761
- if (s.name === "className") {
8762
- s.name = "class";
8763
- }
8764
- debug2(runtime, "%s.setAttribute(%s, ...)", node.getName(), s.name);
8765
- element.setAttribute(s.name, s.value);
8766
- changes++;
8767
- if (s.name === "value") {
8768
- debug2(runtime, "%s.%s=...", node.getName(), s.name);
8769
- element.value = s.value;
8770
- changes++;
8771
- } else if (s.name === "checked") {
8772
- debug2(runtime, "%s.%s=...", node.getName(), s.name);
8773
- element.checked = true;
8774
- changes++;
8775
- }
8776
- }
8777
- }
8778
- return changes;
8779
- }
8780
- };
8781
- }
8782
- function createFlushEffects2(node, options, runtime) {
8783
- return {
8784
- postExecute: () => {
8785
- const meta = node.state;
8786
- const func = node.component;
8787
- const changes = 0;
8788
- if (func && meta) {
8789
- debug2(runtime, "flush effects callbacks for [%s]", node.getName());
8790
- flushEffectCallbacks2(meta.effectCallbacks, options.disableEffects, runtime);
8791
- debug2(runtime, "flush effects for [%s]", node.getName());
8792
- flushEffects2(meta.effects, meta.effectQueueCallbacks, options.disableEffects, runtime);
8793
- }
8794
- return changes;
8795
- }
8796
- };
8797
- }
8798
- function createFlushEffectsRemove2(node, options, runtime) {
8799
- return {
8800
- execute: () => {
8801
- const meta = node.state;
8802
- const changes = 0;
8803
- if (node.component && meta) {
8804
- debug2(runtime, "flush effects callbacks for [%s]", node.getName());
8805
- flushEffectCallbacks2(meta.effectCallbacks, options.disableEffects, runtime);
8806
- debug2(runtime, "flush effects for [%s]", node.getName());
8807
- flushEffectCallbacks2(meta.effectQueueCallbacks, options.disableEffects, runtime);
8808
- }
8809
- return changes;
8810
- }
8811
- };
8812
- }
8813
- function flushEffectCallbacks2(callbacks, disableEffects, runtime) {
8814
- const keys = Object.keys(callbacks);
8815
- for (const key of keys) {
8816
- if (!disableEffects) {
8817
- try {
8818
- callbacks[key]();
8819
- } catch (e) {
8820
- error2(runtime, e);
8821
- }
8822
- }
8823
- delete callbacks[key];
8824
- }
8825
- }
8826
- function flushEffects2(effects, callbacks, disableEffects, runtime) {
8827
- const keys = Object.keys(effects);
8828
- for (const key of keys) {
8829
- if (!disableEffects) {
8830
- try {
8831
- const callback = effects[key]();
8832
- if (callback) {
8833
- callbacks[key] = callback;
8834
- }
8835
- } catch (e) {
8836
- error2(runtime, e);
8837
- }
8838
- }
8839
- delete effects[key];
8840
- }
8841
- }
8842
- function createRemoveListeners2(node, runtime) {
8843
- return {
8844
- execute: () => {
8845
- const ref = node.ref;
8846
- let changes = 0;
8847
- if (!ref) {
8848
- throw new Error("cannot update listeners without a ref");
8849
- }
8850
- const element = ref;
8851
- for (const listener of node.currentEventListeners) {
8852
- debug2(runtime, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
8853
- element.removeEventListener(listener.eventName, listener.listener);
8854
- changes++;
8855
- }
8856
- node.currentEventListeners = [];
8857
- return changes;
8858
- }
8859
- };
8860
- }
8861
- function createUpdateListeners2(node, listeners, runtime) {
8862
- return {
8863
- execute: () => {
8864
- const ref = node.ref;
8865
- let changes = 0;
8866
- if (!ref) {
8867
- throw new Error("cannot update listeners without a ref");
8868
- }
8869
- const element = ref;
8870
- for (const listener of node.currentEventListeners) {
8871
- debug2(runtime, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
8872
- element.removeEventListener(listener.eventName, listener.listener);
8873
- changes++;
8874
- }
8875
- node.currentEventListeners = [];
8876
- for (const listener of listeners) {
8877
- debug2(runtime, "%s.addEventListener(%s, ...)", node.getName(), listener.eventName);
8878
- element.addEventListener(listener.eventName, listener.listener);
8879
- changes++;
8880
- }
8881
- node.currentEventListeners = listeners;
8882
- return changes;
8883
- }
8884
- };
8885
- }
8886
- function createNotifyRef2(node, refListener, runtime) {
8887
- return {
8888
- postExecute: () => {
8889
- const ref = node.ref;
8890
- let changes = 0;
8891
- if (!ref) {
8892
- throw new Error("cannot notify ref without a ref");
8893
- }
8894
- debug2(runtime, "calling ref [%s]", node.getName());
8895
- refListener(ref);
8896
- return changes;
8897
- }
8898
- };
8899
- }
8900
- function createRemoveNode2(node, options, runtime) {
8901
- return {
8902
- isDestructive: true,
8903
- execute: () => {
8904
- const meta = node.state;
8905
- let changes = 0;
8906
- if (node.component && meta) {
8907
- debug2(runtime, "[%s].remove()", node.getName());
8908
- }
8909
- const parent = node.parent;
8910
- if (!parent) {
8911
- throw new Error(`cannot remove from tree ${node.type} ${node.textContent}`);
8912
- }
8913
- parent.children.delete(node);
8914
- const nodeRef = node.ref;
8915
- if (nodeRef) {
8916
- changes++;
8917
- debug2(runtime, "%s.remove()", node.getName());
8918
- nodeRef.remove();
8919
- }
8920
- node.parent = null;
8921
- return changes;
8922
- }
8923
- };
8924
- }
8925
- function createSetTextAction2(node, textContent, runtime) {
8926
- return {
8927
- execute: () => {
8928
- const ref = node.ref;
8929
- let changes = 0;
8930
- if (ref) {
8931
- debug2(runtime, "%s.textContent = ...", node.getName());
8932
- ref.textContent = textContent ? textContent : "";
8933
- node.textContent = textContent;
8934
- changes++;
8935
- }
8936
- return changes;
8937
- }
8938
- };
8939
- }
8940
- function createUpdateLastRenderArgs2(node, options, runtime, props, children) {
8941
- return {
8942
- postExecute: () => {
8943
- node.lastRenderArgs = {
8944
- props,
8945
- children
8946
- };
8947
- return 0;
8948
- }
8949
- };
8950
- }
8951
- function createSetInnerHTMLAction2(node, innerHTML, runtime) {
8952
- return {
8953
- execute: () => {
8954
- const ref = node.ref;
8955
- let changes = 0;
8956
- if (ref) {
8957
- debug2(runtime, "%s.innerHTML = ...", node.getName());
8958
- if (innerHTML !== null && innerHTML !== void 0) {
8959
- ref.innerHTML = String(innerHTML);
8960
- changes++;
8961
- }
8962
- node.innerHTML = innerHTML;
8963
- }
8964
- return changes;
8965
- }
8966
- };
8967
- }
8968
-
8969
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/base-node.js
8970
- var BaseNode2 = class {
8971
- type;
8972
- parent;
8973
- children = /* @__PURE__ */ new Set();
8974
- currentEventListeners = [];
8975
- contextKey;
8976
- contextValue;
8977
- state;
8978
- tagName;
8979
- lastRenderArgs = {};
8980
- component;
8981
- textContent;
8982
- innerHTML;
8983
- ref;
8984
- isRoot;
8985
- constructor(type, parent) {
8986
- this.type = type;
8987
- this.parent = parent;
8988
- }
8989
- create(runtime, options, change, parent, list) {
8990
- this.parent = parent;
8991
- this.update(runtime, options, change, list, true);
8992
- list.push(createAppendAction2(this, runtime));
8993
- this.lastRenderArgs = {
8994
- props: change.props,
8995
- children: change.children
8996
- };
8997
- return this;
8998
- }
8999
- update(runtime, options, change, list, initial) {
9000
- return this;
9001
- }
9002
- compare(change) {
9003
- return this.type === change.type && this.component === change.func && this.tagName === change.tagName && this.contextKey === change.contextKey;
9004
- }
9005
- remove(runtime, options, list) {
9006
- if (this.children) {
9007
- for (const child of this.children) {
9008
- child.remove(runtime, options, list);
9009
- }
9010
- }
9011
- if (this.state && this.component) {
9012
- list.push(createFlushEffectsRemove2(this, options, runtime));
9013
- }
9014
- list.push(createRemoveNode2(this, options, runtime));
9015
- return this;
9016
- }
9017
- calculateChildren(runtime, options, change, list) {
9018
- return change.children ? change.children : [];
9019
- }
9020
- getName() {
9021
- return this.component ? this.component.name : this.tagName ? this.tagName : this.type;
9022
- }
9023
- initComponentState(runtime, options) {
9024
- if (this.state) {
9025
- throw new Error("already initialized");
9026
- }
9027
- const ref = this.ref;
9028
- const o = options ? {
9029
- ...getDefaultOptions2(),
9030
- ...options ? options : {}
9031
- } : {
9032
- ...getDefaultOptions2()
9033
- };
9034
- const shadowInit = o.shadowInit;
9035
- const renderAsFragment = o.asFragment;
9036
- if (!ref && !renderAsFragment) {
9037
- throw new Error("createMeta without ref");
9038
- }
9039
- this.state = {
9040
- effectConditions: {},
9041
- effectCallbacks: {},
9042
- effectQueueCallbacks: {},
9043
- effects: {},
9044
- shadowRoot: renderAsFragment || !runtime.isIntanceOfHTMLElement(ref) || shadowInit === false ? void 0 : runtime.attachShadow(ref, shadowInit === void 0 || shadowInit === true ? {
9045
- mode: "closed"
9046
- } : shadowInit)
9047
- };
9048
- return this;
9049
- }
9050
- abortApply(runtime) {
9051
- if (!this.state) {
9052
- throw new Error("no meta");
9053
- }
9054
- runtime.clearTimeout(this.state.refreshTimeout);
9055
- if (this.state.abort) {
9056
- this.state.abort.abort("abortApply!");
9057
- }
9058
- this.state.abort = runtime.createAbortController();
9059
- return this.state.abort;
9060
- }
9061
- };
9062
- var DEFAULT_OPTIONS2 = {
9063
- /*shadowInit: {
9064
- mode: "closed"
9065
- },
9066
- asFragment: false*/
9067
- /*shadowInit: false*/
9068
- shadowInit: false,
9069
- asFragment: true
9070
- };
9071
- var defaultOptionsFuse2 = false;
9072
- function getDefaultOptions2() {
9073
- defaultOptionsFuse2 = true;
9074
- return DEFAULT_OPTIONS2;
9075
- }
9076
-
9077
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/jsx.js
9078
- var Fragment3 = /* @__PURE__ */ Symbol("Fragment");
9079
- function createElement2(tag2, attributes, ...children) {
9080
- if (!tag2) {
9081
- throw new Error(`cannot call createElement with [${String(tag2)}] `);
9082
- }
9083
- const isFragment = tag2 === Fragment3;
9084
- const fAsFragment = typeof tag2 === "string" || isFragment ? getDefaultOptions2().asFragment : tag2.asFragment !== void 0 ? tag2.asFragment : getDefaultOptions2().asFragment;
9085
- const tagName = typeof tag2 === "string" ? tag2 : isFragment ? "Fragment" : `${!tag2.name ? "no-name" : tag2.name}-component`.toLowerCase();
9086
- return isFragment ? {
9087
- type: "Fragment",
9088
- children
9089
- } : typeof tag2 === "function" ? {
9090
- type: fAsFragment ? "FragmentComponent" : "Component",
9091
- tagName: !fAsFragment ? tagName : void 0,
9092
- props: attributes ? attributes : /* @__PURE__ */ Object.create(null),
9093
- func: tag2,
9094
- children
9095
- } : {
9096
- type: "Element",
9097
- tagName,
9098
- props: attributes ? attributes : /* @__PURE__ */ Object.create(null),
9099
- children
9100
- };
9101
- }
9102
- var JSX2 = /* @__PURE__ */ Object.create(null);
9103
- var objectDefineProperty3 = Object.defineProperty;
9104
- objectDefineProperty3(JSX2, "createElement", {
9105
- configurable: false,
9106
- enumerable: true,
9107
- writable: false,
9108
- value: createElement2
9109
- });
9110
- objectDefineProperty3(JSX2, "jsxFactory", {
9111
- configurable: false,
9112
- enumerable: true,
9113
- writable: false,
9114
- value: createElement2
9115
- });
9116
- objectDefineProperty3(JSX2, "Fragment", {
9117
- configurable: false,
9118
- enumerable: true,
9119
- writable: false,
9120
- value: Fragment3
9121
- });
9122
- objectDefineProperty3(JSX2, "jsxFragmentFactory", {
9123
- configurable: false,
9124
- enumerable: true,
9125
- writable: false,
9126
- value: Fragment3
9127
- });
9128
- Object.freeze(JSX2);
9129
-
9130
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/types.js
9131
- var CHANGE_TYPES_SET2 = /* @__PURE__ */ new Set(["FragmentComponent", "Component", "Element", "Ref", "Fragment", "ContextProvider"]);
9132
-
9133
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/context-provider.js
9134
- var ContextProvider2 = class extends BaseNode2 {
9135
- constructor(parent) {
9136
- super("ContextProvider", parent);
9137
- }
9138
- create(runtime, options, change, parent, list) {
9139
- if (!change.contextKey) {
9140
- throw new Error("cannot create ContextProvider without contextKey");
9141
- }
9142
- this.contextKey = change.contextKey;
9143
- this.contextValue = change.contextValue;
9144
- this.parent = parent;
9145
- const children = this.calculateChildren(runtime, options, change, list);
9146
- for (const child of children) {
9147
- createNewNodeFromChange2(runtime, options, normalizeChild2(runtime, child), this, list);
9148
- }
9149
- return super.create(runtime, options, change, parent, list);
9150
- }
9151
- update(runtime, options, change, list, initial) {
9152
- this.contextValue = change.contextValue;
9153
- return this;
9154
- }
9155
- };
9156
-
9157
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/fragment.js
9158
- var Fragment4 = class extends BaseNode2 {
9159
- constructor(parent) {
9160
- super("Fragment", parent);
9161
- }
9162
- create(runtime, options, change, parent, list) {
9163
- this.parent = parent;
9164
- const children = this.calculateChildren(runtime, options, change, list);
9165
- for (const child of children) {
9166
- createNewNodeFromChange2(runtime, options, normalizeChild2(runtime, child), this, list);
9167
- }
9168
- super.create(runtime, options, change, parent, list);
9169
- return this;
9170
- }
9171
- };
9172
-
9173
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/component/render.js
9174
- var currentContext2 = null;
9175
- function useConditional2(name) {
9176
- return pushContextCall2(currentContext2, name);
9177
- }
9178
- function useRenderContext2() {
9179
- if (!currentContext2) {
9180
- throw new Error("useContext not in render");
9181
- }
9182
- return currentContext2;
9183
- }
9184
- function renderComponent2(runtime, component, options, list, props, children) {
9185
- try {
9186
- const meta = component.state;
9187
- const func = component.component;
9188
- if (!meta || !func) {
9189
- throw new Error("meta not found!");
9190
- }
9191
- if (meta.conditionalUseDetected) {
9192
- throw new Error("conditional this.use calls detected(4)!");
9193
- }
9194
- const context = {
9195
- calls: [],
9196
- node: component,
9197
- options,
9198
- runtime
9199
- };
9200
- list.push(createUpdateLastRenderArgs2(component, options, runtime, props, children));
9201
- currentContext2 = null;
9202
- currentContext2 = context;
9203
- const output = func(props, children);
9204
- currentContext2 = null;
9205
- if (meta.lastContextCalls && meta.lastContextCalls.length !== context.calls.length) {
9206
- meta.conditionalUseDetected = true;
9207
- throw new Error("conditional this.use calls detected(3)!");
9208
- }
9209
- meta.lastContextCalls = context.calls;
9210
- return [output];
9211
- } catch (e) {
9212
- currentContext2 = null;
9213
- throw e;
9214
- }
9215
- }
9216
- function pushContextCall2(context, name) {
9217
- if (!context) {
9218
- throw new Error("not in render(7)");
9219
- }
9220
- const meta = context.node.state;
9221
- if (!meta) {
9222
- throw new Error("not in render(-1)");
9223
- }
9224
- const callIndex = context.calls.length;
9225
- const key = `${callIndex}-${name}`;
9226
- context.calls.push({
9227
- key
9228
- });
9229
- if (!meta.lastContextCalls) {
9230
- return key;
9231
- }
9232
- if (context.calls > meta.lastContextCalls) {
9233
- meta.conditionalUseDetected = true;
9234
- throw new Error("conditional this.use calls detected(1)!");
9235
- }
9236
- const lastCall = meta.lastContextCalls[callIndex];
9237
- if (lastCall === void 0 || lastCall.key !== key) {
9238
- meta.conditionalUseDetected = true;
9239
- throw new Error("conditional this.use calls detected(2)!");
9240
- }
9241
- return key;
9242
- }
9243
-
9244
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/component-fragment.js
9245
- var FragmentComponent2 = class extends Fragment4 {
9246
- constructor(parent) {
9247
- super(parent);
9248
- this.type = "FragmentComponent";
9249
- }
9250
- create(runtime, options, change, parent, list) {
9251
- if (change.func === void 0) {
9252
- throw new Error("cannot create FragmentFunction without func");
9253
- }
9254
- this.component = change.func;
9255
- const o = {
9256
- asFragment: true
9257
- };
9258
- if (this.component.shadowInit !== void 0) {
9259
- o.shadowInit = this.component.shadowInit;
9260
- }
9261
- this.initComponentState(runtime, o);
9262
- this.parent = parent;
9263
- this.lastRenderArgs = {
9264
- props: change.props,
9265
- children: change.children
9266
- };
9267
- return super.create(runtime, options, change, parent, list);
9268
- }
9269
- calculateChildren(runtime, options, change, list) {
9270
- if (this.component && this.state) {
9271
- list.push(createFlushEffects2(this, options, runtime));
9272
- const out = renderComponent2(runtime, this, options, list, change.props, change.children);
9273
- return out ? out : [];
9274
- } else {
9275
- return change.children ? change.children : [];
9276
- }
9277
- }
9278
- };
9279
-
9280
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/element.js
9281
- var ATTRIBUTES_WITHOUT_VALUE2 = /* @__PURE__ */ new Set([
9282
- "disabled",
9283
- "checked",
9284
- "selected",
9285
- "hidden"
9286
- ]);
9287
- var Element2 = class extends BaseNode2 {
9288
- constructor(parent) {
9289
- super("Element", parent);
9290
- }
9291
- create(runtime, options, change, parent, list) {
9292
- if (change.tagName === void 0) {
9293
- throw new Error("cannot create element without a tagName");
9294
- }
9295
- this.tagName = change.tagName;
9296
- this.ref = runtime.createElement(change.tagName);
9297
- this.parent = parent;
9298
- const children = this.calculateChildren(runtime, options, change, list);
9299
- for (const child of children) {
9300
- createNewNodeFromChange2(runtime, options, normalizeChild2(runtime, child), this, list);
9301
- }
9302
- return super.create(runtime, options, change, parent, list);
9303
- }
9304
- update(runtime, options, change, list, initial) {
9305
- const attributesSet = [];
9306
- let setInnerHTMLFlag = true;
9307
- let setInnerHTML = void 0;
9308
- const attributesRemove = [];
9309
- const listenerChanges = [];
9310
- let refListener = null;
9311
- const changeProps = change.props ? change.props : {};
9312
- const changePropNames = new Set(Object.keys(changeProps));
9313
- const element = this.ref;
9314
- const currentAttributeNames = new Set(element.getAttributeNames());
9315
- for (const changePropName of changePropNames) {
9316
- const changePropValue = changeProps[changePropName];
9317
- if (typeof changePropValue === "function") {
9318
- if (changePropName === "ref") {
9319
- if (!initial) {
9320
- continue;
9321
- } else {
9322
- refListener = changePropValue;
9323
- continue;
9324
- }
9325
- } else if (changePropName.indexOf("on") === 0) {
9326
- const eventName = changePropName.substring("on".length);
9327
- listenerChanges.push({
9328
- eventName,
9329
- listener: changePropValue
9330
- });
9331
- continue;
9332
- } else if (changePropName.indexOf("data-on") === 0) {
9333
- const eventName = changePropName.substring("data-on".length);
9334
- listenerChanges.push({
9335
- eventName,
9336
- listener: changePropValue
9337
- });
9338
- continue;
9339
- }
9340
- continue;
9341
- }
9342
- if (!this.component) {
9343
- if (changePropName === "innerHTML") {
9344
- if (changePropValue !== this.innerHTML) {
9345
- setInnerHTMLFlag = true;
9346
- setInnerHTML = changePropValue;
9347
- }
9348
- continue;
9349
- }
9350
- const attributeName = changePropName === "className" ? "class" : changePropName;
9351
- currentAttributeNames.delete(attributeName);
9352
- const currentAttributeValue = attributeName === "value" ? element.value : attributeName === "checked" ? element.checked : element.getAttribute(attributeName);
9353
- if (typeof changePropValue === "boolean" && ATTRIBUTES_WITHOUT_VALUE2.has(attributeName)) {
9354
- if (attributeName === "checked") {
9355
- if (changePropValue) {
9356
- attributesSet.push({
9357
- name: attributeName,
9358
- value: ""
9359
- });
9360
- } else {
9361
- attributesRemove.push(attributeName);
9362
- }
9363
- } else if (!changePropValue && currentAttributeValue !== null) {
9364
- attributesRemove.push(attributeName);
9365
- } else if (changePropValue && currentAttributeValue === null) {
9366
- attributesSet.push({
9367
- name: attributeName,
9368
- value: ""
9369
- });
9370
- }
9371
- } else {
9372
- const sValue = String(changePropValue);
9373
- if (sValue !== currentAttributeValue) {
9374
- attributesSet.push({
9375
- name: attributeName,
9376
- value: String(changePropValue)
9377
- });
9378
- }
9379
- }
9380
- }
9381
- }
9382
- if (!this.component) {
9383
- if (currentAttributeNames.size > 0) {
9384
- for (const name of currentAttributeNames) {
9385
- attributesRemove.push(name);
9386
- }
9387
- }
9388
- }
9389
- if (this.currentEventListeners.length > 0) {
9390
- list.push(createRemoveListeners2(this, runtime));
9391
- }
9392
- if (attributesRemove.length > 0) {
9393
- list.push(createRemoveAttributesAction2(this, attributesRemove, runtime));
9394
- }
9395
- if (attributesSet.length > 0) {
9396
- list.push(createSetAttributesAction2(this, attributesSet, runtime));
9397
- }
9398
- if (listenerChanges.length > 0) {
9399
- list.push(createUpdateListeners2(this, listenerChanges, runtime));
9400
- }
9401
- if (refListener !== null) {
9402
- list.push(createNotifyRef2(this, refListener, runtime));
9403
- }
9404
- if (setInnerHTMLFlag) {
9405
- list.push(createSetInnerHTMLAction2(this, setInnerHTML, runtime));
9406
- }
9407
- return super.update(runtime, options, change, list);
9408
- }
9409
- };
9410
-
9411
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/component.js
9412
- var Component2 = class extends Element2 {
9413
- constructor(parent) {
9414
- super(parent);
9415
- this.type = "Component";
9416
- }
9417
- create(runtime, options, change, parent, list) {
9418
- if (change.func === void 0) {
9419
- throw new Error("cannot create Function without func");
9420
- }
9421
- if (change.tagName === void 0) {
9422
- throw new Error("cannot create element without a tagName");
9423
- }
9424
- this.component = change.func;
9425
- this.tagName = change.tagName;
9426
- this.ref = runtime.createElement(change.tagName);
9427
- if (this.component) {
9428
- const o = {};
9429
- if (this.component.asFragment !== void 0) {
9430
- o.asFragment = this.component.asFragment;
9431
- }
9432
- if (this.component.shadowInit !== void 0) {
9433
- o.shadowInit = this.component.shadowInit;
9434
- }
9435
- this.initComponentState(runtime, o);
9436
- }
9437
- this.parent = parent;
9438
- const children = this.calculateChildren(runtime, options, change, list);
9439
- for (const child of children) {
9440
- createNewNodeFromChange2(runtime, options, normalizeChild2(runtime, child), this, list);
9441
- }
9442
- this.parent = parent;
9443
- this.update(runtime, options, change, list, true);
9444
- list.push(createAppendAction2(this, runtime));
9445
- this.lastRenderArgs = {
9446
- props: change.props,
9447
- children: change.children
9448
- };
9449
- return this;
9450
- }
9451
- calculateChildren(runtime, options, change, list) {
9452
- if (this.component && this.state) {
9453
- list.push(createFlushEffects2(this, options, runtime));
9454
- const out = renderComponent2(runtime, this, options, list, change.props, change.children);
9455
- return out ? out : [];
9456
- } else {
9457
- return super.calculateChildren(runtime, options, change, list);
9458
- }
9459
- }
9460
- };
9461
-
9462
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/ref.js
9463
- var Ref2 = class extends BaseNode2 {
9464
- constructor(parent) {
9465
- super("Ref", parent);
9466
- }
9467
- create(runtime, options, change, parent, list) {
9468
- if (!change.ref) {
9469
- throw new Error("cannot create ref without ref");
9470
- }
9471
- this.ref = change.ref;
9472
- this.parent = parent;
9473
- list.push(createAppendAction2(this, runtime));
9474
- return this;
9475
- }
9476
- compare(change) {
9477
- return this.type === change.type && this.ref === change.ref && this.component === change.func && this.tagName === change.tagName && this.ref === change.ref;
9478
- }
9479
- };
9480
-
9481
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/text.js
9482
- var Text2 = class extends BaseNode2 {
9483
- constructor(parent) {
9484
- super("Text", parent);
9485
- }
9486
- create(runtime, options, change, parent, list) {
9487
- if (change.textContent === void 0) {
9488
- throw new Error("cannot create text without a textContent");
9489
- }
9490
- this.ref = runtime.createTextNode(change.textContent);
9491
- this.textContent = change.textContent;
9492
- this.parent = parent;
9493
- list.push(createAppendAction2(this, runtime));
9494
- return this;
9495
- }
9496
- update(runtime, options, change, list, initial) {
9497
- if (this.textContent !== change.textContent) {
9498
- list.push(createSetTextAction2(this, change.textContent, runtime));
9499
- }
9500
- return this;
9501
- }
9502
- };
9503
-
9504
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/tree.js
9505
- var Tree2 = class extends BaseNode2 {
9506
- name;
9507
- constructor(name, ref, runtime, shadowInit) {
9508
- super("Fragment", null);
9509
- this.isRoot = true;
9510
- this.parent = null;
9511
- this.ref = ref;
9512
- this.initComponentState(runtime, {
9513
- asFragment: false,
9514
- shadowInit
9515
- });
9516
- this.name = name;
9517
- }
9518
- getName() {
9519
- return this.name;
9520
- }
9521
- };
9522
- function createNewNodeFromChange2(runtime, options, change, parent, list) {
9523
- switch (change.type) {
9524
- case "ContextProvider":
9525
- return new ContextProvider2(parent).create(runtime, options, change, parent, list);
9526
- case "Element":
9527
- return new Element2(parent).create(runtime, options, change, parent, list);
9528
- case "Component":
9529
- return new Component2(parent).create(runtime, options, change, parent, list);
9530
- case "Ref":
9531
- return new Ref2(parent).create(runtime, options, change, parent, list);
9532
- case "Text":
9533
- return new Text2(parent).create(runtime, options, change, parent, list);
9534
- case "Fragment":
9535
- return new Fragment4(parent).create(runtime, options, change, parent, list);
9536
- case "FragmentComponent":
9537
- return new FragmentComponent2(parent).create(runtime, options, change, parent, list);
9538
- default:
9539
- throw new Error(`unsopported change.type = %${change.type}`);
9540
- }
9541
- }
9542
- function normalizeChild2(runtime, c) {
9543
- if (typeof c === "object") {
9544
- if (c instanceof Array) {
9545
- return {
9546
- type: "Fragment",
9547
- children: c
9548
- };
9549
- } else if (runtime.isInstanceofNode(c)) {
9550
- return {
9551
- type: "Ref",
9552
- ref: c
9553
- };
9554
- } else if (c && CHANGE_TYPES_SET2.has(c.type)) {
9555
- return c;
9556
- }
9557
- }
9558
- return {
9559
- type: "Text",
9560
- textContent: String(c)
9561
- };
9562
- }
9563
-
9564
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/diff.js
9565
- function diff2(abortSignal, tree, changes, actions, options, runtime, lo = false) {
9566
- if (changes === void 0 || changes === null || abortSignal.aborted) {
9567
- return actions;
9568
- }
9569
- const currentChildren = tree.children.values();
9570
- let currentChildrenRet = currentChildren.next();
9571
- for (const change of changes) {
9572
- const normalizedChange = normalizeChild2(runtime, change);
9573
- const actualChild = currentChildrenRet.value;
9574
- if (actualChild === void 0) {
9575
- createNewNodeFromChange2(runtime, options, normalizedChange, tree, actions);
9576
- } else if (!actualChild.compare(normalizedChange)) {
9577
- currentChildrenRet = removeFrom2(runtime, currentChildren, currentChildrenRet, actions, options);
9578
- createNewNodeFromChange2(runtime, options, normalizedChange, tree, actions);
9579
- } else {
9580
- actualChild.update(runtime, options, normalizedChange, actions);
9581
- if (actualChild.type === "Fragment" || actualChild.type === "FragmentComponent" || actualChild.type === "ContextProvider") {
9582
- const fragmentActions = [];
9583
- diff2(abortSignal, actualChild, actualChild.calculateChildren(runtime, options, normalizedChange, fragmentActions), fragmentActions, options, runtime, true);
9584
- if (areActionDestructive2(fragmentActions)) {
9585
- currentChildrenRet = currentChildren.next();
9586
- currentChildrenRet = removeFrom2(runtime, currentChildren, currentChildrenRet, actions, options);
9587
- }
9588
- actions.push(...fragmentActions);
9589
- } else {
9590
- diff2(abortSignal, actualChild, actualChild.calculateChildren(runtime, options, normalizedChange, actions), actions, options, runtime);
9591
- }
9592
- }
9593
- currentChildrenRet = currentChildren.next();
9594
- }
9595
- currentChildrenRet = removeFrom2(runtime, currentChildren, currentChildrenRet, actions, options);
9596
- return actions;
9597
- }
9598
- function removeFrom2(runtime, nodeIterator, nodeIteratorRet, currentActions, options) {
9599
- while (nodeIteratorRet.value !== void 0) {
9600
- nodeIteratorRet.value.remove(runtime, options, currentActions);
9601
- nodeIteratorRet = nodeIterator.next();
9602
- }
9603
- return nodeIteratorRet;
9604
- }
9605
- function areActionDestructive2(actions) {
9606
- for (const fragmentAction of actions) {
9607
- if (fragmentAction.isDestructive) {
9608
- return true;
9609
- }
9610
- }
9611
- return false;
9612
- }
9613
-
9614
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/execute.js
9615
- function execute2(abortSignal, runtime, actions) {
9616
- if (abortSignal.aborted) {
9617
- return 0;
9618
- }
9619
- let changes = 0;
9620
- const postExecute = [];
9621
- for (const action of actions) {
9622
- try {
9623
- if (action.execute) {
9624
- const actionChanges = action.execute();
9625
- changes += actionChanges;
9626
- }
9627
- if (action.postExecute) {
9628
- postExecute.push(action);
9629
- }
9630
- } catch (e) {
9631
- error2(runtime, e);
9632
- throw e;
9633
- }
9634
- }
9635
- for (const action of postExecute) {
9636
- try {
9637
- const actionChanges = action.postExecute();
9638
- changes += actionChanges;
9639
- } catch (e) {
9640
- error2(runtime, e);
9641
- throw e;
9642
- }
9643
- }
9644
- return changes;
9645
- }
9646
-
9647
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/render.js
9648
- function render2(runtime, tree, treeOptions, change, preActions = [], props, children) {
9649
- const meta = tree.state;
9650
- if (!meta) {
9651
- throw new Error("cannot find meta");
9652
- }
9653
- const abortSignal = tree.abortApply(runtime).signal;
9654
- debug2(runtime, "render for [%s]", tree.getName());
9655
- if (tree.isRoot || tree.parent !== null) {
9656
- const applyStart = Date.now();
9657
- const out = change instanceof Array ? change : change === true ? renderComponent2(runtime, tree, treeOptions, preActions, props, children) : void 0;
9658
- const changes = execute2(abortSignal, runtime, diff2(abortSignal, tree, out, preActions, treeOptions, runtime));
9659
- const took = Date.now() - applyStart;
9660
- if (took > 5e3) {
9661
- error2(runtime, "render for [%s] with [%s] changes took [%s]ms", tree.getName(), changes, took);
9662
- } else {
9663
- debug2(runtime, "render for [%s] with [%s] changes took [%s]ms", tree.getName(), changes, took);
9664
- }
9665
- return changes;
9666
- } else {
9667
- debug2(runtime, "render skipped for [%s]", tree.getName());
9668
- return 0;
9669
- }
9670
- }
9671
-
9672
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/component/container.js
9673
- var objectDefineProperty4 = Object.defineProperty;
9674
- function createContainer2(element, runtime, args) {
9675
- const name = `DOMContainer [${String(element)}]`;
9676
- const tree = new Tree2(name, element, runtime, args?.shadowInit);
9677
- const treeOptions = args && args.runtimeOptions ? {
9678
- disableEffects: false,
9679
- disableRefListener: false,
9680
- disableRefresh: false,
9681
- disableEvents: false,
9682
- ...args.runtimeOptions
9683
- } : {
9684
- disableEffects: false,
9685
- disableRefListener: false,
9686
- disableRefresh: false,
9687
- disableEvents: false
9688
- };
9689
- const container = /* @__PURE__ */ Object.create(null);
9690
- objectDefineProperty4(container, "name", {
9691
- configurable: false,
9692
- enumerable: true,
9693
- writable: false,
9694
- value: name
9695
- });
9696
- objectDefineProperty4(container, "render", {
9697
- configurable: false,
9698
- enumerable: true,
9699
- writable: false,
9700
- value: function render3(out) {
9701
- return render2(runtime, tree, treeOptions, [out]);
9702
- }
9703
- });
9704
- objectDefineProperty4(container, "disconnect", {
9705
- configurable: false,
9706
- enumerable: true,
9707
- writable: false,
9708
- value: function disconnect() {
9709
- return render2(runtime, tree, treeOptions, []);
9710
- }
9711
- });
9712
- Object.freeze(container);
9713
- return container;
9714
- }
9715
-
9716
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/hooks/runtime.js
9717
- function useRuntime2() {
9718
- useConditional2("useRuntime");
9719
- const currentContext3 = useRenderContext2();
9720
- if (!currentContext3) {
9721
- throw new Error("useRuntime not in render");
9722
- }
9723
- return currentContext3.runtime;
9724
- }
9725
-
9726
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/hooks/refresh.js
9727
- var REFRESH_TIMEOUT_MS2 = 0;
9728
- function useRefresh2() {
9729
- useConditional2("useRefresh");
9730
- const currentContext3 = useRenderContext2();
9731
- if (!currentContext3) {
9732
- throw new Error("useRefresh not in render");
9733
- }
9734
- const meta = currentContext3.node.state;
9735
- if (!meta) {
9736
- throw new Error("useRefresh without meta");
9737
- }
9738
- const runtime = useRuntime2();
9739
- const options = currentContext3.options;
9740
- const node = currentContext3.node;
9741
- const component = node.component;
9742
- if (!component) {
9743
- throw new Error("useRefresh without func");
9744
- }
9745
- return (cb) => {
9746
- runtime.clearTimeout(meta.refreshTimeout);
9747
- if (options.disableRefresh) {
9748
- debug2(runtime, "useRefresh.refresh() disabled for [%s]", component.name);
9749
- } else {
9750
- meta.refreshTimeout = runtime.setTimeout(() => {
9751
- debug2(runtime, "useRefresh.refresh() for [%s]", component.name);
9752
- const props = node.lastRenderArgs.props;
9753
- const children = node.lastRenderArgs.children;
9754
- const changes = render2(runtime, node, options, true, [createFlushEffects2(node, options, runtime)], props, children);
9755
- if (cb) {
9756
- runtime.setTimeout(() => cb(changes), 0);
9757
- }
9758
- }, REFRESH_TIMEOUT_MS2);
9759
- }
9760
- };
9761
- }
9762
-
9763
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/hooks/state.js
9764
- function useState2(defaultValue) {
9765
- const key = useConditional2("useState");
9766
- const currentContext3 = useRenderContext2();
9767
- if (!currentContext3) {
9768
- throw new Error("useState not in render");
9769
- }
9770
- const refresh = useRefresh2();
9771
- const meta = currentContext3.node.state;
9772
- const runtime = useRuntime2();
9773
- if (!meta) {
9774
- throw new Error("useState without meta");
9775
- }
9776
- if (!meta.state) {
9777
- meta.state = /* @__PURE__ */ Object.create(null);
9778
- }
9779
- if (!meta.state) {
9780
- throw new Error("useState without meta.state");
9781
- }
9782
- const name = currentContext3.node.component?.name;
9783
- const currentStateItem = meta.state[key];
9784
- if (currentStateItem === void 0) {
9785
- const stateItem = {
9786
- value: defaultValue,
9787
- set: (newValue, refreshOnSet = true) => {
9788
- debug2(runtime, "setState() for [%s]", name);
9789
- if (stateItem.value !== newValue) {
9790
- stateItem.value = newValue;
9791
- if (refreshOnSet) {
9792
- refresh(typeof refreshOnSet === "function" ? refreshOnSet : void 0);
9793
- }
9794
- }
9795
- },
9796
- get: () => {
9797
- return stateItem.value;
9798
- }
9799
- };
9800
- meta.state[key] = stateItem;
9801
- return [
9802
- stateItem.value,
9803
- stateItem.set,
9804
- stateItem.get
9805
- ];
9806
- } else {
9807
- return [
9808
- currentStateItem.value,
9809
- currentStateItem.set,
9810
- currentStateItem.get
9811
- ];
9812
- }
9813
- }
9814
-
9815
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/hooks/effect.js
9816
- function useEffect2(effect, condition) {
9817
- const currentContext3 = useRenderContext2();
9818
- if (!currentContext3) {
9819
- throw new Error("useEffect not in render");
9820
- }
9821
- const key = useConditional2("useEffect");
9822
- const meta = currentContext3.node.state;
9823
- if (!meta) {
9824
- throw new Error("useEffect without meta");
9825
- }
9826
- const c = condition ? condition : false;
9827
- if (meta.effectConditions[key] === void 0 || condition === void 0 && meta.effectConditions[key] === false || !equalArray2(meta.effectConditions[key], c)) {
9828
- meta.effectConditions[key] = c;
9829
- const oldCallback = meta.effectQueueCallbacks[key];
9830
- delete meta.effectQueueCallbacks[key];
9831
- if (meta.effectCallbacks[key]) {
9832
- meta.conditionalUseDetected = true;
9833
- throw new Error("invalid state. component lock.");
9834
- }
9835
- if (oldCallback) {
9836
- meta.effectCallbacks[key] = oldCallback;
9837
- }
9838
- meta.effects[key] = effect;
9839
- }
9840
- }
9841
- function equalArray2(a, c) {
9842
- if (typeof a !== typeof c) {
9843
- return false;
9844
- }
9845
- if (typeof a === "undefined" || typeof a === "boolean") {
9846
- return a === c;
9847
- }
9848
- const l1 = a;
9849
- const l2 = c;
9850
- if (l1.length !== l2.length) {
9851
- return false;
9852
- }
9853
- for (let i = 0; i < l1.length; i++) {
9854
- if (l1[i] !== l2[i]) {
9855
- return false;
9856
- }
9857
- }
9858
- return true;
9859
- }
9860
-
9861
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/hooks/pathname.js
9862
- function usePathname2() {
9863
- const runtime = useRuntime2();
9864
- const pathname = runtime.getLocation().pathname;
9865
- const [currentLocation, setCurrentLocation, getL] = useState2(pathname);
9866
- debug2(runtime, "usePathname [%s]", currentLocation);
9867
- useEffect2(function usePathnameEffect() {
9868
- const listener = () => {
9869
- const newLocation = runtime.getLocation().pathname;
9870
- setCurrentLocation(newLocation);
9871
- };
9872
- runtime.addPathListener(listener);
9873
- return function usePathnameEffectUnLoad() {
9874
- runtime.removePathListener(listener);
9875
- };
9876
- }, []);
9877
- return String(currentLocation);
9878
- }
9879
-
9880
- // ../jsx-node/node_modules/@miqro/jsx/build/esm/component/router.js
9881
- function useIsLocationPathNameActive2(path) {
9882
- useConditional2("useIsLocationPathNameMatch");
9883
- const runtime = useRuntime2();
9884
- const basePath = runtime.getBasePath();
9885
- return isPathLocation2(basePath, path, usePathname2());
9886
- }
9887
- function Router2(props) {
9888
- const defaultElement = props.defaultElement;
9889
- const locationPathName = usePathname2();
9890
- const runtime = useRuntime2();
9891
- const active = getActiveRoute2(locationPathName, props.routes, runtime);
9892
- return active ? active.element : defaultElement;
9893
- }
9894
- Router2.asFragment = true;
9895
- Router2.shadowInit = false;
9896
- function Link2(props, children) {
9897
- const path = props.path;
9898
- const runtime = useRuntime2();
9899
- const basePath = runtime.getBasePath();
9900
- const className = props.className ? props.className : "";
9901
- const activeClass = props.classNameActive ? props.classNameActive : "active";
9902
- const inactiveClass = props.classNameInactive ? props.classNameInactive : "inactive";
9903
- const isActive = useIsLocationPathNameActive2(path);
9904
- const newClassName = `${className ? `${className} ` : ""}${isActive ? activeClass : inactiveClass}`;
9905
- const fullPath = getFullPath2(basePath, path);
9906
- const element = {
9907
- type: "Element",
9908
- tagName: "a",
9909
- props: {
9910
- class: newClassName,
9911
- href: fullPath
9912
- },
9913
- children
9914
- };
9915
- return props.disableHandler ? element : {
9916
- ...element,
9917
- props: {
9918
- ...element.props,
9919
- onclick: (ev) => {
9920
- ev.preventDefault();
9921
- runtime.pushPath(fullPath);
9922
- }
9923
- }
9924
- };
9925
- }
9926
- Link2.asFragment = true;
9927
- Link2.shadowInit = false;
9928
- function getFullPath2(basePath, p) {
9929
- return normalizePath2(`${basePath ? basePath : ""}${p}`);
9930
- }
9931
- function isPathLocation2(basePath, p, currentLocation) {
9932
- const path = getFullPath2(basePath, p);
9933
- const pathname = normalizePath2(currentLocation);
9934
- return pathname.toLocaleLowerCase() === path.toLowerCase();
9935
- }
9936
- function getActiveRoute2(locationPathName, routes, runtime) {
9937
- let activeRoute;
9938
- const basePath = runtime.getBasePath() ? runtime.getBasePath() : "";
9939
- for (const route of routes) {
9940
- if (isPathLocation2(basePath, route.path, locationPathName)) {
9941
- activeRoute = route;
9942
- break;
9943
- }
9944
- }
9945
- return activeRoute;
9946
- }
9947
- function normalizePath2(path) {
9948
- if (path.length > 1 && path.charAt(path.length - 1) === "/") {
9949
- path = path.substring(0, path.length - 1);
9950
- }
9951
- return path;
9952
- }
9953
-
9954
- // ../jsx-node/build/esm/runtime.js
8675
+ // node_modules/@miqro/jsx-node/build/esm/runtime.js
9955
8676
  var import_events = require("events");
9956
8677
  var SELF_CLOSING_TAGS = /* @__PURE__ */ new Set([
9957
8678
  "area",
@@ -10240,7 +8961,7 @@ function runtimeDefine(runtime, tagName, component, options) {
10240
8961
  props[name] = self.getAttribute(name);
10241
8962
  }
10242
8963
  props["$element$"] = self;
10243
- container.render(createElement2(component, props, originalChildNodes));
8964
+ container.render(createElement(component, props, originalChildNodes));
10244
8965
  }
10245
8966
  disconnectedCallback() {
10246
8967
  const container = containerMap.get(this);
@@ -10264,7 +8985,7 @@ function runtimeDefine(runtime, tagName, component, options) {
10264
8985
  props[name] = self.getAttribute(name);
10265
8986
  }
10266
8987
  props["$element$"] = self;
10267
- container.render(createElement2(component, props, originalChildNodes));
8988
+ container.render(createElement(component, props, originalChildNodes));
10268
8989
  }
10269
8990
  reCalculateOriginalChildren() {
10270
8991
  if (originalChildNodesMap.has(this)) {
@@ -10325,7 +9046,7 @@ function createNodeRuntime(options) {
10325
9046
  return runtime._activeElement;
10326
9047
  },
10327
9048
  createContainer: (element, options2) => {
10328
- return createContainer2(element, runtime, options2);
9049
+ return createContainer(element, runtime, options2);
10329
9050
  },
10330
9051
  getElementById: (id) => {
10331
9052
  return elementByIdMap[id] ? elementByIdMap[id] : null;
@@ -11649,17 +10370,17 @@ async function sqlite3Executor(config) {
11649
10370
  transformOutput: sqliteTransformOutput,
11650
10371
  query: async function sqlite3Executor2(sql, values) {
11651
10372
  return new Promise((resolve24, reject) => {
11652
- const st = driver.prepare(sql, values, function(error3) {
11653
- if (error3) {
11654
- reject(error3);
10373
+ const st = driver.prepare(sql, values, function(error2) {
10374
+ if (error2) {
10375
+ reject(error2);
11655
10376
  } else {
11656
- st.all(function(error4, rows) {
11657
- if (error4) {
11658
- reject(error4);
10377
+ st.all(function(error3, rows) {
10378
+ if (error3) {
10379
+ reject(error3);
11659
10380
  } else {
11660
- st.finalize((error5) => {
11661
- if (error5) {
11662
- reject(error5);
10381
+ st.finalize((error4) => {
10382
+ if (error4) {
10383
+ reject(error4);
11663
10384
  } else {
11664
10385
  resolve24(rows);
11665
10386
  }
@@ -12954,7 +11675,7 @@ var ClusterWebSocketServer2 = class extends WebSocketServer {
12954
11675
  return options.validate ? options.validate(req) : true;
12955
11676
  }
12956
11677
  },
12957
- onError: (req, error3) => {
11678
+ onError: (req, error2) => {
12958
11679
  if (process.send) {
12959
11680
  process.send({
12960
11681
  type: ClusterWebSocketServer2MessageType,
@@ -12962,13 +11683,13 @@ var ClusterWebSocketServer2 = class extends WebSocketServer {
12962
11683
  target: this.name,
12963
11684
  clientUUID: req.uuid,
12964
11685
  fromPID: String(process.pid),
12965
- errorMessage: error3.message
11686
+ errorMessage: error2.message
12966
11687
  });
12967
11688
  }
12968
- this.logger?.error("[%s] error from (%s) error [%s]", req.uuid, req.req.socket.remoteAddress, error3);
12969
- this.logger?.error(error3);
11689
+ this.logger?.error("[%s] error from (%s) error [%s]", req.uuid, req.req.socket.remoteAddress, error2);
11690
+ this.logger?.error(error2);
12970
11691
  if (options.onError) {
12971
- options.onError(req, error3);
11692
+ options.onError(req, error2);
12972
11693
  }
12973
11694
  },
12974
11695
  onConnection: (req) => {
@@ -13658,7 +12379,7 @@ var LogProvider = class {
13658
12379
  try {
13659
12380
  const url = newURL2(req.url ? req.url : "/");
13660
12381
  query = url.searchParams.toString();
13661
- path = normalizePath3(url.pathname);
12382
+ path = normalizePath2(url.pathname);
13662
12383
  method = req.method ? req.method.toUpperCase() : "GET";
13663
12384
  remoteAddress = req.socket.remoteAddress;
13664
12385
  } catch (e) {
@@ -13979,7 +12700,7 @@ function getRoutes(prePath, defaultPath, apiOptions) {
13979
12700
  inflatePath: p !== "/" ? (0, import_node_path9.join)(prePath, p) : defaultInflatePath,
13980
12701
  defaultInflatePath,
13981
12702
  method: m.toLocaleLowerCase() !== "use" ? m.toUpperCase() : void 0,
13982
- path: normalizePath3((0, import_node_path9.join)(prePath, p))
12703
+ path: normalizePath2((0, import_node_path9.join)(prePath, p))
13983
12704
  });
13984
12705
  }
13985
12706
  }
@@ -14092,7 +12813,7 @@ async function setupError(logger, servicePath, service, mainRouter, inflateDir,
14092
12813
 
14093
12814
  // src/inflate/setup-http.ts
14094
12815
  async function setupHTTPRouter(importOptions, inflateOptions, server, logger, hotreload, servicePath, service, routeFileMap, staticFileMap, inflateDir, inflateSea, errors, inflateParallel) {
14095
- const mainRouter = new Router3();
12816
+ const mainRouter = new Router2();
14096
12817
  const apiRouterPath = getHTTPRouterPath(servicePath);
14097
12818
  let middlewareConfig = null;
14098
12819
  await setupError(logger, servicePath, service, mainRouter, inflateDir, inflateSea, importOptions, errors);
@@ -14130,7 +12851,7 @@ async function createStaticRoute(inflateJSXOptions, service, logger, router, dir
14130
12851
  routeFileMap[file.filePath] = {
14131
12852
  routes: [{
14132
12853
  method: "GET",
14133
- path: normalizePath3(path)
12854
+ path: normalizePath2(path)
14134
12855
  }],
14135
12856
  service,
14136
12857
  filePath: file.filePath,
@@ -14154,7 +12875,7 @@ async function createStaticRoute(inflateJSXOptions, service, logger, router, dir
14154
12875
  filePath: file.filePath,
14155
12876
  previewMethod: "html",
14156
12877
  method: "GET",
14157
- path: normalizePath3(path),
12878
+ path: normalizePath2(path),
14158
12879
  body: Buffer.from(body),
14159
12880
  inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path) : void 0
14160
12881
  };
@@ -14196,7 +12917,7 @@ async function createStaticRoute(inflateJSXOptions, service, logger, router, dir
14196
12917
  });
14197
12918
  }
14198
12919
  async function createStaticRouterFromDirectory(inflateOptions, service, logger, dir, inflateDir, routeFileMap, staticFileMap, inflateParallel) {
14199
- const router = new Router3();
12920
+ const router = new Router2();
14200
12921
  const maxParallel = inflateParallel ? inflateParallel : 1;
14201
12922
  logger.debug("loading static directory with parallel [%s]", maxParallel);
14202
12923
  let tR = [];
@@ -14215,7 +12936,7 @@ async function createStaticRouterFromDirectory(inflateOptions, service, logger,
14215
12936
  return router;
14216
12937
  }
14217
12938
  async function createRouterFromDirectory(importOptions, inflateJSXOptions, server, hotreload, service, logger, dir, errors = [], routeFileMap = {}, staticFileMap = null, inflateDir, inflateSea, inflateParallel) {
14218
- const router = new Router3();
12939
+ const router = new Router2();
14219
12940
  const maxParallel = inflateParallel ? inflateParallel : 1;
14220
12941
  server.logger.debug("loading http directory with parallel [%s]", maxParallel);
14221
12942
  let tR = [];
@@ -15327,7 +14048,7 @@ async function inflateApp({ inflateParallel, serverInterface, logger, hotreload,
15327
14048
  const errors = [];
15328
14049
  let routeFileMap = {};
15329
14050
  const wsConfigList = [];
15330
- const router = new Router3();
14051
+ const router = new Router2();
15331
14052
  const logConfigMap = {};
15332
14053
  for (const service of services) {
15333
14054
  const serviceRouteFileMap = {};
@@ -15491,8 +14212,8 @@ var server_default = {
15491
14212
  init_lib3();
15492
14213
  init_constants();
15493
14214
  async function createEditorRouter(adminInterface) {
15494
- const router = new Router3();
15495
- const innerRouter = new Router3();
14215
+ const router = new Router2();
14216
+ const innerRouter = new Router2();
15496
14217
  innerRouter.use(async (req, res) => {
15497
14218
  res.setHeader("x-uuid", req.uuid);
15498
14219
  req.editor = adminInterface;
@@ -15666,13 +14387,13 @@ function setupExitHandlers(app) {
15666
14387
  }
15667
14388
  process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
15668
14389
  });
15669
- process.on("exit", async function(code) {
14390
+ process.on("exit", function(code) {
15670
14391
  if (exceptionOccured) {
15671
14392
  app.logger?.error("Exception occured");
15672
14393
  } else {
15673
14394
  cleanJSX(app);
15674
14395
  if (app.server) {
15675
- await app.stop();
14396
+ app.stop();
15676
14397
  }
15677
14398
  }
15678
14399
  });
@@ -18789,7 +17510,7 @@ var Miqro = class _Miqro {
18789
17510
  }
18790
17511
  this.inflated = void 0;
18791
17512
  this.inflated = {
18792
- router: inflated && inflated.router ? inflated.router : new Router3(),
17513
+ router: inflated && inflated.router ? inflated.router : new Router2(),
18793
17514
  errors: inflated && inflated.errors ? inflated.errors : [],
18794
17515
  fileMap: inflated && inflated.fileMap ? inflated.fileMap : {},
18795
17516
  logConfigMap: inflated && inflated.logConfigMap ? inflated.logConfigMap : {},
@@ -18876,7 +17597,7 @@ var Miqro = class _Miqro {
18876
17597
  _Miqro.initAssetsPromise = initAssets(this.logger);
18877
17598
  }
18878
17599
  await _Miqro.initAssetsPromise;
18879
- const router = new Router3();
17600
+ const router = new Router2();
18880
17601
  const wsConfigList = [];
18881
17602
  const { dbList, errors: dbConfigErrors } = await this.loadDBConfig(options);
18882
17603
  await Promise.all(dbList.map((db) => this.dbManager.setupDB(db.dbConfig)));
@@ -18895,7 +17616,7 @@ var Miqro = class _Miqro {
18895
17616
  path: HOT_RELOAD_PATH
18896
17617
  });
18897
17618
  this.logger?.debug("setting up hot-reload script on [%s]", HOT_RELOAD_SCRIPT_PATH);
18898
- const hotReloadScriptRouter = new Router3();
17619
+ const hotReloadScriptRouter = new Router2();
18899
17620
  hotReloadScriptRouter.get(HOT_RELOAD_SCRIPT_PATH, async (req, res) => res.js(HOT_RELOAD_JS_SCRIPT));
18900
17621
  router.use(hotReloadScriptRouter);
18901
17622
  }
@@ -19214,7 +17935,7 @@ async function appendAPIModule(router, dir, filePath, module2) {
19214
17935
 
19215
17936
  // src/lib.ts
19216
17937
  init_lib3();
19217
- var JSX3 = {
17938
+ var JSX2 = {
19218
17939
  createElement: (...args) => {
19219
17940
  const ret = createElement(...args);
19220
17941
  ret.toString = () => jsx2HTML(ret);