@limno/core 0.1.12 → 0.1.14

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.cjs CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ FRAME_FOCUS_GUARD: () => FRAME_FOCUS_GUARD,
33
34
  ROUTE: () => ROUTE,
34
35
  SOURCE_FILES: () => SOURCE_FILES,
35
36
  TEMPLATE_FILES: () => TEMPLATE_FILES,
@@ -974,6 +975,7 @@ data: ${JSON.stringify(data)}
974
975
  let watcher = null;
975
976
  let watchedIno = -1;
976
977
  let debounce;
978
+ const pending = /* @__PURE__ */ new Set();
977
979
  function startWatching() {
978
980
  watcher?.close();
979
981
  watcher = null;
@@ -981,10 +983,13 @@ data: ${JSON.stringify(data)}
981
983
  watchedIno = (0, import_node_fs4.statSync)(folder).ino;
982
984
  watcher = (0, import_node_fs4.watch)(folder, (_event, name) => {
983
985
  if (!name || name.endsWith(".tmp")) return;
986
+ pending.add(String(name));
984
987
  clearTimeout(debounce);
985
988
  debounce = setTimeout(() => {
986
- if (name === "changeset.json") onChangeSetFile();
987
- if (name === "agent.json") pushAgent();
989
+ const names = new Set(pending);
990
+ pending.clear();
991
+ if (names.has("changeset.json")) onChangeSetFile();
992
+ if (names.has("agent.json")) pushAgent();
988
993
  }, 40);
989
994
  });
990
995
  watcher.unref?.();
@@ -1221,8 +1226,12 @@ var SOURCE_FILES = /\.(jsx|tsx|js|mjs)$/;
1221
1226
  function shouldStamp(file, include = SOURCE_FILES) {
1222
1227
  return include.test(file) && !/[\\/]node_modules[\\/]/.test(file) && !file.startsWith("\0");
1223
1228
  }
1229
+
1230
+ // src/frameGuard.ts
1231
+ var FRAME_FOCUS_GUARD = `(function(){if(window.name!=="limno-frame"||window.__limnoGuard)return;window.__limnoGuard=true;var g=function(e){if(!window.__limnoHoldFocus||e.relatedTarget)return;e.stopImmediatePropagation();};window.addEventListener("blur",g,true);window.addEventListener("focusout",g,true);document.addEventListener("visibilitychange",function(e){if(window.__limnoHoldFocus)e.stopImmediatePropagation();},true);})();`;
1224
1232
  // Annotate the CommonJS export names for ESM import in node:
1225
1233
  0 && (module.exports = {
1234
+ FRAME_FOCUS_GUARD,
1226
1235
  ROUTE,
1227
1236
  SOURCE_FILES,
1228
1237
  TEMPLATE_FILES,
package/dist/index.d.cts CHANGED
@@ -136,4 +136,14 @@ interface RunnerInfo {
136
136
  */
137
137
  declare function isLocalRequest(req: IncomingMessage): boolean;
138
138
 
139
- export { type AgentStatus, type LimnoServer, type LimnoService, type LimnoServiceOptions, ROUTE, type RunnerAgent, type RunnerAgentId, type RunnerInfo, type RunnerLogEntry, type RunnerState, SOURCE_FILES, TEMPLATE_FILES, createLimnoService, isLocalRequest, overlayFile, shouldStamp, stampSource, stampTemplate, startServer };
139
+ /**
140
+ * A tiny inline script for the top of the page, ahead of the app's own code. Inside Limno's
141
+ * edit frame only, while the overlay is selecting or commenting (`__limnoHoldFocus`), it keeps
142
+ * "the page lost focus" from the app: an open menu, popover or select then stays open while it's
143
+ * edited, and through tab or app switches. Window listeners run in the order they were added, so
144
+ * this has to be registered before the app's; the overlay installs the same guard later as a
145
+ * fallback (and skips it when this one is there).
146
+ */
147
+ declare const FRAME_FOCUS_GUARD = "(function(){if(window.name!==\"limno-frame\"||window.__limnoGuard)return;window.__limnoGuard=true;var g=function(e){if(!window.__limnoHoldFocus||e.relatedTarget)return;e.stopImmediatePropagation();};window.addEventListener(\"blur\",g,true);window.addEventListener(\"focusout\",g,true);document.addEventListener(\"visibilitychange\",function(e){if(window.__limnoHoldFocus)e.stopImmediatePropagation();},true);})();";
148
+
149
+ export { type AgentStatus, FRAME_FOCUS_GUARD, type LimnoServer, type LimnoService, type LimnoServiceOptions, ROUTE, type RunnerAgent, type RunnerAgentId, type RunnerInfo, type RunnerLogEntry, type RunnerState, SOURCE_FILES, TEMPLATE_FILES, createLimnoService, isLocalRequest, overlayFile, shouldStamp, stampSource, stampTemplate, startServer };
package/dist/index.d.ts CHANGED
@@ -136,4 +136,14 @@ interface RunnerInfo {
136
136
  */
137
137
  declare function isLocalRequest(req: IncomingMessage): boolean;
138
138
 
139
- export { type AgentStatus, type LimnoServer, type LimnoService, type LimnoServiceOptions, ROUTE, type RunnerAgent, type RunnerAgentId, type RunnerInfo, type RunnerLogEntry, type RunnerState, SOURCE_FILES, TEMPLATE_FILES, createLimnoService, isLocalRequest, overlayFile, shouldStamp, stampSource, stampTemplate, startServer };
139
+ /**
140
+ * A tiny inline script for the top of the page, ahead of the app's own code. Inside Limno's
141
+ * edit frame only, while the overlay is selecting or commenting (`__limnoHoldFocus`), it keeps
142
+ * "the page lost focus" from the app: an open menu, popover or select then stays open while it's
143
+ * edited, and through tab or app switches. Window listeners run in the order they were added, so
144
+ * this has to be registered before the app's; the overlay installs the same guard later as a
145
+ * fallback (and skips it when this one is there).
146
+ */
147
+ declare const FRAME_FOCUS_GUARD = "(function(){if(window.name!==\"limno-frame\"||window.__limnoGuard)return;window.__limnoGuard=true;var g=function(e){if(!window.__limnoHoldFocus||e.relatedTarget)return;e.stopImmediatePropagation();};window.addEventListener(\"blur\",g,true);window.addEventListener(\"focusout\",g,true);document.addEventListener(\"visibilitychange\",function(e){if(window.__limnoHoldFocus)e.stopImmediatePropagation();},true);})();";
148
+
149
+ export { type AgentStatus, FRAME_FOCUS_GUARD, type LimnoServer, type LimnoService, type LimnoServiceOptions, ROUTE, type RunnerAgent, type RunnerAgentId, type RunnerInfo, type RunnerLogEntry, type RunnerState, SOURCE_FILES, TEMPLATE_FILES, createLimnoService, isLocalRequest, overlayFile, shouldStamp, stampSource, stampTemplate, startServer };
package/dist/index.js CHANGED
@@ -925,6 +925,7 @@ data: ${JSON.stringify(data)}
925
925
  let watcher = null;
926
926
  let watchedIno = -1;
927
927
  let debounce;
928
+ const pending = /* @__PURE__ */ new Set();
928
929
  function startWatching() {
929
930
  watcher?.close();
930
931
  watcher = null;
@@ -932,10 +933,13 @@ data: ${JSON.stringify(data)}
932
933
  watchedIno = statSync(folder).ino;
933
934
  watcher = watch(folder, (_event, name) => {
934
935
  if (!name || name.endsWith(".tmp")) return;
936
+ pending.add(String(name));
935
937
  clearTimeout(debounce);
936
938
  debounce = setTimeout(() => {
937
- if (name === "changeset.json") onChangeSetFile();
938
- if (name === "agent.json") pushAgent();
939
+ const names = new Set(pending);
940
+ pending.clear();
941
+ if (names.has("changeset.json")) onChangeSetFile();
942
+ if (names.has("agent.json")) pushAgent();
939
943
  }, 40);
940
944
  });
941
945
  watcher.unref?.();
@@ -1172,7 +1176,11 @@ var SOURCE_FILES = /\.(jsx|tsx|js|mjs)$/;
1172
1176
  function shouldStamp(file, include = SOURCE_FILES) {
1173
1177
  return include.test(file) && !/[\\/]node_modules[\\/]/.test(file) && !file.startsWith("\0");
1174
1178
  }
1179
+
1180
+ // src/frameGuard.ts
1181
+ var FRAME_FOCUS_GUARD = `(function(){if(window.name!=="limno-frame"||window.__limnoGuard)return;window.__limnoGuard=true;var g=function(e){if(!window.__limnoHoldFocus||e.relatedTarget)return;e.stopImmediatePropagation();};window.addEventListener("blur",g,true);window.addEventListener("focusout",g,true);document.addEventListener("visibilitychange",function(e){if(window.__limnoHoldFocus)e.stopImmediatePropagation();},true);})();`;
1175
1182
  export {
1183
+ FRAME_FOCUS_GUARD,
1176
1184
  ROUTE,
1177
1185
  SOURCE_FILES,
1178
1186
  TEMPLATE_FILES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limno/core",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Limno's framework-neutral dev tooling: JSX source stamping, the change-set store and the endpoints the editor talks to.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "type": "module",
@@ -37,9 +37,9 @@
37
37
  "dependencies": {
38
38
  "@babel/parser": "^7.29.0",
39
39
  "@babel/traverse": "^7.29.0",
40
- "@limno/mcp": "0.1.6",
41
- "@limno/overlay": "0.1.12",
42
- "@limno/spec": "0.1.6",
40
+ "@limno/mcp": "0.1.8",
41
+ "@limno/overlay": "0.1.14",
42
+ "@limno/spec": "0.1.8",
43
43
  "launch-editor": "^2.14.1",
44
44
  "magic-string": "^0.30.17"
45
45
  },