@bedrock-layout/solid 0.7.0 → 0.8.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.
@@ -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/cover.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import { Component, JSX, JSXElement } from "solid-js";
2
+ import { CSSLength, SpacingOptions } from "./spacing-constants";
3
+ declare type MinHeight = CSSLength | number;
4
+ interface CoverWrapperProps {
5
+ gutter?: SpacingOptions;
6
+ minHeight?: MinHeight;
7
+ stretchContent?: boolean;
8
+ }
9
+ export interface CoverProps extends CoverWrapperProps {
10
+ top?: JSXElement;
11
+ bottom?: JSXElement;
12
+ as?: Component | keyof JSX.IntrinsicElements;
13
+ }
14
+ export declare const Cover: Component<CoverProps>;
15
+ 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 me=Object.defineProperty,xe=Object.defineProperties;var be=Object.getOwnPropertyDescriptors;var X=Object.getOwnPropertySymbols;var we=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable;var K=(e,t,n)=>t in e?me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t)=>{for(var n in t||(t={}))we.call(t,n)&&K(e,n,t[n]);if(X)for(var n of X(t))Se.call(t,n)&&K(e,n,t[n]);return e},D=(e,t)=>xe(e,be(t));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";let $e={data:""},Ae=e=>typeof window=="object"?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||$e,Ce=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,ve=/\/\*[^]*?\*\/|\s\s+|\n/g,w=(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"?w(l,s):s+"{"+w(l,s[1]=="k"?"":t)+"}":typeof l=="object"?i+=w(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+=w.p?w.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},ke=(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=Ce.exec(c.replace(ve,""));)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]=w(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},Ee=(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?"":w(o,""):o===!1?"":o}return i+r+(l==null?"":l)},"");function x(e){let t=this||{},n=e.call?e(t.p):e;return ke(n.unshift?n.raw?Ee(n,[].slice.call(arguments,1),t.p):n.reduce((i,r)=>Object.assign(i,r&&r.call?r(t.p):r),{}):n,Ae(t.target),t.g,t.o,t.k)}x.bind({g:1});x.bind({k:1});const Ne=(e,t)=>e===t,je=Symbol("solid-proxy"),G={equals:Ne};let Pe=ae;const O={},b=1,R=2,Oe={owned:null,cleanups:null,context:null,owner:null};var h=null;let E=null,f=null,v=null,g=null,m=null,V=0;function Te(e,t,n){const i=_(e,t,!0,b);N(i)}function k(e,t,n){const i=_(e,t,!1,b);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),ze.bind(i)}function Le(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 Ie(e){const t=Symbol("context");return{id:t,Provider:Re(t),defaultValue:e}}function De(e){return de(h,e.id)||e.defaultValue}function Me(e){const t=H(e);return H(()=>B(t()))}function ze(){const e=E;if(this.sources&&(this.state||e)){const t=g;g=null,this.state===b||e?N(this):U(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):m.push(s),s.observers&&(i&&!s.tState||!i&&!s.state)&&ue(s),i||(s.state=b)}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=b,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!==Oe&&(h.owned?h.owned.push(s):h.owned=[s]),s}function oe(e){const t=E;if(e.state!==b)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===b||t)N(e);else if(e.state===R||t){const r=g;g=null,U(e,n[0]),g=r}}function ce(e,t){if(g)return e();let n=!1;t||(g=[]),m?n=!0:m=[],V++;try{return e()}catch(i){ge(i)}finally{Fe(n)}}function Fe(e){g&&(ae(g),g=null),!e&&(m.length?Le(()=>{Pe(m),m=null}):m=null)}function ae(e){for(let t=0;t<e.length;t++)oe(e[t])}function U(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===b||n?r!==t&&oe(r):(r.state===R||n)&&U(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=R,i.pure?g.push(i):m.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 B(e){if(typeof e=="function"&&!e.length)return B(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const i=B(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 Te(()=>i=W(()=>(h.context={[e]:n.value},Me(()=>n.children)))),i}}function j(){return!0}const he={get(e,t,n){return t===je?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 Ve=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],We=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...Ve]),_e=new Set(["innerHTML","textContent","innerText","children"]),Ue={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"]),Xe={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function Ke(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 Ge(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,it))}}function He(e,t,n){n==null?e.removeAttribute(t):e.setAttribute(t,n)}function Qe(e,t,n,i){i==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,i)}function Ye(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 Ze(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 Je(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 et(e,t,n,i){typeof t=="function"?k(r=>ne(e,t(),r,n,i)):ne(e,t,void 0,n,i)}function tt(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 nt(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 Je(e,n,i);if(t==="classList")return Ze(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);Ye(e,c,n,a),a&&Ge([c])}else if((o=_e.has(t))||!r&&(Z[t]||(l=We.has(t)))||(s=e.nodeName.includes("-")))s&&!l&&!o?e[nt(t)]=n:e[Z[t]||t]=n;else{const c=r&&t.indexOf(":")>-1&&Xe[t.split(":")[0]];c?Qe(e,c,t,n):He(e,Ue[t]||t,n)}return n}function it(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(()=>tt(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(F(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):Ke(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 F(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=F(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=F(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 st(e,...t){}const rt=!1,lt=Ie();function ot(e){let t=this||{};return(...n)=>{const i=r=>{const s=De(lt),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=x.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(rt){const[p,A]=Y(a,["children"]);d=st([`<${u} `,">",`</${u}>`],void 0,p.children||"")}else d=document.createElement(u),et(d,a);return d};return i.className=r=>W(()=>x.apply({target:t.target,p:r,g:t.g},n)),i}}const y=new Proxy(ot,{get(e,t){return e(t)}});function ye(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 q={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 ct(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:q,r=ct(Object.entries(n).map(([c,a])=>[c,typeof a=="number"?`${a}px`:a]))[e];return ye(r)?r:void 0};function at(e){return e===void 0?"100%":typeof e=="number"?`${e}px`:e}const ut=y("div")`
1
+ "use strict";var A=Object.defineProperty,j=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var u=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var h=(e,t,n)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g=(e,t)=>{for(var n in t||(t={}))v.call(t,n)&&h(e,n,t[n]);if(u)for(var n of u(t))$.call(t,n)&&h(e,n,t[n]);return e},y=(e,t)=>j(e,z(t));var S=(e,t)=>{var n={};for(var i in e)v.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&u)for(var i of u(e))t.indexOf(i)<0&&$.call(e,i)&&(n[i]=e[i]);return n};Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var a=require("solid-styled-components");function p(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 b={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 I(e){return e.reduce((t,[n,i])=>y(g({},t),{[n]:i}),{})}const s=(e,t)=>{var r,c;const n=(c=(r=t==null?void 0:t.space)!=null?r:t==null?void 0:t.spacing)!=null?c:b,o=I(Object.entries(n).map(([f,x])=>[f,typeof x=="number"?`${x}px`:x]))[e];return p(o)?o:void 0};function R(e){return e===void 0?"100%":typeof e=="number"?`${e}px`:e}const W=a.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=>at(e.maxWidth)};
8
+ --maxWidth: ${e=>R(e.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?x`
20
+ ${e=>e.centerChildren?a.css`
19
21
  display: flex;
20
22
  flex-direction: column;
21
23
  align-items: center;
22
24
  `:""}
23
25
 
24
- ${e=>e.centerText?x`
26
+ ${e=>e.centerText?a.css`
25
27
  text-align: center;
26
28
  `:""}
27
- `;function ft(e){return e===void 0?"100%":typeof e=="number"?`${e}px`:e}const gt=y("div")`
29
+ `;function E(e){return e===void 0?"100%":typeof e=="number"?`${e}px`:e}const M=a.styled("div")`
28
30
  @property --basis {
29
31
  syntax: "<length-percentage>";
30
32
  inherits: true;
@@ -37,8 +39,8 @@
37
39
  initial-value: 0px;
38
40
  }
39
41
 
40
- --basis: ${e=>ft(e.basis)};
41
- --gutter: ${e=>{var t;return e.gutter&&(t=S(e.gutter,e.theme))!=null?t:"0px"}};
42
+ --basis: ${e=>E(e.basis)};
43
+ --gutter: ${e=>{var t;return e.gutter&&(t=s(e.gutter,e.theme))!=null?t:"0px"}};
42
44
 
43
45
  box-sizing: border-box;
44
46
  > * {
@@ -51,14 +53,14 @@
51
53
  display: flex;
52
54
  flex-wrap: wrap;
53
55
  gap: var(--gutter, 0px);
54
- `;function dt(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 ht(e){return Array.isArray(e)?e.join("/"):e}function yt(e){return dt(e)?ht(e):void 0}const pt=y.div`
56
+ `;function O(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 P(e){return Array.isArray(e)?e.join("/"):e}function D(e){return O(e)?P(e):void 0}const L=a.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=yt(e.ratio);return t?x`
63
+ ${e=>{const t=D(e.ratio);return t?a.css`
62
64
  aspect-ratio: ${t};
63
65
  `:""}};
64
66
 
@@ -86,7 +88,7 @@
86
88
  object-fit: cover;
87
89
  object-position: ${e=>typeof e.position=="string"?e.position:"50%"};
88
90
  }
89
- `,mt=y("div")`
91
+ `,T=a.styled("div")`
90
92
  @property --gutter {
91
93
  syntax: "<length-percentage>";
92
94
  inherits: false;
@@ -99,7 +101,7 @@
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"}};
104
+ --gutter: ${e=>{var t;return e.gutter&&(t=s(e.gutter,e.theme))!=null?t:"0px"}};
103
105
  --minItemWidth: ${e=>{var t;return typeof e.minItemWidth=="string"?e.minItemWidth:`${(t=e.minItemWidth)!=null?t:0}px`}};
104
106
 
105
107
  box-sizing: border-box;
@@ -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"},z=D(I({},P),{stretch:"stretch"}),pe=y.div`
118
- --gutter: ${e=>{var t;return e.gutter&&(t=S(e.gutter,e.theme))!=null?t:"0px"}};
119
+ `,d={start:"flex-start",end:"flex-end",center:"center"},m=y(g({},d),{stretch:"stretch"}),C=a.styled.div`
120
+ --gutter: ${e=>{var t;return e.gutter&&(t=s(e.gutter,e.theme))!=null?t:"0px"}};
119
121
 
120
122
  box-sizing: border-box;
121
123
  > * {
@@ -126,10 +128,10 @@
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: ${e=>typeof e.justify!="undefined"&&d[e.justify]?d[e.justify]:d.start};
130
132
 
131
- align-items: ${e=>typeof e.align!="undefined"&&z[e.align]?z[e.align]:z.start};
132
- `;function xt(e){return e&&e>-1?!0:typeof e=="string"&&typeof CSS!==void 0?CSS.supports(`height: ${e}`):!1}const bt=y(pe)`
133
+ align-items: ${e=>typeof e.align!="undefined"&&m[e.align]?m[e.align]:m.start};
134
+ `;function V(e){return typeof e=="number"&&e>-1?!0:typeof e=="string"&&typeof CSS!==void 0?CSS.supports(`height: ${e}`):!1}const B=a.styled(C)`
133
135
  @property --switchAt {
134
136
  syntax: "<length-percentage>";
135
137
  inherits: true;
@@ -138,7 +140,7 @@
138
140
  flex-wrap: nowrap;
139
141
  ${e=>e.stretch==="all"?"> * { flex: 1 }":e.stretch==="start"?"> :first-child { flex: 1 }":e.stretch==="end"?"> :last-child { flex: 1 }":typeof e.stretch=="number"?`> :nth-child(${e.stretch+1}) { flex: 1 }`:""}
140
142
 
141
- ${e=>xt(e.switchAt)?x`
143
+ ${e=>V(e.switchAt)?`
142
144
  --switchAt: ${typeof e.switchAt=="string"?e.switchAt:`${e.switchAt}px`};
143
145
  flex-wrap: wrap;
144
146
  > * {
@@ -148,25 +150,17 @@
148
150
  );
149
151
  }
150
152
  `:""}
151
-
152
- &[style*="--switchAt"] {
153
- flex-wrap: wrap;
154
- > * {
155
- min-inline-size: fit-content;
156
- flex-basis: calc((var(--switchAt) - (100% - var(--gutter, 0px))) * 999);
157
- }
158
- }
159
- `,se=new Set(["left","right","top","bottom","inlineStart","inlineEnd","blockStart","blockEnd"]),wt=(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 St(e){return t=>{const n=S(t,e);return n!=null?n:"0px"}}function $t(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:q));(()=>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=St(e);return typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((l,[o,c])=>se.has(o)?l+wt(o,r(c)):l,""):t?`padding: ${Array.from(Array.isArray(t)?t:[t]).map(l=>r(l)).join(" ")}`:""}const At=y.div`
153
+ `,k=new Set(["left","right","top","bottom","inlineStart","inlineEnd","blockStart","blockEnd"]),F=(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 X(e){return t=>{const n=s(t,e);return n!=null?n:"0px"}}function w(e,t){var l;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((l=e==null?void 0:e.spacing)!=null?l:b));(()=>typeof t=="string"?!0:Array.isArray(t)?t.every(r=>n.has(r)):t&&Object.keys(t).every(r=>k.has(r))&&Object.values(t).every(r=>n.has(r)))()||console.error("Invalid padding Type");const o=X(e);return typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[c,f])=>k.has(c)?r+F(c,o(f)):r,""):t!==void 0?`padding: ${Array.from(Array.isArray(t)?t:[t]).map(r=>o(r)).join(" ")};`:""}const G=a.styled.div`
160
154
  box-sizing: border-box;
161
- ${e=>$t(e.theme,e.padding)}
162
- `,Ct=y.div`
155
+ ${e=>(console.log(w(e.theme,e.padding)),w(e.theme,e.padding))}
156
+ `,_=a.styled.div`
163
157
  box-sizing: border-box;
164
158
  > * {
165
159
  margin: 0;
166
160
  scroll-snap-align: start;
167
161
  }
168
162
 
169
- --gutter: ${e=>{var t;return e.gutter&&(t=S(e.gutter,e.theme))!=null?t:"0px"}};
163
+ --gutter: ${e=>{var t;return e.gutter&&(t=s(e.gutter,e.theme))!=null?t:"0px"}};
170
164
 
171
165
  display: flex;
172
166
  gap: var(--gutter, 0px);
@@ -174,14 +168,14 @@
174
168
  overflow-x: scroll;
175
169
 
176
170
  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"}}};
177
- `,vt=y("div")`
171
+ `,q=a.styled("div")`
178
172
  @property --gutter {
179
173
  syntax: "<length-percentage>";
180
174
  inherits: false;
181
175
  initial-value: 0;
182
176
  }
183
177
 
184
- --gutter: ${e=>{var t;return e.gutter&&(t=S(e.gutter,e.theme))!=null?t:"0px"}};
178
+ --gutter: ${e=>{var t;return e.gutter&&(t=s(e.gutter,e.theme))!=null?t:"0px"}};
185
179
  box-sizing: border-box;
186
180
  > * {
187
181
  margin: 0;
@@ -195,4 +189,44 @@
195
189
  & > [data-bedrock-column] {
196
190
  grid-column: span 1 / auto;
197
191
  }
198
- `;exports.Center=ut;exports.ColumnDrop=gt;exports.Frame=pt;exports.Grid=mt;exports.Inline=bt;exports.InlineCluster=pe;exports.PadBox=At;exports.Reel=Ct;exports.Stack=vt;exports.checkIsCSSLength=ye;exports.getSpacingValue=S;exports.spacing=q;
192
+ `;function H(e){return typeof e=="number"?`${e}px`:e&&p(e)?e:"100vh"}const K=a.styled.div`
193
+ @property --gutter {
194
+ syntax: "<length-percentage>";
195
+ inherits: false;
196
+ initial-value: 0;
197
+ }
198
+
199
+ @property --minHeight {
200
+ syntax: "<length-percentage>";
201
+ inherits: false;
202
+ initial-value: 100vh;
203
+ }
204
+
205
+ --gutter: ${e=>{var t;return e.gutter&&(t=s(e.gutter,e.theme))!=null?t:"0px"}};
206
+
207
+ --minHeight: ${e=>H(e.minHeight)};
208
+
209
+ > * {
210
+ margin: 0;
211
+ }
212
+
213
+ display: flex;
214
+ flex-direction: column;
215
+ gap: var(--gutter, 0px);
216
+
217
+ min-block-size: var(--minHeight, 100vh);
218
+
219
+ > [data-bedrock-cover-centered] {
220
+ margin-block-start: auto;
221
+ margin-block-end: auto;
222
+
223
+ ${({stretchContent:e})=>e===!0?`
224
+ flex: 1;
225
+ display: flex;
226
+ flex-direction: column;
227
+ > * {
228
+ flex: 1;
229
+ }
230
+ `:""};
231
+ }
232
+ `,N=e=>{const l=e,{top:t,bottom:n,children:i}=l,o=S(l,["top","bottom","children"]);return React.createElement(K,g({},o),e.top,React.createElement("div",{"data-bedrock-cover-centered":!0},e.children),e.bottom)};exports.Center=W;exports.ColumnDrop=M;exports.Cover=N;exports.Frame=L;exports.Grid=T;exports.Inline=B;exports.InlineCluster=C;exports.PadBox=G;exports.Reel=_;exports.Stack=q;exports.checkIsCSSLength=p;exports.getSpacingValue=s;exports.spacing=b;
package/lib/index.d.ts CHANGED
@@ -1,131 +1,11 @@
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 Stretch = "all" | "start" | "end" | number;
86
- declare type SwitchAt = string | number;
87
- export interface InlineProps extends InlineClusterProps {
88
- stretch?: Stretch;
89
- switchAt?: SwitchAt;
90
- }
91
- export declare const Inline: ((props: InlineProps & InlineClusterProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
92
- className: (props: InlineProps & InlineClusterProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
93
- };
94
- declare type PaddingObj = {
95
- left: SpacingOptions;
96
- } | {
97
- right: SpacingOptions;
98
- } | {
99
- top: SpacingOptions;
100
- } | {
101
- bottom: SpacingOptions;
102
- } | {
103
- inlineStart: SpacingOptions;
104
- } | {
105
- inlineEnd: SpacingOptions;
106
- } | {
107
- blockStart: SpacingOptions;
108
- } | {
109
- blockEnd: SpacingOptions;
110
- };
111
- declare type PaddingTypes = SpacingOptions | PaddingObj | [SpacingOptions] | [SpacingOptions, SpacingOptions] | [SpacingOptions, SpacingOptions, SpacingOptions] | [SpacingOptions, SpacingOptions, SpacingOptions, SpacingOptions];
112
- export interface PadBoxProps {
113
- padding: PaddingTypes;
114
- }
115
- export declare const PadBox: ((props: PadBoxProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
116
- className: (props: PadBoxProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
117
- };
118
- export interface ReelProps {
119
- snapType?: "none" | "proximity" | "mandatory";
120
- gutter: SpacingOptions;
121
- }
122
- export declare const Reel: ((props: ReelProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
123
- className: (props: ReelProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
124
- };
125
- export interface StackProps {
126
- gutter?: SpacingOptions;
127
- }
128
- export declare const Stack: ((props: StackProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => import("solid-js").JSX.Element) & {
129
- className: (props: StackProps & import("solid-js").JSX.HTMLAttributes<HTMLDivElement>) => string;
130
- };
131
- 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";
11
+ export * from "./cover";