aeo.js 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +132 -17
  2. package/dist/angular.d.mts +29 -0
  3. package/dist/angular.d.ts +29 -0
  4. package/dist/angular.js +1314 -0
  5. package/dist/angular.js.map +1 -0
  6. package/dist/angular.mjs +1310 -0
  7. package/dist/angular.mjs.map +1 -0
  8. package/dist/astro.d.mts +8 -2
  9. package/dist/astro.d.ts +8 -2
  10. package/dist/astro.js +400 -100
  11. package/dist/astro.js.map +1 -1
  12. package/dist/astro.mjs +400 -100
  13. package/dist/astro.mjs.map +1 -1
  14. package/dist/cli.d.mts +1 -0
  15. package/dist/cli.d.ts +1 -0
  16. package/dist/cli.js +1880 -0
  17. package/dist/cli.js.map +1 -0
  18. package/dist/cli.mjs +1878 -0
  19. package/dist/cli.mjs.map +1 -0
  20. package/dist/index.d.mts +183 -4
  21. package/dist/index.d.ts +183 -4
  22. package/dist/index.js +974 -19
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +952 -20
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/next.d.mts +2 -17
  27. package/dist/next.d.ts +2 -17
  28. package/dist/next.js +262 -73
  29. package/dist/next.js.map +1 -1
  30. package/dist/next.mjs +262 -73
  31. package/dist/next.mjs.map +1 -1
  32. package/dist/nuxt.d.mts +13 -0
  33. package/dist/nuxt.d.ts +13 -0
  34. package/dist/nuxt.js +1344 -0
  35. package/dist/nuxt.js.map +1 -0
  36. package/dist/nuxt.mjs +1337 -0
  37. package/dist/nuxt.mjs.map +1 -0
  38. package/dist/react.d.mts +1 -1
  39. package/dist/react.d.ts +1 -1
  40. package/dist/react.js +330 -4
  41. package/dist/react.js.map +1 -1
  42. package/dist/react.mjs +330 -4
  43. package/dist/react.mjs.map +1 -1
  44. package/dist/{types-BTY-v-7i.d.mts → types-Cn_Qbkmg.d.mts} +34 -0
  45. package/dist/{types-BTY-v-7i.d.ts → types-Cn_Qbkmg.d.ts} +34 -0
  46. package/dist/vite.d.mts +5 -0
  47. package/dist/vite.d.ts +5 -0
  48. package/dist/vite.js +1370 -0
  49. package/dist/vite.js.map +1 -0
  50. package/dist/vite.mjs +1366 -0
  51. package/dist/vite.mjs.map +1 -0
  52. package/dist/vue.d.mts +19 -0
  53. package/dist/vue.d.ts +19 -0
  54. package/dist/vue.js +1404 -0
  55. package/dist/vue.js.map +1 -0
  56. package/dist/vue.mjs +1398 -0
  57. package/dist/vue.mjs.map +1 -0
  58. package/dist/webpack.d.mts +1 -1
  59. package/dist/webpack.d.ts +1 -1
  60. package/dist/webpack.js +178 -18
  61. package/dist/webpack.js.map +1 -1
  62. package/dist/webpack.mjs +178 -18
  63. package/dist/webpack.mjs.map +1 -1
  64. package/dist/widget.d.mts +11 -1
  65. package/dist/widget.d.ts +11 -1
  66. package/dist/widget.js +330 -4
  67. package/dist/widget.js.map +1 -1
  68. package/dist/widget.mjs +330 -4
  69. package/dist/widget.mjs.map +1 -1
  70. package/package.json +48 -2
