Expand Dock gallery with account workspace and identity states
This commit is contained in:
1 parent
d2002071e6
commit
c41a5e4276
71 files changed
+2254
-67
No files matched your search
+56
-5
@@ -43,6 +43,12 @@ if (requested.get("concept") === "dock") {
|
||||
state.density = "compact";
|
||||
delete state.accents.dock;
|
||||
}
|
||||
if (
|
||||
[...document.querySelector("#page").options].some(
|
||||
(o) => o.value === requested.get("page"),
|
||||
)
|
||||
)
|
||||
state.page = requested.get("page");
|
||||
function render() {
|
||||
const en = state.locale === "en";
|
||||
document.documentElement.lang = state.locale;
|
||||
@@ -103,6 +109,12 @@ function render() {
|
||||
"Authentication",
|
||||
"Components",
|
||||
"Tokens",
|
||||
"Account",
|
||||
"Security",
|
||||
"Devices and sessions",
|
||||
"Applications",
|
||||
"Appearance",
|
||||
"Sign-in states",
|
||||
]
|
||||
: [
|
||||
"Dashboard",
|
||||
@@ -111,6 +123,12 @@ function render() {
|
||||
"Авторизация",
|
||||
"Компоненты",
|
||||
"Токены",
|
||||
"Аккаунт",
|
||||
"Безопасность",
|
||||
"Устройства и сеансы",
|
||||
"Приложения",
|
||||
"Оформление",
|
||||
"Состояния входа",
|
||||
];
|
||||
[...$("#page").options].forEach((o, i) => (o.text = labels[i]));
|
||||
[...$("#theme").options].forEach(
|
||||
@@ -133,10 +151,8 @@ function render() {
|
||||
theme: state.theme,
|
||||
density: state.density,
|
||||
locale: state.locale,
|
||||
accent:
|
||||
state.accents[concept] ||
|
||||
tokensFor(concept, state.theme)["color.accent"],
|
||||
});
|
||||
if (state.accents[concept]) params.set("accent", state.accents[concept]);
|
||||
const src = "frame.html?" + params;
|
||||
if ($("#preview-" + side).getAttribute("src") !== src)
|
||||
$("#preview-" + side).src = src;
|
||||
@@ -265,12 +281,17 @@ $("#export").onclick = async () => {
|
||||
const files = {};
|
||||
const paths = [
|
||||
"components/system.css",
|
||||
"components/account-pages.js",
|
||||
"patterns/demo-identity.js",
|
||||
"concepts/registry.js",
|
||||
"playground/frame.html",
|
||||
"playground/frame.js",
|
||||
"tokens/schema.json",
|
||||
"components/CONTRACT.md",
|
||||
"patterns/UX.md",
|
||||
"patterns/IDENTITY.md",
|
||||
"prompts/SSO.md",
|
||||
"prompts/README.md",
|
||||
"layouts/README.md",
|
||||
"DESIGN.md",
|
||||
"ANTI-SLOP.md",
|
||||
@@ -284,7 +305,12 @@ $("#export").onclick = async () => {
|
||||
);
|
||||
for (const [p, t] of fetched) files[p] = t;
|
||||
for (const theme of ["light", "dark"]) {
|
||||
const tokens = tokensFor(c.id, theme, accent, state.density);
|
||||
const tokens = tokensFor(
|
||||
c.id,
|
||||
theme,
|
||||
state.accents[c.id] || undefined,
|
||||
state.density,
|
||||
);
|
||||
files[`tokens/${theme}.json`] = JSON.stringify(tokens, null, 2);
|
||||
files[`tokens/${theme}.css`] = `:root {\n${cssVars(tokens)}\n}\n`;
|
||||
}
|
||||
@@ -293,7 +319,9 @@ $("#export").onclick = async () => {
|
||||
version: "0.1.0",
|
||||
status: "candidate-export",
|
||||
concept: c.id,
|
||||
page: state.page,
|
||||
accent,
|
||||
customAccent: state.accents[c.id] || null,
|
||||
density: state.density,
|
||||
theme: state.theme,
|
||||
locale: state.locale,
|
||||
@@ -301,8 +329,16 @@ $("#export").onclick = async () => {
|
||||
null,
|
||||
2,
|
||||
);
|
||||
const exportParams = new URLSearchParams({
|
||||
concept: c.id,
|
||||
page: state.page,
|
||||
density: state.density,
|
||||
theme: state.theme,
|
||||
locale: state.locale,
|
||||
});
|
||||
if (state.accents[c.id]) exportParams.set("accent", state.accents[c.id]);
|
||||
files["index.html"] =
|
||||
`<!doctype html><meta charset="utf-8"><title>Anidev ${c.name}</title><script>location.replace('playground/frame.html?${new URLSearchParams({ concept: c.id, accent, density: state.density, theme: state.theme, locale: state.locale })}')<\/script>`;
|
||||
`<!doctype html><meta charset="utf-8"><title>Anidev ${c.name}</title><script>location.replace('playground/frame.html?${exportParams}')<\/script>`;
|
||||
files["README.md"] =
|
||||
`# Anidev / ${c.name}\nCandidate export, not final approval.\nServe this folder over HTTP (for example python -m http.server 8080).\nOpen index.html.\nUse tokens/light.css or tokens/dark.css and components/system.css in any framework.\nSemantic token JSON is the source of values.\nNo upstream implementation is bundled. Final Skill follows user concept selection.\n`;
|
||||
const url = URL.createObjectURL(zip(files)),
|
||||
@@ -323,3 +359,18 @@ $("#export").onclick = async () => {
|
||||
}
|
||||
};
|
||||
render();
|
||||
|
||||
addEventListener("message", (event) => {
|
||||
if (
|
||||
event.origin === location.origin &&
|
||||
[
|
||||
document.querySelector("#preview-a").contentWindow,
|
||||
document.querySelector("#preview-b").contentWindow,
|
||||
].includes(event.source) &&
|
||||
event.data?.type === "anidev-theme" &&
|
||||
["light", "dark"].includes(event.data.theme)
|
||||
) {
|
||||
state.theme = event.data.theme;
|
||||
render();
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user