minecodex 0.1.6 → 0.1.7

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "id": "images",
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "label": {
6
6
  "en": "Images",
7
7
  "zh-CN": "图片"
@@ -303,9 +303,9 @@ function layoutMasonry() {
303
303
  const cards = [...grid.children];
304
304
  if (!cards.length) return;
305
305
 
306
- // Keep DOM writes and geometry reads in separate batches so the browser only
307
- // needs to resolve layout once, even for a full page of boards.
308
- for (const card of cards) card.style.gridRowEnd = "auto";
306
+ // Existing spans do not affect the intrinsic card boxes because the grid
307
+ // aligns items to the start. Clearing them here would collapse the 1px row
308
+ // grid and clamp the user's scroll position before the new spans are applied.
309
309
  const blockGap = Number.parseFloat(getComputedStyle(cards[0]).marginBottom);
310
310
  const spans = cards.map((card) => (
311
311
  Math.ceil((card.getBoundingClientRect().height + blockGap) / rowHeight)
@@ -617,6 +617,7 @@ h1,
617
617
 
618
618
  .thread-board-preview img {
619
619
  width: 100%;
620
+ height: auto;
620
621
  min-height: 76px;
621
622
  aspect-ratio: 16 / 6;
622
623
  display: block;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "id": "model-slider",
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "label": {
6
6
  "en": "Model Slider",
7
7
  "zh-CN": "模型滑条"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "id": "notes",
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "label": {
6
6
  "en": "Notes",
7
7
  "zh-CN": "笔记"
@@ -1,4 +1,4 @@
1
- const params = new URLSearchParams(location.search);
1
+ const params = new URL(document.baseURI).searchParams;
2
2
  const SUPPORTED_LOCALES = new Set(["en", "zh-CN"]);
3
3
 
4
4
  function normalizeLocale(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecodex",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Lightweight, local-first plugins for the Codex desktop app.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -51,12 +51,25 @@ function declaredSurfaceUrls(feature) {
51
51
  }
52
52
 
53
53
  function requireDeclaredLoopbackSurface(feature, value) {
54
- if (typeof value !== "string" || !declaredSurfaceUrls(feature).has(value)) {
54
+ if (typeof value !== "string") {
55
55
  throw Object.assign(new Error("Surface URL is not declared by this feature"), {
56
56
  code: "SURFACE_URL_NOT_ALLOWED",
57
57
  });
58
58
  }
59
59
  const url = new URL(value);
60
+ const matchesDeclaredDocument = Array.from(declaredSurfaceUrls(feature), (declared) => new URL(declared))
61
+ .some((declared) => (
62
+ declared.origin === url.origin
63
+ && declared.username === url.username
64
+ && declared.password === url.password
65
+ && declared.pathname === url.pathname
66
+ && declared.hash === url.hash
67
+ ));
68
+ if (!matchesDeclaredDocument) {
69
+ throw Object.assign(new Error("Surface URL is not declared by this feature"), {
70
+ code: "SURFACE_URL_NOT_ALLOWED",
71
+ });
72
+ }
60
73
  if (url.protocol !== "http:" || !LOOPBACK_SURFACE_HOSTS.has(url.hostname)) {
61
74
  throw Object.assign(new Error("Surface URL must use an exact loopback HTTP origin"), {
62
75
  code: "SURFACE_URL_NOT_ALLOWED",
@@ -2541,7 +2554,7 @@ export function createInjectionSource(features, {
2541
2554
 
2542
2555
  closePromptPreview({ immediate: true });
2543
2556
  closeModalSurface();
2544
- const editorUrl = new URL(sourceRecord.frame.src);
2557
+ const editorUrl = new URL(sourceRecord.surfaceUrl);
2545
2558
  editorUrl.searchParams.set("surface", "editor");
2546
2559
  editorUrl.searchParams.set("kind", kind);
2547
2560
  if (typeof payload.id === "string" && payload.id) editorUrl.searchParams.set("id", payload.id);