@zen-ui-capri/system 1.1.2 → 1.1.3
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/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +3 -3
- package/dist/lib/theme/ZenThemeProvider.d.ts.map +1 -1
- package/dist/lib/universal/zen-universal.js +1 -1
- package/dist/lib/{zen-universal-CdKK8x-h.js → zen-universal-BhiGXo0e.js} +110 -106
- package/package.json +41 -11
- package/src/lib/index.ts +1 -1
- package/src/lib/theme/ZenThemeProvider.tsx +15 -4
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ZEN_UI_VERSION = "1.1.
|
|
1
|
+
export declare const ZEN_UI_VERSION = "1.1.3";
|
|
2
2
|
export declare const ZEN_PACKAGE_NAME = "@zen-ui/system";
|
|
3
3
|
export { ZenThemeProvider, useZenTheme, syncZenScrollbarStyles, ZEN_THEMES, type ZenThemeId, type ZenThemeMode, type ZenDensityMode, type ZenRadiusMode, type ZenThemeMetadata, type ZenThemeTokenOverrides, type ZenThemeContextValue, type ZenThemeProviderProps, } from './theme/ZenThemeProvider';
|
|
4
4
|
export { ZenButton, ZenCopyButton, type ZenButtonVariant, type ZenButtonSize, type ZenButtonProps, type ZenCopyButtonProps, } from './components/ZenButton';
|
package/dist/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as Ie, u as Le, C as he } from "./zen-universal-
|
|
2
|
-
import { a as en, Z as tn, b as rn, d as nn, e as an, f as sn, g as ln, h as on, i as cn, j as dn, k as mn, l as un, m as pn, n as fn, o as vn, r as hn, p as bn, s as xn, q as gn, z as yn, t as zn } from "./zen-universal-
|
|
1
|
+
import { c as Ie, u as Le, C as he } from "./zen-universal-BhiGXo0e.js";
|
|
2
|
+
import { a as en, Z as tn, b as rn, d as nn, e as an, f as sn, g as ln, h as on, i as cn, j as dn, k as mn, l as un, m as pn, n as fn, o as vn, r as hn, p as bn, s as xn, q as gn, z as yn, t as zn } from "./zen-universal-BhiGXo0e.js";
|
|
3
3
|
import { jsxs as a, jsx as e, Fragment as ye } from "react/jsx-runtime";
|
|
4
4
|
import { useState as H, useRef as R, useEffect as q, useId as re, useCallback as ge, useMemo as le, useImperativeHandle as ot, Suspense as ct } from "react";
|
|
5
5
|
import { Loader2 as dt, Check as Ne, Copy as mt, CheckCircle2 as Pe, ArrowUpRight as Ze, ChevronDown as Ke, X as we, AlertTriangle as Ye, Info as Xe, ArrowUp as ut, ArrowDown as pt, ArrowUpDown as ft, Menu as vt, Radio as ht, Minimize2 as bt, Maximize2 as xt, Sparkles as Be, Terminal as gt, Activity as yt, Cpu as zt, ShieldAlert as Qe, FileText as Je, Minus as et, UploadCloud as Nt, Plus as wt, ChevronRight as tt, ChevronLeft as kt, Search as Ct, CornerDownLeft as St, TrendingUp as At, TrendingDown as Tt, Inbox as Et, Volume2 as He, VolumeX as _e, Disc3 as Mt } from "lucide-react";
|
|
@@ -3834,7 +3834,7 @@ function Kr({
|
|
|
3834
3834
|
/* @__PURE__ */ e(lt, { bridgeRef: s })
|
|
3835
3835
|
] });
|
|
3836
3836
|
}
|
|
3837
|
-
const Yr = "1.1.
|
|
3837
|
+
const Yr = "1.1.3", Xr = "@zen-ui/system";
|
|
3838
3838
|
export {
|
|
3839
3839
|
he as CAPRI_SUBROUTINE_SKILLS,
|
|
3840
3840
|
en as CapriEngine,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZenThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/lib/theme/ZenThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,mBAAmB,GACnB,cAAc,GACd,iBAAiB,GACjB,eAAe,GACf,aAAa,GACb,cAAc,GACd,gBAAgB,CAAC;AAErB,MAAM,MAAM,YAAY,GAAG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,sBAAsB,GACjC,IAAI,CAmEN;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,YAAkC,EAClC,cAA8B,EAC9B,aAA+B,EAC/B,SAAS,EACT,gBAAuB,EACvB,QAAQ,GACT,EAAE,qBAAqB,+BA6FvB;AAED,wBAAgB,WAAW,IAAI,oBAAoB,CAMlD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as s, a, f as t, g as r, h as m, j as i, k as E, m as l, n as o, c as Z, o as c, r as A, s as I, z as S, t as h } from "../zen-universal-
|
|
1
|
+
import { C as s, a, f as t, g as r, h as m, j as i, k as E, m as l, n as o, c as Z, o as c, r as A, s as I, z as S, t as h } from "../zen-universal-BhiGXo0e.js";
|
|
2
2
|
export {
|
|
3
3
|
s as CAPRI_SUBROUTINE_SKILLS,
|
|
4
4
|
a as CapriEngine,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var g = (s, e, n) =>
|
|
4
|
-
import { jsx as
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
1
|
+
var J = Object.defineProperty;
|
|
2
|
+
var ee = (s, e, n) => e in s ? J(s, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : s[e] = n;
|
|
3
|
+
var g = (s, e, n) => ee(s, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { jsx as W } from "react/jsx-runtime";
|
|
5
|
+
import { useState as L, useEffect as G, useMemo as te, useContext as ne, createContext as re } from "react";
|
|
6
|
+
const T = [
|
|
7
7
|
{
|
|
8
8
|
id: "obsidian-gold",
|
|
9
9
|
name: "Obsidian Gold",
|
|
@@ -84,8 +84,12 @@ const E = [
|
|
|
84
84
|
secondaryHex: "#0284C7",
|
|
85
85
|
inkHex: "#09090D"
|
|
86
86
|
}
|
|
87
|
-
]
|
|
88
|
-
|
|
87
|
+
];
|
|
88
|
+
let _ = null;
|
|
89
|
+
function Y() {
|
|
90
|
+
return _ || (_ = re(null)), _;
|
|
91
|
+
}
|
|
92
|
+
function X(s, e) {
|
|
89
93
|
if (typeof document > "u") return;
|
|
90
94
|
const n = (e == null ? void 0 : e.accentPrimary) ?? s.accentHex, t = (e == null ? void 0 : e.bgCanvas) ?? s.canvasHex, a = s.polarity === "dark" ? "rgba(255, 255, 255, 0.12)" : "rgba(15, 23, 42, 0.14)", i = "zen-theme-scrollbar";
|
|
91
95
|
let r = document.getElementById(i);
|
|
@@ -140,7 +144,7 @@ body::-webkit-scrollbar-corner,
|
|
|
140
144
|
}
|
|
141
145
|
`.trim();
|
|
142
146
|
}
|
|
143
|
-
function
|
|
147
|
+
function be({
|
|
144
148
|
defaultTheme: s = "blackwall-crimson",
|
|
145
149
|
defaultDensity: e = "comfortable",
|
|
146
150
|
defaultRadius: n = "architectural",
|
|
@@ -148,18 +152,18 @@ function ge({
|
|
|
148
152
|
syncDocumentRoot: a = !0,
|
|
149
153
|
children: i
|
|
150
154
|
}) {
|
|
151
|
-
const [r, d] = L(s), [l, c] = L(e), [u, v] = L(n), [b, h] = L(() => typeof window > "u" ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches), A =
|
|
152
|
-
|
|
155
|
+
const [r, d] = L(s), [l, c] = L(e), [u, v] = L(n), [b, h] = L(() => typeof window > "u" ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches), A = T.find((m) => m.id === r) ?? T[0];
|
|
156
|
+
G(() => {
|
|
153
157
|
if (typeof window > "u") return;
|
|
154
|
-
const m = window.matchMedia("(prefers-reduced-motion: reduce)"),
|
|
155
|
-
return m.addEventListener("change",
|
|
156
|
-
}, []),
|
|
158
|
+
const m = window.matchMedia("(prefers-reduced-motion: reduce)"), E = (x) => h(x.matches);
|
|
159
|
+
return m.addEventListener("change", E), () => m.removeEventListener("change", E);
|
|
160
|
+
}, []), G(() => {
|
|
157
161
|
if (!a || typeof document > "u") return;
|
|
158
162
|
const m = document.documentElement;
|
|
159
|
-
m.setAttribute("data-theme", r), m.setAttribute("data-polarity", A.polarity), m.setAttribute("data-density", l), m.setAttribute("data-radius", u), t != null && t.accentPrimary ? m.style.setProperty("--zen-accent-primary", t.accentPrimary) : m.style.removeProperty("--zen-accent-primary"), t != null && t.bgCanvas ? m.style.setProperty("--zen-bg-canvas", t.bgCanvas) : m.style.removeProperty("--zen-bg-canvas"), t != null && t.surface1 ? m.style.setProperty("--zen-surface-1", t.surface1) : m.style.removeProperty("--zen-surface-1"), t != null && t.inkPrimary ? m.style.setProperty("--zen-ink-primary", t.inkPrimary) : m.style.removeProperty("--zen-ink-primary"),
|
|
163
|
+
m.setAttribute("data-theme", r), m.setAttribute("data-polarity", A.polarity), m.setAttribute("data-density", l), m.setAttribute("data-radius", u), t != null && t.accentPrimary ? m.style.setProperty("--zen-accent-primary", t.accentPrimary) : m.style.removeProperty("--zen-accent-primary"), t != null && t.bgCanvas ? m.style.setProperty("--zen-bg-canvas", t.bgCanvas) : m.style.removeProperty("--zen-bg-canvas"), t != null && t.surface1 ? m.style.setProperty("--zen-surface-1", t.surface1) : m.style.removeProperty("--zen-surface-1"), t != null && t.inkPrimary ? m.style.setProperty("--zen-ink-primary", t.inkPrimary) : m.style.removeProperty("--zen-ink-primary"), X(A, t);
|
|
160
164
|
}, [r, A, l, u, t, a]);
|
|
161
165
|
const C = () => {
|
|
162
|
-
d((m) => (
|
|
166
|
+
d((m) => (T.find((x) => x.id === m) ?? T[0]).polarity === "dark" ? m === "blackwall-crimson" ? "cyber-daylight" : m === "neon-emerald" ? "kyoto-matcha" : m === "midnight-cobalt" ? "nordic-snow" : "atelier-paper" : m === "cyber-daylight" ? "blackwall-crimson" : m === "kyoto-matcha" ? "neon-emerald" : m === "nordic-snow" ? "midnight-cobalt" : "obsidian-gold");
|
|
163
167
|
}, w = te(
|
|
164
168
|
() => ({
|
|
165
169
|
theme: r,
|
|
@@ -168,29 +172,29 @@ function ge({
|
|
|
168
172
|
density: l,
|
|
169
173
|
radius: u,
|
|
170
174
|
reducedMotion: b,
|
|
171
|
-
themes:
|
|
175
|
+
themes: T,
|
|
172
176
|
setTheme: d,
|
|
173
177
|
togglePolarity: C,
|
|
174
178
|
setDensity: c,
|
|
175
179
|
setRadius: v
|
|
176
180
|
}),
|
|
177
181
|
[r, A, l, u, b]
|
|
178
|
-
);
|
|
179
|
-
return /* @__PURE__ */
|
|
182
|
+
), k = Y();
|
|
183
|
+
return /* @__PURE__ */ W(k.Provider, { value: w, children: i });
|
|
180
184
|
}
|
|
181
|
-
function
|
|
182
|
-
const s = ne(
|
|
185
|
+
function fe() {
|
|
186
|
+
const s = ne(Y());
|
|
183
187
|
if (!s)
|
|
184
188
|
throw new Error("useZenTheme must be used within a ZenThemeProvider");
|
|
185
189
|
return s;
|
|
186
190
|
}
|
|
187
|
-
const
|
|
191
|
+
const P = {
|
|
188
192
|
xs: 12,
|
|
189
193
|
sm: 14,
|
|
190
194
|
md: 16,
|
|
191
195
|
lg: 20,
|
|
192
196
|
xl: 24
|
|
193
|
-
},
|
|
197
|
+
}, $ = {
|
|
194
198
|
inherit: "currentColor",
|
|
195
199
|
primary: "var(--zen-ink-primary)",
|
|
196
200
|
secondary: "var(--zen-ink-secondary)",
|
|
@@ -199,7 +203,7 @@ const R = {
|
|
|
199
203
|
success: "var(--zen-status-success)",
|
|
200
204
|
warning: "var(--zen-status-warning)",
|
|
201
205
|
danger: "var(--zen-status-danger)"
|
|
202
|
-
},
|
|
206
|
+
}, I = {
|
|
203
207
|
search: '<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',
|
|
204
208
|
plus: '<path d="M5 12h14"/><path d="M12 5v14"/>',
|
|
205
209
|
minus: '<path d="M5 12h14"/>',
|
|
@@ -240,14 +244,14 @@ const R = {
|
|
|
240
244
|
lock: '<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',
|
|
241
245
|
globe: '<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',
|
|
242
246
|
folder: '<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>'
|
|
243
|
-
},
|
|
244
|
-
|
|
247
|
+
}, ve = Object.keys(
|
|
248
|
+
I
|
|
245
249
|
);
|
|
246
|
-
function
|
|
247
|
-
const e = s.size ?? "md", n = Object.prototype.hasOwnProperty.call(
|
|
250
|
+
function ae(s) {
|
|
251
|
+
const e = s.size ?? "md", n = Object.prototype.hasOwnProperty.call(P, e) ? P[e] : P.md, t = s.tone ?? "inherit", a = Object.prototype.hasOwnProperty.call($, t) ? $[t] : $.inherit, i = typeof s.strokeWidth == "number" && Number.isFinite(s.strokeWidth) ? Math.min(Math.max(s.strokeWidth, 0.5), 4) : 2, r = Object.prototype.hasOwnProperty.call(I, s.name) ? I[s.name] : I.sparkles, d = s.spin ? "animation: spin 1s linear infinite;" : "";
|
|
248
252
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${n}" viewBox="0 0 24 24" fill="none" stroke="${a}" stroke-width="${i}" stroke-linecap="round" stroke-linejoin="round" style="display:inline-block;vertical-align:middle;flex-shrink:0;${d}">${r}</svg>`;
|
|
249
253
|
}
|
|
250
|
-
function
|
|
254
|
+
function we({
|
|
251
255
|
name: s,
|
|
252
256
|
size: e = "md",
|
|
253
257
|
tone: n = "inherit",
|
|
@@ -257,8 +261,8 @@ function ve({
|
|
|
257
261
|
className: r = "",
|
|
258
262
|
...d
|
|
259
263
|
}) {
|
|
260
|
-
const l = Object.prototype.hasOwnProperty.call(
|
|
261
|
-
return /* @__PURE__ */
|
|
264
|
+
const l = Object.prototype.hasOwnProperty.call(P, e) ? P[e] : P.md, c = Object.prototype.hasOwnProperty.call($, n) ? $[n] : $.inherit, u = Object.prototype.hasOwnProperty.call(I, s) ? I[s] : I.sparkles;
|
|
265
|
+
return /* @__PURE__ */ W(
|
|
262
266
|
"svg",
|
|
263
267
|
{
|
|
264
268
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -413,7 +417,7 @@ Respond with concise, technical engineering output (Persona Voice is OFF by defa
|
|
|
413
417
|
3. Zero Runtime Overhead: Keep documentation purely static or on-demand (via 'npx capri docu'); never inject docu scanners into production render loops.`,
|
|
414
418
|
aiVoiceAddendum: "VOICE MODE ACTIVE (--voice): Adopt Capri's neural cartographer persona from Cyberpunk: Edgerunners Season 2."
|
|
415
419
|
}
|
|
416
|
-
},
|
|
420
|
+
}, ie = [
|
|
417
421
|
{
|
|
418
422
|
category: "SYSTEM_PROMPT_OVERRIDE",
|
|
419
423
|
patternName: "Ignore / Disregard System Instructions",
|
|
@@ -455,7 +459,7 @@ Respond with concise, technical engineering output (Persona Voice is OFF by defa
|
|
|
455
459
|
regex: /(?:\bsk_(?:live|test)_[0-9a-zA-Z]{16,}|\bAIza[0-9A-Za-z_-]{35}\b|\bghp_[0-9A-Za-z]{36}\b|-----BEGIN\s+(?:RSA\s+)?PRIVATE\s+KEY-----)/g
|
|
456
460
|
}
|
|
457
461
|
];
|
|
458
|
-
class
|
|
462
|
+
class oe {
|
|
459
463
|
constructor() {
|
|
460
464
|
g(this, "activeSubroutine", "orion");
|
|
461
465
|
g(this, "lastReport", null);
|
|
@@ -479,7 +483,7 @@ class ie {
|
|
|
479
483
|
scanPromptInjection(e) {
|
|
480
484
|
const n = [];
|
|
481
485
|
let t = e.replace(/[\u200B-\u200F\uFEFF]/g, "");
|
|
482
|
-
for (const a of
|
|
486
|
+
for (const a of ie) {
|
|
483
487
|
const i = [...t.matchAll(a.regex)];
|
|
484
488
|
for (const r of i)
|
|
485
489
|
n.push({
|
|
@@ -507,7 +511,7 @@ class ie {
|
|
|
507
511
|
this.activeSubroutine = e;
|
|
508
512
|
const t = S[e];
|
|
509
513
|
if (typeof document < "u" && (document.documentElement.setAttribute("data-capri-subroutine", e), n != null && n.applyPresetTheme)) {
|
|
510
|
-
const r =
|
|
514
|
+
const r = T.find((d) => d.id === t.recommendedTheme) ?? T[0];
|
|
511
515
|
document.documentElement.setAttribute("data-theme", t.recommendedTheme), document.documentElement.setAttribute("data-polarity", r.polarity), document.documentElement.setAttribute("data-radius", t.recommendedRadius), document.documentElement.setAttribute("data-density", t.recommendedDensity), document.documentElement.style.colorScheme = r.polarity, (i = n.onThemeChange) == null || i.call(
|
|
512
516
|
n,
|
|
513
517
|
t.recommendedTheme,
|
|
@@ -519,7 +523,7 @@ class ie {
|
|
|
519
523
|
return this.notify(a), t;
|
|
520
524
|
}
|
|
521
525
|
guard(e) {
|
|
522
|
-
var m,
|
|
526
|
+
var k, m, E, x, O;
|
|
523
527
|
if (typeof document > "u" || typeof window > "u") {
|
|
524
528
|
const y = {
|
|
525
529
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -549,14 +553,14 @@ class ie {
|
|
|
549
553
|
), c = [];
|
|
550
554
|
let u = 0;
|
|
551
555
|
for (const y of l) {
|
|
552
|
-
const H = (
|
|
553
|
-
if (!H && !o && !p && !f && !
|
|
554
|
-
const
|
|
555
|
-
c.push(`${
|
|
556
|
+
const H = (k = y.getAttribute("aria-label")) == null ? void 0 : k.trim(), o = (m = y.getAttribute("aria-labelledby")) == null ? void 0 : m.trim(), p = (E = y.getAttribute("title")) == null ? void 0 : E.trim(), f = (x = y.textContent) == null ? void 0 : x.trim(), M = (O = y.getAttribute("placeholder")) == null ? void 0 : O.trim(), z = y.getAttribute("id"), F = !!(z && n.querySelector(`label[for="${CSS.escape(z)}"]`)), U = !!y.closest("label");
|
|
557
|
+
if (!H && !o && !p && !f && !M && !F && !U) {
|
|
558
|
+
const R = y.tagName.toLowerCase(), B = y.className ? `.${String(y.className).trim().split(/\s+/).slice(0, 2).join(".")}` : "";
|
|
559
|
+
c.push(`${R}${B}`);
|
|
556
560
|
}
|
|
557
561
|
if (y instanceof HTMLInputElement || y instanceof HTMLTextAreaElement) {
|
|
558
|
-
const
|
|
559
|
-
|
|
562
|
+
const R = this.scanPromptInjection(y.value || "");
|
|
563
|
+
R.safe || (u += R.threatCount);
|
|
560
564
|
}
|
|
561
565
|
}
|
|
562
566
|
const b = n.querySelectorAll(
|
|
@@ -641,7 +645,7 @@ class ie {
|
|
|
641
645
|
};
|
|
642
646
|
}
|
|
643
647
|
docu(e) {
|
|
644
|
-
var
|
|
648
|
+
var x, O, y, H;
|
|
645
649
|
const n = this.telemetry(), t = this.guard(e);
|
|
646
650
|
if (typeof document > "u" || typeof window > "u") {
|
|
647
651
|
const o = {
|
|
@@ -670,18 +674,18 @@ class ie {
|
|
|
670
674
|
const a = e ?? document, i = document.title || "zeN-UI Application", r = window.location.pathname || "/", l = Array.from(
|
|
671
675
|
a.querySelectorAll("header, nav, section[id], main, footer")
|
|
672
676
|
).slice(0, 12).map((o, p) => {
|
|
673
|
-
var
|
|
674
|
-
const f = o.tagName.toLowerCase(),
|
|
677
|
+
var q;
|
|
678
|
+
const f = o.tagName.toLowerCase(), M = o.id || `${f}-${p + 1}`, z = o.querySelector("h1, h2, h3, h4"), F = o.getAttribute("aria-label"), U = ((q = z == null ? void 0 : z.textContent) == null ? void 0 : q.trim()) || (F == null ? void 0 : F.trim()) || `${f.toUpperCase()} (${M})`, R = this.sanitizeForPrompt(U).replace(/\s+/g, " ").slice(0, 64), B = o.querySelectorAll(
|
|
675
679
|
'button, a[href], [role="button"], [role="radio"], [role="tab"]'
|
|
676
|
-
).length,
|
|
680
|
+
).length, Q = o.querySelectorAll(
|
|
677
681
|
'input, select, textarea, [role="switch"], [role="checkbox"], [role="combobox"]'
|
|
678
682
|
).length;
|
|
679
683
|
return {
|
|
680
|
-
id:
|
|
684
|
+
id: M,
|
|
681
685
|
tag: f,
|
|
682
|
-
title:
|
|
686
|
+
title: R,
|
|
683
687
|
interactiveCount: B,
|
|
684
|
-
formControlsCount:
|
|
688
|
+
formControlsCount: Q
|
|
685
689
|
};
|
|
686
690
|
}), c = [
|
|
687
691
|
"zen-icon",
|
|
@@ -701,12 +705,12 @@ class ie {
|
|
|
701
705
|
customElements: c
|
|
702
706
|
}, v = [], b = Array.from(a.querySelectorAll("nav a[href], nav button")).slice(0, 5);
|
|
703
707
|
for (const [o, p] of b.entries()) {
|
|
704
|
-
const f = ((
|
|
708
|
+
const f = ((x = p.textContent) == null ? void 0 : x.trim().replace(/\s+/g, " ").slice(0, 36)) || `Nav Trigger ${o + 1}`, M = p.getAttribute("href") || "Section / State Action";
|
|
705
709
|
v.push({
|
|
706
710
|
id: `flow-nav-${o + 1}`,
|
|
707
711
|
category: "navigation",
|
|
708
712
|
triggerLabel: f,
|
|
709
|
-
targetDescription: `Navigates or jumps to ${
|
|
713
|
+
targetDescription: `Navigates or jumps to ${M}`
|
|
710
714
|
});
|
|
711
715
|
}
|
|
712
716
|
const h = Array.from(
|
|
@@ -743,7 +747,7 @@ class ie {
|
|
|
743
747
|
targetDescription: `Tabular data grid (${p.querySelectorAll("tbody tr").length} rows visible)`
|
|
744
748
|
});
|
|
745
749
|
}
|
|
746
|
-
const w = (o) => o.replace(/["[\]()]/g, "").replace(/\s+/g, " ").trim(),
|
|
750
|
+
const w = (o) => o.replace(/["[\]()]/g, "").replace(/\s+/g, " ").trim(), k = [
|
|
747
751
|
"flowchart TD",
|
|
748
752
|
` AppRoot["${w(i)} (${n.theme} / ${n.polarity})"]`,
|
|
749
753
|
` Guard["CapriEngine Guard: ${t.score}/100 (${t.horizontalOverflowPx}px overflow)"]`,
|
|
@@ -751,17 +755,17 @@ class ie {
|
|
|
751
755
|
];
|
|
752
756
|
l.slice(0, 6).forEach((o, p) => {
|
|
753
757
|
const f = `LM_${p + 1}`;
|
|
754
|
-
|
|
758
|
+
k.push(
|
|
755
759
|
` AppRoot --> ${f}["${w(o.id)}: ${w(o.title)} (${o.interactiveCount} actions)"]`
|
|
756
760
|
);
|
|
757
761
|
}), v.slice(0, 5).forEach((o, p) => {
|
|
758
762
|
const f = `UF_${p + 1}`;
|
|
759
|
-
|
|
763
|
+
k.push(
|
|
760
764
|
` Guard --> ${f}["[${o.category}] ${w(o.triggerLabel)}"]`
|
|
761
765
|
);
|
|
762
766
|
});
|
|
763
|
-
const
|
|
764
|
-
`),
|
|
767
|
+
const m = k.join(`
|
|
768
|
+
`), E = [
|
|
765
769
|
`# ${i} — Automated Architecture, User-Flow & AI Context Dossier`,
|
|
766
770
|
`Generated by \`@zen-ui/system\` // \`capri.docu()\` at \`${(/* @__PURE__ */ new Date()).toISOString()}\``,
|
|
767
771
|
"",
|
|
@@ -793,7 +797,7 @@ class ie {
|
|
|
793
797
|
"",
|
|
794
798
|
"## 5. Auto-Generated Mermaid Architecture & User-Flow Diagram",
|
|
795
799
|
"```mermaid",
|
|
796
|
-
|
|
800
|
+
m,
|
|
797
801
|
"```"
|
|
798
802
|
].join(`
|
|
799
803
|
`);
|
|
@@ -806,8 +810,8 @@ class ie {
|
|
|
806
810
|
landmarks: l,
|
|
807
811
|
inventory: u,
|
|
808
812
|
userFlows: v,
|
|
809
|
-
mermaidDiagram:
|
|
810
|
-
markdownBundle:
|
|
813
|
+
mermaidDiagram: m,
|
|
814
|
+
markdownBundle: E
|
|
811
815
|
};
|
|
812
816
|
}
|
|
813
817
|
exportMarkdownDocu(e = this.activeSubroutine, n, t = !1) {
|
|
@@ -870,7 +874,7 @@ ${d}` : ""
|
|
|
870
874
|
n(this.activeSubroutine, e);
|
|
871
875
|
}
|
|
872
876
|
}
|
|
873
|
-
const
|
|
877
|
+
const Ae = new oe(), D = [
|
|
874
878
|
{
|
|
875
879
|
id: "blackwall-crimson",
|
|
876
880
|
name: "Capri // Capricorn",
|
|
@@ -1005,11 +1009,11 @@ const we = new ie(), D = [
|
|
|
1005
1009
|
]
|
|
1006
1010
|
}
|
|
1007
1011
|
];
|
|
1008
|
-
function
|
|
1012
|
+
function K(s) {
|
|
1009
1013
|
const e = D.find((n) => n.id === s);
|
|
1010
1014
|
return e ? e.polarity : "dark";
|
|
1011
1015
|
}
|
|
1012
|
-
class
|
|
1016
|
+
class se {
|
|
1013
1017
|
constructor(e) {
|
|
1014
1018
|
g(this, "state");
|
|
1015
1019
|
g(this, "listeners", /* @__PURE__ */ new Set());
|
|
@@ -1025,7 +1029,7 @@ class oe {
|
|
|
1025
1029
|
}
|
|
1026
1030
|
this.state = {
|
|
1027
1031
|
theme: n,
|
|
1028
|
-
polarity:
|
|
1032
|
+
polarity: K(n),
|
|
1029
1033
|
density: (e == null ? void 0 : e.defaultDensity) ?? "comfortable",
|
|
1030
1034
|
radius: (e == null ? void 0 : e.defaultRadius) ?? "architectural"
|
|
1031
1035
|
}, this.applyToDom();
|
|
@@ -1037,7 +1041,7 @@ class oe {
|
|
|
1037
1041
|
if (this.state = {
|
|
1038
1042
|
...this.state,
|
|
1039
1043
|
theme: e,
|
|
1040
|
-
polarity:
|
|
1044
|
+
polarity: K(e)
|
|
1041
1045
|
}, typeof window < "u")
|
|
1042
1046
|
try {
|
|
1043
1047
|
window.localStorage.setItem(this.storageKey, e);
|
|
@@ -1071,14 +1075,14 @@ class oe {
|
|
|
1071
1075
|
const e = document.documentElement;
|
|
1072
1076
|
e.setAttribute("data-theme", this.state.theme), e.setAttribute("data-polarity", this.state.polarity), e.setAttribute("data-density", this.state.density), e.setAttribute("data-radius", this.state.radius);
|
|
1073
1077
|
const n = D.find((t) => t.id === this.state.theme) ?? D[0];
|
|
1074
|
-
|
|
1078
|
+
X(n);
|
|
1075
1079
|
}
|
|
1076
1080
|
notify() {
|
|
1077
1081
|
for (const e of this.listeners)
|
|
1078
1082
|
e(this.state);
|
|
1079
1083
|
}
|
|
1080
1084
|
}
|
|
1081
|
-
class
|
|
1085
|
+
class ce {
|
|
1082
1086
|
constructor() {
|
|
1083
1087
|
g(this, "ctx", null);
|
|
1084
1088
|
g(this, "muted", !1);
|
|
@@ -1099,8 +1103,8 @@ class se {
|
|
|
1099
1103
|
}
|
|
1100
1104
|
}
|
|
1101
1105
|
}
|
|
1102
|
-
const Z = new
|
|
1103
|
-
class
|
|
1106
|
+
const Z = new se(), V = new ce();
|
|
1107
|
+
class le extends HTMLElement {
|
|
1104
1108
|
constructor() {
|
|
1105
1109
|
super(...arguments);
|
|
1106
1110
|
g(this, "framing", "portrait");
|
|
@@ -1164,11 +1168,11 @@ class ce extends HTMLElement {
|
|
|
1164
1168
|
this.rafId = window.requestAnimationFrame(t);
|
|
1165
1169
|
}
|
|
1166
1170
|
render() {
|
|
1167
|
-
const n =
|
|
1171
|
+
const n = j(
|
|
1168
1172
|
this.getAttribute("title") ?? "CAPRI // CONSTRUCT"
|
|
1169
|
-
), t =
|
|
1173
|
+
), t = j(
|
|
1170
1174
|
this.getAttribute("subtitle") ?? "Edgerunners S2 // Soulkiller Net-Driver"
|
|
1171
|
-
), a =
|
|
1175
|
+
), a = pe(
|
|
1172
1176
|
this.getAttribute("image-src") ?? "/capri-construct-base.png"
|
|
1173
1177
|
), i = N.find((l) => l.id === this.activeMode) ?? N[0];
|
|
1174
1178
|
this.innerHTML = `
|
|
@@ -1210,13 +1214,13 @@ class ce extends HTMLElement {
|
|
|
1210
1214
|
`, this.canvasEl = this.querySelector("[data-capri-eyes]"), this.figureEl = this.querySelector("[data-capri-figure]"), this.querySelectorAll("[data-framing]").forEach((l) => {
|
|
1211
1215
|
l.addEventListener("click", () => {
|
|
1212
1216
|
const c = l.getAttribute("framing") ?? l.dataset.framing;
|
|
1213
|
-
(c === "portrait" || c === "full") && (
|
|
1217
|
+
(c === "portrait" || c === "full") && (V.playMicroClick(560), this.framing = c, this.setAttribute("framing", c), this.render(), this.startEyeLoop());
|
|
1214
1218
|
});
|
|
1215
1219
|
}), this.querySelectorAll("[data-directive]").forEach((l) => {
|
|
1216
1220
|
l.addEventListener("click", () => {
|
|
1217
1221
|
const c = l.dataset.directive;
|
|
1218
1222
|
if (!c) return;
|
|
1219
|
-
|
|
1223
|
+
V.playMicroClick(620), this.activeMode = c, this.setAttribute("mode", c);
|
|
1220
1224
|
const u = N.find((v) => v.id === c);
|
|
1221
1225
|
u && this.dispatchEvent(
|
|
1222
1226
|
new CustomEvent("zen-directive", {
|
|
@@ -1229,7 +1233,7 @@ class ce extends HTMLElement {
|
|
|
1229
1233
|
});
|
|
1230
1234
|
}
|
|
1231
1235
|
}
|
|
1232
|
-
class
|
|
1236
|
+
class de extends HTMLElement {
|
|
1233
1237
|
static get observedAttributes() {
|
|
1234
1238
|
return ["variant"];
|
|
1235
1239
|
}
|
|
@@ -1246,7 +1250,7 @@ class le extends HTMLElement {
|
|
|
1246
1250
|
`;
|
|
1247
1251
|
}
|
|
1248
1252
|
}
|
|
1249
|
-
class
|
|
1253
|
+
class me extends HTMLElement {
|
|
1250
1254
|
constructor() {
|
|
1251
1255
|
super(...arguments);
|
|
1252
1256
|
g(this, "unsubscribe", null);
|
|
@@ -1279,7 +1283,7 @@ class de extends HTMLElement {
|
|
|
1279
1283
|
`, this.querySelectorAll("[data-theme-id]").forEach((t) => {
|
|
1280
1284
|
t.addEventListener("click", () => {
|
|
1281
1285
|
const a = t.dataset.themeId;
|
|
1282
|
-
a && (
|
|
1286
|
+
a && (V.playMicroClick(540), Z.setTheme(a), this.dispatchEvent(
|
|
1283
1287
|
new CustomEvent("zen-theme-change", {
|
|
1284
1288
|
detail: Z.getState(),
|
|
1285
1289
|
bubbles: !0,
|
|
@@ -1290,7 +1294,7 @@ class de extends HTMLElement {
|
|
|
1290
1294
|
});
|
|
1291
1295
|
}
|
|
1292
1296
|
}
|
|
1293
|
-
class
|
|
1297
|
+
class ue extends HTMLElement {
|
|
1294
1298
|
static get observedAttributes() {
|
|
1295
1299
|
return ["name", "size", "tone", "stroke-width", "spin"];
|
|
1296
1300
|
}
|
|
@@ -1302,7 +1306,7 @@ class me extends HTMLElement {
|
|
|
1302
1306
|
}
|
|
1303
1307
|
render() {
|
|
1304
1308
|
const e = this.getAttribute("name") ?? "sparkles", n = this.getAttribute("size") ?? "md", t = this.getAttribute("tone") ?? "inherit", a = Number(this.getAttribute("stroke-width") ?? 2), i = this.getAttribute("spin") === "true";
|
|
1305
|
-
this.innerHTML =
|
|
1309
|
+
this.innerHTML = ae({
|
|
1306
1310
|
name: e,
|
|
1307
1311
|
size: n,
|
|
1308
1312
|
tone: t,
|
|
@@ -1311,42 +1315,42 @@ class me extends HTMLElement {
|
|
|
1311
1315
|
});
|
|
1312
1316
|
}
|
|
1313
1317
|
}
|
|
1314
|
-
function
|
|
1318
|
+
function j(s) {
|
|
1315
1319
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1316
1320
|
}
|
|
1317
|
-
function
|
|
1321
|
+
function pe(s) {
|
|
1318
1322
|
const e = s.trim(), n = e.replace(/[\u0000-\u0020]+/g, "");
|
|
1319
|
-
return /^(?:javascript|data|vbscript|file):/i.test(n) ? "/capri-construct-base.png" :
|
|
1323
|
+
return /^(?:javascript|data|vbscript|file):/i.test(n) ? "/capri-construct-base.png" : j(e);
|
|
1320
1324
|
}
|
|
1321
|
-
function
|
|
1322
|
-
typeof window > "u" || !("customElements" in window) || (window.customElements.get("zen-icon") || window.customElements.define("zen-icon",
|
|
1325
|
+
function xe() {
|
|
1326
|
+
typeof window > "u" || !("customElements" in window) || (window.customElements.get("zen-icon") || window.customElements.define("zen-icon", ue), window.customElements.get("zen-ai-construct") || window.customElements.define("zen-ai-construct", le), window.customElements.get("zen-ambient-background") || window.customElements.define(
|
|
1323
1327
|
"zen-ambient-background",
|
|
1324
|
-
|
|
1325
|
-
), window.customElements.get("zen-theme-switcher") || window.customElements.define("zen-theme-switcher",
|
|
1328
|
+
de
|
|
1329
|
+
), window.customElements.get("zen-theme-switcher") || window.customElements.define("zen-theme-switcher", me));
|
|
1326
1330
|
}
|
|
1327
1331
|
export {
|
|
1328
1332
|
S as C,
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1333
|
+
ve as Z,
|
|
1334
|
+
oe as a,
|
|
1335
|
+
P as b,
|
|
1336
|
+
Ae as c,
|
|
1337
|
+
I as d,
|
|
1338
|
+
T as e,
|
|
1335
1339
|
D as f,
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1340
|
+
le as g,
|
|
1341
|
+
de as h,
|
|
1342
|
+
we as i,
|
|
1343
|
+
ue as j,
|
|
1344
|
+
se as k,
|
|
1345
|
+
be as l,
|
|
1346
|
+
me as m,
|
|
1347
|
+
ce as n,
|
|
1348
|
+
j as o,
|
|
1349
|
+
ae as p,
|
|
1350
|
+
X as q,
|
|
1351
|
+
xe as r,
|
|
1352
|
+
pe as s,
|
|
1349
1353
|
Z as t,
|
|
1350
|
-
|
|
1351
|
-
|
|
1354
|
+
fe as u,
|
|
1355
|
+
V as z
|
|
1352
1356
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zen-ui-capri/system",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "zeN-UI // CAPRI — Universal Multi-Framework Design System (51 Primitives, 40 Vector Icons, 8 Dark/Light Themes & Capri 5-Subroutine AI Co-Pilot)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,26 +54,56 @@
|
|
|
54
54
|
"prepublishOnly": "npm run capri -- all && npm run build",
|
|
55
55
|
"publish:npm": "node bin/capri.mjs publish-npm"
|
|
56
56
|
},
|
|
57
|
-
"
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"@react-three/fiber": ">=8.0.0",
|
|
59
|
+
"@react-three/postprocessing": ">=2.0.0",
|
|
60
|
+
"lucide-react": ">=0.300.0",
|
|
61
|
+
"postprocessing": ">=6.0.0",
|
|
62
|
+
"react": ">=18.0.0",
|
|
63
|
+
"react-dom": ">=18.0.0",
|
|
64
|
+
"three": ">=0.150.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"@react-three/fiber": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"@react-three/postprocessing": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"lucide-react": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"postprocessing": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"react": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"react-dom": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"three": {
|
|
86
|
+
"optional": true
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"devDependencies": {
|
|
58
90
|
"@gsap/react": "^2.1.2",
|
|
91
|
+
"@playwright/test": "^1.51.0",
|
|
59
92
|
"@react-three/fiber": "^9.5.0",
|
|
60
93
|
"@react-three/postprocessing": "^3.2.2",
|
|
61
94
|
"@tailwindcss/vite": "^4.1.0",
|
|
95
|
+
"@types/node": "^22.10.0",
|
|
96
|
+
"@types/react": "^19.0.10",
|
|
97
|
+
"@types/react-dom": "^19.0.4",
|
|
98
|
+
"@types/three": "^0.182.0",
|
|
99
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
62
100
|
"gsap": "^3.13.0",
|
|
63
101
|
"lucide-react": "^0.562.0",
|
|
64
102
|
"postprocessing": "^6.39.6",
|
|
65
103
|
"react": "^19.2.3",
|
|
66
104
|
"react-dom": "^19.2.3",
|
|
67
105
|
"tailwindcss": "^4.1.0",
|
|
68
|
-
"three": "^0.182.0"
|
|
69
|
-
},
|
|
70
|
-
"devDependencies": {
|
|
71
|
-
"@playwright/test": "^1.51.0",
|
|
72
|
-
"@types/node": "^22.10.0",
|
|
73
|
-
"@types/react": "^19.0.10",
|
|
74
|
-
"@types/react-dom": "^19.0.4",
|
|
75
|
-
"@types/three": "^0.182.0",
|
|
76
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
106
|
+
"three": "^0.182.0",
|
|
77
107
|
"typescript": "~5.8.2",
|
|
78
108
|
"vite": "^6.2.0"
|
|
79
109
|
}
|
package/src/lib/index.ts
CHANGED
|
@@ -136,7 +136,16 @@ export interface ZenThemeContextValue {
|
|
|
136
136
|
readonly setRadius: (next: ZenRadiusMode) => void;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
let zenThemeContextInstance: ReturnType<
|
|
140
|
+
typeof createContext<ZenThemeContextValue | null>
|
|
141
|
+
> | null = null;
|
|
142
|
+
|
|
143
|
+
function getZenThemeContext() {
|
|
144
|
+
if (!zenThemeContextInstance) {
|
|
145
|
+
zenThemeContextInstance = createContext<ZenThemeContextValue | null>(null);
|
|
146
|
+
}
|
|
147
|
+
return zenThemeContextInstance;
|
|
148
|
+
}
|
|
140
149
|
|
|
141
150
|
export interface ZenThemeProviderProps {
|
|
142
151
|
readonly defaultTheme?: ZenThemeId;
|
|
@@ -312,15 +321,17 @@ export function ZenThemeProvider({
|
|
|
312
321
|
[theme, themeMeta, density, radius, reducedMotion]
|
|
313
322
|
);
|
|
314
323
|
|
|
324
|
+
const ThemeCtx = getZenThemeContext();
|
|
325
|
+
|
|
315
326
|
return (
|
|
316
|
-
<
|
|
327
|
+
<ThemeCtx.Provider value={value}>
|
|
317
328
|
{children}
|
|
318
|
-
</
|
|
329
|
+
</ThemeCtx.Provider>
|
|
319
330
|
);
|
|
320
331
|
}
|
|
321
332
|
|
|
322
333
|
export function useZenTheme(): ZenThemeContextValue {
|
|
323
|
-
const ctx = useContext(
|
|
334
|
+
const ctx = useContext(getZenThemeContext());
|
|
324
335
|
if (!ctx) {
|
|
325
336
|
throw new Error('useZenTheme must be used within a ZenThemeProvider');
|
|
326
337
|
}
|