@firsthandjs/styled 0.9.1 → 0.10.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/dist/index.js +1 -1
- package/dist/styled.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bind as
|
|
1
|
+
import{bind as T,signal as W,useContext as G}from"@firsthandjs/core";import{component as B}from"@firsthandjs/dom";import{applyProp as J,insert as N}from"@firsthandjs/dom/internal";var v=Symbol("firsthand.css");function f(e,...t){return{[v]:!0,strings:[...e],values:t}}function C(e){return typeof e=="object"&&e!==null&&v in e}function A(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n===":")return!0;if(n===";"||n==="{"||n==="}")return!1}return!1}function j(e){return e==null||e===!1||e===!0?"":String(e)}function g(e,t,n=!0){let o=[],s=[],r="",i=()=>{r!==""&&(s.push(r),r="")},a=c=>{for(let[l,p]of c.strings.entries()){if(r+=p,l>=c.values.length)continue;let d=c.values[l];if(C(d)){a(d);continue}if(typeof d!="function"){r+=j(d);continue}let E=o.length,P=n&&A(r)?"value":"block",w={kind:P,property:`--${t}-${String(E)}`,fn:d};o.push(w),P==="value"?r+=`var(${w.property})`:(i(),s.push(w))}};return a(e),i(),{chunks:s,slots:o,static:o.length===0}}function b(e){return e.chunks.join("")}function x(e,t){let n="";for(let o of e.chunks)n+=typeof o=="string"?o:t(o);return n}function S(e){if(C(e)){let t=g(e,"x");if(!t.static)throw new Error("A css`` fragment returned from an interpolation must not contain further functions.");return b(t)}return j(e)}var k=new Map,u=null;function m(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function M(){return u!==null&&u.isConnected||(u=document.createElement("style"),u.setAttribute("data-firsthand-styled",""),document.head.appendChild(u)),u}function y(e,t){let n=k.get(e);if(n!==void 0)return n.count++,!1;let o=document.createTextNode(t);return k.set(e,{node:o,count:1}),M().appendChild(o),!0}function $(e){let t=k.get(e);t!==void 0&&(--t.count>0||(k.delete(e),t.node.remove()))}function I(){k.clear(),u?.remove(),u=null}import{createContext as O,useContext as V}from"@firsthandjs/core";var H=Object.freeze({}),h=O(H,"theme");function L(){return V(h)}function X(e,t){return t==="children"||t==="class"||t.startsWith("$")?!1:t in e||t.startsWith("data-")||t.startsWith("aria-")||t.startsWith("on")||t==="style"||t==="role"}function q(e,t){let n={};for(let o of Object.keys(e))Object.defineProperty(n,o,{enumerable:!0,get:()=>e[o]});return Object.defineProperty(n,"theme",{enumerable:!0,get:()=>t.value}),n}var z=0,R=new WeakMap;function F(e,t){let n=typeof e=="string"?e:null,o=n===null?(R.get(e)??0)+1:0,s=`s${m(t.strings.join("|"))}${String(++z)}`,r=g(t,s,n!==null),i=x(r,()=>""),a={tag:n,id:s,compiled:r,selector:l=>`.${l}`.repeat(o+1),baseClass:`${s}-${m(i)}`,blocks:r.slots.some(l=>l.kind==="block")};a.blocks||y(a.baseClass,`${a.selector(a.baseClass)}{${i}}`);let c=B(l=>Y(l,a,e),void 0,`firsthand/styled:${s}`,n===null?`Styled(${e.name})`:`Styled(${n})`);return R.set(c,o),c}function Y(e,t,n){let o=G(h),s=q(e,o),r=t.tag===null?null:document.createElement(t.tag),i=r===null?W(""):null,a="";if(D(t,s,c=>{let l=e.class,p=`${c}${typeof l=="string"&&l!==""?` ${l}`:""}`;p!==a&&(a=p,_(r,i,p))}),K(t,s,r),r===null)return n(Q(e,i));for(let c of Object.keys(e))X(r,c)&&T(()=>{J(r,c,e[c])});return N(r,()=>e.children),r}function _(e,t,n){e===null?t.value=n:e.className=n}function D(e,t,n){if(!e.blocks){T(()=>{n(e.baseClass)});return}T(()=>{let o=x(e.compiled,r=>S(r.fn(t))),s=`${e.id}-${m(o)}`;y(s,`${e.selector(s)}{${o}}`),n(s)})}function K(e,t,n){for(let o of e.compiled.slots){if(o.kind!=="value")continue;let s=n;T(()=>{let r=o.fn(t),i=r==null||r===!1?"":String(r);s.style.setProperty(o.property,i)})}}function Q(e,t){let n={};for(let o of Object.keys(e))o!=="class"&&Object.defineProperty(n,o,{enumerable:!0,get:()=>e[o]});return Object.defineProperty(n,"class",{enumerable:!0,get:()=>t.value}),n}var U=new Proxy((e=>(t,...n)=>F(e,f(t,...n))),{get:(e,t)=>(n,...o)=>F(t,f(n,...o))});import{bind as Z,onCleanup as ee,useContext as te}from"@firsthandjs/core";import{component as ne}from"@firsthandjs/dom";function oe(e,...t){let n=g(f(e,...t),"k",!1);if(!n.static)throw new Error("keyframes`` cannot interpolate functions: an animation has no props.");let o=b(n),s=`k${m(o)}`;return y(s,`@keyframes ${s}{${o}}`),s}function re(e,...t){let n=f(e,...t),o=g(n,"g",!1);return ne(()=>{let r=te(h),i=null,a=()=>{i!==null&&($(i),i=null)};return Z(()=>{let c={theme:r.value},l=x(o,d=>S(d.fn(c))),p=`g${m(l)}`;a(),y(p,l),i=p}),ee(a),null},void 0,`firsthand/styled:global${m(e.join("|"))}`,"GlobalStyle")}export{h as ThemeContext,re as createGlobalStyle,f as css,m as hash,C as isFragment,oe as keyframes,I as resetStyles,U as styled,L as useTheme};
|
package/dist/styled.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.ts"],"names":[],"mappings":"AAUA,OAAO,EAAa,KAAK,SAAS,EAAa,MAAM,kBAAkB,CAAC;AAKxE,OAAO,EAA2B,UAAU,EAAQ,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvF,OAAO,EAAgB,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtD,kEAAkE;AAClE,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,GAAG,CAAC,iBAAiB,GAC9E,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,GACxB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA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,KAAK,OAAO,CAAC,CAAC;AAEpG,MAAM,MAAM,aAAa,CAAC,IAAI,IAAI;IAChC;;;;;;OAMG;IACH,CAAC,CAAC,GAAG,OAAO,EACV,OAAO,EAAE,oBAAoB,EAC7B,GAAG,MAAM,EAAE,aAAa,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GACnC,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;CACxB,CAAC;AAoPF,KAAK,IAAI,GAAG;KACT,CAAC,IAAI,MAAM,GAAG,CAAC,iBAAiB,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CACnE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,MAAM,WAId,CAAC,QAAQ,SAAS,CAAC,CAAC,CAAC,KAAG,aAAa,CAAC,CAAC,CAAC,CAQ5C,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firsthandjs/styled",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "CSS-in-JS for Firsthand: tagged templates, themes, and fine-grained style updates.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"LICENSE"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@firsthandjs/core": "0.
|
|
23
|
-
"@firsthandjs/dom": "0.
|
|
24
|
-
"@firsthandjs/jsx-runtime": "0.
|
|
22
|
+
"@firsthandjs/core": "0.10.0",
|
|
23
|
+
"@firsthandjs/dom": "0.10.0",
|
|
24
|
+
"@firsthandjs/jsx-runtime": "0.10.0"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
27
27
|
"node": ">=20.11.0"
|