cirrojs 0.0.9 → 0.0.10

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/CHANGELOG.md CHANGED
@@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## [0.0.10] - 2026-06-27
17
+
18
+ ### Added
19
+ - New `cirrojs/layout` entry point exporting `createLayout`, a factory that produces the Every Layout primitives (`stack`, `cluster`, `center`, `grid`, `switcher`, `sidebar`, `cover`, `frame`, `reel`, `imposter`, `box`) as typed functions returning deterministic class names. `createLayout` accepts a `LayoutTheme` for overriding the output `css` function and partially overriding the defaults. Also exports the `Layout`, `LayoutTheme`, `LayoutDefaults`, `SidebarSlots`, and `CoverSlots` types.
20
+
21
+ ### Changed
22
+ - Replaced the `mediaAtRule?: string` field of `GenCssFnOpt` with `atRules?: string[]`. `genCssFn` now accepts any at-rules directly instead of only a media query condition.
23
+ - The dev server now responds with the error's stack trace instead of its string representation when a render throws.
24
+
16
25
  ## [0.0.9] - 2026-06-22
17
26
 
18
27
  ### Fixed
@@ -72,7 +81,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
72
81
  ## 0.0.1 - 2026-06-15
73
82
  - initial release
74
83
 
75
- [Unreleased]: https://github.com/osawa-naotaka/cirro/compare/v0.0.9...HEAD
84
+ [Unreleased]: https://github.com/osawa-naotaka/cirro/compare/v0.0.10...HEAD
85
+ [0.0.10]: https://github.com/osawa-naotaka/cirro/compare/v0.0.9...v0.0.10
76
86
  [0.0.9]: https://github.com/osawa-naotaka/cirro/compare/v0.0.8...v0.0.9
77
87
  [0.0.8]: https://github.com/osawa-naotaka/cirro/compare/v0.0.7...v0.0.8
78
88
  [0.0.7]: https://github.com/osawa-naotaka/cirro/compare/v0.0.6...v0.0.7
