@bedrock-layout/solid 0.6.0 → 0.7.2

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.
@@ -0,0 +1,11 @@
1
+ import { CSSLength } from "./spacing-constants";
2
+ declare type MaxWidth = number | CSSLength;
3
+ export interface CenterProps {
4
+ maxWidth?: MaxWidth;
5
+ centerText?: boolean;
6
+ centerChildren?: boolean;
7
+ }
8
+ export declare const Center: ((props: CenterProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
9
+ className: (props: CenterProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
10
+ };
11
+ export {};
@@ -0,0 +1,11 @@
1
+ import { CSSLength, SpacingOptions } from "./spacing-constants";
2
+ declare type Basis = CSSLength | number;
3
+ export interface ColumnDropProps {
4
+ gutter?: SpacingOptions;
5
+ basis?: Basis;
6
+ noStretchedColumns?: boolean;
7
+ }
8
+ export declare const ColumnDrop: ((props: ColumnDropProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
9
+ className: (props: ColumnDropProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
10
+ };
11
+ export {};
package/lib/frame.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ declare type RatioString = `${number}/${number}` | `${number} / ${number}`;
2
+ declare type Ratio = [number, number] | RatioString;
3
+ export interface FrameProps {
4
+ ratio?: Ratio;
5
+ position?: string;
6
+ }
7
+ export declare const Frame: ((props: FrameProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
8
+ className: (props: FrameProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
9
+ };
10
+ export {};
package/lib/grid.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { CSSLength, SpacingOptions } from "./spacing-constants";
2
+ declare type MinItemWidth = number | CSSLength;
3
+ export interface GridProps {
4
+ gutter?: SpacingOptions;
5
+ minItemWidth?: MinItemWidth;
6
+ }
7
+ export declare const Grid: ((props: GridProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
8
+ className: (props: GridProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
9
+ };
10
+ export {};
package/lib/index.cjs.js CHANGED
@@ -1,30 +1,32 @@
1
- "use strict";var ye=Object.defineProperty,me=Object.defineProperties;var xe=Object.getOwnPropertyDescriptors;var X=Object.getOwnPropertySymbols;var be=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable;var K=(e,t,n)=>t in e?ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t)=>{for(var n in t||(t={}))be.call(t,n)&&K(e,n,t[n]);if(X)for(var n of X(t))we.call(t,n)&&K(e,n,t[n]);return e},D=(e,t)=>me(e,xe(t));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";let Se={data:""},$e=e=>typeof window=="object"?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||Se,Ae=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Ce=/\/\*[^]*?\*\/|\s\s+|\n/g,b=(e,t)=>{let n="",i="",r="";for(let s in e){let l=e[s];s[0]=="@"?s[1]=="i"?n=s+" "+l+";":i+=s[1]=="f"?b(l,s):s+"{"+b(l,s[1]=="k"?"":t)+"}":typeof l=="object"?i+=b(l,t?t.replace(/([^,])+/g,o=>s.replace(/(^:.*)|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,o):o?o+" "+c:c)):s):l!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),r+=b.p?b.p(s,l):s+":"+l+";")}return n+(t&&r?t+"{"+r+"}":r)+i},C={},re=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+re(e[n]);return t}return e},ve=(e,t,n,i,r)=>{let s=re(e),l=C[s]||(C[s]=(o=>{let c=0,a=11;for(;c<o.length;)a=101*a+o.charCodeAt(c++)>>>0;return"go"+a})(s));if(!C[l]){let o=s!==e?e:(c=>{let a,u=[{}];for(;a=Ae.exec(c.replace(Ce,""));)a[4]?u.shift():a[3]?u.unshift(u[0][a[3]]=u[0][a[3]]||{}):u[0][a[1]]=a[2];return u[0]})(e);C[l]=b(r?{["@keyframes "+l]:o}:o,n?"":"."+l)}return((o,c,a)=>{c.data.indexOf(o)==-1&&(c.data=a?o+c.data:c.data+o)})(C[l],t,i),l},ke=(e,t,n)=>e.reduce((i,r,s)=>{let l=t[s];if(l&&l.call){let o=l(n),c=o&&o.props&&o.props.className||/^go/.test(o)&&o;l=c?"."+c:o&&typeof o=="object"?o.props?"":b(o,""):o===!1?"":o}return i+r+(l==null?"":l)},"");function w(e){let t=this||{},n=e.call?e(t.p):e;return ve(n.unshift?n.raw?ke(n,[].slice.call(arguments,1),t.p):n.reduce((i,r)=>Object.assign(i,r&&r.call?r(t.p):r),{}):n,$e(t.target),t.g,t.o,t.k)}w.bind({g:1});w.bind({k:1});const Ee=(e,t)=>e===t,Ne=Symbol("solid-proxy"),G={equals:Ee};let je=ae;const O={},m=1,z=2,Pe={owned:null,cleanups:null,context:null,owner:null};var h=null;let E=null,f=null,v=null,g=null,y=null,V=0;function Oe(e,t,n){const i=_(e,t,!0,m);N(i)}function k(e,t,n){const i=_(e,t,!1,m);N(i)}function H(e,t,n){n=n?Object.assign({},G,n):G;const i=_(e,t,!0,0);return i.pending=O,i.observers=null,i.observerSlots=null,i.comparator=n.equals||void 0,N(i),Me.bind(i)}function Te(e){if(v)return e();let t;const n=v=[];try{t=e()}finally{v=null}return ce(()=>{for(let i=0;i<n.length;i+=1){const r=n[i];if(r.pending!==O){const s=r.pending;r.pending=O,le(r,s)}}},!1),t}function W(e){let t,n=f;return f=null,t=e(),f=n,t}function Le(e){const t=Symbol("context");return{id:t,Provider:Re(t),defaultValue:e}}function Ie(e){return de(h,e.id)||e.defaultValue}function De(e){const t=H(e);return H(()=>F(t()))}function Me(){const e=E;if(this.sources&&(this.state||e)){const t=g;g=null,this.state===m||e?N(this):q(this),g=t}if(f){const t=this.observers?this.observers.length:0;f.sources?(f.sources.push(this),f.sourceSlots.push(t)):(f.sources=[this],f.sourceSlots=[t]),this.observers?(this.observers.push(f),this.observerSlots.push(f.sources.length-1)):(this.observers=[f],this.observerSlots=[f.sources.length-1])}return this.value}function le(e,t,n){if(e.comparator&&e.comparator(e.value,t))return t;if(v)return e.pending===O&&v.push(e),e.pending=t,t;let i=!1;return e.value=t,e.observers&&e.observers.length&&ce(()=>{for(let r=0;r<e.observers.length;r+=1){const s=e.observers[r];i&&E.disposed.has(s),s.pure?g.push(s):y.push(s),s.observers&&(i&&!s.tState||!i&&!s.state)&&ue(s),i||(s.state=m)}if(g.length>1e6)throw g=[],new Error},!1),t}function N(e){if(!e.fn)return;fe(e);const t=h,n=f,i=V;f=h=e,Be(e,e.value,i),f=n,h=t}function Be(e,t,n){let i;try{i=e.fn(t)}catch(r){ge(r)}(!e.updatedAt||e.updatedAt<=n)&&(e.observers&&e.observers.length?le(e,i):e.value=i,e.updatedAt=n)}function _(e,t,n,i=m,r){const s={fn:e,state:i,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:h,context:null,pure:n};return h===null||h!==Pe&&(h.owned?h.owned.push(s):h.owned=[s]),s}function oe(e){const t=E;if(e.state!==m)return e.state=0;if(e.suspense&&W(e.suspense.inFallback))return e.suspense.effects.push(e);const n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<V);)(e.state||t)&&n.push(e);for(let i=n.length-1;i>=0;i--)if(e=n[i],e.state===m||t)N(e);else if(e.state===z||t){const r=g;g=null,q(e,n[0]),g=r}}function ce(e,t){if(g)return e();let n=!1;t||(g=[]),y?n=!0:y=[],V++;try{return e()}catch(i){ge(i)}finally{Fe(n)}}function Fe(e){g&&(ae(g),g=null),!e&&(y.length?Te(()=>{je(y),y=null}):y=null)}function ae(e){for(let t=0;t<e.length;t++)oe(e[t])}function q(e,t){e.state=0;const n=E;for(let i=0;i<e.sources.length;i+=1){const r=e.sources[i];r.sources&&(r.state===m||n?r!==t&&oe(r):(r.state===z||n)&&q(r,t))}}function ue(e){const t=E;for(let n=0;n<e.observers.length;n+=1){const i=e.observers[n];(!i.state||t)&&(i.state=z,i.pure?g.push(i):y.push(i),i.observers&&ue(i))}}function fe(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),i=e.sourceSlots.pop(),r=n.observers;if(r&&r.length){const s=r.pop(),l=n.observerSlots.pop();i<r.length&&(s.sourceSlots[l]=i,r[i]=s,n.observerSlots[i]=l)}}if(e.owned){for(t=0;t<e.owned.length;t++)fe(e.owned[t]);e.owned=null}if(e.cleanups){for(t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}e.state=0,e.context=null}function ge(e){throw e}function de(e,t){return e&&(e.context&&e.context[t]!==void 0?e.context[t]:e.owner&&de(e.owner,t))}function F(e){if(typeof e=="function"&&!e.length)return F(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const i=F(e[n]);Array.isArray(i)?t.push.apply(t,i):t.push(i)}return t}return e}function Re(e){return function(n){let i;return Oe(()=>i=W(()=>(h.context={[e]:n.value},De(()=>n.children)))),i}}function j(){return!0}const he={get(e,t,n){return t===Ne?n:e.get(t)},has(e,t){return e.has(t)},set:j,deleteProperty:j,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:j,deleteProperty:j}},ownKeys(e){return e.keys()}};function M(e){return typeof e=="function"?e():e}function Q(...e){return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){const i=M(e[n])[t];if(i!==void 0)return i}},has(t){for(let n=e.length-1;n>=0;n--)if(t in M(e[n]))return!0;return!1},keys(){const t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(M(e[n])));return[...new Set(t)]}},he)}function Y(e,...t){const n=new Set(t.flat()),i=Object.getOwnPropertyDescriptors(e),r=t.map(s=>{const l={};for(let o=0;o<s.length;o++){const c=s[o];Object.defineProperty(l,c,i[c]?i[c]:{get(){return e[c]},set(){return!0}})}return l});return r.push(new Proxy({get(s){return n.has(s)?void 0:e[s]},has(s){return n.has(s)?!1:s in e},keys(){return Object.keys(e).filter(s=>!n.has(s))}},he)),r}const ze=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],Ve=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...ze]),We=new Set(["innerHTML","textContent","innerText","children"]),_e={className:"class",htmlFor:"for"},Z={class:"className",formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"},qe=new Set(["beforeinput","click","dblclick","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),Ue={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function Xe(e,t,n){let i=n.length,r=t.length,s=i,l=0,o=0,c=t[r-1].nextSibling,a=null;for(;l<r||o<s;){if(t[l]===n[o]){l++,o++;continue}for(;t[r-1]===n[s-1];)r--,s--;if(r===l){const u=s<i?o?n[o-1].nextSibling:n[s-o]:c;for(;o<s;)e.insertBefore(n[o++],u)}else if(s===o)for(;l<r;)(!a||!a.has(t[l]))&&t[l].remove(),l++;else if(t[l]===n[s-1]&&n[o]===t[r-1]){const u=t[--r].nextSibling;e.insertBefore(n[o++],t[l++].nextSibling),e.insertBefore(n[--s],u),t[r]=n[s]}else{if(!a){a=new Map;let d=o;for(;d<s;)a.set(n[d],d++)}const u=a.get(t[l]);if(u!=null)if(o<u&&u<s){let d=l,p=1,A;for(;++d<r&&d<s&&!((A=a.get(t[d]))==null||A!==u+p);)p++;if(p>u-o){const L=t[l];for(;o<u;)e.insertBefore(n[o++],L)}else e.replaceChild(n[o++],t[l++])}else l++;else t[l++].remove()}}}const J="_$DX_DELEGATE";function Ke(e,t=window.document){const n=t[J]||(t[J]=new Set);for(let i=0,r=e.length;i<r;i++){const s=e[i];n.has(s)||(n.add(s),t.addEventListener(s,nt))}}function Ge(e,t,n){n==null?e.removeAttribute(t):e.setAttribute(t,n)}function He(e,t,n,i){i==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,i)}function Qe(e,t,n,i){i?Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n:Array.isArray(n)?e.addEventListener(t,r=>n[0](n[1],r)):e.addEventListener(t,n)}function Ye(e,t,n={}){const i=Object.keys(t||{}),r=Object.keys(n);let s,l;for(s=0,l=r.length;s<l;s++){const o=r[s];!o||o==="undefined"||t[o]||(ee(e,o,!1),delete n[o])}for(s=0,l=i.length;s<l;s++){const o=i[s],c=!!t[o];!o||o==="undefined"||n[o]===c||!c||(ee(e,o,!0),n[o]=c)}return n}function Ze(e,t,n={}){const i=e.style;if(t==null||typeof t=="string")return i.cssText=t;typeof n=="string"&&(n={});let r,s;for(s in n)t[s]==null&&i.removeProperty(s),delete n[s];for(s in t)r=t[s],r!==n[s]&&(i.setProperty(s,r),n[s]=r);return n}function Je(e,t,n,i){typeof t=="function"?k(r=>ne(e,t(),r,n,i)):ne(e,t,void 0,n,i)}function et(e,t,n,i,r={}){for(const s in r)if(!(s in t)){if(s==="children")continue;te(e,s,null,r[s],n)}for(const s in t){if(s==="children"){i||T(e,t.children);continue}const l=t[s];r[s]=te(e,s,l,r[s],n)}}function tt(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function ee(e,t,n){const i=t.trim().split(/\s+/);for(let r=0,s=i.length;r<s;r++)e.classList.toggle(i[r],n)}function te(e,t,n,i,r){let s,l,o;if(t==="style")return Ze(e,n,i);if(t==="classList")return Ye(e,n,i);if(n===i)return i;if(t==="ref")n(e);else if(t.slice(0,3)==="on:")e.addEventListener(t.slice(3),n);else if(t.slice(0,10)==="oncapture:")e.addEventListener(t.slice(10),n,!0);else if(t.slice(0,2)==="on"){const c=t.slice(2).toLowerCase(),a=qe.has(c);Qe(e,c,n,a),a&&Ke([c])}else if((o=We.has(t))||!r&&(Z[t]||(l=Ve.has(t)))||(s=e.nodeName.includes("-")))s&&!l&&!o?e[tt(t)]=n:e[Z[t]||t]=n;else{const c=r&&t.indexOf(":")>-1&&Ue[t.split(":")[0]];c?He(e,c,t,n):Ge(e,_e[t]||t,n)}return n}function nt(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return n||document}});n!==null;){const i=n[t];if(i&&!n.disabled){const r=n[`${t}Data`];if(r!==void 0?i(r,e):i(e),e.cancelBubble)return}n=n.host&&n.host!==n&&n.host instanceof Node?n.host:n.parentNode}}function ne(e,t,n={},i,r){return!r&&"children"in t&&k(()=>n.children=T(e,t.children,n.children)),k(()=>et(e,t,i,!0,n)),n}function T(e,t,n,i,r){for(;typeof n=="function";)n=n();if(t===n)return n;const s=typeof t,l=i!==void 0;if(e=l&&n[0]&&n[0].parentNode||e,s==="string"||s==="number")if(s==="number"&&(t=t.toString()),l){let o=n[0];o&&o.nodeType===3?o.data=t:o=document.createTextNode(t),n=$(e,n,i,o)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t;else if(t==null||s==="boolean")n=$(e,n,i);else{if(s==="function")return k(()=>{let o=t();for(;typeof o=="function";)o=o();n=T(e,o,n,i)}),()=>n;if(Array.isArray(t)){const o=[];if(R(o,t,r))return k(()=>n=T(e,o,n,i,!0)),()=>n;if(o.length===0){if(n=$(e,n,i),l)return n}else Array.isArray(n)?n.length===0?ie(e,o,i):Xe(e,n,o):(n&&$(e),ie(e,o));n=o}else if(t instanceof Node){if(Array.isArray(n)){if(l)return n=$(e,n,i,t);$(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function R(e,t,n){let i=!1;for(let r=0,s=t.length;r<s;r++){let l=t[r],o;if(l instanceof Node)e.push(l);else if(!(l==null||l===!0||l===!1))if(Array.isArray(l))i=R(e,l)||i;else if((o=typeof l)=="string")e.push(document.createTextNode(l));else if(o==="function")if(n){for(;typeof l=="function";)l=l();i=R(e,Array.isArray(l)?l:[l])||i}else e.push(l),i=!0;else e.push(document.createTextNode(l.toString()))}return i}function ie(e,t,n){for(let i=0,r=t.length;i<r;i++)e.insertBefore(t[i],n)}function $(e,t,n,i){if(n===void 0)return e.textContent="";const r=i||document.createTextNode("");if(t.length){let s=!1;for(let l=t.length-1;l>=0;l--){const o=t[l];if(r!==o){const c=o.parentNode===e;!s&&!l?c?e.replaceChild(r,o):e.insertBefore(r,n):c&&o.remove()}else s=!0}}else e.insertBefore(r,n);return[r]}function it(e,...t){}const st=!1,rt=Le();function lt(e){let t=this||{};return(...n)=>{const i=r=>{const s=Ie(rt),l=Q(r,{theme:s}),o=Q(l,{get className(){const p=l.className,A="className"in l&&/^go[0-9]+/.test(p);let L=w.apply({target:t.target,o:A,p:l,g:t.g},n);return[p,L].filter(Boolean).join(" ")}}),[c,a]=Y(o,["as"]),u=c.as||e;let d;if(typeof u=="function")d=u(a);else if(st){const[p,A]=Y(a,["children"]);d=it([`<${u} `,">",`</${u}>`],void 0,p.children||"")}else d=document.createElement(u),Je(d,a);return d};return i.className=r=>W(()=>w.apply({target:t.target,p:r,g:t.g},n)),i}}const x=new Proxy(lt,{get(e,t){return e(t)}});function pe(e){return typeof e!="string"?!1:[/^[0-9]{0,10000}\.?[0-9]{1,10000}(vmin|vmax|vh|vw|%|ch|ex|em|rem|in|cm|mm|pt|pc|px)$/,/^var\(--\D{1,100}\)$/].some(t=>t.test(e))}const U={none:"0px",xxs:"0.0625rem",xs:"0.125rem",sm:"0.25rem",md:"0.5rem",mdLg:"0.75rem",lg:"1rem",lgXl:"1.5rem",xl:"2rem",xlXXl:"3rem",xxl:"4rem"};function ot(e){return e.reduce((t,[n,i])=>D(I({},t),{[n]:i}),{})}const S=(e,t)=>{var l,o;const n=(o=(l=t==null?void 0:t.space)!=null?l:t==null?void 0:t.spacing)!=null?o:U,r=ot(Object.entries(n).map(([c,a])=>[c,typeof a=="number"?`${a}px`:a]))[e];return pe(r)?r:void 0};function ct(e){return e===void 0?"100%":typeof e=="number"?`${e}px`:e}const at=x("div")`
1
+ "use strict";var S=Object.defineProperty,k=Object.defineProperties;var w=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var b=(t,e,n)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,f=(t,e)=>{for(var n in e||(e={}))A.call(e,n)&&b(t,n,e[n]);if(m)for(var n of m(e))j.call(e,n)&&b(t,n,e[n]);return t},x=(t,e)=>k(t,w(e));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var r=require("solid-styled-components");function v(t){return typeof t!="string"?!1:[/^[0-9]{0,10000}\.?[0-9]{1,10000}(vmin|vmax|vh|vw|%|ch|ex|em|rem|in|cm|mm|pt|pc|px)$/,/^var\(--\D{1,100}\)$/].some(e=>e.test(t))}const p={none:"0px",xxs:"0.0625rem",xs:"0.125rem",sm:"0.25rem",md:"0.5rem",mdLg:"0.75rem",lg:"1rem",lgXl:"1.5rem",xl:"2rem",xlXXl:"3rem",xxl:"4rem"};function C(t){return t.reduce((e,[n,c])=>x(f({},e),{[n]:c}),{})}const s=(t,e)=>{var i,o;const n=(o=(i=e==null?void 0:e.space)!=null?i:e==null?void 0:e.spacing)!=null?o:p,a=C(Object.entries(n).map(([g,d])=>[g,typeof d=="number"?`${d}px`:d]))[t];return v(a)?a:void 0};function z(t){return t===void 0?"100%":typeof t=="number"?`${t}px`:t}const I=r.styled.div`
2
2
  @property --maxWidth {
3
3
  syntax: "<length-percentage>";
4
4
  inherits: false;
5
5
  initial-value: 100%;
6
6
  }
7
7
 
8
- --maxWidth: ${e=>ct(e.maxWidth)};
8
+ --maxWidth: ${t=>z(t.maxWidth)};
9
9
 
10
10
  box-sizing: content-box;
11
11
 
12
- margin-inline-start: auto;
13
- margin-inline-end: auto;
14
- margin-inline: auto;
12
+ && {
13
+ margin-inline-start: auto;
14
+ margin-inline-end: auto;
15
+ margin-inline: auto;
16
+ }
15
17
 
16
18
  max-inline-size: var(--maxWidth, 100%);
17
19
 
18
- ${e=>e.centerChildren?w`
20
+ ${t=>t.centerChildren?r.css`
19
21
  display: flex;
20
22
  flex-direction: column;
21
23
  align-items: center;
22
24
  `:""}
23
25
 
24
- ${e=>e.centerText?w`
26
+ ${t=>t.centerText?r.css`
25
27
  text-align: center;
26
28
  `:""}
27
- `;function ut(e){return e===void 0?"100%":typeof e=="number"?`${e}px`:e}const ft=x("div")`
29
+ `;function O(t){return t===void 0?"100%":typeof t=="number"?`${t}px`:t}const R=r.styled("div")`
28
30
  @property --basis {
29
31
  syntax: "<length-percentage>";
30
32
  inherits: true;
@@ -37,29 +39,29 @@
37
39
  initial-value: 0px;
38
40
  }
39
41
 
40
- --basis: ${e=>ut(e.basis)};
41
- --gutter: ${e=>{var t;return e.gutter&&(t=S(e.gutter,e.theme))!=null?t:"0px"}};
42
+ --basis: ${t=>O(t.basis)};
43
+ --gutter: ${t=>{var e;return t.gutter&&(e=s(t.gutter,t.theme))!=null?e:"0px"}};
42
44
 
43
45
  box-sizing: border-box;
44
46
  > * {
45
47
  margin: 0;
46
48
  flex-basis: var(--basis, 100%);
47
- flex-grow: ${e=>e.noStretchedColumns?"0":"1"};
49
+ flex-grow: ${t=>t.noStretchedColumns?"0":"1"};
48
50
  flex-shrink: 1;
49
51
  }
50
52
 
51
53
  display: flex;
52
54
  flex-wrap: wrap;
53
55
  gap: var(--gutter, 0px);
54
- `;function gt(e){return Array.isArray(e)&&e.length===2&&e.every(Number.isFinite)||typeof e=="string"&&/^\d{1,1000} {0,1}\/ {0,1}\d{1,1000}$/.test(e)}function dt(e){return Array.isArray(e)?e.join("/"):e}function ht(e){return gt(e)?dt(e):void 0}const pt=x.div`
56
+ `;function W(t){return Array.isArray(t)&&t.length===2&&t.every(Number.isFinite)||typeof t=="string"&&/^\d{1,1000} {0,1}\/ {0,1}\d{1,1000}$/.test(t)}function M(t){return Array.isArray(t)?t.join("/"):t}function E(t){return W(t)?M(t):void 0}const P=r.styled.div`
55
57
  box-sizing: border-box;
56
58
  display: block;
57
59
  inline-size: 100%;
58
60
  position: relative;
59
61
  overflow: hidden;
60
62
 
61
- ${e=>{const t=ht(e.ratio);return t?w`
62
- aspect-ratio: ${t};
63
+ ${t=>{const e=E(t.ratio);return e?r.css`
64
+ aspect-ratio: ${e};
63
65
  `:""}};
64
66
 
65
67
  > * {
@@ -84,9 +86,9 @@
84
86
  size: 100%;
85
87
 
86
88
  object-fit: cover;
87
- object-position: ${e=>typeof e.position=="string"?e.position:"50%"};
89
+ object-position: ${t=>typeof t.position=="string"?t.position:"50%"};
88
90
  }
89
- `,yt=x("div")`
91
+ `,D=r.styled("div")`
90
92
  @property --gutter {
91
93
  syntax: "<length-percentage>";
92
94
  inherits: false;
@@ -99,8 +101,8 @@
99
101
  initial-value: 639px;
100
102
  }
101
103
 
102
- --gutter: ${e=>{var t;return e.gutter&&(t=S(e.gutter,e.theme))!=null?t:"0px"}};
103
- --minItemWidth: ${e=>{var t;return typeof e.minItemWidth=="string"?e.minItemWidth:`${(t=e.minItemWidth)!=null?t:0}px`}};
104
+ --gutter: ${t=>{var e;return t.gutter&&(e=s(t.gutter,t.theme))!=null?e:"0px"}};
105
+ --minItemWidth: ${t=>{var e;return typeof t.minItemWidth=="string"?t.minItemWidth:`${(e=t.minItemWidth)!=null?e:0}px`}};
104
106
 
105
107
  box-sizing: border-box;
106
108
  > * {
@@ -114,8 +116,8 @@
114
116
  auto-fit,
115
117
  minmax(min(var(--minItemWidth, 639px), 100%), 1fr)
116
118
  );
117
- `,P={start:"flex-start",end:"flex-end",center:"center"},B=D(I({},P),{stretch:"stretch"}),mt=x.div`
118
- --gutter: ${e=>{var t;return e.gutter&&(t=S(e.gutter,e.theme))!=null?t:"0px"}};
119
+ `,l={start:"flex-start",end:"flex-end",center:"center"},y=x(f({},l),{stretch:"stretch"}),$=r.styled.div`
120
+ --gutter: ${t=>{var e;return t.gutter&&(e=s(t.gutter,t.theme))!=null?e:"0px"}};
119
121
 
120
122
  box-sizing: border-box;
121
123
  > * {
@@ -126,35 +128,54 @@
126
128
  flex-wrap: wrap;
127
129
  gap: var(--gutter, 0px);
128
130
 
129
- justify-content: ${e=>typeof e.justify!="undefined"&&P[e.justify]?P[e.justify]:P.start};
131
+ justify-content: ${t=>typeof t.justify!="undefined"&&l[t.justify]?l[t.justify]:l.start};
130
132
 
131
- align-items: ${e=>typeof e.align!="undefined"&&B[e.align]?B[e.align]:B.start};
132
- `,se=new Set(["left","right","top","bottom","inlineStart","inlineEnd","blockStart","blockEnd"]),xt=(e,t)=>({left:`padding-inline-start:${t};`,right:`padding-inline-end:${t};`,top:`padding-block-start:${t};`,bottom:`padding-block-end:${t};`,inlineStart:`padding-inline-start:${t};`,inlineEnd:`padding-inline-end:${t};`,blockStart:`padding-block-start:${t};`,blockEnd:`padding-block-end:${t};`})[e];function bt(e){return t=>{const n=S(t,e);return n!=null?n:"0px"}}function wt(e,t){var s;if(Array.isArray(t)&&t.length>4)throw new Error("padding arrays can only be 4 or less in length");const n=new Set(Object.keys((s=e==null?void 0:e.spacing)!=null?s:U));(()=>typeof t=="string"?!0:Array.isArray(t)?t.every(l=>n.has(l)):t&&Object.keys(t).every(l=>se.has(l))&&Object.values(t).every(l=>n.has(l)))()||console.error("Invalid padding Type");const r=bt(e);return typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((l,[o,c])=>se.has(o)?l+xt(o,r(c)):l,""):t?`padding: ${Array.from(Array.isArray(t)?t:[t]).map(l=>r(l)).join(" ")}`:""}const St=x.div`
133
+ align-items: ${t=>typeof t.align!="undefined"&&y[t.align]?y[t.align]:y.start};
134
+ `;function L(t){return typeof t=="number"&&t>-1?!0:typeof t=="string"&&typeof CSS!==void 0?CSS.supports(`height: ${t}`):!1}const T=r.styled($)`
135
+ @property --switchAt {
136
+ syntax: "<length-percentage>";
137
+ inherits: true;
138
+ initial-value: 0;
139
+ }
140
+ flex-wrap: nowrap;
141
+ ${t=>t.stretch==="all"?"> * { flex: 1 }":t.stretch==="start"?"> :first-child { flex: 1 }":t.stretch==="end"?"> :last-child { flex: 1 }":typeof t.stretch=="number"?`> :nth-child(${t.stretch+1}) { flex: 1 }`:""}
142
+
143
+ ${t=>L(t.switchAt)?`
144
+ --switchAt: ${typeof t.switchAt=="string"?t.switchAt:`${t.switchAt}px`};
145
+ flex-wrap: wrap;
146
+ > * {
147
+ min-inline-size: fit-content;
148
+ flex-basis: calc(
149
+ (var(--switchAt) - (100% - var(--gutter, 0px))) * 999
150
+ );
151
+ }
152
+ `:""}
153
+ `,h=new Set(["left","right","top","bottom","inlineStart","inlineEnd","blockStart","blockEnd"]),V=(t,e)=>({left:`padding-inline-start:${e};`,right:`padding-inline-end:${e};`,top:`padding-block-start:${e};`,bottom:`padding-block-end:${e};`,inlineStart:`padding-inline-start:${e};`,inlineEnd:`padding-inline-end:${e};`,blockStart:`padding-block-start:${e};`,blockEnd:`padding-block-end:${e};`})[t];function B(t){return e=>{const n=s(e,t);return n!=null?n:"0px"}}function F(t,e){var u;if(Array.isArray(e)&&e.length>4)throw new Error("padding arrays can only be 4 or less in length");const n=new Set(Object.keys((u=t==null?void 0:t.spacing)!=null?u:p));(()=>typeof e=="string"?!0:Array.isArray(e)?e.every(i=>n.has(i)):e&&Object.keys(e).every(i=>h.has(i))&&Object.values(e).every(i=>n.has(i)))()||console.error("Invalid padding Type");const a=B(t);return typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((i,[o,g])=>h.has(o)?i+V(o,a(g)):i,""):e?`padding: ${Array.from(Array.isArray(e)?e:[e]).map(i=>a(i)).join(" ")}`:""}const X=r.styled.div`
133
154
  box-sizing: border-box;
134
- ${e=>wt(e.theme,e.padding)}
135
- `,$t=x.div`
155
+ ${t=>F(t.theme,t.padding)}
156
+ `,G=r.styled.div`
136
157
  box-sizing: border-box;
137
158
  > * {
138
159
  margin: 0;
139
160
  scroll-snap-align: start;
140
161
  }
141
162
 
142
- --gutter: ${e=>{var t;return e.gutter&&(t=S(e.gutter,e.theme))!=null?t:"0px"}};
163
+ --gutter: ${t=>{var e;return t.gutter&&(e=s(t.gutter,t.theme))!=null?e:"0px"}};
143
164
 
144
165
  display: flex;
145
166
  gap: var(--gutter, 0px);
146
167
 
147
168
  overflow-x: scroll;
148
169
 
149
- scroll-snap-type: ${({snapType:e="none"})=>{switch(e){case"none":return"none";case"proximity":return"x proximity";case"mandatory":return"x mandatory";default:return"none"}}};
150
- `,At=x("div")`
170
+ scroll-snap-type: ${({snapType:t="none"})=>{switch(t){case"none":return"none";case"proximity":return"x proximity";case"mandatory":return"x mandatory";default:return"none"}}};
171
+ `,_=r.styled("div")`
151
172
  @property --gutter {
152
173
  syntax: "<length-percentage>";
153
174
  inherits: false;
154
175
  initial-value: 0;
155
176
  }
156
177
 
157
- --gutter: ${e=>{var t;return e.gutter&&(t=S(e.gutter,e.theme))!=null?t:"0px"}};
178
+ --gutter: ${t=>{var e;return t.gutter&&(e=s(t.gutter,t.theme))!=null?e:"0px"}};
158
179
  box-sizing: border-box;
159
180
  > * {
160
181
  margin: 0;
@@ -168,4 +189,4 @@
168
189
  & > [data-bedrock-column] {
169
190
  grid-column: span 1 / auto;
170
191
  }
171
- `;exports.Center=at;exports.ColumnDrop=ft;exports.Frame=pt;exports.Grid=yt;exports.InlineCluster=mt;exports.PadBox=St;exports.Reel=$t;exports.Stack=At;exports.checkIsCSSLength=pe;exports.getSpacingValue=S;exports.spacing=U;
192
+ `;exports.Center=I;exports.ColumnDrop=R;exports.Frame=P;exports.Grid=D;exports.Inline=T;exports.InlineCluster=$;exports.PadBox=X;exports.Reel=G;exports.Stack=_;exports.checkIsCSSLength=v;exports.getSpacingValue=s;exports.spacing=p;
package/lib/index.d.ts CHANGED
@@ -1,122 +1,10 @@
1
- import { DefaultTheme } from "solid-styled-components";
2
- declare type LowercaseCharacter = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
3
- declare type AllCharacter = LowercaseCharacter | Uppercase<LowercaseCharacter>;
4
- declare type NonEmptyString = `${AllCharacter}${string}`;
5
- declare type CSSCustomProperties = `var(--${NonEmptyString})`;
6
- declare type LengthUnit = "vmin" | "vmax" | "vh" | "vw" | "%" | "ch" | "ex" | "em" | "rem" | "in" | "cm" | "mm" | "pt" | "pc" | "px";
7
- export declare type CSSLength = `${number}${LengthUnit}` | CSSCustomProperties;
8
- export declare function checkIsCSSLength(str: string): str is CSSLength;
9
- export interface Spacing {
10
- none: CSSLength;
11
- xxs: CSSLength;
12
- xs: CSSLength;
13
- sm: CSSLength;
14
- md: CSSLength;
15
- mdLg: CSSLength;
16
- lg: CSSLength;
17
- lgXl: CSSLength;
18
- xl: CSSLength;
19
- xlXXl: CSSLength;
20
- xxl: CSSLength;
21
- }
22
- export declare const spacing: Spacing;
23
- export declare type BaseTheme = Record<string, CSSLength | string | number>;
24
- declare type ThemeOrDefaultSpace<T> = T extends {
25
- space: BaseTheme;
26
- } ? T["space"] : keyof Spacing;
27
- declare type SpacingOptions = ThemeOrDefaultSpace<DefaultTheme>;
28
- declare type MaybeValue = CSSLength | undefined;
29
- declare type GetSpacingValue = (spacingKey: SpacingOptions, theme?: Partial<BaseTheme>) => MaybeValue;
30
- export declare const getSpacingValue: GetSpacingValue;
31
- declare type MaxWidth = number | CSSLength;
32
- export interface CenterProps {
33
- maxWidth?: MaxWidth;
34
- centerText?: boolean;
35
- centerChildren?: boolean;
36
- }
37
- export declare const Center: ((props: CenterProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
38
- className: (props: CenterProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
39
- };
40
- declare type Basis = CSSLength | number;
41
- export interface ColumnDropProps {
42
- gutter?: SpacingOptions;
43
- basis?: Basis;
44
- noStretchedColumns?: boolean;
45
- }
46
- export declare const ColumnDrop: ((props: ColumnDropProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
47
- className: (props: ColumnDropProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
48
- };
49
- declare type RatioString = `${number}/${number}` | `${number} / ${number}`;
50
- declare type Ratio = [number, number] | RatioString;
51
- export interface FrameProps {
52
- ratio?: Ratio;
53
- position?: string;
54
- }
55
- export declare const Frame: ((props: FrameProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
56
- className: (props: FrameProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
57
- };
58
- declare type MinItemWidth = number | CSSLength;
59
- export interface GridProps {
60
- gutter?: SpacingOptions;
61
- minItemWidth?: MinItemWidth;
62
- }
63
- export declare const Grid: ((props: GridProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
64
- className: (props: GridProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
65
- };
66
- declare const justifyMap: {
67
- readonly start: "flex-start";
68
- readonly end: "flex-end";
69
- readonly center: "center";
70
- };
71
- declare const alignMap: {
72
- readonly stretch: "stretch";
73
- readonly start: "flex-start";
74
- readonly end: "flex-end";
75
- readonly center: "center";
76
- };
77
- export interface InlineClusterProps {
78
- justify?: keyof typeof justifyMap;
79
- align?: keyof typeof alignMap;
80
- gutter: SpacingOptions;
81
- }
82
- export declare const InlineCluster: ((props: InlineClusterProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
83
- className: (props: InlineClusterProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
84
- };
85
- declare type PaddingObj = {
86
- left: SpacingOptions;
87
- } | {
88
- right: SpacingOptions;
89
- } | {
90
- top: SpacingOptions;
91
- } | {
92
- bottom: SpacingOptions;
93
- } | {
94
- inlineStart: SpacingOptions;
95
- } | {
96
- inlineEnd: SpacingOptions;
97
- } | {
98
- blockStart: SpacingOptions;
99
- } | {
100
- blockEnd: SpacingOptions;
101
- };
102
- declare type PaddingTypes = SpacingOptions | PaddingObj | [SpacingOptions] | [SpacingOptions, SpacingOptions] | [SpacingOptions, SpacingOptions, SpacingOptions] | [SpacingOptions, SpacingOptions, SpacingOptions, SpacingOptions];
103
- export interface PadBoxProps {
104
- padding: PaddingTypes;
105
- }
106
- export declare const PadBox: ((props: PadBoxProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
107
- className: (props: PadBoxProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
108
- };
109
- export interface ReelProps {
110
- snapType?: "none" | "proximity" | "mandatory";
111
- gutter: SpacingOptions;
112
- }
113
- export declare const Reel: ((props: ReelProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
114
- className: (props: ReelProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
115
- };
116
- export interface StackProps {
117
- gutter?: SpacingOptions;
118
- }
119
- export declare const Stack: ((props: StackProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
120
- className: (props: StackProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
121
- };
122
- export {};
1
+ export * from "./spacing-constants";
2
+ export * from "./center";
3
+ export * from "./column-drop";
4
+ export * from "./frame";
5
+ export * from "./grid";
6
+ export * from "./inline-cluster";
7
+ export * from "./inline";
8
+ export * from "./padbox";
9
+ export * from "./reel";
10
+ export * from "./stack";