feat: release design system engine, studio and component contracts
This commit is contained in:
1 parent
ff1065fb27
commit
3943b946d6
693 files changed
+175546
-3894
No files matched your search
@@ -153,7 +153,9 @@
|
||||
declarations.push(` state ${name} = ${JSON.stringify(data, null, 2)}`);
|
||||
attributes.push(`${name}="{${name}}"`);
|
||||
continue;
|
||||
} catch { /* Keep invalid JSON visible for correction. */ }
|
||||
} catch {
|
||||
/* Keep invalid JSON visible for correction. */
|
||||
}
|
||||
}
|
||||
if (field instanceof HTMLInputElement && field.type === "checkbox") {
|
||||
attributes.push(`${name}="${field.checked}"`);
|
||||
@@ -172,7 +174,8 @@
|
||||
let source = hasSlot
|
||||
? `${opening}>\n <!-- Add slot content here -->\n</${tag}>`
|
||||
: `${opening}\n/>`;
|
||||
if (declarations.length) source = `page ${component.replace(/[^A-Za-z0-9]/g, "")}Example {\n${declarations.join("\n")}\n view {\n${source}\n }\n}`;
|
||||
if (declarations.length)
|
||||
source = `page ${component.replace(/[^A-Za-z0-9]/g, "")}Example {\n${declarations.join("\n")}\n view {\n${source}\n }\n}`;
|
||||
writeCode(code, source);
|
||||
}
|
||||
|
||||
@@ -335,7 +338,10 @@
|
||||
const initializedCode = new WeakSet();
|
||||
function bindPlaygroundEvents(root = document) {
|
||||
for (const playground of root.querySelectorAll?.(SELECTOR) ?? []) {
|
||||
if (!initializedCode.has(playground)) { initializedCode.add(playground); updateCode(playground); }
|
||||
if (!initializedCode.has(playground)) {
|
||||
initializedCode.add(playground);
|
||||
updateCode(playground);
|
||||
}
|
||||
const outputNames = (playground.getAttribute("data-playground-events") || "")
|
||||
.split(",")
|
||||
.map((name) => name.trim())
|
||||
@@ -413,7 +419,14 @@
|
||||
const copyTarget = event.target.closest?.("[data-copy-target]");
|
||||
if (copyTarget) {
|
||||
const target = document.querySelector(copyTarget.dataset.copyTarget);
|
||||
if (target) { try { await navigator.clipboard.writeText(target.textContent || ""); copyTarget.textContent = "Copied"; } catch { copyTarget.textContent = "Select code to copy"; } }
|
||||
if (target) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(target.textContent || "");
|
||||
copyTarget.textContent = "Copied";
|
||||
} catch {
|
||||
copyTarget.textContent = "Select code to copy";
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
const copyText = event.target.closest?.("[data-copy-text]");
|
||||
|
||||
Reference in new issue
Block a user