package/dist/cli.js CHANGED
@@ -1 +1 @@
1
- import{r as e}from"./css-BZ1E8BDE.js";import{Fragment as t,createElement as n}from"react";import{renderToStaticMarkup as r}from"react-dom/server";import{dirname as i,extname as a,join as o,resolve as s}from"node:path";import{mkdir as c,readFile as l,writeFile as u}from"node:fs/promises";import{build as d,createServer as f,createServerModuleRunner as p}from"vite";import{createServer as m}from"node:http";function h(e){let t=[];for(let n of e)switch(n.type){case`static`:t.push({type:`html`,path:n.path,cssPath:o(n.path,`index.css`),render:()=>n.component({params:{}})}),t.push({type:`css`,path:o(n.path,`index.css`),render:()=>n.component({params:{}})});break;case`dynamic`:for(let e of n.getStaticPaths())t.push({type:`html`,path:n.path(e),cssPath:n.cssPath,render:()=>n.component({params:e})});t.push({type:`css`,path:n.cssPath,render:()=>n.component({params:n.getStaticPaths()[0]})});break;case`file`:t.push({type:`file`,path:n.path,ext:a(n.path),render:()=>n.component({params:{}})});break}return t}function g(e){return e===`/`?`index.html`:`${e.replace(/^\/+|\/+$/g,``)}/index.html`}function _(e){return e===`/`?`index.css`:`${e.replace(/^\/+|\/+$/g,``)}`}function v(e,r,i){return n(t,null,e,n(`script`,{async:!0,type:`module`,src:r,key:`cirro-client`}),n(`link`,{rel:`stylesheet`,href:i,precedence:`default`,key:`cirro-css`}))}function y(e){for(let t of e.plugins){let e=t.api;if(t.name===`cirro`&&e?.options)return e.options}throw Error(`cirro: plugin not found in Vite config (did you add cirro() to plugins?)`)}async function b(){await d();let t=await f({server:{middlewareMode:!0,hmr:!1},appType:`custom`}),n=p(t.environments.ssr);try{let a=t.config,d=y(a),f=a.root,p=s(f,a.build.outDir),m=s(f,d.routes),b=JSON.parse(await l(o(p,`.vite/manifest.json`),`utf-8`))[`virtual:cirro/client`];if(!b)throw Error(`cirro: manifest entry "virtual:cirro/client" not found`);let x=`/${b.file}`,{routes:S,runWithRegistry:C}=await n.import(m);for(let t of h(S))switch(t.type){case`css`:{let{registry:n}=C(()=>r(t.render())),a=e(n),s=o(p,_(t.path));await c(i(s),{recursive:!0}),await u(s,a),console.log(`wrote ${s} (url: ${t.path})`);break}case`html`:{let{result:e}=C(()=>`<!DOCTYPE html>${r(v(t.render(),x,t.cssPath))}`),n=o(p,g(t.path));await c(i(n),{recursive:!0}),await u(n,e),console.log(`wrote ${n} (url: ${t.path})`);break}case`file`:{let e=t.render(),n=o(p,t.path);await c(i(n),{recursive:!0}),await u(n,e),console.log(`wrote ${n} (url: ${t.path})`);break}}}finally{await t.close()}}const x=[[`.aac`,`audio/aac`],[`.abw`,`application/x-abiword`],[`.arc`,`application/x-freearc`],[`.avi`,`video/x-msvideo`],[`.azw`,`application/vnd.amazon.ebook`],[`.bin`,`application/octet-stream`],[`.bmp`,`image/bmp`],[`.bz`,`application/x-bzip`],[`.bz2`,`application/x-bzip2`],[`.csh`,`application/x-csh`],[`.css`,`text/css`],[`.csv`,`text/csv`],[`.doc`,`application/msword`],[`.docx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`],[`.eot`,`application/vnd.ms-fontobject`],[`.epub`,`application/epub+zip`],[`.gz`,`application/gzip`],[`.gif`,`image/gif`],[`.htm`,`text/html`],[`.html`,`text/html`],[`.ico`,`image/vnd.microsoft.icon`],[`.ics`,`text/calendar`],[`.jar`,`application/java-archive`],[`.jpeg`,`image/jpeg`],[`.jpg`,`image/jpeg`],[`.js`,`text/javascript`],[`.json`,`application/json`],[`.jsonld`,`application/ld+json`],[`.mid`,`audio/midi`],[`.midi`,`audio/x-midi`],[`.mjs`,`text/javascript`],[`.mp3`,`audio/mpeg`],[`.mpeg`,`video/mpeg`],[`.mpkg`,`application/vnd.apple.installer+xml`],[`.odp`,`application/vnd.oasis.opendocument.presentation`],[`.ods`,`application/vnd.oasis.opendocument.spreadsheet`],[`.odt`,`application/vnd.oasis.opendocument.text`],[`.oga`,`audio/ogg`],[`.ogv`,`video/ogg`],[`.ogx`,`application/ogg`],[`.opus`,`audio/opus`],[`.otf`,`font/otf`],[`.png`,`image/png`],[`.pdf`,`application/pdf`],[`.php`,`application/x-httpd-php`],[`.ppt`,`application/vnd.ms-powerpoint`],[`.pptx`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],[`.rar`,`application/vnd.rar`],[`.rtf`,`application/rtf`],[`.sh`,`application/x-sh`],[`.svg`,`image/svg+xml`],[`.swf`,`application/x-shockwave-flash`],[`.tar`,`application/x-tar`],[`.tif`,`image/tiff`],[`.tiff`,`image/tiff`],[`.ts`,`video/mp2t`],[`.ttf`,`font/ttf`],[`.txt`,`text/plain`],[`.vsd`,`application/vnd.visio`],[`.wav`,`audio/wav`],[`.weba`,`audio/webm`],[`.webm`,`video/webm`],[`.webp`,`image/webp`],[`.woff`,`font/woff`],[`.woff2`,`font/woff2`],[`.xhtml`,`application/xhtml+xml`],[`.xls`,`application/vnd.ms-excel`],[`.xlsx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],[`.xml`,`application/xml`],[`.xul`,`application/vnd.mozilla.xul+xml`],[`.zip`,`application/zip`],[`.3gp`,`video/3gpp`],[`.3g2`,`video/3gpp2`],[`.7z`,`application/x-7z-compressed`]];function S(e){return x.find(t=>t[0]===e)?.[1]||`text/plain`}function C(e,t){let n=[t,t.replaceAll(`\\`,`/`)];for(let t of Object.values(e.environments)){let e=t.moduleGraph;if(!e)continue;let r=new Set,i=t=>{if(!r.has(t)){r.add(t),e.invalidateModule(t);for(let e of t.importers)i(e)}};for(let t of n){let n=e.getModulesByFile(t);if(n)for(let e of n)i(e)}}}async function w(t=5173){let n=await f({server:{middlewareMode:!0},appType:`custom`}),a=p(n.environments.ssr),o=y(n.config),c=n.config.root,l=s(c,o.routes),u=i(s(c,o.islands)).replaceAll(`\\`,`/`),d=m((t,i)=>{function o(e,t){i.statusCode=200,i.setHeader(`Content-Type`,S(e)),i.end(t)}function s(e){i.statusCode=404,i.setHeader(`Content-Type`,S(e)),e===`.html`?i.end(`<!DOCTYPE html><meta charset="utf-8"><h1>404 Not Found</h1>`):i.end()}n.middlewares(t,i,async()=>{let c=t.url??`/`,u=new URL(c,`http://localhost`).pathname.replace(/\/+$/,``)||`/`;try{let{routes:t,runWithRegistry:i}=await a.import(l),d=h(t).find(e=>e.path===u);if(d===void 0){s(`.html`);return}switch(d.type){case`html`:{let{result:e}=i(()=>`<!DOCTYPE html>${r(v(d.render(),`/@id/__x00__virtual:cirro/client`,d.cssPath))}`);o(`.html`,await n.transformIndexHtml(c,e));break}case`css`:{let{registry:t}=i(()=>r(d.render()));o(`.css`,e(t));break}case`file`:{let e=d.render();o(d.ext,e);break}}return}catch(e){i.statusCode=500,i.end(String(e))}})}),g=`${s(c,o.watchDir??`./src`).replaceAll(`\\`,`/`).replace(/\/+$/,``)}/`;n.watcher.on(`change`,e=>{let t=e.replaceAll(`\\`,`/`);t.startsWith(u)||t.startsWith(g)&&(C(n,e),n.ws.send({type:`full-reload`}))}),d.listen(t,()=>{console.log(`cirro dev: http://localhost:${t}`)})}async function T(e){let t=e[0];t===`dev`?await w():t===`build`?await b():(console.error(`usage: cirro <dev|build>`),process.exit(1))}export{T as main};
1
+ import{r as e}from"./css-CPDjsrSK.js";import{Fragment as t,createElement as n}from"react";import{renderToStaticMarkup as r}from"react-dom/server";import{dirname as i,extname as a,join as o,resolve as s}from"node:path";import{mkdir as c,readFile as l,writeFile as u}from"node:fs/promises";import{build as d,createServer as f,createServerModuleRunner as p}from"vite";import{createServer as m}from"node:http";function h(e){let t=[];for(let n of e)switch(n.type){case`static`:t.push({type:`html`,path:n.path,cssPath:o(n.path,`index.css`),render:()=>n.component({params:{}})}),t.push({type:`css`,path:o(n.path,`index.css`),render:()=>n.component({params:{}})});break;case`dynamic`:for(let e of n.getStaticPaths())t.push({type:`html`,path:n.path(e),cssPath:n.cssPath,render:()=>n.component({params:e})});t.push({type:`css`,path:n.cssPath,render:()=>n.component({params:n.getStaticPaths()[0]})});break;case`file`:t.push({type:`file`,path:n.path,ext:a(n.path),render:()=>n.component({params:{}})});break}return t}function g(e){return e===`/`?`index.html`:`${e.replace(/^\/+|\/+$/g,``)}/index.html`}function _(e){return e===`/`?`index.css`:`${e.replace(/^\/+|\/+$/g,``)}`}function v(e,r,i){return n(t,null,e,n(`script`,{async:!0,type:`module`,src:r,key:`cirro-client`}),n(`link`,{rel:`stylesheet`,href:i,precedence:`default`,key:`cirro-css`}))}function y(e){for(let t of e.plugins){let e=t.api;if(t.name===`cirro`&&e?.options)return e.options}throw Error(`cirro: plugin not found in Vite config (did you add cirro() to plugins?)`)}async function b(){await d();let t=await f({server:{middlewareMode:!0,hmr:!1},appType:`custom`}),n=p(t.environments.ssr);try{let a=t.config,d=y(a),f=a.root,p=s(f,a.build.outDir),m=s(f,d.routes),b=JSON.parse(await l(o(p,`.vite/manifest.json`),`utf-8`))[`virtual:cirro/client`];if(!b)throw Error(`cirro: manifest entry "virtual:cirro/client" not found`);let x=`/${b.file}`,{routes:S,runWithRegistry:C}=await n.import(m);for(let t of h(S))switch(t.type){case`css`:{let{registry:n}=C(()=>r(t.render())),a=e(n),s=o(p,_(t.path));await c(i(s),{recursive:!0}),await u(s,a),console.log(`wrote ${s} (url: ${t.path})`);break}case`html`:{let{result:e}=C(()=>`<!DOCTYPE html>${r(v(t.render(),x,t.cssPath))}`),n=o(p,g(t.path));await c(i(n),{recursive:!0}),await u(n,e),console.log(`wrote ${n} (url: ${t.path})`);break}case`file`:{let e=t.render(),n=o(p,t.path);await c(i(n),{recursive:!0}),await u(n,e),console.log(`wrote ${n} (url: ${t.path})`);break}}}finally{await t.close()}}const x=[[`.aac`,`audio/aac`],[`.abw`,`application/x-abiword`],[`.arc`,`application/x-freearc`],[`.avi`,`video/x-msvideo`],[`.azw`,`application/vnd.amazon.ebook`],[`.bin`,`application/octet-stream`],[`.bmp`,`image/bmp`],[`.bz`,`application/x-bzip`],[`.bz2`,`application/x-bzip2`],[`.csh`,`application/x-csh`],[`.css`,`text/css`],[`.csv`,`text/csv`],[`.doc`,`application/msword`],[`.docx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`],[`.eot`,`application/vnd.ms-fontobject`],[`.epub`,`application/epub+zip`],[`.gz`,`application/gzip`],[`.gif`,`image/gif`],[`.htm`,`text/html`],[`.html`,`text/html`],[`.ico`,`image/vnd.microsoft.icon`],[`.ics`,`text/calendar`],[`.jar`,`application/java-archive`],[`.jpeg`,`image/jpeg`],[`.jpg`,`image/jpeg`],[`.js`,`text/javascript`],[`.json`,`application/json`],[`.jsonld`,`application/ld+json`],[`.mid`,`audio/midi`],[`.midi`,`audio/x-midi`],[`.mjs`,`text/javascript`],[`.mp3`,`audio/mpeg`],[`.mpeg`,`video/mpeg`],[`.mpkg`,`application/vnd.apple.installer+xml`],[`.odp`,`application/vnd.oasis.opendocument.presentation`],[`.ods`,`application/vnd.oasis.opendocument.spreadsheet`],[`.odt`,`application/vnd.oasis.opendocument.text`],[`.oga`,`audio/ogg`],[`.ogv`,`video/ogg`],[`.ogx`,`application/ogg`],[`.opus`,`audio/opus`],[`.otf`,`font/otf`],[`.png`,`image/png`],[`.pdf`,`application/pdf`],[`.php`,`application/x-httpd-php`],[`.ppt`,`application/vnd.ms-powerpoint`],[`.pptx`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],[`.rar`,`application/vnd.rar`],[`.rtf`,`application/rtf`],[`.sh`,`application/x-sh`],[`.svg`,`image/svg+xml`],[`.swf`,`application/x-shockwave-flash`],[`.tar`,`application/x-tar`],[`.tif`,`image/tiff`],[`.tiff`,`image/tiff`],[`.ts`,`video/mp2t`],[`.ttf`,`font/ttf`],[`.txt`,`text/plain`],[`.vsd`,`application/vnd.visio`],[`.wav`,`audio/wav`],[`.weba`,`audio/webm`],[`.webm`,`video/webm`],[`.webp`,`image/webp`],[`.woff`,`font/woff`],[`.woff2`,`font/woff2`],[`.xhtml`,`application/xhtml+xml`],[`.xls`,`application/vnd.ms-excel`],[`.xlsx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],[`.xml`,`application/xml`],[`.xul`,`application/vnd.mozilla.xul+xml`],[`.zip`,`application/zip`],[`.3gp`,`video/3gpp`],[`.3g2`,`video/3gpp2`],[`.7z`,`application/x-7z-compressed`]];function S(e){return x.find(t=>t[0]===e)?.[1]||`text/plain`}function C(e,t){let n=[t,t.replaceAll(`\\`,`/`)];for(let t of Object.values(e.environments)){let e=t.moduleGraph;if(!e)continue;let r=new Set,i=t=>{if(!r.has(t)){r.add(t),e.invalidateModule(t);for(let e of t.importers)i(e)}};for(let t of n){let n=e.getModulesByFile(t);if(n)for(let e of n)i(e)}}}async function w(t=5173){let n=await f({server:{middlewareMode:!0},appType:`custom`}),a=p(n.environments.ssr),o=y(n.config),c=n.config.root,l=s(c,o.routes),u=i(s(c,o.islands)).replaceAll(`\\`,`/`),d=m((t,i)=>{function o(e,t){i.statusCode=200,i.setHeader(`Content-Type`,S(e)),i.end(t)}function s(e){i.statusCode=404,i.setHeader(`Content-Type`,S(e)),e===`.html`?i.end(`<!DOCTYPE html><meta charset="utf-8"><h1>404 Not Found</h1>`):i.end()}n.middlewares(t,i,async()=>{let c=t.url??`/`,u=new URL(c,`http://localhost`).pathname.replace(/\/+$/,``)||`/`;try{let{routes:t,runWithRegistry:i}=await a.import(l),d=h(t).find(e=>e.path===u);if(d===void 0){s(`.html`);return}switch(d.type){case`html`:{let{result:e}=i(()=>`<!DOCTYPE html>${r(v(d.render(),`/@id/__x00__virtual:cirro/client`,d.cssPath))}`);o(`.html`,await n.transformIndexHtml(c,e));break}case`css`:{let{registry:t}=i(()=>r(d.render()));o(`.css`,e(t));break}case`file`:{let e=d.render();o(d.ext,e);break}}return}catch(e){i.statusCode=500,e instanceof Error?i.end(e.stack):i.end(String(e))}})}),g=`${s(c,o.watchDir??`./src`).replaceAll(`\\`,`/`).replace(/\/+$/,``)}/`;n.watcher.on(`change`,e=>{let t=e.replaceAll(`\\`,`/`);t.startsWith(u)||t.startsWith(g)&&(C(n,e),n.ws.send({type:`full-reload`}))}),d.listen(t,()=>{console.log(`cirro dev: http://localhost:${t}`)})}async function T(e){let t=e[0];t===`dev`?await w():t===`build`?await b():(console.error(`usage: cirro <dev|build>`),process.exit(1))}export{T as main};
@@ -1,4 +1,4 @@
1
- import{registerCss as e}from"cirrojs/registry";function t(e,t){let n=t?.selector??`&`,r=t?.atrules??[],o=a({selector:n,atrules:r,properties:e}),s=`${t?.name??`cirro`}-${o.toString(16)}`;return i([...r,n],e,s),s}function n(e){let n=[];return e.layer&&n.push(`@layer ${e.layer}`),e.mediaAtRule&&n.push(`@media (${e.mediaAtRule})`),(e,r)=>t(e,{atrules:n,name:r?.name,selector:r?.selector})}function r(e){let t=`@charset "utf-8";
1
+ import{registerCss as e}from"cirrojs/registry";function t(e,t){let n=t?.selector??`&`,r=t?.atrules??[],o=a({selector:n,atrules:r,properties:e}),s=`${t?.name??`cirro`}-${o.toString(16)}`;return i([...r,n],e,s),s}function n(e){let n=[];return e.layer&&n.push(`@layer ${e.layer}`),e.atRules&&n.push(...e.atRules),(e,r)=>t(e,{atrules:n,name:r?.name,selector:r?.selector})}function r(e){let t=`@charset "utf-8";
2
2
  @layer base, font, low, main, high;
3
3
  `;for(let[n,[r,i]]of e)t+=r.reduceRight((e,t)=>`${t} { ${e} }`,Object.entries(i).map(([e,t])=>`${e.replaceAll(`_`,`-`)}: ${t};`).join(` `)),t+=`
4
4
  `;return t}function i(t,n,r){e(r,t.map(e=>e.replaceAll(`&`,`.${r}`)),n)}function a(...e){return o(e.map(e=>JSON.stringify(e)).join(``))}function o(e){let t=5381;for(let n of[...e])t=(t<<5)+t+n.charCodeAt(0)&4294967295;return t>>>0}export{n,r,t};
@@ -0,0 +1,17 @@
1
+ import { t as Properties } from "./properties-FKQ-gJeC.js";
2
+
3
+ //#region src/css.d.ts
4
+ type CssOpt = {
5
+ name?: string;
6
+ atrules?: string[];
7
+ selector?: string;
8
+ };
9
+ declare function css(properties: Properties, opt?: CssOpt): string;
10
+ type CssFnT = (properties: Properties, opt?: Omit<CssOpt, "atrules">) => string;
11
+ type GenCssFnOpt = {
12
+ atRules?: string[];
13
+ layer?: string;
14
+ };
15
+ declare function genCssFn(opt: GenCssFnOpt): CssFnT;
16
+ //#endregion
17
+ export { genCssFn as i, CssOpt as n, css as r, CssFnT as t };
package/dist/index.d.ts CHANGED
@@ -1,22 +1,9 @@
1
1
  import { t as Properties } from "./properties-FKQ-gJeC.js";
2
- import { Registry } from "./registry.js";
2
+ import { t as Registry } from "./registry-Bg8dxPHm.js";
3
+ import { i as genCssFn, n as CssOpt, r as css } from "./css-J_tbT4BH.js";
3
4
  import { runWithRegistry } from "cirrojs/registry";
4
5
  import { ReactElement } from "react";
5
6
 
6
- //#region src/css.d.ts
7
- type CssOpt = {
8
- name?: string;
9
- atrules?: string[];
10
- selector?: string;
11
- };
12
- declare function css(properties: Properties, opt?: CssOpt): string;
13
- type CssFnT = (properties: Properties, opt?: Omit<CssOpt, "atrules">) => string;
14
- type GenCssFnOpt = {
15
- mediaAtRule?: string;
16
- layer?: string;
17
- };
18
- declare function genCssFn(opt: GenCssFnOpt): CssFnT;
19
- //#endregion
20
7
  //#region src/route.d.ts
21
8
  type Params = Record<string, unknown>;
22
9
  type StaticRoute = {
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{n as e,t}from"./css-BZ1E8BDE.js";import{runWithRegistry as n}from"cirrojs/registry";export{t as css,e as genCssFn,n as runWithRegistry};
1
+ import{n as e,t}from"./css-CPDjsrSK.js";import{runWithRegistry as n}from"cirrojs/registry";export{t as css,e as genCssFn,n as runWithRegistry};
@@ -0,0 +1,90 @@
1
+ import { t as Properties } from "./properties-FKQ-gJeC.js";
2
+ import { t as CssFnT } from "./css-J_tbT4BH.js";
3
+
4
+ //#region src/layout.d.ts
5
+ interface LayoutDefaults {
6
+ gap: string;
7
+ stackGap?: string;
8
+ clusterGap?: string;
9
+ gridGap?: string;
10
+ switcherGap?: string;
11
+ sidebarGap?: string;
12
+ clusterJustify: Properties["justify_content"];
13
+ clusterAlign: Properties["align_items"];
14
+ centerMax: string;
15
+ gridMin: string;
16
+ switcherThreshold: string;
17
+ switcherLimit: number;
18
+ sidebarContentMin: string;
19
+ coverMinHeight: string;
20
+ frameRatio: string;
21
+ boxPadding?: string;
22
+ }
23
+ interface LayoutTheme {
24
+ css?: CssFnT;
25
+ defaults?: Partial<LayoutDefaults>;
26
+ }
27
+ interface SidebarSlots {
28
+ root: string;
29
+ side: string;
30
+ content: string;
31
+ }
32
+ interface CoverSlots {
33
+ root: string;
34
+ centered: string;
35
+ }
36
+ interface Layout {
37
+ stack(opts?: {
38
+ gap?: string;
39
+ }): string;
40
+ cluster(opts?: {
41
+ gap?: string;
42
+ justify?: Properties["justify_content"];
43
+ align?: Properties["align_items"];
44
+ }): string;
45
+ center(opts?: {
46
+ max?: string;
47
+ gutters?: string;
48
+ intrinsic?: boolean;
49
+ andText?: boolean;
50
+ }): string;
51
+ grid(opts?: {
52
+ gap?: string;
53
+ min?: string;
54
+ }): string;
55
+ switcher(opts?: {
56
+ threshold?: string;
57
+ gap?: string;
58
+ limit?: number;
59
+ }): string;
60
+ sidebar(opts?: {
61
+ sideWidth?: string;
62
+ contentMin?: string;
63
+ gap?: string;
64
+ }): SidebarSlots;
65
+ cover(opts?: {
66
+ minHeight?: string;
67
+ gap?: string;
68
+ padding?: string;
69
+ }): CoverSlots;
70
+ frame(opts?: {
71
+ ratio?: string;
72
+ }): string;
73
+ reel(opts?: {
74
+ itemWidth?: string;
75
+ height?: string;
76
+ gap?: string;
77
+ }): string;
78
+ imposter(opts?: {
79
+ fixed?: boolean;
80
+ contain?: boolean;
81
+ margin?: string;
82
+ }): string;
83
+ box(opts?: {
84
+ padding?: string;
85
+ border?: string;
86
+ }): string;
87
+ }
88
+ declare function createLayout(theme?: LayoutTheme): Layout;
89
+ //#endregion
90
+ export { CoverSlots, Layout, LayoutDefaults, LayoutTheme, SidebarSlots, createLayout };
package/dist/layout.js ADDED
@@ -0,0 +1 @@
1
+ import{n as e}from"./css-CPDjsrSK.js";const t={gap:`1rem`,clusterJustify:`flex-start`,clusterAlign:`center`,centerMax:`60ch`,gridMin:`16rem`,switcherThreshold:`30rem`,switcherLimit:4,sidebarContentMin:`50%`,coverMinHeight:`100vh`,frameRatio:`16 / 9`};function n(...e){return e.filter(Boolean).join(` `)}function r(r={}){let i=r.css??e({layer:`low`}),a={...t,...r.defaults};function o(e){return i({display:`flex`,flex_direction:`column`,gap:e?.gap??a.stackGap??a.gap})}function s(e){return i({display:`flex`,flex_wrap:`wrap`,gap:e?.gap??a.clusterGap??a.gap,justify_content:e?.justify??a.clusterJustify,align_items:e?.align??a.clusterAlign})}function c(e){return n(i({box_sizing:`border-box`,margin_inline:`auto`,max_inline_size:e?.max??a.centerMax}),e?.gutters?i({padding_inline:e.gutters}):``,e?.intrinsic?i({display:`flex`,flex_direction:`column`,align_items:`center`}):``,e?.andText?i({text_align:`center`}):``)}function l(e){let t=e?.min??a.gridMin;return i({display:`grid`,gap:e?.gap??a.gridGap??a.gap,grid_template_columns:`repeat(auto-fit, minmax(min(${t}, 100%), 1fr))`})}function u(e){let t=e?.threshold??a.switcherThreshold,r=e?.limit??a.switcherLimit;return n(i({display:`flex`,flex_wrap:`wrap`,gap:e?.gap??a.switcherGap??a.gap}),i({flex_grow:`1`,flex_basis:`calc((${t} - 100%) * 999)`},{selector:`& > *`}),i({flex_basis:`100%`},{selector:`& > :nth-last-child(n+${r+1})`}),i({flex_basis:`100%`},{selector:`& > :nth-last-child(n+${r+1}) ~ *`}))}function d(e){return{root:i({display:`flex`,flex_wrap:`wrap`,gap:e?.gap??a.sidebarGap??a.gap}),side:i({flex_grow:`1`,flex_basis:e?.sideWidth??`auto`}),content:i({flex_grow:`999`,flex_basis:`0`,min_inline_size:e?.contentMin??a.sidebarContentMin})}}function f(e){let t=e?.gap??a.gap,r=i({margin_block:`auto`});return{root:n(i({display:`flex`,flex_direction:`column`,min_block_size:e?.minHeight??a.coverMinHeight,padding:e?.padding??t}),i({margin_block:t},{selector:`& > :not(.${r})`}),i({margin_block_start:`0`},{selector:`& > :first-child:not(.${r})`}),i({margin_block_end:`0`},{selector:`& > :last-child:not(.${r})`})),centered:r}}function p(e){return n(i({aspect_ratio:e?.ratio??a.frameRatio,overflow:`hidden`,display:`flex`,justify_content:`center`,align_items:`center`}),i({inline_size:`100%`,block_size:`100%`,object_fit:`cover`},{selector:`& > img, & > video`}))}function m(e){return n(i({display:`flex`,block_size:e?.height??`auto`,overflow_x:`auto`,overflow_y:`hidden`,gap:e?.gap??a.gap}),i({flex:`0 0 ${e?.itemWidth??`auto`}`},{selector:`& > *`}),i({block_size:`100%`,flex_basis:`auto`,inline_size:`auto`},{selector:`& > img`}))}function h(e){let t=e?.margin??`0px`;return n(i({position:e?.fixed?`fixed`:`absolute`,inset_block_start:`50%`,inset_inline_start:`50%`,transform:`translate(-50%, -50%)`}),e?.contain?i({overflow:`auto`,max_inline_size:`calc(100% - (${t} * 2))`,max_block_size:`calc(100% - (${t} * 2))`}):``)}function g(e){return n(i({box_sizing:`border-box`,padding:e?.padding??a.boxPadding??a.gap}),e?.border?i({border:e.border}):``)}return{stack:o,cluster:s,center:c,grid:l,switcher:u,sidebar:d,cover:f,frame:p,reel:m,imposter:h,box:g}}export{r as createLayout};
@@ -0,0 +1,15 @@
1
+ import { t as Properties } from "./properties-FKQ-gJeC.js";
2
+
3
+ //#region src/registry.d.ts
4
+ type Registry = Map<string, [string[], Partial<Properties>]>;
5
+ declare function registerCss(designator: string, selectors: string[], properties: Partial<Properties>): void;
6
+ declare function runWithRegistry<T>(fn: () => T): {
7
+ result: T;
8
+ registry: Registry;
9
+ };
10
+ type RunWithRegistry<T> = (fn: () => T) => {
11
+ result: T;
12
+ registry: Registry;
13
+ };
14
+ //#endregion
15
+ export { runWithRegistry as i, RunWithRegistry as n, registerCss as r, Registry as t };
@@ -1,15 +1,2 @@
1
- import { t as Properties } from "./properties-FKQ-gJeC.js";
2
-
3
- //#region src/registry.d.ts
4
- type Registry = Map<string, [string[], Partial<Properties>]>;
5
- declare function registerCss(designator: string, selectors: string[], properties: Partial<Properties>): void;
6
- declare function runWithRegistry<T>(fn: () => T): {
7
- result: T;
8
- registry: Registry;
9
- };
10
- type RunWithRegistry<T> = (fn: () => T) => {
11
- result: T;
12
- registry: Registry;
13
- };
14
- //#endregion
1
+ import { i as runWithRegistry, n as RunWithRegistry, r as registerCss, t as Registry } from "./registry-Bg8dxPHm.js";
15
2
  export { Registry, RunWithRegistry, registerCss, runWithRegistry };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cirrojs",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "React islands SSG with strict CSP (no unsafe-inline). Vite-based, MPA-first.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,6 +31,10 @@
31
31
  "types": "./dist/cli.d.ts",
32
32
  "default": "./dist/cli.js"
33
33
  },
34
+ "./layout": {
35
+ "types": "./dist/layout.d.ts",
36
+ "default": "./dist/layout.js"
37
+ },
34
38
  "./registry": {
35
39
  "types": "./dist/registry.d.ts",
36
40
  "browser": "./dist/registry.browser.js",