package/dist/widget.js CHANGED
@@ -13,7 +13,7 @@ function getStyles(theme) {
13
13
 
14
14
  .aeo-toggle {
15
15
  position: fixed;
16
- z-index: 10001;
16
+ z-index: 2147483647;
17
17
  font-family: 'JetBrains Mono', monospace;
18
18
  font-size: 14px;
19
19
  animation: aeo-fade-in 0.3s ease;
@@ -87,12 +87,15 @@ function getStyles(theme) {
87
87
  left: 0;
88
88
  right: 0;
89
89
  bottom: 0;
90
+ width: 100vw;
91
+ height: 100vh;
90
92
  background: ${t.background};
91
- z-index: 10000;
93
+ z-index: 2147483646;
92
94
  display: flex;
93
95
  flex-direction: column;
94
96
  animation: aeo-fade-in 0.2s ease;
95
97
  font-family: 'JetBrains Mono', monospace;
98
+ isolation: isolate;
96
99
  }
97
100
 
98
101
  /* Top bar */
@@ -215,6 +218,177 @@ function getStyles(theme) {
215
218
  stroke: currentColor;
216
219
  }
217
220
 
221
+ /* View tabs */
222
+ .aeo-view-tabs {
223
+ display: flex;
224
+ gap: 2px;
225
+ background: rgba(255, 255, 255, 0.05);
226
+ border-radius: 8px;
227
+ padding: 2px;
228
+ border: 1px solid rgba(255, 255, 255, 0.08);
229
+ }
230
+
231
+ .aeo-view-tab {
232
+ padding: 5px 12px;
233
+ background: transparent;
234
+ color: ${t.text};
235
+ border: none;
236
+ border-radius: 6px;
237
+ font-family: inherit;
238
+ font-size: 12px;
239
+ font-weight: 500;
240
+ cursor: pointer;
241
+ transition: all 0.15s ease;
242
+ }
243
+
244
+ .aeo-view-tab:hover {
245
+ background: rgba(255, 255, 255, 0.05);
246
+ }
247
+
248
+ .aeo-view-tab.aeo-view-active {
249
+ background: rgba(255, 255, 255, 0.1);
250
+ color: ${t.accent};
251
+ }
252
+
253
+ /* Metadata bar */
254
+ .aeo-meta-bar {
255
+ display: flex;
256
+ flex-wrap: wrap;
257
+ align-items: center;
258
+ gap: 16px;
259
+ padding: 12px 16px;
260
+ margin-bottom: 24px;
261
+ background: rgba(255, 255, 255, 0.03);
262
+ border: 1px solid rgba(255, 255, 255, 0.06);
263
+ border-radius: 8px;
264
+ font-size: 12px;
265
+ color: ${t.text};
266
+ }
267
+
268
+ .aeo-meta-label {
269
+ color: rgba(160, 160, 168, 0.5);
270
+ margin-right: 4px;
271
+ }
272
+
273
+ .aeo-meta-sep {
274
+ width: 1px;
275
+ height: 14px;
276
+ background: rgba(255, 255, 255, 0.1);
277
+ }
278
+
279
+ /* Rendered markdown view */
280
+ .aeo-rendered {
281
+ color: ${t.text};
282
+ line-height: 1.75;
283
+ font-size: 14px;
284
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
285
+ }
286
+
287
+ .aeo-rendered .aeo-r-h1 {
288
+ font-size: 28px;
289
+ font-weight: 700;
290
+ color: ${t.accent};
291
+ margin: 0 0 16px;
292
+ padding-bottom: 12px;
293
+ border-bottom: 1px solid rgba(255, 255, 255, 0.08);
294
+ line-height: 1.3;
295
+ }
296
+
297
+ .aeo-rendered .aeo-r-h2 {
298
+ font-size: 22px;
299
+ font-weight: 600;
300
+ color: ${t.accent};
301
+ margin: 32px 0 12px;
302
+ line-height: 1.3;
303
+ }
304
+
305
+ .aeo-rendered .aeo-r-h3 {
306
+ font-size: 18px;
307
+ font-weight: 600;
308
+ color: ${t.accent};
309
+ margin: 24px 0 8px;
310
+ line-height: 1.4;
311
+ }
312
+
313
+ .aeo-rendered .aeo-r-h4,
314
+ .aeo-rendered .aeo-r-h5,
315
+ .aeo-rendered .aeo-r-h6 {
316
+ font-size: 15px;
317
+ font-weight: 600;
318
+ color: ${t.accent};
319
+ margin: 20px 0 8px;
320
+ }
321
+
322
+ .aeo-rendered .aeo-r-p {
323
+ margin: 0 0 12px;
324
+ }
325
+
326
+ .aeo-rendered .aeo-r-list {
327
+ margin: 0 0 16px;
328
+ padding-left: 24px;
329
+ }
330
+
331
+ .aeo-rendered .aeo-r-list li {
332
+ margin: 4px 0;
333
+ }
334
+
335
+ .aeo-rendered .aeo-r-quote {
336
+ margin: 16px 0;
337
+ padding: 12px 20px;
338
+ border-left: 3px solid ${t.badge};
339
+ background: rgba(255, 255, 255, 0.02);
340
+ color: ${t.text};
341
+ font-style: italic;
342
+ }
343
+
344
+ .aeo-rendered .aeo-r-hr {
345
+ border: none;
346
+ border-top: 1px solid rgba(255, 255, 255, 0.08);
347
+ margin: 24px 0;
348
+ }
349
+
350
+ .aeo-rendered .aeo-r-code {
351
+ background: rgba(255, 255, 255, 0.05);
352
+ border: 1px solid rgba(255, 255, 255, 0.08);
353
+ border-radius: 8px;
354
+ padding: 16px;
355
+ margin: 16px 0;
356
+ font-family: 'JetBrains Mono', monospace;
357
+ font-size: 13px;
358
+ overflow-x: auto;
359
+ color: ${t.badge};
360
+ }
361
+
362
+ .aeo-rendered .aeo-r-inline-code {
363
+ background: rgba(255, 255, 255, 0.06);
364
+ padding: 2px 6px;
365
+ border-radius: 4px;
366
+ font-family: 'JetBrains Mono', monospace;
367
+ font-size: 0.9em;
368
+ color: ${t.badge};
369
+ }
370
+
371
+ .aeo-rendered .aeo-r-link {
372
+ color: ${t.badge};
373
+ text-decoration: none;
374
+ border-bottom: 1px solid rgba(74, 222, 128, 0.3);
375
+ transition: border-color 0.15s ease;
376
+ }
377
+
378
+ .aeo-rendered .aeo-r-link:hover {
379
+ border-color: ${t.badge};
380
+ }
381
+
382
+ .aeo-rendered strong {
383
+ color: ${t.accent};
384
+ font-weight: 600;
385
+ }
386
+
387
+ .aeo-rendered em {
388
+ font-style: italic;
389
+ opacity: 0.9;
390
+ }
391
+
218
392
  /* Content area */
219
393
  .aeo-content-area {
220
394
  flex: 1;
@@ -357,7 +531,7 @@ function getStyles(theme) {
357
531
  font-size: 13px;
358
532
  opacity: 0;
359
533
  transition: all 0.3s ease;
360
- z-index: 10002;
534
+ z-index: 2147483647;
361
535
  }
362
536
 
363
537
  .aeo-toast.aeo-toast-show {
@@ -406,6 +580,17 @@ function getStyles(theme) {
406
580
  display: none;
407
581
  }
408
582
 
583
+ .aeo-view-tabs {
584
+ order: 10;
585
+ width: 100%;
586
+ justify-content: center;
587
+ }
588
+
589
+ .aeo-meta-bar {
590
+ font-size: 11px;
591
+ gap: 8px;
592
+ }
593
+
409
594
  .aeo-content-area {
410
595
  padding: 24px 16px;
411
596
  }
@@ -815,6 +1000,10 @@ var AeoWidget = class {
815
1000
  <div class="aeo-topbar">
816
1001
  ${((_a = this.config.widget) == null ? void 0 : _a.showBadge) !== false ? '<span class="aeo-badge"><span class="aeo-badge-dot"></span>LLM-READY</span>' : ""}
817
1002
  <span class="aeo-route-tab">${mdPath}</span>
1003
+ <div class="aeo-view-tabs">
1004
+ <button class="aeo-view-tab aeo-view-active" data-view="rendered">Rendered</button>
1005
+ <button class="aeo-view-tab" data-view="source">Source</button>
1006
+ </div>
818
1007
  <div class="aeo-topbar-spacer"></div>
819
1008
  <div class="aeo-topbar-actions">
820
1009
  <button class="aeo-topbar-btn aeo-copy-btn" disabled>
@@ -843,8 +1032,135 @@ var AeoWidget = class {
843
1032
  this.container.appendChild(this.overlayElement);
844
1033
  const closeBtn = this.overlayElement.querySelector(".aeo-close-btn");
845
1034
  closeBtn == null ? void 0 : closeBtn.addEventListener("click", () => this.closeOverlay());
1035
+ const viewTabs = this.overlayElement.querySelectorAll(".aeo-view-tab");
1036
+ viewTabs.forEach((tab) => {
1037
+ tab.addEventListener("click", () => {
1038
+ var _a2, _b;
1039
+ viewTabs.forEach((t) => t.classList.remove("aeo-view-active"));
1040
+ tab.classList.add("aeo-view-active");
1041
+ const view = tab.dataset.view;
1042
+ const rendered = (_a2 = this.overlayElement) == null ? void 0 : _a2.querySelector(".aeo-rendered");
1043
+ const source = (_b = this.overlayElement) == null ? void 0 : _b.querySelector(".aeo-markdown-source");
1044
+ if (rendered && source) {
1045
+ rendered.style.display = view === "rendered" ? "block" : "none";
1046
+ source.style.display = view === "source" ? "block" : "none";
1047
+ }
1048
+ });
1049
+ });
846
1050
  await this.loadContent();
847
1051
  }
1052
+ /**
1053
+ * Strip YAML frontmatter from markdown content.
1054
+ */
1055
+ stripFrontmatter(md) {
1056
+ const frontmatter = {};
1057
+ let body = md;
1058
+ if (md.startsWith("---")) {
1059
+ const endIndex = md.indexOf("---", 3);
1060
+ if (endIndex !== -1) {
1061
+ const fmBlock = md.slice(3, endIndex).trim();
1062
+ body = md.slice(endIndex + 3).trim();
1063
+ for (const line of fmBlock.split("\n")) {
1064
+ const colonIdx = line.indexOf(":");
1065
+ if (colonIdx > 0) {
1066
+ const key = line.slice(0, colonIdx).trim();
1067
+ const val = line.slice(colonIdx + 1).trim().replace(/^["']|["']$/g, "");
1068
+ frontmatter[key] = val;
1069
+ }
1070
+ }
1071
+ }
1072
+ }
1073
+ return { frontmatter, body };
1074
+ }
1075
+ /**
1076
+ * Convert markdown to simple rendered HTML for the "Rendered" view.
1077
+ */
1078
+ renderMarkdown(md) {
1079
+ const esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1080
+ const lines = md.split("\n");
1081
+ const html = [];
1082
+ let inList = false;
1083
+ let inCode = false;
1084
+ let codeContent = [];
1085
+ for (const line of lines) {
1086
+ const trimmed = line.trim();
1087
+ if (trimmed.startsWith("```")) {
1088
+ if (inCode) {
1089
+ html.push(`<pre class="aeo-r-code"><code>${esc(codeContent.join("\n"))}</code></pre>`);
1090
+ codeContent = [];
1091
+ inCode = false;
1092
+ } else {
1093
+ if (inList) {
1094
+ html.push("</ul>");
1095
+ inList = false;
1096
+ }
1097
+ inCode = true;
1098
+ }
1099
+ continue;
1100
+ }
1101
+ if (inCode) {
1102
+ codeContent.push(line);
1103
+ continue;
1104
+ }
1105
+ if (!trimmed) {
1106
+ if (inList) {
1107
+ html.push("</ul>");
1108
+ inList = false;
1109
+ }
1110
+ continue;
1111
+ }
1112
+ const headingMatch = trimmed.match(/^(#{1,6})\s+(.*)/);
1113
+ if (headingMatch) {
1114
+ if (inList) {
1115
+ html.push("</ul>");
1116
+ inList = false;
1117
+ }
1118
+ const level = headingMatch[1].length;
1119
+ html.push(`<h${level} class="aeo-r-h${level}">${this.renderInlineMarkdown(esc(headingMatch[2]))}</h${level}>`);
1120
+ continue;
1121
+ }
1122
+ if (/^(-{3,}|\*{3,}|_{3,})$/.test(trimmed)) {
1123
+ if (inList) {
1124
+ html.push("</ul>");
1125
+ inList = false;
1126
+ }
1127
+ html.push('<hr class="aeo-r-hr">');
1128
+ continue;
1129
+ }
1130
+ if (trimmed.startsWith(">")) {
1131
+ if (inList) {
1132
+ html.push("</ul>");
1133
+ inList = false;
1134
+ }
1135
+ html.push(`<blockquote class="aeo-r-quote">${this.renderInlineMarkdown(esc(trimmed.slice(1).trim()))}</blockquote>`);
1136
+ continue;
1137
+ }
1138
+ const listMatch = trimmed.match(/^[-*+]\s+(.*)/);
1139
+ if (listMatch) {
1140
+ if (!inList) {
1141
+ html.push('<ul class="aeo-r-list">');
1142
+ inList = true;
1143
+ }
1144
+ html.push(`<li>${this.renderInlineMarkdown(esc(listMatch[1]))}</li>`);
1145
+ continue;
1146
+ }
1147
+ if (inList) {
1148
+ html.push("</ul>");
1149
+ inList = false;
1150
+ }
1151
+ html.push(`<p class="aeo-r-p">${this.renderInlineMarkdown(esc(trimmed))}</p>`);
1152
+ }
1153
+ if (inList) html.push("</ul>");
1154
+ if (inCode) html.push(`<pre class="aeo-r-code"><code>${esc(codeContent.join("\n"))}</code></pre>`);
1155
+ return html.join("\n");
1156
+ }
1157
+ renderInlineMarkdown(text) {
1158
+ let out = text.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
1159
+ out = out.replace(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g, "<em>$1</em>");
1160
+ out = out.replace(/`([^`]+)`/g, '<code class="aeo-r-inline-code">$1</code>');
1161
+ out = out.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a class="aeo-r-link" href="$2" target="_blank" rel="noopener">$1</a>');
1162
+ return out;
1163
+ }
848
1164
  async loadContent() {
849
1165
  if (!this.overlayElement) return;
850
1166
  const wrapper = this.overlayElement.querySelector(".aeo-content-wrapper");
@@ -858,8 +1174,15 @@ var AeoWidget = class {
858
1174
  } else {
859
1175
  content = extractDOMToMarkdown();
860
1176
  }
1177
+ const { frontmatter, body } = this.stripFrontmatter(content);
1178
+ const metaItems = [];
1179
+ if (frontmatter.title) metaItems.push(`<span class="aeo-meta-label">Title:</span> ${this.escHtml(frontmatter.title)}`);
1180
+ if (frontmatter.url) metaItems.push(`<span class="aeo-meta-label">URL:</span> <a class="aeo-r-link" href="${this.escHtml(frontmatter.url)}" target="_blank">${this.escHtml(frontmatter.url)}</a>`);
1181
+ const metaBar = metaItems.length > 0 ? `<div class="aeo-meta-bar">${metaItems.join('<span class="aeo-meta-sep"></span>')}</div>` : "";
861
1182
  wrapper.innerHTML = `
862
- <pre class="aeo-markdown-source"><code>${this.highlightMarkdown(content)}</code></pre>
1183
+ ${metaBar}
1184
+ <div class="aeo-rendered">${this.renderMarkdown(body)}</div>
1185
+ <pre class="aeo-markdown-source" style="display:none"><code>${this.highlightMarkdown(content)}</code></pre>
863
1186
  `;
864
1187
  const copyBtn = this.overlayElement.querySelector(".aeo-copy-btn");
865
1188
  const downloadBtn = this.overlayElement.querySelector(".aeo-download-btn");
@@ -884,6 +1207,9 @@ var AeoWidget = class {
884
1207
  `;
885
1208
  }
886
1209
  }
1210
+ escHtml(s) {
1211
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1212
+ }
887
1213
  highlightMarkdown(md) {
888
1214
  var _a;
889
1215
  const esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");