@birdapi/velinstyle 1.0.0 → 1.1.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.
Files changed (43) hide show
  1. package/README.de.md +12 -8
  2. package/README.md +12 -8
  3. package/cli/cli-manifest.json +1 -1
  4. package/cli/docgen/extract-a11y.js +4 -2
  5. package/cli/index.js +4 -2
  6. package/components/index.js +2 -0
  7. package/components/runtime/component-loaders.js +2 -0
  8. package/components/velin-data-table.js +361 -0
  9. package/components/velin-form-summary.js +348 -0
  10. package/core/a11y/component-contracts.json +18 -1
  11. package/core/highlight/languages/go.js +28 -0
  12. package/core/highlight/languages/python.js +29 -0
  13. package/core/highlight/languages/rust.js +32 -0
  14. package/core/highlight/languages/yaml.js +23 -0
  15. package/core/highlight/registry.js +13 -2
  16. package/core/meta/build.js +1 -1
  17. package/dist/chunks/attributes-353XDOAX.js +391 -0
  18. package/dist/chunks/chunk-ERF5YVP4.js +253 -0
  19. package/dist/chunks/chunk-QVHYL3R4.js +111 -0
  20. package/dist/chunks/go-HZ6XTFCK.js +31 -0
  21. package/dist/chunks/highlight-IBDX4XWS.js +37 -0
  22. package/dist/chunks/python-BMPKDKNO.js +32 -0
  23. package/dist/chunks/runtime-entry.js +1 -1
  24. package/dist/chunks/rust-2BWKI2MN.js +35 -0
  25. package/dist/chunks/velin-code-block-ITCLIC6T.js +132 -0
  26. package/dist/chunks/velin-data-table-KK7IDGTP.js +302 -0
  27. package/dist/chunks/velin-form-summary-XRQ7COQH.js +273 -0
  28. package/dist/chunks/velin-lightbox-NXA3U2FM.js +149 -0
  29. package/dist/chunks/yaml-O67LEQYT.js +26 -0
  30. package/dist/llms.txt +2 -2
  31. package/dist/search-index.json +28 -2
  32. package/dist/velin-agent.json +31 -5
  33. package/dist/velinstyle-components.iife.js +742 -4
  34. package/dist/velinstyle-components.js +744 -4
  35. package/dist/velinstyle-components.min.js +85 -85
  36. package/dist/velinstyle.css +129 -0
  37. package/dist/velinstyle.d.ts +2 -0
  38. package/dist/velinstyle.min.css +1 -1
  39. package/package.json +8 -2
  40. package/src/base/wc-placeholder.css +7 -0
  41. package/src/components/data-table.css +93 -0
  42. package/src/components/form-validation.css +40 -0
  43. package/src/velinstyle.css +1 -0
