@birdapi/velinstyle 1.2.1 → 1.3.0
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.
- package/README.de.md +148 -11
- package/README.md +174 -16
- package/cli/__fixtures__/atelier-library/showcases/01-login/app.css +1 -0
- package/cli/__fixtures__/atelier-library/showcases/01-login/app.js +2 -0
- package/cli/__fixtures__/atelier-library/showcases/01-login/index.html +5 -0
- package/cli/__fixtures__/atelier-library/showcases/04-pricing/app.css +1 -0
- package/cli/__fixtures__/atelier-library/showcases/04-pricing/app.js +2 -0
- package/cli/__fixtures__/atelier-library/showcases/04-pricing/index.html +5 -0
- package/cli/__fixtures__/atelier-library/showcases/36-calendar/app.css +1 -0
- package/cli/__fixtures__/atelier-library/showcases/36-calendar/app.js +2 -0
- package/cli/__fixtures__/atelier-library/showcases/36-calendar/index.html +5 -0
- package/cli/atelier-catalog.json +1267 -0
- package/cli/atelier-formats.js +159 -0
- package/cli/atelier.js +382 -0
- package/cli/blueprints/empty-state.html +3 -5
- package/cli/cli-manifest.json +441 -161
- package/cli/docgen/extract-cli.js +2 -1
- package/cli/docs-generate.js +9 -0
- package/cli/experience.js +173 -0
- package/cli/index.js +1384 -361
- package/cli/motion.js +738 -0
- package/cli/production/component-graph.json +166 -0
- package/cli/production/explain.js +52 -0
- package/cli/production/extract.js +278 -0
- package/cli/production/graph.js +102 -0
- package/cli/production/report.js +168 -0
- package/cli/production/run.js +355 -0
- package/cli/production/trim-css.js +177 -0
- package/cli/production/trim-fonts.js +23 -0
- package/cli/production/trim-icons.js +38 -0
- package/cli/production/trim-js.js +48 -0
- package/cli/production/trim-motion.js +22 -0
- package/cli/production/trim-themes.js +50 -0
- package/cli/production/watch.js +38 -0
- package/cli/review.js +48 -1
- package/cli/scripts/write-atelier-fixtures.mjs +33 -0
- package/cli/security.js +190 -0
- package/cli/skills.js +53 -10
- package/cli/transparency.js +140 -41
- package/cli/workflow.js +32 -17
- package/components/index.js +3 -0
- package/components/runtime/component-loaders.js +3 -0
- package/components/velin-drawer.js +43 -4
- package/components/velin-empty-state.js +83 -0
- package/components/velin-modal.js +76 -15
- package/components/velin-otp-input.js +220 -0
- package/components/velin-password-strength.js +147 -0
- package/components/velin-sheet.js +49 -4
- package/components/velin-theme-toggle.js +15 -1
- package/core/a11y/component-contracts.json +391 -255
- package/core/attributes/registry.js +1 -1
- package/core/meta/knowledge/components.json +75 -3
- package/core/motion/analyze.js +38 -0
- package/core/motion/blueprint.js +51 -0
- package/core/motion/composer.js +114 -0
- package/core/motion/data/registry.json +352 -0
- package/core/motion/effects.js +17 -1
- package/core/motion/index.js +112 -9
- package/core/motion/optimize.js +44 -0
- package/core/motion/policy.js +77 -0
- package/core/motion/registry.js +131 -0
- package/core/motion/review.js +59 -0
- package/core/motion/scan.js +150 -0
- package/core/motion/timeline.js +68 -0
- package/core/motion/transitions.js +49 -0
- package/core/motion/triggers.js +168 -0
- package/core/security/checks/fs.js +92 -0
- package/core/security/detect.js +35 -0
- package/core/security/engine.js +116 -0
- package/core/security/index.js +18 -0
- package/core/security/registry.js +85 -0
- package/core/security/report/report.js +113 -0
- package/core/security/rules/ci/index.js +146 -0
- package/core/security/rules/consumer/index.js +174 -0
- package/core/security/rules/deps/index.js +182 -0
- package/core/security/rules/index.js +24 -0
- package/core/security/rules/publish/index.js +230 -0
- package/core/security/rules/repo/index.js +143 -0
- package/core/security/rules/secrets/index.js +133 -0
- package/core/security/score/dependency-health.js +53 -0
- package/core/security/score/release-health.js +66 -0
- package/core/security/score/score.js +102 -0
- package/core/security/timeline/timeline.js +76 -0
- package/dist/chunks/attributes-2ORR27KA.js +404 -0
- package/dist/chunks/attributes-HK7VIOLA.js +1080 -0
- package/dist/chunks/attributes-VRHHVNDO.js +1080 -0
- package/dist/chunks/chunk-MYKUI364.js +116 -0
- package/dist/chunks/chunk-NEVBPD5T.js +116 -0
- package/dist/chunks/chunk-Y6HN7HWX.js +116 -0
- package/dist/chunks/runtime-entry.js +1 -1
- package/dist/chunks/velin-drawer-A7Q7EBOS.js +162 -0
- package/dist/chunks/velin-empty-state-3NTUH2RF.js +81 -0
- package/dist/chunks/velin-modal-3MV4FYBK.js +231 -0
- package/dist/chunks/velin-otp-input-PSK42MM6.js +207 -0
- package/dist/chunks/velin-password-strength-TAXMLSED.js +136 -0
- package/dist/chunks/velin-sheet-N2VVYXFP.js +157 -0
- package/dist/chunks/velin-theme-toggle-J2NHC7IM.js +304 -0
- package/dist/llms.txt +4 -4
- package/dist/search-index.json +232 -5
- package/dist/velin-agent.json +433 -46
- package/dist/velinstyle-components.iife.js +3695 -2272
- package/dist/velinstyle-components.js +3698 -2271
- package/dist/velinstyle-components.min.js +262 -120
- package/dist/velinstyle.css +96 -13
- package/dist/velinstyle.d.ts +3 -0
- package/dist/velinstyle.min.css +1 -1
- package/package.json +19 -4
- package/packages/velinstyle-cli-core/package.json +11 -0
- package/packages/velinstyle-cli-core/src/config.js +84 -0
- package/packages/velinstyle-cli-core/src/contract.js +56 -0
- package/packages/velinstyle-cli-core/src/event-bus.js +50 -0
- package/packages/velinstyle-cli-core/src/index.js +18 -0
- package/packages/velinstyle-cli-core/src/lifecycle.js +33 -0
- package/packages/velinstyle-cli-core/src/runner.js +129 -0
- package/packages/velinstyle-cli-registry/data/commands.json +1216 -0
- package/packages/velinstyle-cli-registry/data/layouts.json +33 -0
- package/packages/velinstyle-cli-registry/data/widgets.json +35 -0
- package/packages/velinstyle-cli-registry/package.json +13 -0
- package/packages/velinstyle-cli-registry/src/index.js +88 -0
- package/packages/velinstyle-cli-renderer/package.json +8 -0
- package/packages/velinstyle-cli-renderer/src/index.js +286 -0
- package/packages/velinstyle-cli-theme/package.json +8 -0
- package/packages/velinstyle-cli-theme/src/index.js +84 -0
- package/packages/velinstyle-cli-ui/package.json +8 -0
- package/packages/velinstyle-cli-ui/src/index.js +34 -0
- package/packages/velinstyle-motion/README.md +81 -0
- package/packages/velinstyle-motion/package.json +37 -0
- package/packages/velinstyle-motion/src/ai/mini-prompt.js +119 -0
- package/packages/velinstyle-motion/src/ai/provider.js +59 -0
- package/packages/velinstyle-motion/src/ai/providers/pixverse-setup.js +402 -0
- package/packages/velinstyle-motion/src/ai/providers/pixverse.js +245 -0
- package/packages/velinstyle-motion/src/config.js +257 -0
- package/packages/velinstyle-motion/src/export/html-clip.js +141 -0
- package/packages/velinstyle-motion/src/index.js +304 -0
- package/packages/velinstyle-motion/src/jobs/cache.js +30 -0
- package/packages/velinstyle-motion/src/jobs/queue.js +69 -0
- package/packages/velinstyle-motion/src/jobs/usage.js +53 -0
- package/packages/velinstyle-motion/src/local/effects.js +139 -0
- package/packages/velinstyle-motion/src/local/engine.js +96 -0
- package/packages/velinstyle-motion/src/providers-catalog.js +44 -0
- package/packages/velinstyle-motion/src/registry/presets.js +25 -0
- package/packages/velinstyle-motion/src/registry/presets.json +85 -0
- package/packages/velinstyle-motion/src/ux/cost-gate.js +37 -0
- package/packages/velinstyle-motion/src/ux/pixverse-gate.js +153 -0
- package/packages/velinstyle-motion/src/ux/wizard.js +171 -0
- package/packages/velinstyle-motion/src/validate-image.js +91 -0
- package/packages/velinstyle-skills/catalog.json +1 -1
- package/packages/velinstyle-skills/registry.json +1 -142
- package/packages/velinstyle-skills/skills/velin-motion-reduced-safe/SKILL.md +1 -1
- package/packages/velinstyle-skills/skills/velin-motion-reveal-feedback/SKILL.md +1 -1
- package/src/components/data-table.css +19 -0
- package/src/components/empty-auth.css +33 -0
- package/src/components/table.css +16 -6
- package/src/tokens/motion.css +7 -0
- package/src/utilities/scroll-animation.css +66 -0
- package/src/velinstyle.css +1 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SHADOW_A11Y_STYLES
|
|
3
|
+
} from "./chunk-F7OLHTGX.js";
|
|
4
|
+
import {
|
|
5
|
+
clearBackgroundInert,
|
|
6
|
+
getFocusableElements,
|
|
7
|
+
restoreFocus,
|
|
8
|
+
saveFocus,
|
|
9
|
+
setBackgroundInert,
|
|
10
|
+
trapFocus
|
|
11
|
+
} from "./chunk-42VVPW6N.js";
|
|
12
|
+
|
|
13
|
+
// components/velin-sheet.js
|
|
14
|
+
var styles = `
|
|
15
|
+
${SHADOW_A11Y_STYLES}
|
|
16
|
+
:host { display: contents; }
|
|
17
|
+
.overlay {
|
|
18
|
+
position: fixed; inset: 0; z-index: var(--velin-z-overlay, 400);
|
|
19
|
+
background: var(--velin-color-overlay, rgba(0,0,0,0.4));
|
|
20
|
+
opacity: 0; visibility: hidden;
|
|
21
|
+
transition: opacity 200ms ease, visibility 200ms ease;
|
|
22
|
+
}
|
|
23
|
+
:host([open]) .overlay { opacity: 1; visibility: visible; }
|
|
24
|
+
.sheet {
|
|
25
|
+
position: fixed; inset-inline: 0; inset-block-end: 0;
|
|
26
|
+
z-index: var(--velin-z-modal, 500);
|
|
27
|
+
max-block-size: min(85vh, 32rem);
|
|
28
|
+
background: var(--velin-color-surface-bright, #fff);
|
|
29
|
+
border-radius: var(--velin-radius-lg, 0.75rem) var(--velin-radius-lg, 0.75rem) 0 0;
|
|
30
|
+
box-shadow: var(--velin-shadow-xl, 0 -4px 24px rgba(0,0,0,0.12));
|
|
31
|
+
display: flex; flex-direction: column;
|
|
32
|
+
transform: translateY(100%);
|
|
33
|
+
transition: transform 250ms ease;
|
|
34
|
+
padding-block-end: env(safe-area-inset-bottom, 0px);
|
|
35
|
+
}
|
|
36
|
+
:host([open]) .sheet { transform: translateY(0); }
|
|
37
|
+
.header {
|
|
38
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
39
|
+
padding: var(--velin-space-4, 1rem) var(--velin-space-5, 1.25rem);
|
|
40
|
+
border-bottom: 1px solid var(--velin-color-border, #ddd);
|
|
41
|
+
}
|
|
42
|
+
.title { font-size: var(--velin-text-lg, 1.25rem); font-weight: 600; margin: 0; }
|
|
43
|
+
.close-btn {
|
|
44
|
+
min-width: 2.75rem; min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center;
|
|
45
|
+
background: none; border: none; border-radius: var(--velin-radius-md, 0.5rem); cursor: pointer;
|
|
46
|
+
color: var(--velin-color-text-muted, #666); font-size: 1.5rem; line-height: 1;
|
|
47
|
+
}
|
|
48
|
+
.close-btn:hover { background: var(--velin-color-surface-dim, #eee); color: var(--velin-color-text, #111); }
|
|
49
|
+
.body { flex: 1; overflow-y: auto; padding: var(--velin-space-5, 1.25rem); }
|
|
50
|
+
@media (prefers-reduced-motion: reduce) { .overlay, .sheet { transition: none; } }
|
|
51
|
+
`;
|
|
52
|
+
var VelinSheet = class extends HTMLElement {
|
|
53
|
+
static get observedAttributes() {
|
|
54
|
+
return ["open", "title", "label"];
|
|
55
|
+
}
|
|
56
|
+
constructor() {
|
|
57
|
+
super();
|
|
58
|
+
this.attachShadow({ mode: "open", delegatesFocus: true });
|
|
59
|
+
this._prev = null;
|
|
60
|
+
this._onKey = this._onKey.bind(this);
|
|
61
|
+
this._onTitleSlot = this._onTitleSlot.bind(this);
|
|
62
|
+
}
|
|
63
|
+
connectedCallback() {
|
|
64
|
+
if (this.shadowRoot.querySelector(".sheet")) return;
|
|
65
|
+
const titleId = "velin-sheet-title";
|
|
66
|
+
this.shadowRoot.innerHTML = `
|
|
67
|
+
<style>${styles}</style>
|
|
68
|
+
<div class="overlay" part="overlay"></div>
|
|
69
|
+
<div class="sheet" role="dialog" aria-modal="true" aria-labelledby="${titleId}" part="sheet">
|
|
70
|
+
<div class="header" part="header">
|
|
71
|
+
<h2 class="title" id="${titleId}" part="title">
|
|
72
|
+
<slot name="title"></slot>
|
|
73
|
+
<span class="title-fallback"></span>
|
|
74
|
+
</h2>
|
|
75
|
+
<button class="close-btn" aria-label="Close" part="close">×</button>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="body" part="body"><slot></slot></div>
|
|
78
|
+
</div>
|
|
79
|
+
`;
|
|
80
|
+
this.shadowRoot.querySelector(".close-btn").addEventListener("click", () => this.close());
|
|
81
|
+
this.shadowRoot.querySelector(".overlay").addEventListener("click", () => this.close());
|
|
82
|
+
this.shadowRoot.querySelector('slot[name="title"]').addEventListener("slotchange", this._onTitleSlot);
|
|
83
|
+
this._syncTitle();
|
|
84
|
+
if (this.hasAttribute("open")) this._open();
|
|
85
|
+
}
|
|
86
|
+
attributeChangedCallback(name) {
|
|
87
|
+
if (name === "open") this.hasAttribute("open") ? this._open() : this._close();
|
|
88
|
+
if (name === "title" || name === "label") this._syncTitle();
|
|
89
|
+
}
|
|
90
|
+
open() {
|
|
91
|
+
this.setAttribute("open", "");
|
|
92
|
+
}
|
|
93
|
+
close() {
|
|
94
|
+
this.removeAttribute("open");
|
|
95
|
+
this.dispatchEvent(new CustomEvent("velin-close", { bubbles: true }));
|
|
96
|
+
}
|
|
97
|
+
_syncTitle() {
|
|
98
|
+
const fallback = this.shadowRoot?.querySelector(".title-fallback");
|
|
99
|
+
if (!fallback) return;
|
|
100
|
+
fallback.textContent = this.getAttribute("title") || this.getAttribute("label") || "";
|
|
101
|
+
}
|
|
102
|
+
_hasTitleSlot() {
|
|
103
|
+
const slot = this.shadowRoot?.querySelector('slot[name="title"]');
|
|
104
|
+
if (!slot) return false;
|
|
105
|
+
return slot.assignedNodes({ flatten: true }).some((n) => {
|
|
106
|
+
if (n.nodeType === Node.TEXT_NODE) return Boolean(n.textContent.trim());
|
|
107
|
+
return n.nodeType === Node.ELEMENT_NODE;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
_onTitleSlot() {
|
|
111
|
+
const dialog = this.shadowRoot?.querySelector('[role="dialog"]');
|
|
112
|
+
const fallback = this.shadowRoot?.querySelector(".title-fallback");
|
|
113
|
+
if (!dialog || !fallback) return;
|
|
114
|
+
if (this._hasTitleSlot()) {
|
|
115
|
+
fallback.hidden = true;
|
|
116
|
+
dialog.removeAttribute("aria-labelledby");
|
|
117
|
+
const slot = this.shadowRoot.querySelector('slot[name="title"]');
|
|
118
|
+
const label = slot.assignedNodes({ flatten: true }).map((n) => n.textContent || "").join(" ").trim();
|
|
119
|
+
if (label) dialog.setAttribute("aria-label", label);
|
|
120
|
+
} else {
|
|
121
|
+
fallback.hidden = false;
|
|
122
|
+
dialog.removeAttribute("aria-label");
|
|
123
|
+
dialog.setAttribute("aria-labelledby", "velin-sheet-title");
|
|
124
|
+
this._syncTitle();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
_open() {
|
|
128
|
+
this._prev = saveFocus();
|
|
129
|
+
setBackgroundInert(this);
|
|
130
|
+
document.addEventListener("keydown", this._onKey);
|
|
131
|
+
requestAnimationFrame(() => {
|
|
132
|
+
const f = getFocusableElements(this.shadowRoot);
|
|
133
|
+
if (f.length) f[0].focus();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
_close() {
|
|
137
|
+
document.removeEventListener("keydown", this._onKey);
|
|
138
|
+
clearBackgroundInert(this);
|
|
139
|
+
restoreFocus(this._prev);
|
|
140
|
+
}
|
|
141
|
+
_onKey(e) {
|
|
142
|
+
if (e.key === "Escape") {
|
|
143
|
+
this.close();
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
trapFocus(this.shadowRoot, e);
|
|
147
|
+
}
|
|
148
|
+
disconnectedCallback() {
|
|
149
|
+
document.removeEventListener("keydown", this._onKey);
|
|
150
|
+
clearBackgroundInert(this);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
customElements.define("velin-sheet", VelinSheet);
|
|
154
|
+
var velin_sheet_default = VelinSheet;
|
|
155
|
+
export {
|
|
156
|
+
velin_sheet_default as default
|
|
157
|
+
};
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
// components/velin-theme-toggle.js
|
|
2
|
+
var THEMES = [
|
|
3
|
+
{ slug: "", label: "Default (Light)" },
|
|
4
|
+
{ slug: "dark", label: "Dark" },
|
|
5
|
+
{ slug: "brutalist", label: "Brutalist" },
|
|
6
|
+
{ slug: "corporate", label: "Corporate" },
|
|
7
|
+
{ slug: "earth", label: "Earth" },
|
|
8
|
+
{ slug: "forest", label: "Forest" },
|
|
9
|
+
{ slug: "midnight", label: "Midnight" },
|
|
10
|
+
{ slug: "neon", label: "Neon" },
|
|
11
|
+
{ slug: "nordic", label: "Nordic" },
|
|
12
|
+
{ slug: "ocean", label: "Ocean" },
|
|
13
|
+
{ slug: "pastel", label: "Pastel" },
|
|
14
|
+
{ slug: "retro", label: "Retro" },
|
|
15
|
+
{ slug: "sharp", label: "Sharp" },
|
|
16
|
+
{ slug: "soft", label: "Soft" },
|
|
17
|
+
{ slug: "sunset", label: "Sunset" }
|
|
18
|
+
];
|
|
19
|
+
var BUILTIN_THEMES = /* @__PURE__ */ new Set(["", "dark"]);
|
|
20
|
+
var DARK_THEME_SLUGS = /* @__PURE__ */ new Set(["dark", "midnight", "neon"]);
|
|
21
|
+
var loadedThemeStylesheets = /* @__PURE__ */ new Set();
|
|
22
|
+
function applyColorScheme(target, slug) {
|
|
23
|
+
const dark = DARK_THEME_SLUGS.has(slug);
|
|
24
|
+
if (target === document.documentElement || target === document.body) {
|
|
25
|
+
target.style.colorScheme = dark ? "dark" : "light";
|
|
26
|
+
}
|
|
27
|
+
target.setAttribute("data-velin-color-scheme", dark ? "dark" : "light");
|
|
28
|
+
}
|
|
29
|
+
function ensureThemeStylesheet(slug, base) {
|
|
30
|
+
if (!slug || BUILTIN_THEMES.has(slug)) return;
|
|
31
|
+
if (loadedThemeStylesheets.has(slug)) return;
|
|
32
|
+
const existing = document.querySelector(`link[data-velin-theme-css="${slug}"]`);
|
|
33
|
+
if (existing) {
|
|
34
|
+
loadedThemeStylesheets.add(slug);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const link = document.createElement("link");
|
|
38
|
+
link.rel = "stylesheet";
|
|
39
|
+
link.href = `${base.replace(/\/$/, "")}/${slug}.min.css`;
|
|
40
|
+
link.setAttribute("data-velin-theme-css", slug);
|
|
41
|
+
document.head.appendChild(link);
|
|
42
|
+
loadedThemeStylesheets.add(slug);
|
|
43
|
+
}
|
|
44
|
+
var styles = `
|
|
45
|
+
:host { display: inline-flex; position: relative; }
|
|
46
|
+
.group {
|
|
47
|
+
display: inline-flex; align-items: stretch;
|
|
48
|
+
border: 2px solid var(--velin-color-border, #ddd);
|
|
49
|
+
border-radius: var(--velin-radius-md, 0.5rem);
|
|
50
|
+
background: none;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
}
|
|
53
|
+
button {
|
|
54
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
55
|
+
min-height: 2.75rem; padding: 0.5rem;
|
|
56
|
+
background: none; border: 0; cursor: pointer;
|
|
57
|
+
color: var(--velin-color-text, #111);
|
|
58
|
+
transition: background 150ms ease;
|
|
59
|
+
}
|
|
60
|
+
button:hover { background: var(--velin-color-surface-dim, #eee); }
|
|
61
|
+
button:focus-visible {
|
|
62
|
+
outline: 3px solid var(--velin-color-focus, #2563eb);
|
|
63
|
+
outline-offset: 2px;
|
|
64
|
+
}
|
|
65
|
+
.toggle { min-width: 2.75rem; }
|
|
66
|
+
.picker {
|
|
67
|
+
min-width: 1.75rem;
|
|
68
|
+
border-inline-start: 1px solid var(--velin-color-border, #ddd);
|
|
69
|
+
color: var(--velin-color-text-muted, #555);
|
|
70
|
+
}
|
|
71
|
+
svg { width: 1.25rem; height: 1.25rem; transition: transform 300ms ease; }
|
|
72
|
+
.chev { width: 0.75rem; height: 0.75rem; }
|
|
73
|
+
:host([theme="dark"]) .sun { display: none; }
|
|
74
|
+
:host(:not([theme="dark"])) .moon { display: none; }
|
|
75
|
+
:host([compact]) .picker { display: none; }
|
|
76
|
+
:host([compact]) .toggle { border-inline-end: 0; }
|
|
77
|
+
@media (prefers-reduced-motion: reduce) { svg { transition: none; } }
|
|
78
|
+
|
|
79
|
+
.menu {
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: calc(100% + 0.5rem);
|
|
82
|
+
inset-inline-end: 0;
|
|
83
|
+
z-index: 1000;
|
|
84
|
+
min-width: 12rem;
|
|
85
|
+
padding: 0.375rem;
|
|
86
|
+
background: var(--velin-color-surface-bright, #fff);
|
|
87
|
+
border: 1px solid var(--velin-color-border, #ddd);
|
|
88
|
+
border-radius: var(--velin-radius-md, 0.5rem);
|
|
89
|
+
box-shadow: var(--velin-shadow-lg, 0 12px 32px rgba(0,0,0,0.12));
|
|
90
|
+
list-style: none;
|
|
91
|
+
margin: 0;
|
|
92
|
+
display: none;
|
|
93
|
+
max-height: min(70vh, 24rem);
|
|
94
|
+
overflow-y: auto;
|
|
95
|
+
}
|
|
96
|
+
:host([menu-open]) .menu { display: block; }
|
|
97
|
+
.menu li { margin: 0; }
|
|
98
|
+
.menu button {
|
|
99
|
+
width: 100%;
|
|
100
|
+
justify-content: flex-start;
|
|
101
|
+
padding: 0.4rem 0.75rem;
|
|
102
|
+
font-size: 0.875rem;
|
|
103
|
+
color: var(--velin-color-text, #111);
|
|
104
|
+
border-radius: var(--velin-radius-sm, 0.25rem);
|
|
105
|
+
min-height: 2rem;
|
|
106
|
+
text-align: start;
|
|
107
|
+
}
|
|
108
|
+
.menu button:hover,
|
|
109
|
+
.menu button[aria-current="true"] {
|
|
110
|
+
background: var(--velin-color-primary-subtle, #eef);
|
|
111
|
+
color: var(--velin-color-primary, #2a4cf0);
|
|
112
|
+
}
|
|
113
|
+
.menu button[aria-current="true"] {
|
|
114
|
+
font-weight: 600;
|
|
115
|
+
}
|
|
116
|
+
.menu .swatch {
|
|
117
|
+
width: 0.75rem; height: 0.75rem;
|
|
118
|
+
border-radius: 50%;
|
|
119
|
+
margin-inline-end: 0.5rem;
|
|
120
|
+
background: currentColor;
|
|
121
|
+
border: 1px solid var(--velin-color-border, #ddd);
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
var VelinThemeToggle = class extends HTMLElement {
|
|
125
|
+
constructor() {
|
|
126
|
+
super();
|
|
127
|
+
this.attachShadow({ mode: "open" });
|
|
128
|
+
this._onDocClick = this._onDocClick.bind(this);
|
|
129
|
+
this._onKeyDown = this._onKeyDown.bind(this);
|
|
130
|
+
}
|
|
131
|
+
connectedCallback() {
|
|
132
|
+
this.shadowRoot.innerHTML = `
|
|
133
|
+
<style>${styles}</style>
|
|
134
|
+
<div class="group" part="group">
|
|
135
|
+
<button class="toggle" part="button" aria-label="Toggle dark mode" aria-pressed="false">
|
|
136
|
+
<svg class="sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true" focusable="false">
|
|
137
|
+
<circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/>
|
|
138
|
+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
|
|
139
|
+
<line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/>
|
|
140
|
+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
|
|
141
|
+
</svg>
|
|
142
|
+
<svg class="moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true" focusable="false">
|
|
143
|
+
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/>
|
|
144
|
+
</svg>
|
|
145
|
+
</button>
|
|
146
|
+
<button class="picker" part="picker" aria-label="Choose theme" aria-haspopup="menu" aria-expanded="false">
|
|
147
|
+
<svg class="chev" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
|
|
148
|
+
<polyline points="6 9 12 15 18 9"/>
|
|
149
|
+
</svg>
|
|
150
|
+
</button>
|
|
151
|
+
</div>
|
|
152
|
+
<ul class="menu" role="menu" aria-label="Theme selection" hidden></ul>
|
|
153
|
+
`;
|
|
154
|
+
this._target = document.querySelector(this.getAttribute("target") || "html");
|
|
155
|
+
this._themesBase = this.getAttribute("themes-base") || "dist/themes";
|
|
156
|
+
this._menu = this.shadowRoot.querySelector(".menu");
|
|
157
|
+
this._toggleBtn = this.shadowRoot.querySelector(".toggle");
|
|
158
|
+
this._pickerBtn = this.shadowRoot.querySelector(".picker");
|
|
159
|
+
this._renderMenu();
|
|
160
|
+
this._initPreference();
|
|
161
|
+
this._syncTogglePressed();
|
|
162
|
+
this._toggleBtn.addEventListener("click", () => this._toggleDarkMode());
|
|
163
|
+
this._pickerBtn.addEventListener("click", (e) => {
|
|
164
|
+
e.stopPropagation();
|
|
165
|
+
this._toggleMenu();
|
|
166
|
+
});
|
|
167
|
+
document.addEventListener("click", this._onDocClick);
|
|
168
|
+
this.shadowRoot.addEventListener("keydown", this._onKeyDown);
|
|
169
|
+
const prefersDarkMq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
170
|
+
prefersDarkMq.addEventListener("change", () => this._applyFromPreference());
|
|
171
|
+
window.addEventListener("storage", (e) => {
|
|
172
|
+
if (e.key === "velin-theme") this._readStorage();
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
disconnectedCallback() {
|
|
176
|
+
document.removeEventListener("click", this._onDocClick);
|
|
177
|
+
}
|
|
178
|
+
_renderMenu() {
|
|
179
|
+
this._menu.innerHTML = THEMES.map((t) => `
|
|
180
|
+
<li role="none">
|
|
181
|
+
<button type="button" role="menuitem" data-theme="${t.slug}">
|
|
182
|
+
<span class="swatch" aria-hidden="true" data-theme-swatch="${t.slug}"></span>
|
|
183
|
+
${t.label}
|
|
184
|
+
</button>
|
|
185
|
+
</li>
|
|
186
|
+
`).join("");
|
|
187
|
+
this._menu.removeAttribute("hidden");
|
|
188
|
+
this._menu.querySelectorAll("button[data-theme]").forEach((btn) => {
|
|
189
|
+
btn.addEventListener("click", () => {
|
|
190
|
+
const slug = btn.getAttribute("data-theme");
|
|
191
|
+
this._applyTheme(slug, { persist: true });
|
|
192
|
+
this._closeMenu();
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
_toggleMenu() {
|
|
197
|
+
if (this.hasAttribute("menu-open")) this._closeMenu();
|
|
198
|
+
else this._openMenu();
|
|
199
|
+
}
|
|
200
|
+
_openMenu() {
|
|
201
|
+
this.setAttribute("menu-open", "");
|
|
202
|
+
this._pickerBtn.setAttribute("aria-expanded", "true");
|
|
203
|
+
this._highlightActive();
|
|
204
|
+
const first = this._menu.querySelector("button[data-theme]");
|
|
205
|
+
if (first) first.focus();
|
|
206
|
+
}
|
|
207
|
+
_closeMenu() {
|
|
208
|
+
this.removeAttribute("menu-open");
|
|
209
|
+
this._pickerBtn.setAttribute("aria-expanded", "false");
|
|
210
|
+
}
|
|
211
|
+
_onDocClick(e) {
|
|
212
|
+
if (!this.hasAttribute("menu-open")) return;
|
|
213
|
+
if (e.composedPath().includes(this)) return;
|
|
214
|
+
this._closeMenu();
|
|
215
|
+
}
|
|
216
|
+
_onKeyDown(e) {
|
|
217
|
+
if (!this.hasAttribute("menu-open")) return;
|
|
218
|
+
if (e.key === "Escape") {
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
this._closeMenu();
|
|
221
|
+
this._pickerBtn.focus();
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
225
|
+
e.preventDefault();
|
|
226
|
+
const items = Array.from(this._menu.querySelectorAll("button[data-theme]"));
|
|
227
|
+
const idx = items.indexOf(this.shadowRoot.activeElement);
|
|
228
|
+
const next = e.key === "ArrowDown" ? items[(idx + 1) % items.length] : items[(idx - 1 + items.length) % items.length];
|
|
229
|
+
next?.focus();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
_highlightActive() {
|
|
233
|
+
const current = this._currentSlug();
|
|
234
|
+
this._menu.querySelectorAll("button[data-theme]").forEach((btn) => {
|
|
235
|
+
const slug = btn.getAttribute("data-theme");
|
|
236
|
+
if (slug === current) btn.setAttribute("aria-current", "true");
|
|
237
|
+
else btn.removeAttribute("aria-current");
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
_currentSlug() {
|
|
241
|
+
if (!this._target) return "";
|
|
242
|
+
const value = this._target.getAttribute("data-velin-theme");
|
|
243
|
+
if (!value || value === "light") return "";
|
|
244
|
+
return value;
|
|
245
|
+
}
|
|
246
|
+
_initPreference() {
|
|
247
|
+
const stored = localStorage.getItem("velin-theme");
|
|
248
|
+
if (stored) {
|
|
249
|
+
this._applyTheme(stored, { persist: false });
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
this._applyFromPreference();
|
|
253
|
+
}
|
|
254
|
+
_readStorage() {
|
|
255
|
+
const stored = localStorage.getItem("velin-theme");
|
|
256
|
+
this._applyTheme(stored || "", { persist: false });
|
|
257
|
+
}
|
|
258
|
+
_applyFromPreference() {
|
|
259
|
+
if (localStorage.getItem("velin-theme")) return;
|
|
260
|
+
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
261
|
+
this._applyTheme(prefersDark ? "dark" : "", { persist: false });
|
|
262
|
+
}
|
|
263
|
+
_applyTheme(slug, { persist }) {
|
|
264
|
+
const normalized = !slug || slug === "light" ? "" : slug;
|
|
265
|
+
if (!this._target) return;
|
|
266
|
+
if (!normalized) {
|
|
267
|
+
this._target.removeAttribute("data-velin-theme");
|
|
268
|
+
this.removeAttribute("theme");
|
|
269
|
+
} else {
|
|
270
|
+
this._target.setAttribute("data-velin-theme", normalized);
|
|
271
|
+
this.setAttribute("theme", normalized === "dark" ? "dark" : normalized);
|
|
272
|
+
ensureThemeStylesheet(normalized, this._themesBase);
|
|
273
|
+
}
|
|
274
|
+
applyColorScheme(this._target, normalized);
|
|
275
|
+
if (persist) {
|
|
276
|
+
if (!normalized) localStorage.removeItem("velin-theme");
|
|
277
|
+
else localStorage.setItem("velin-theme", normalized);
|
|
278
|
+
}
|
|
279
|
+
this._highlightActive();
|
|
280
|
+
this.dispatchEvent(new CustomEvent("velin-theme-change", {
|
|
281
|
+
bubbles: true,
|
|
282
|
+
detail: {
|
|
283
|
+
theme: normalized || "light",
|
|
284
|
+
dark: DARK_THEME_SLUGS.has(normalized),
|
|
285
|
+
slug: normalized
|
|
286
|
+
}
|
|
287
|
+
}));
|
|
288
|
+
}
|
|
289
|
+
_syncTogglePressed() {
|
|
290
|
+
const dark = this._currentSlug() === "dark";
|
|
291
|
+
this._toggleBtn?.setAttribute("aria-pressed", dark ? "true" : "false");
|
|
292
|
+
}
|
|
293
|
+
_toggleDarkMode() {
|
|
294
|
+
const current = this._currentSlug();
|
|
295
|
+
const next = current === "dark" ? "" : "dark";
|
|
296
|
+
this._applyTheme(next, { persist: true });
|
|
297
|
+
this._syncTogglePressed();
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
customElements.define("velin-theme-toggle", VelinThemeToggle);
|
|
301
|
+
var velin_theme_toggle_default = VelinThemeToggle;
|
|
302
|
+
export {
|
|
303
|
+
velin_theme_toggle_default as default
|
|
304
|
+
};
|
package/dist/llms.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# VelinStyle 1.
|
|
1
|
+
# VelinStyle 1.3.0
|
|
2
2
|
|
|
3
3
|
> VelinStyle is a CSS framework with WCAG 2.2 AAA-oriented defaults, native JavaScript runtime, and Web Components.
|
|
4
4
|
> Full machine context: https://velinstyle.info/dist/velin-agent.json
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
- VelinStyle is a CSS framework with WCAG 2.2 AAA-oriented defaults, native JavaScript runtime, and Web Components.
|
|
10
10
|
- Pipeline: Core Foundation → Design System → Knowledge Graph → Prompt Engine → Review Engine → AI Metadata
|
|
11
11
|
- Maturity: CSS/Web Components/runtime = stable; plan/review, knowledge graph, page/section registry, agent metadata = beta/foundation (seed, expanding); Studio + Utility Engine generator = planned
|
|
12
|
-
- Components:
|
|
13
|
-
- Knowledge graph:
|
|
14
|
-
- HTML attributes:
|
|
12
|
+
- Components: 43 canonical Web Components (`velin-*`); 45 lazy-loader entries
|
|
13
|
+
- Knowledge graph: 20 component nodes, 17 page types, 12 sections, 3 design constraint packs
|
|
14
|
+
- HTML attributes: 36 `velin-*` bridges
|
|
15
15
|
- CLI: velinstyle (scan, scaffold, plan, review, docs generate, search index, meta)
|
|
16
16
|
|
|
17
17
|
## Agent briefing
|