@drawnagency/primitives 0.1.83 → 0.1.84

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.
@@ -925,13 +925,14 @@ function DocCanvas({
925
925
  const el = containerRef.current;
926
926
  if (!el || typeof ResizeObserver === "undefined") return;
927
927
  const observer = new ResizeObserver(() => {
928
- const available = el.clientWidth - 48;
929
- setScale(Math.min(0.75, Math.max(0.15, available / PAGE_W2)));
928
+ const availW = el.clientWidth - 48;
929
+ const availH = el.clientHeight - 48;
930
+ setScale(Math.max(0.15, Math.min(availW / PAGE_W2, availH / PAGE_H2)));
930
931
  });
931
932
  observer.observe(el);
932
933
  return () => observer.disconnect();
933
934
  }, []);
934
- const note = (text) => /* @__PURE__ */ jsx6("p", { className: "mt-24 text-sm text-neutral-400", children: text });
935
+ const note = (text) => /* @__PURE__ */ jsx6("p", { className: "text-sm text-neutral-400", children: text });
935
936
  let body;
936
937
  if (active?.kind === "cover") {
937
938
  body = noContent ? /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center gap-4", children: [
@@ -950,8 +951,8 @@ function DocCanvas({
950
951
  {
951
952
  ref: containerRef,
952
953
  "data-testid": "doc-canvas",
953
- className: "flex flex-1 items-start justify-center overflow-auto bg-neutral-100 p-6",
954
- children: body
954
+ className: "flex min-h-0 min-w-0 flex-1 overflow-auto bg-neutral-100 p-6",
955
+ children: /* @__PURE__ */ jsx6("div", { className: "m-auto", children: body })
955
956
  }
956
957
  );
957
958
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawnagency/primitives",
3
- "version": "0.1.83",
3
+ "version": "0.1.84",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",
@@ -243,14 +243,19 @@ function DocCanvas({
243
243
  const el = containerRef.current;
244
244
  if (!el || typeof ResizeObserver === "undefined") return;
245
245
  const observer = new ResizeObserver(() => {
246
- const available = el.clientWidth - 48;
247
- setScale(Math.min(0.75, Math.max(0.15, available / PAGE_W)));
246
+ // Fill the canvas: fit both dimensions (clientWidth/Height include the
247
+ // p-6 padding — subtract it) and take the limiting axis. The page keeps
248
+ // its true 1632×1056 layout and is transform-scaled, so what's shown is
249
+ // byte-identical to the print layout at any size.
250
+ const availW = el.clientWidth - 48;
251
+ const availH = el.clientHeight - 48;
252
+ setScale(Math.max(0.15, Math.min(availW / PAGE_W, availH / PAGE_H)));
248
253
  });
249
254
  observer.observe(el);
250
255
  return () => observer.disconnect();
251
256
  }, []);
252
257
 
253
- const note = (text: string) => <p className="mt-24 text-sm text-neutral-400">{text}</p>;
258
+ const note = (text: string) => <p className="text-sm text-neutral-400">{text}</p>;
254
259
 
255
260
  let body: ReactNode;
256
261
  if (active?.kind === "cover") {
@@ -283,9 +288,12 @@ function DocCanvas({
283
288
  <div
284
289
  ref={containerRef}
285
290
  data-testid="doc-canvas"
286
- className="flex flex-1 items-start justify-center overflow-auto bg-neutral-100 p-6"
291
+ className="flex min-h-0 min-w-0 flex-1 overflow-auto bg-neutral-100 p-6"
287
292
  >
288
- {body}
293
+ {/* m-auto instead of items/justify-center: centers both axes when the
294
+ page fits, but keeps the top/left edge reachable when it overflows
295
+ (flex centering clips overflow irretrievably; auto margins don't). */}
296
+ <div className="m-auto">{body}</div>
289
297
  </div>
290
298
  );
291
299
  }