@@ -0,0 +1,111 @@
1
+ // components/runtime/component-loaders.js
2
+ var COMPONENT_LOADERS = {
3
+ "velin-accordion": () => import("./velin-accordion-QAQO7BI7.js"),
4
+ "velin-announcer": () => import("./velin-announcer-PVTXXCWR.js"),
5
+ "velin-bottom-nav": () => import("./velin-bottom-nav-CTU6FFZV.js"),
6
+ "velin-carousel": () => import("./velin-carousel-ZTBANFQQ.js"),
7
+ "velin-code-block": () => import("./velin-code-block-ITCLIC6T.js"),
8
+ "velin-collapse": () => import("./velin-collapse-5XYBUIID.js"),
9
+ "velin-combobox": () => import("./velin-combobox-UGA56HP3.js"),
10
+ "velin-command": () => import("./velin-command-CKDNO4BW.js"),
11
+ "velin-copy": () => import("./velin-copy-G2TZ5YBB.js"),
12
+ "velin-countdown": () => import("./velin-countdown-7AIY66CU.js"),
13
+ "velin-counter": () => import("./velin-counter-L5FYJF7A.js"),
14
+ "velin-data-table": () => import("./velin-data-table-KK7IDGTP.js"),
15
+ "velin-dialog": () => import("./velin-dialog-ELFOZIXZ.js"),
16
+ "velin-drawer": () => import("./velin-drawer-BE6TYN3H.js"),
17
+ "velin-dropdown": () => import("./velin-dropdown-PLUIFA5M.js"),
18
+ "velin-email": () => import("./velin-email-NTM6DG3V.js"),
19
+ "velin-form-summary": () => import("./velin-form-summary-XRQ7COQH.js"),
20
+ "velin-icon": () => import("./velin-icon-WTFPG2DD.js"),
21
+ "velin-lightbox": () => import("./velin-lightbox-NXA3U2FM.js"),
22
+ "velin-live-dot": () => import("./velin-live-dot-RJHX2DGY.js"),
23
+ "velin-menubar": () => import("./velin-menubar-I426AED2.js"),
24
+ "velin-modal": () => import("./velin-modal-AEOTZ67O.js"),
25
+ "velin-persist": () => import("./velin-persist-DFPL3QP4.js"),
26
+ "velin-popover": () => import("./velin-popover-HQW6Q2Y6.js"),
27
+ "velin-progress-ring": () => import("./velin-progress-ring-E4YRLZHH.js"),
28
+ "velin-rating": () => import("./velin-rating-6CDBI6DG.js"),
29
+ "velin-scroll-top": () => import("./velin-scroll-top-OHYVVHHY.js"),
30
+ "velin-scrollspy": () => import("./velin-scrollspy-OKCT4FDV.js"),
31
+ "velin-search": () => import("./velin-search-FDHEMCSO.js"),
32
+ "velin-secure-field": () => import("./velin-secure-field-OFNAXCDP.js"),
33
+ "velin-segmented-control": () => import("./velin-segmented-control-EKL4E3BL.js"),
34
+ "velin-sheet": () => import("./velin-sheet-R2Y67X6H.js"),
35
+ "velin-sparkline": () => import("./velin-sparkline-XVTFC6GE.js"),
36
+ "velin-stepper": () => import("./velin-stepper-7ECRUYHD.js"),
37
+ "velin-stepper-wc": () => import("./velin-stepper-7ECRUYHD.js"),
38
+ "velin-tabs": () => import("./velin-tabs-5UQ5ZVMV.js"),
39
+ "velin-theme-toggle": () => import("./velin-theme-toggle-32J2CBNC.js"),
40
+ "velin-toast": () => import("./velin-toast-RSF2IHT3.js"),
41
+ "velin-tooltip": () => import("./velin-tooltip-HVUOKNVX.js"),
42
+ "velin-tooltip-wc": () => import("./velin-tooltip-HVUOKNVX.js")
43
+ };
44
+
45
+ // components/runtime/index.js
46
+ var registry = /* @__PURE__ */ new Map();
47
+ var VELIN_TAG_RE = /^velin-[a-z0-9-]+$/;
48
+ function whenDefined(tagName) {
49
+ if (typeof customElements === "undefined") {
50
+ return Promise.reject(new Error("customElements not available"));
51
+ }
52
+ return customElements.whenDefined(tagName);
53
+ }
54
+ async function lazyDefine(tagName) {
55
+ const loader = COMPONENT_LOADERS[tagName];
56
+ if (!loader) {
57
+ throw new Error(`Unknown Velin component: ${tagName}`);
58
+ }
59
+ if (registry.has(tagName)) return registry.get(tagName);
60
+ const p = loader().then((mod) => {
61
+ const Cls = mod.default;
62
+ if (Cls && !customElements.get(tagName)) {
63
+ customElements.define(tagName, Cls);
64
+ }
65
+ return Cls;
66
+ });
67
+ registry.set(tagName, p);
68
+ return p;
69
+ }
70
+ async function register(tagNames) {
71
+ return Promise.all(tagNames.map((t) => lazyDefine(t)));
72
+ }
73
+ function collectTagsFromDOM(root) {
74
+ const tags = /* @__PURE__ */ new Set();
75
+ root.querySelectorAll("[data-velin-component]").forEach((el) => {
76
+ const name = el.getAttribute("data-velin-component");
77
+ if (name) tags.add(name.startsWith("velin-") ? name : `velin-${name}`);
78
+ });
79
+ for (const el of root.querySelectorAll("*")) {
80
+ const tag = el.tagName?.toLowerCase();
81
+ if (tag && VELIN_TAG_RE.test(tag) && COMPONENT_LOADERS[tag]) {
82
+ tags.add(tag);
83
+ }
84
+ }
85
+ return tags;
86
+ }
87
+ async function bootFromDOM(root = document, options = {}) {
88
+ const tags = options.tags?.length ? new Set(options.tags) : collectTagsFromDOM(root);
89
+ const wcPromise = register([...tags]);
90
+ if (options.attributes) {
91
+ const { bootAttributes } = await import("./attributes-353XDOAX.js");
92
+ await bootAttributes(root);
93
+ }
94
+ if (options.highlight) {
95
+ const { initHighlight } = await import("./highlight-IBDX4XWS.js");
96
+ initHighlight(root);
97
+ }
98
+ if (options.haptic) {
99
+ const { VelinHapticObserver } = await import("./velin-haptic-4QQTM3RK.js");
100
+ new VelinHapticObserver().start(root instanceof Document ? root.body : root);
101
+ }
102
+ return wcPromise;
103
+ }
104
+
105
+ export {
106
+ COMPONENT_LOADERS,
107
+ whenDefined,
108
+ lazyDefine,
109
+ register,
110
+ bootFromDOM
111
+ };
@@ -0,0 +1,31 @@
1
+ import {
2
+ tokenize
3
+ } from "./chunk-7FFAMRFV.js";
4
+
5
+ // core/highlight/languages/go.js
6
+ var RULES = [
7
+ { type: "comment", re: /\/\/[^\n]*/y },
8
+ { type: "comment", re: /\/\*[\s\S]*?\*\//y },
9
+ // Raw strings may span lines.
10
+ { type: "string", re: /`[^`]*`/y },
11
+ { type: "string", re: /"(?:\\.|[^"\\\n])*"/y },
12
+ { type: "string", re: /'(?:\\.|[^'\\\n])*'/y },
13
+ { type: "number", re: /\b0[xX][\da-fA-F_]+\b|\b\d[\d_]*(?:\.[\d_]*)?(?:[eE][+-]?\d+)?i?\b/y },
14
+ {
15
+ type: "keyword",
16
+ re: /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go|goto|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/y
17
+ },
18
+ {
19
+ type: "builtin",
20
+ re: /\b(?:append|bool|byte|cap|clear|close|complex|complex64|complex128|copy|delete|error|float32|float64|imag|int|int8|int16|int32|int64|len|make|max|min|new|nil|panic|print|println|real|recover|rune|string|true|false|iota|uint|uint8|uint16|uint32|uint64|uintptr|any)\b/y
21
+ },
22
+ { type: "operator", re: /:=|\.\.\.|&&|\|\||<-|\+\+|--|<<=?|>>=?|&\^=?|[-+*/%&|^<>!=]=?|~/y },
23
+ { type: "punctuation", re: /[[\]{}(),;:.]/y },
24
+ { type: "identifier", re: /\b[A-Za-z_]\w*\b/y }
25
+ ];
26
+ function lexGo(code) {
27
+ return tokenize(code, RULES);
28
+ }
29
+ export {
30
+ lexGo as default
31
+ };
@@ -0,0 +1,37 @@
1
+ import {
2
+ applyHighlight,
3
+ escapeHtml,
4
+ getLanguage,
5
+ getSourceText,
6
+ highlightAll,
7
+ highlightElement,
8
+ initHighlight,
9
+ lazyLoadLanguage,
10
+ listLanguages,
11
+ normalizeLanguage,
12
+ observeCodeBlocks,
13
+ registerLanguage,
14
+ renderTokens,
15
+ resolveLanguage,
16
+ velinSyntax
17
+ } from "./chunk-ERF5YVP4.js";
18
+ import "./chunk-7MCGPHVC.js";
19
+ import "./chunk-M5CHQVP6.js";
20
+ import "./chunk-7FFAMRFV.js";
21
+ export {
22
+ applyHighlight,
23
+ escapeHtml,
24
+ getLanguage,
25
+ getSourceText,
26
+ highlightAll,
27
+ highlightElement,
28
+ initHighlight,
29
+ lazyLoadLanguage,
30
+ listLanguages,
31
+ normalizeLanguage,
32
+ observeCodeBlocks,
33
+ registerLanguage,
34
+ renderTokens,
35
+ resolveLanguage,
36
+ velinSyntax
37
+ };
@@ -0,0 +1,32 @@
1
+ import {
2
+ tokenize
3
+ } from "./chunk-7FFAMRFV.js";
4
+
5
+ // core/highlight/languages/python.js
6
+ var RULES = [
7
+ { type: "comment", re: /#[^\n]*/y },
8
+ // Triple-quoted strings first so the single-quote rules cannot split them.
9
+ { type: "string", re: /[rbfu]{0,2}"""[\s\S]*?"""/y },
10
+ { type: "string", re: /[rbfu]{0,2}'''[\s\S]*?'''/y },
11
+ { type: "string", re: /[rbfu]{0,2}"(?:\\.|[^"\\\n])*"/y },
12
+ { type: "string", re: /[rbfu]{0,2}'(?:\\.|[^'\\\n])*'/y },
13
+ { type: "number", re: /\b0[xX][\da-fA-F_]+\b|\b\d[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?j?\b/y },
14
+ {
15
+ type: "keyword",
16
+ re: /\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|raise|return|try|while|with|yield)\b/y
17
+ },
18
+ {
19
+ type: "builtin",
20
+ re: /\b(?:None|True|False|self|cls|abs|all|any|bool|bytes|dict|dir|enumerate|filter|float|format|frozenset|getattr|hasattr|int|isinstance|issubclass|iter|len|list|map|max|min|next|object|open|print|range|repr|reversed|round|set|setattr|sorted|str|sum|super|tuple|type|zip)\b/y
21
+ },
22
+ // Multi-character operators first so `->` is not split into `-` and `>`.
23
+ { type: "operator", re: /->|:=|\*\*=?|\/\/=?|<<=?|>>=?|[-+*/%&|^~<>!=]=?/y },
24
+ { type: "punctuation", re: /[[\]{}(),:;.@]/y },
25
+ { type: "identifier", re: /\b[A-Za-z_]\w*\b/y }
26
+ ];
27
+ function lexPython(code) {
28
+ return tokenize(code, RULES);
29
+ }
30
+ export {
31
+ lexPython as default
32
+ };
@@ -4,7 +4,7 @@ import {
4
4
  lazyDefine,
5
5
  register,
6
6
  whenDefined
7
- } from "./chunk-IEHKRARD.js";
7
+ } from "./chunk-QVHYL3R4.js";
8
8
  export {
9
9
  COMPONENT_LOADERS,
10
10
  bootFromDOM,
@@ -0,0 +1,35 @@
1
+ import {
2
+ tokenize
3
+ } from "./chunk-7FFAMRFV.js";
4
+
5
+ // core/highlight/languages/rust.js
6
+ var RULES = [
7
+ { type: "comment", re: /\/\/\/?[^\n]*/y },
8
+ { type: "comment", re: /\/\*[\s\S]*?\*\//y },
9
+ // Raw strings close on the same number of hashes they opened with.
10
+ { type: "string", re: /b?r(#*)"[\s\S]*?"\1/y },
11
+ { type: "string", re: /b?"(?:\\.|[^"\\])*"/y },
12
+ { type: "string", re: /b?'(?:\\.|[^'\\])'/y },
13
+ // Attributes such as #[derive(Debug)] read as annotations.
14
+ { type: "builtin", re: /#!?\[[^\]]*\]/y },
15
+ { type: "number", re: /\b0[xXbo][\da-fA-F_]+\b|\b\d[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?(?:[iuf](?:8|16|32|64|128|size))?\b/y },
16
+ {
17
+ type: "keyword",
18
+ re: /\b(?:as|async|await|break|const|continue|crate|dyn|else|enum|extern|fn|for|if|impl|in|let|loop|match|mod|move|mut|pub|ref|return|self|Self|static|struct|super|trait|type|unsafe|use|where|while)\b/y
19
+ },
20
+ {
21
+ type: "builtin",
22
+ re: /\b(?:bool|char|f32|f64|i8|i16|i32|i64|i128|isize|str|u8|u16|u32|u64|u128|usize|String|Vec|Option|Result|Some|None|Ok|Err|Box|Rc|Arc|true|false)\b/y
23
+ },
24
+ // Lifetimes such as 'a must not be read as an unterminated char literal.
25
+ { type: "operator", re: /'[a-z_]\w*\b/y },
26
+ { type: "operator", re: /=>|->|::|\.\.=?|&&|\|\||<<=?|>>=?|[-+*/%&|^<>!=]=?|[?@]/y },
27
+ { type: "punctuation", re: /[[\]{}(),;:.#]/y },
28
+ { type: "identifier", re: /\b[A-Za-z_]\w*!?\b/y }
29
+ ];
30
+ function lexRust(code) {
31
+ return tokenize(code, RULES);
32
+ }
33
+ export {
34
+ lexRust as default
35
+ };
@@ -0,0 +1,132 @@
1
+ import {
2
+ highlightElement,
3
+ initHighlight
4
+ } from "./chunk-ERF5YVP4.js";
5
+ import "./chunk-7MCGPHVC.js";
6
+ import "./chunk-M5CHQVP6.js";
7
+ import "./chunk-7FFAMRFV.js";
8
+
9
+ // components/velin-code-block.js
10
+ function parseLineHighlight(spec) {
11
+ const lines = /* @__PURE__ */ new Set();
12
+ if (!spec) return lines;
13
+ for (const part of spec.split(",")) {
14
+ const p = part.trim();
15
+ if (!p) continue;
16
+ if (p.includes("-")) {
17
+ const [a, b] = p.split("-").map((n) => parseInt(n, 10));
18
+ if (!Number.isNaN(a) && !Number.isNaN(b)) {
19
+ for (let i = Math.min(a, b); i <= Math.max(a, b); i += 1) lines.add(i);
20
+ }
21
+ } else {
22
+ const n = parseInt(p, 10);
23
+ if (!Number.isNaN(n)) lines.add(n);
24
+ }
25
+ }
26
+ return lines;
27
+ }
28
+ var VelinCodeBlock = class extends HTMLElement {
29
+ static get observedAttributes() {
30
+ return ["language", "highlight", "line-numbers", "collapsed"];
31
+ }
32
+ connectedCallback() {
33
+ if (this._built) return;
34
+ this._built = true;
35
+ this.classList.add("velin-code-block");
36
+ this._render();
37
+ this._setupHighlight();
38
+ }
39
+ attributeChangedCallback() {
40
+ if (!this._built) return;
41
+ this._render();
42
+ this._setupHighlight();
43
+ }
44
+ _render() {
45
+ const lang = this.getAttribute("language") || "";
46
+ const showLines = this.hasAttribute("line-numbers");
47
+ const collapsed = this.hasAttribute("collapsed");
48
+ const highlightLines = parseLineHighlight(this.getAttribute("highlight") || "");
49
+ const source = this.textContent.trim();
50
+ this.textContent = "";
51
+ const toolbar = document.createElement("div");
52
+ toolbar.className = "velin-code-block__toolbar";
53
+ toolbar.innerHTML = "";
54
+ const copyWc = document.createElement("velin-copy");
55
+ copyWc.setAttribute("value", source);
56
+ copyWc.setAttribute("label", "Copy");
57
+ toolbar.appendChild(copyWc);
58
+ const panelId = `velin-code-panel-${Math.random().toString(36).slice(2, 9)}`;
59
+ const wrap = document.createElement("div");
60
+ wrap.id = panelId;
61
+ wrap.className = showLines ? "velin-code-block__gutter" : "";
62
+ if (collapsed) {
63
+ const toggle = document.createElement("button");
64
+ toggle.type = "button";
65
+ toggle.className = "velin-btn velin-btn--sm velin-btn--ghost";
66
+ toggle.textContent = "Expand";
67
+ toggle.setAttribute("aria-expanded", "false");
68
+ toggle.setAttribute("aria-controls", panelId);
69
+ toggle.setAttribute("aria-label", "Expand code block");
70
+ toggle.addEventListener("click", () => {
71
+ const on = this.hasAttribute("data-collapsed");
72
+ if (on) {
73
+ this.removeAttribute("data-collapsed");
74
+ toggle.textContent = "Collapse";
75
+ toggle.setAttribute("aria-expanded", "true");
76
+ toggle.setAttribute("aria-label", "Collapse code block");
77
+ } else {
78
+ this.setAttribute("data-collapsed", "");
79
+ toggle.textContent = "Expand";
80
+ toggle.setAttribute("aria-expanded", "false");
81
+ toggle.setAttribute("aria-label", "Expand code block");
82
+ }
83
+ });
84
+ this.setAttribute("data-collapsed", "");
85
+ toolbar.appendChild(toggle);
86
+ }
87
+ if (showLines) {
88
+ const gutter = document.createElement("div");
89
+ gutter.className = "velin-code-block__line-numbers";
90
+ const lines = source.split("\n");
91
+ const lineCount = lines.length;
92
+ gutter.textContent = "";
93
+ for (let i = 0; i < lineCount; i += 1) {
94
+ const n = i + 1;
95
+ const span = document.createElement("span");
96
+ if (highlightLines.has(n)) span.className = "velin-code-block__line--highlight";
97
+ span.textContent = String(n);
98
+ gutter.appendChild(span);
99
+ }
100
+ wrap.appendChild(gutter);
101
+ }
102
+ const pre = document.createElement("pre");
103
+ if (lang) {
104
+ pre.setAttribute("language", lang);
105
+ pre.dataset.language = lang;
106
+ }
107
+ const code = document.createElement("code");
108
+ if (lang) code.className = `language-${lang}`;
109
+ code.textContent = source;
110
+ pre.appendChild(code);
111
+ wrap.appendChild(pre);
112
+ this.appendChild(toolbar);
113
+ this.appendChild(wrap);
114
+ this._pre = pre;
115
+ }
116
+ async _setupHighlight() {
117
+ if (!this._pre) return;
118
+ delete this._pre.dataset.velinHighlighted;
119
+ delete this._pre.dataset.velinObserve;
120
+ const immediate = typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches;
121
+ if (immediate) {
122
+ await highlightElement(this._pre);
123
+ } else {
124
+ initHighlight(this, { root: this });
125
+ }
126
+ }
127
+ };
128
+ customElements.define("velin-code-block", VelinCodeBlock);
129
+ var velin_code_block_default = VelinCodeBlock;
130
+ export {
131
+ velin_code_block_default as default
132
+ };