@kbach/browser 1.0.0-beta.1 → 1.0.0-beta.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/AGENTS.md +3 -2
- package/README.md +5 -0
- package/THIRD_PARTY_NOTICES.md +41 -0
- package/dist/kbach.js +1 -1
- package/dist/kbach_core_engine_bg.wasm +0 -0
- package/package.json +3 -2
package/AGENTS.md
CHANGED
|
@@ -52,8 +52,9 @@ only for that text, which `kb()` callers handle by using the returned
|
|
|
52
52
|
className. A CDN script can't rewrite the page's own `class` attributes, so
|
|
53
53
|
each hex pair becomes `rgb(var(--kb-color-<name>))`, and
|
|
54
54
|
`ensureColorVariablesInjected` supplies the light/dark values for the
|
|
55
|
-
configured strategy.
|
|
56
|
-
color)
|
|
55
|
+
configured strategy. Opacity suffixes on them (`bg-surface/50`) go through
|
|
56
|
+
`color-mix(in srgb, …)`; `@kbach/browser` 1.0.0-beta.2 and earlier bundled
|
|
57
|
+
an engine that dropped the opacity, so `bg-card/80` rendered fully opaque.
|
|
57
58
|
|
|
58
59
|
## 2. How it's built — it bundles `@kbach/react`'s SOURCE
|
|
59
60
|
|
package/README.md
CHANGED
|
@@ -70,3 +70,8 @@ build plugin instead: zero runtime cost and no flash.
|
|
|
70
70
|
## License
|
|
71
71
|
|
|
72
72
|
MIT
|
|
73
|
+
|
|
74
|
+
Tailwind CSS is a trademark of Tailwind Labs Inc. Kbach is an independent
|
|
75
|
+
project and is not affiliated with, sponsored by, or endorsed by Tailwind Labs.
|
|
76
|
+
See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) for the Tailwind CSS
|
|
77
|
+
license notice.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!-- GENERATED from the repo root THIRD_PARTY_NOTICES.md by packages/core-engine/scripts/generate-notices.mjs. Edit the root file, then regenerate. -->
|
|
2
|
+
|
|
3
|
+
# Third-party notices
|
|
4
|
+
|
|
5
|
+
Kbach is MIT-licensed (see `LICENSE`). It also contains material from the
|
|
6
|
+
project below, used under that project's license.
|
|
7
|
+
|
|
8
|
+
## Tailwind CSS
|
|
9
|
+
|
|
10
|
+
Kbach uses Tailwind CSS-compatible utility class names, and some of its
|
|
11
|
+
default theme values (for example the spacing formula and the shadow, radius,
|
|
12
|
+
blur, and line-height scales) are derived from Tailwind CSS.
|
|
13
|
+
|
|
14
|
+
Tailwind CSS is a trademark of Tailwind Labs Inc. Kbach is an independent
|
|
15
|
+
project and is not affiliated with, sponsored by, or endorsed by Tailwind Labs.
|
|
16
|
+
|
|
17
|
+
Source: https://github.com/tailwindlabs/tailwindcss
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
MIT License
|
|
21
|
+
|
|
22
|
+
Copyright (c) Tailwind Labs, Inc.
|
|
23
|
+
|
|
24
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
25
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
26
|
+
in the Software without restriction, including without limitation the rights
|
|
27
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
28
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
29
|
+
furnished to do so, subject to the following conditions:
|
|
30
|
+
|
|
31
|
+
The above copyright notice and this permission notice shall be included in all
|
|
32
|
+
copies or substantial portions of the Software.
|
|
33
|
+
|
|
34
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
35
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
36
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
37
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
38
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
39
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
40
|
+
SOFTWARE.
|
|
41
|
+
```
|
package/dist/kbach.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";(()=>{var xe={};function z(e,t){let n,r;try{let o=$(e,f.__wbindgen_malloc,f.__wbindgen_realloc),a=E,i=$(t,f.__wbindgen_malloc,f.__wbindgen_realloc),s=E,c=f.generate_css(o,a,i,s);return n=c[0],r=c[1],pe(c[0],c[1])}finally{f.__wbindgen_free(n,r,1)}}function be(){return{__proto__:null,"./kbach_core_engine_bg.js":{__proto__:null,__wbindgen_init_externref_table:function(){let t=f.__wbindgen_externrefs,n=t.grow(4);t.set(0,void 0),t.set(n+0,void 0),t.set(n+1,null),t.set(n+2,!0),t.set(n+3,!1)}}}}function pe(e,t){return ye(e>>>0,t)}var _=null;function C(){return(_===null||_.byteLength===0)&&(_=new Uint8Array(f.memory.buffer)),_}function $(e,t,n){if(n===void 0){let s=w.encode(e),c=t(s.length,1)>>>0;return C().subarray(c,c+s.length).set(s),E=s.length,c}let r=e.length,o=t(r,1)>>>0,a=C(),i=0;for(;i<r;i++){let s=e.charCodeAt(i);if(s>127)break;a[o+i]=s}if(i!==r){i!==0&&(e=e.slice(i)),o=n(o,r,r=i+e.length*3,1)>>>0;let s=C().subarray(o+i,o+r),c=w.encodeInto(e,s);i+=c.written,o=n(o,r,i,1)>>>0}return E=i,o}var x=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});x.decode();var he=2146435072,S=0;function ye(e,t){return S+=t,S>=he&&(x=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),x.decode(),S=t),x.decode(C().subarray(e,e+t))}var w=new TextEncoder;"encodeInto"in w||(w.encodeInto=function(e,t){let n=w.encode(e);return t.set(n),{read:e.length,written:n.length}});var E=0,_e,we,f;function ke(e,t){return we=e,f=e.exports,_e=t,_=null,f.__wbindgen_start(),f}async function Ce(e,t){if(typeof Response=="function"&&e instanceof Response){if(!e.ok)throw new Error(`failed to fetch Wasm: ${e.status} ${e.statusText} fetching '${e.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(o){if(n(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}async function A(e){if(f!==void 0)return f;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0&&(e=new URL("kbach_core_engine_bg.wasm",xe.url));let t=be();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Ce(await e,t);return ke(n,r)}var D=null,U=!1;function N(e){return D||(D=(e===void 0?A():A({module_or_path:e})).then(()=>{U=!0})),D}function P(e,t){if(!U)throw new Error("[Kbach] generateCss() was called before initKbach() resolved. Call `await initKbach()` once at startup (e.g. before rendering your app) before using kb().");return z(e,t)}var G={"amber-1":"#fffbeb","amber-10":"#78350f","amber-11":"#451a03","amber-12":"#291002","amber-2":"#fef3c7","amber-3":"#fde68a","amber-4":"#fcd34d","amber-5":"#fbbf24","amber-6":"#f59e0b","amber-7":"#d97706","amber-8":"#b45309","amber-9":"#92400e",black:"#000000","blue-1":"#eff6ff","blue-10":"#1e3a8a","blue-11":"#172554","blue-12":"#0d1633","blue-2":"#dbeafe","blue-3":"#bfdbfe","blue-4":"#93c5fd","blue-5":"#60a5fa","blue-6":"#3b82f6","blue-7":"#2563eb","blue-8":"#1d4ed8","blue-9":"#1e40af",bronze:"#cd7f32",coal:"#1c1c1c",copper:"#b87333",current:"currentColor","cyan-1":"#ecfeff","cyan-10":"#164e63","cyan-11":"#083344","cyan-12":"#041e28","cyan-2":"#cffafe","cyan-3":"#a5f3fc","cyan-4":"#67e8f9","cyan-5":"#22d3ee","cyan-6":"#06b6d4","cyan-7":"#0891b2","cyan-8":"#0e7490","cyan-9":"#155e75","emerald-1":"#ecfdf5","emerald-10":"#064e3b","emerald-11":"#022c22","emerald-12":"#011a14","emerald-2":"#d1fae5","emerald-3":"#a7f3d0","emerald-4":"#6ee7b7","emerald-5":"#34d399","emerald-6":"#10b981","emerald-7":"#059669","emerald-8":"#047857","emerald-9":"#065f46","fuchsia-1":"#fdf4ff","fuchsia-10":"#701a75","fuchsia-11":"#4a044e","fuchsia-12":"#2d022f","fuchsia-2":"#fae8ff","fuchsia-3":"#f5d0fe","fuchsia-4":"#f0abfc","fuchsia-5":"#e879f9","fuchsia-6":"#d946ef","fuchsia-7":"#c026d3","fuchsia-8":"#a21caf","fuchsia-9":"#86198f",gold:"#d4af37","gray-1":"#f9fafb","gray-10":"#111827","gray-11":"#030712","gray-12":"#020409","gray-2":"#f3f4f6","gray-3":"#e5e7eb","gray-4":"#d1d5db","gray-5":"#9ca3af","gray-6":"#6b7280","gray-7":"#4b5563","gray-8":"#374151","gray-9":"#1f2937","green-1":"#f0fdf4","green-10":"#14532d","green-11":"#052e16","green-12":"#031b0d","green-2":"#dcfce7","green-3":"#bbf7d0","green-4":"#86efac","green-5":"#4ade80","green-6":"#22c55e","green-7":"#16a34a","green-8":"#15803d","green-9":"#166534","indigo-1":"#eef2ff","indigo-10":"#312e81","indigo-11":"#1e1b4b","indigo-12":"#12102d","indigo-2":"#e0e7ff","indigo-3":"#c7d2fe","indigo-4":"#a5b4fc","indigo-5":"#818cf8","indigo-6":"#6366f1","indigo-7":"#4f46e5","indigo-8":"#4338ca","indigo-9":"#3730a3","lime-1":"#f7fee7","lime-10":"#365314","lime-11":"#1a2e05","lime-12":"#0f1b03","lime-2":"#ecfccb","lime-3":"#d9f99d","lime-4":"#bef264","lime-5":"#a3e635","lime-6":"#84cc16","lime-7":"#65a30d","lime-8":"#4d7c0f","lime-9":"#3f6212","neutral-1":"#fafafa","neutral-10":"#171717","neutral-11":"#0a0a0a","neutral-12":"#050505","neutral-2":"#f5f5f5","neutral-3":"#e5e5e5","neutral-4":"#d4d4d4","neutral-5":"#a3a3a3","neutral-6":"#737373","neutral-7":"#525252","neutral-8":"#404040","neutral-9":"#262626","orange-1":"#fff7ed","orange-10":"#7c2d12","orange-11":"#431407","orange-12":"#270c04","orange-2":"#ffedd5","orange-3":"#fed7aa","orange-4":"#fdba74","orange-5":"#fb923c","orange-6":"#f97316","orange-7":"#ea580c","orange-8":"#c2410c","orange-9":"#9a3412","pink-1":"#fdf2f8","pink-10":"#831843","pink-11":"#500724","pink-12":"#300415","pink-2":"#fce7f3","pink-3":"#fbcfe8","pink-4":"#f9a8d4","pink-5":"#f472b6","pink-6":"#ec4899","pink-7":"#db2777","pink-8":"#be185d","pink-9":"#9d174d","purple-1":"#faf5ff","purple-10":"#581c87","purple-11":"#3b0764","purple-12":"#23043c","purple-2":"#f3e8ff","purple-3":"#e9d5ff","purple-4":"#d8b4fe","purple-5":"#c084fc","purple-6":"#a855f7","purple-7":"#9333ea","purple-8":"#7e22ce","purple-9":"#6b21a8","red-1":"#fef2f2","red-10":"#7f1d1d","red-11":"#450a0a","red-12":"#280606","red-2":"#fee2e2","red-3":"#fecaca","red-4":"#fca5a5","red-5":"#f87171","red-6":"#ef4444","red-7":"#dc2626","red-8":"#b91c1c","red-9":"#991b1b","rose-1":"#fff1f2","rose-10":"#881337","rose-11":"#4c0519","rose-12":"#2d030e","rose-2":"#ffe4e6","rose-3":"#fecdd3","rose-4":"#fda4af","rose-5":"#fb7185","rose-6":"#f43f5e","rose-7":"#e11d48","rose-8":"#be123c","rose-9":"#9f1239",silver:"#c0c0c0","sky-1":"#f0f9ff","sky-10":"#0c4a6e","sky-11":"#082f49","sky-12":"#041b2b","sky-2":"#e0f2fe","sky-3":"#bae6fd","sky-4":"#7dd3fc","sky-5":"#38bdf8","sky-6":"#0ea5e9","sky-7":"#0284c7","sky-8":"#0369a1","sky-9":"#075985","slate-1":"#f8fafc","slate-10":"#0f172a","slate-11":"#020617","slate-12":"#01020a","slate-2":"#f1f5f9","slate-3":"#e2e8f0","slate-4":"#cbd5e1","slate-5":"#94a3b8","slate-6":"#64748b","slate-7":"#475569","slate-8":"#334155","slate-9":"#1e293b","stone-1":"#fafaf9","stone-10":"#1c1917","stone-11":"#0c0a09","stone-12":"#070605","stone-2":"#f5f5f4","stone-3":"#e7e5e4","stone-4":"#d6d3d1","stone-5":"#a8a29e","stone-6":"#78716c","stone-7":"#57534e","stone-8":"#44403c","stone-9":"#292524","teal-1":"#f0fdfa","teal-10":"#134e4a","teal-11":"#042f2e","teal-12":"#021c1b","teal-2":"#ccfbf1","teal-3":"#99f6e4","teal-4":"#5eead4","teal-5":"#2dd4bf","teal-6":"#14b8a6","teal-7":"#0d9488","teal-8":"#0f766e","teal-9":"#115e59",transparent:"transparent","violet-1":"#f5f3ff","violet-10":"#4c1d95","violet-11":"#2e1065","violet-12":"#1c0a3d","violet-2":"#ede9fe","violet-3":"#ddd6fe","violet-4":"#c4b5fd","violet-5":"#a78bfa","violet-6":"#8b5cf6","violet-7":"#7c3aed","violet-8":"#6d28d9","violet-9":"#5b21b6",white:"#ffffff","yellow-1":"#fefce8","yellow-10":"#713f12","yellow-11":"#422006","yellow-12":"#271304","yellow-2":"#fef9c3","yellow-3":"#fef08a","yellow-4":"#fde047","yellow-5":"#facc15","yellow-6":"#eab308","yellow-7":"#ca8a04","yellow-8":"#a16207","yellow-9":"#854d0e","zinc-1":"#fafafa","zinc-10":"#18181b","zinc-11":"#09090b","zinc-12":"#050506","zinc-2":"#f4f4f5","zinc-3":"#e4e4e7","zinc-4":"#d4d4d8","zinc-5":"#a1a1aa","zinc-6":"#71717a","zinc-7":"#52525b","zinc-8":"#3f3f46","zinc-9":"#27272a"};var v={colors:{...G,surface:{light:"#f9fafb",dark:"#111827"}},spacing:{0:0,px:1,"0.5":2,1:4,"1.5":6,2:8,"2.5":10,3:12,"3.5":14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,52:208,56:224,60:240,64:256,72:288,80:320,96:384},screens:{sm:640,md:768,lg:1024,xl:1280,"2xl":1536},fontFamily:{sans:'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',serif:'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',mono:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},darkMode:"media",container:{}},T=v,H=JSON.stringify(v);function R(e){T=e,H=JSON.stringify(e)}function J(){return T}function V(){return H}var Ee=new Set(["attribute","class","media"]);function Y(){if(typeof document>"u")return;let e=getComputedStyle(document.documentElement).getPropertyValue("--kb-dark-mode").trim();!Ee.has(e)||e===T.darkMode||R({...T,darkMode:e})}var K="kbach-reset",Te=[{css:"*, *::before, *::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: currentColor; }"},{css:"body { margin: 0; padding: 0; }"},{css:"h1, h2, h3, h4, h5, h6 { margin: 0; font-size: inherit; font-weight: inherit; }",tags:["h1","h2","h3","h4","h5","h6"]},{css:"p { margin: 0; }",tags:["p"]},{css:"a { color: inherit; text-decoration: none; }",tags:["a"]},{css:"ul, ol { margin: 0; padding: 0; list-style: none; }",tags:["ul","ol"]},{css:"img, video, svg { display: block; max-width: 100%; }",tags:["img","video","svg"]},{css:"input:where(:not([type='checkbox']):not([type='radio'])), textarea { appearance: none; -webkit-appearance: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; line-height: inherit; }",tags:["input","textarea"]},{css:":where(input[type='checkbox'], input[type='radio'], input[type='range']) { margin: 0; font: inherit; accent-color: currentColor; }",tags:["input"]},{css:"select { margin: 0; font: inherit; color: inherit; line-height: inherit; }",tags:["select"]},{css:"button { appearance: none; -webkit-appearance: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; line-height: inherit; text-align: inherit; }",tags:["button"]},{css:"button, [role='button'] { cursor: pointer; }",tags:["button"]},{css:":disabled { cursor: default; }",tags:["button","input","select","textarea"]},{css:"textarea { resize: vertical; }",tags:["textarea"]},{css:"::placeholder { opacity: 1; }",tags:["input","textarea"]},{css:"input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button { margin: 0; }",tags:["input"]},{css:"input[type='search']::-webkit-search-decoration, input[type='search']::-webkit-search-cancel-button { -webkit-appearance: none; }",tags:["input"]},{css:"fieldset { padding: 0; margin: 0; }",tags:["fieldset"]},{css:"table { border-collapse: collapse; border-spacing: 0; }",tags:["table"]}],q=Te.map(e=>e.css).join(`
|
|
2
2
|
`);var ve=!1;var h=null,j=[],O=new Map;function Re(){return h||(h=document.createElement("style"),h.setAttribute("data-kbach",""),document.head.appendChild(h),h)}function Me(e){let t=0,n=j.length;for(;t<n;){let r=t+n>>>1;O.get(j[r])>e?n=r:t=r+1}return t}function Se(e,t){if(O.has(e))return;let n=Re().sheet;if(!n)return;let r=Me(t);try{n.insertRule(e,r)}catch{return}j.splice(r,0,e),O.set(e,t)}var X=!1;function Ae(){if(X||(X=!0,document.getElementById(K)))return;let e=document.createElement("style");e.id=K,e.textContent=q,document.head.insertBefore(e,document.head.firstChild)}var De=500,k=new Map,Q=null;function Z(e){let t=V();t!==Q&&(k.clear(),Q=t);let n=k.get(e);if(n===void 0){let a=P(e,t);n=JSON.parse(a),k.size>=De&&k.clear(),k.set(e,n)}let{className:r,rules:o}=n;if(!ve){Ae();for(let{rule:a,order:i}of o)Se(a,i)}return r}function m(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=t[1];n.length===3&&(n=n.split("").map(o=>o+o).join(""));let r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function Ke(e,t){switch(e){case"class":return`.dark { ${t} }`;case"media":return`@media (prefers-color-scheme: dark) { :root { ${t} } }`;default:return`[data-theme="dark"] { ${t} }`}}var ee="kbach-colors",te=null;function ne(e){if(typeof document>"u"||te===e)return;te=e;let t=[],n=[];for(let[o,a]of Object.entries(e.colors)){if(typeof a=="string")continue;let i=m(a.light),s=m(a.dark);!i||!s||(t.push(`--kb-color-${o}: ${i.join(",")};`),n.push(`--kb-color-${o}: ${s.join(",")};`))}let r=document.getElementById(ee);if(t.length===0){r?.remove();return}r||(r=document.createElement("style"),r.id=ee,document.head.insertBefore(r,document.head.firstChild)),r.textContent=`:root { ${t.join(" ")} }
|
|
3
|
-
${Ke(e.darkMode,n.join(" "))}`}var re="kbach-theme",je=new Set;function Oe(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}function oe(){return typeof window>"u"?null:window.localStorage}function Ie(){let e=oe();if(!e)return null;try{let t=e.getItem(re);return t==="light"||t==="dark"||t==="system"?t:null}catch{return null}}function ie(e){return e==="system"?Oe():e==="dark"}function M(e){if(typeof document>"u")return;let t=document.documentElement,n=J().darkMode;t.classList.toggle("dark",n==="class"&&e),t.classList.toggle("light",n==="class"&&!e),n==="attribute"?t.setAttribute("data-theme",e?"dark":"light"):t.removeAttribute("data-theme")}Y();var Le=Ie();var I=Le??"system",b=ie(I);M(b);if(typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),t=n=>{I==="system"&&(b=n.matches,M(b),se())};e.addEventListener?e.addEventListener("change",t):e.addListener(t)}function se(){for(let e of je)e()}function L(){M(b)}function F(e){I=e,b=ie(e),M(b);let t=oe();if(t)try{t.setItem(re,e)}catch{}se()}function ae(){F(b?"light":"dark")}function W(e,t){let n=m(e);if(!n)return e;let r=Number(t)/100,o=Number.isFinite(r)?Math.min(1,Math.max(0,r)):1;return`rgba(${n.join(",")},${o})`}function ce(e,t){if(typeof e!="string")return e;let n=e.indexOf("/"),r=n===-1?e:e.slice(0,n),o=n===-1?void 0:e.slice(n+1),a=t(r);return a===void 0?e:o===void 0?a:typeof a=="string"?W(a,o):{light:W(a.light,o),dark:W(a.dark,o)}}function Fe(e,t){let{dark:n,...r}=e,o={},a=i=>o[i]??t[i];for(let[i,s]of Object.entries(r))typeof s=="object"&&s!==null&&!("light"in s)&&!("dark"in s)||(o[i]=ce(s,a));if(n){let i={},s=c=>{let u=i[c]??t[c];return typeof u=="string"?u:void 0};for(let[c,u]of Object.entries(n)){let g=ce(u,s);i[c]=typeof g=="string"?g:g.dark}for(let[c,u]of Object.entries(i)){let g=o[c];g===void 0||typeof g!="string"||(o[c]={light:g,dark:u})}}return o}function fe(e){let t={...v,...e.theme};return e.extend?.colors&&(t={...t,colors:{...t.colors,...Fe(e.extend.colors,t.colors)}}),e.extend?.spacing&&(t={...t,spacing:{...t.spacing,...e.extend.spacing}}),e.extend?.screens&&(t={...t,screens:{...t.screens,...e.extend.screens}}),e.extend?.fontFamily&&(t={...t,fontFamily:{...t.fontFamily,...e.extend.fontFamily}}),e.extend?.container&&(t={...t,container:{...t.container,...e.extend.container}}),e.darkMode&&(t={...t,darkMode:e.darkMode}),t}function le(e){let t=!1,n={};for(let[r,o]of Object.entries(e.colors))typeof o!="string"&&m(o.light)&&m(o.dark)?(n[r]=`rgb(var(--kb-color-${r}))`,t=!0):n[r]=o;return t?{...e,colors:n}:e}function We(e){let t=e.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}function de({document:e,wasmUrl:t,config:n}){let r=new Set,o=!1,a=l=>{if(!o)return;let d=[];for(let y of l)for(let p of We(y))r.has(p)||(r.add(p),d.push(p));d.length>0&&Z(d.join(" "))},i=l=>[l,...Array.from(l.querySelectorAll("[class]"))],s=()=>a(i(e.documentElement)),c=l=>{let d=fe(l??{});R(le(d)),ne(d),L()};c(n);let u=new e.defaultView.MutationObserver(l=>{let d=[];for(let y of l)if(y.type==="attributes")d.push(y.target);else for(let p of Array.from(y.addedNodes))p.nodeType===1&&d.push(...i(p));a(d)});return{ready:N(t).then(()=>{o=!0,s(),u.observe(e.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class"]})}),config(l){c(l),r.clear(),s()},refresh:s,setMode:F,toggle:ae}}var B="kbach_core_engine_bg.wasm",ue=/(\/@kbach\/browser)(@[^/]*)?\/?$/;function ge(e,t,n,r){if(t)return new URL(t,n).href;if(!e)return new URL(B,n).href;let o=new URL(e,n);return ue.test(o.pathname)?(o.pathname=o.pathname.replace(ue,`$1@${r}/dist/${B}`),o.search="",o.hash="",o.href):new URL(B,o).href}var me=document.currentScript,Be=ge(me?.src||void 0,me?.dataset.wasm,document.baseURI,"1.0.0-beta.
|
|
3
|
+
${Ke(e.darkMode,n.join(" "))}`}var re="kbach-theme",je=new Set;function Oe(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}function oe(){return typeof window>"u"?null:window.localStorage}function Ie(){let e=oe();if(!e)return null;try{let t=e.getItem(re);return t==="light"||t==="dark"||t==="system"?t:null}catch{return null}}function ie(e){return e==="system"?Oe():e==="dark"}function M(e){if(typeof document>"u")return;let t=document.documentElement,n=J().darkMode;t.classList.toggle("dark",n==="class"&&e),t.classList.toggle("light",n==="class"&&!e),n==="attribute"?t.setAttribute("data-theme",e?"dark":"light"):t.removeAttribute("data-theme")}Y();var Le=Ie();var I=Le??"system",b=ie(I);M(b);if(typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),t=n=>{I==="system"&&(b=n.matches,M(b),se())};e.addEventListener?e.addEventListener("change",t):e.addListener(t)}function se(){for(let e of je)e()}function L(){M(b)}function F(e){I=e,b=ie(e),M(b);let t=oe();if(t)try{t.setItem(re,e)}catch{}se()}function ae(){F(b?"light":"dark")}function W(e,t){let n=m(e);if(!n)return e;let r=Number(t)/100,o=Number.isFinite(r)?Math.min(1,Math.max(0,r)):1;return`rgba(${n.join(",")},${o})`}function ce(e,t){if(typeof e!="string")return e;let n=e.indexOf("/"),r=n===-1?e:e.slice(0,n),o=n===-1?void 0:e.slice(n+1),a=t(r);return a===void 0?e:o===void 0?a:typeof a=="string"?W(a,o):{light:W(a.light,o),dark:W(a.dark,o)}}function Fe(e,t){let{dark:n,...r}=e,o={},a=i=>o[i]??t[i];for(let[i,s]of Object.entries(r))typeof s=="object"&&s!==null&&!("light"in s)&&!("dark"in s)||(o[i]=ce(s,a));if(n){let i={},s=c=>{let u=i[c]??t[c];return typeof u=="string"?u:void 0};for(let[c,u]of Object.entries(n)){let g=ce(u,s);i[c]=typeof g=="string"?g:g.dark}for(let[c,u]of Object.entries(i)){let g=o[c];g===void 0||typeof g!="string"||(o[c]={light:g,dark:u})}}return o}function fe(e){let t={...v,...e.theme};return e.extend?.colors&&(t={...t,colors:{...t.colors,...Fe(e.extend.colors,t.colors)}}),e.extend?.spacing&&(t={...t,spacing:{...t.spacing,...e.extend.spacing}}),e.extend?.screens&&(t={...t,screens:{...t.screens,...e.extend.screens}}),e.extend?.fontFamily&&(t={...t,fontFamily:{...t.fontFamily,...e.extend.fontFamily}}),e.extend?.container&&(t={...t,container:{...t.container,...e.extend.container}}),e.darkMode&&(t={...t,darkMode:e.darkMode}),t}function le(e){let t=!1,n={};for(let[r,o]of Object.entries(e.colors))typeof o!="string"&&m(o.light)&&m(o.dark)?(n[r]=`rgb(var(--kb-color-${r}))`,t=!0):n[r]=o;return t?{...e,colors:n}:e}function We(e){let t=e.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}function de({document:e,wasmUrl:t,config:n}){let r=new Set,o=!1,a=l=>{if(!o)return;let d=[];for(let y of l)for(let p of We(y))r.has(p)||(r.add(p),d.push(p));d.length>0&&Z(d.join(" "))},i=l=>[l,...Array.from(l.querySelectorAll("[class]"))],s=()=>a(i(e.documentElement)),c=l=>{let d=fe(l??{});R(le(d)),ne(d),L()};c(n);let u=new e.defaultView.MutationObserver(l=>{let d=[];for(let y of l)if(y.type==="attributes")d.push(y.target);else for(let p of Array.from(y.addedNodes))p.nodeType===1&&d.push(...i(p));a(d)});return{ready:N(t).then(()=>{o=!0,s(),u.observe(e.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class"]})}),config(l){c(l),r.clear(),s()},refresh:s,setMode:F,toggle:ae}}var B="kbach_core_engine_bg.wasm",ue=/(\/@kbach\/browser)(@[^/]*)?\/?$/;function ge(e,t,n,r){if(t)return new URL(t,n).href;if(!e)return new URL(B,n).href;let o=new URL(e,n);return ue.test(o.pathname)?(o.pathname=o.pathname.replace(ue,`$1@${r}/dist/${B}`),o.search="",o.hash="",o.href):new URL(B,o).href}var me=document.currentScript,Be=ge(me?.src||void 0,me?.dataset.wasm,document.baseURI,"1.0.0-beta.3");window.Kbach=de({document,wasmUrl:Be,config:window.kbachConfig});})();
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kbach/browser",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
4
|
"description": "Kbach from a CDN: one <script> tag styles a plain HTML page with Kbach's utility classes. No build step, no bundler, no React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"dist",
|
|
29
|
-
"AGENTS.md"
|
|
29
|
+
"AGENTS.md",
|
|
30
|
+
"THIRD_PARTY_NOTICES.md"
|
|
30
31
|
],
|
|
31
32
|
"main": "./dist/kbach.js",
|
|
32
33
|
"unpkg": "./dist/kbach.js",
|