feat: release design system engine, studio and component contracts

This commit is contained in:
Clintchiz committed 2026-10-19 13:09:03 +05:30
1 parent ff1065fb27
commit 3943b946d6
693 files changed
+175546 -3894

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/viewer",
"version": "0.8.14",
"version": "0.8.17",
"type": "module",
"sideEffects": true,
"description": "Read-only file previews with bounded loading and graceful fallback.",
+1 -1
View File
@@ -86,7 +86,7 @@ export function mountViewer(
element("span", source.name || "File");
title.textContent = source.name || "File";
title.hidden = options.hideName === true;
title.setAttribute('data-viewer-title','');
title.setAttribute("data-viewer-title", "");
if (!toolbar.contains(title)) toolbar.append(title);
const controls = toolbar.querySelector<HTMLElement>("[data-viewer-controls]") ?? element("span");
const actions = toolbar.querySelector<HTMLElement>("[data-viewer-actions]") ?? element("span");
+2 -4
View File
@@ -29,8 +29,8 @@ export function mountExtractedText(
button.type = "button";
button.className = "wrn-viewer-action";
setButtonLabel(button, "Extract text");
const details = doc.createElement("details");
const summary = doc.createElement("summary");
const details = doc.createElement("section");
const summary = doc.createElement("h3");
summary.textContent = "Extracted text";
const text = doc.createElement("pre");
details.append(summary, text);
@@ -46,12 +46,10 @@ export function mountExtractedText(
const result = await extractText(source, { baseURI: doc.baseURI, signal });
if (disposed) return;
text.textContent = result || "No text was found.";
details.open = true;
parent.append(details);
} catch {
if (!disposed) {
text.textContent = "Text extraction is unavailable.";
details.open = true;
parent.append(details);
}
} finally {
+16 -8
View File
@@ -13,14 +13,22 @@ function fixture() {
return { window, host: host as unknown as HTMLElement };
}
test('hideName hides only the visual title and preserves the file identity',async()=>{
const {window,host}=fixture();
const dispose=mountViewer(host,{name:'report.txt',blob:new Blob(['hello'])},{hideName:true});
await settled();
expect(host.querySelector<HTMLElement>('[data-viewer-title]')?.hidden??host.querySelector<HTMLElement>('.wrn-viewer-toolbar span')?.hidden).toBe(true);
expect(host.getAttribute('aria-label')).toBe('report.txt');
expect(host.querySelector<HTMLAnchorElement>('a[download]')?.download).toBe('report.txt');
dispose();window.close();
test("hideName hides only the visual title and preserves the file identity", async () => {
const { window, host } = fixture();
const dispose = mountViewer(
host,
{ name: "report.txt", blob: new Blob(["hello"]) },
{ hideName: true },
);
await settled();
expect(
host.querySelector<HTMLElement>("[data-viewer-title]")?.hidden ??
host.querySelector<HTMLElement>(".wrn-viewer-toolbar span")?.hidden,
).toBe(true);
expect(host.getAttribute("aria-label")).toBe("report.txt");
expect(host.querySelector<HTMLAnchorElement>("a[download]")?.download).toBe("report.txt");
dispose();
window.close();
});
test("image controls, failure fallback, and teardown", async () => {
const { window, host } = fixture();
+6 -2
View File
@@ -27,8 +27,12 @@
align-items: center;
gap: 0.5rem;
}
.wrn-viewer-toolbar > [data-viewer-title][hidden] { display: none; }
.wrn-viewer-toolbar:has(> [data-viewer-title][hidden]) { justify-content: flex-end; }
.wrn-viewer-toolbar > [data-viewer-title][hidden] {
display: none;
}
.wrn-viewer-toolbar:has(> [data-viewer-title][hidden]) {
justify-content: flex-end;
}
/* The generic control look applies only to controls the package has not styled
itself; without this it outranks every specific rule below. */
.wrn-viewer button:not([class*="wrn-viewer-"]),