cirrojs 0.0.11 → 0.0.13

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,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## [0.0.13] - 2026-06-28
17
+
18
+ ### Changed
19
+ - The layout primitives now embed a human-readable prefix in their generated class names (for example `stack`, `cluster`, and `center-intrinsic`). The class names remain deterministic.
20
+
21
+ ## [0.0.12] - 2026-06-28
22
+
23
+ ### Added
24
+ - Component versions of the layout primitives on the `Layout` interface: `Stack`, `Cluster`, `Center`, `Grid`, `Switcher`, `Frame`, `Reel`, `Imposter`, and `Box`. Each returns a layout-only `<div>` with the computed class name applied, and accepts its primitive's options together with the standard `div` attributes. `sidebar` and `cover` have no component version because they require slot-based markup.
25
+ - `ElementOpt`, the standard `div` attributes accepted by the component versions (inline `style` is excluded to preserve `style-src 'self'`).
26
+ - Exported the per-primitive option types: `StackOpt`, `ClusterOpt`, `CenterOpt`, `GridOpt`, `SwitcherOpt`, `SidebarOpt`, `CoverOpt`, `FrameOpt`, `ReelOpt`, `ImposterOpt`, and `BoxOpt`.
27
+ - `cx`, a helper for joining class names that drops falsy values.
28
+
16
29
  ## [0.0.11] - 2026-06-28
17
30
 
18
31
  ### Added
@@ -91,7 +104,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
91
104
  ## 0.0.1 - 2026-06-15
92
105
  - initial release
93
106
 
94
- [Unreleased]: https://github.com/osawa-naotaka/cirro/compare/v0.0.11...HEAD
107
+ [Unreleased]: https://github.com/osawa-naotaka/cirro/compare/v0.0.13...HEAD
108
+ [0.0.13]: https://github.com/osawa-naotaka/cirro/compare/v0.0.12...v0.0.13
109
+ [0.0.12]: https://github.com/osawa-naotaka/cirro/compare/v0.0.11...v0.0.12
95
110
  [0.0.11]: https://github.com/osawa-naotaka/cirro/compare/v0.0.10...v0.0.11
96
111
  [0.0.10]: https://github.com/osawa-naotaka/cirro/compare/v0.0.9...v0.0.10
97
112
  [0.0.9]: https://github.com/osawa-naotaka/cirro/compare/v0.0.8...v0.0.9
package/dist/layout.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { t as Properties } from "./properties-FKQ-gJeC.js";
2
2
  import { t as CssFnT } from "./css-J_tbT4BH.js";
3
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
3
4
 
4
5
  //#region src/layout.d.ts
5
6
  interface LayoutDefaults {
@@ -35,58 +36,81 @@ interface CoverSlots {
35
36
  root: string;
36
37
  centered: string;
37
38
  }
39
+ interface StackOpt {
40
+ gap?: string;
41
+ }
42
+ interface ClusterOpt {
43
+ gap?: string;
44
+ wrap?: Properties["flex_wrap"];
45
+ justify?: Properties["justify_content"];
46
+ align?: Properties["align_items"];
47
+ }
48
+ interface CenterOpt {
49
+ max?: string;
50
+ gutters?: string;
51
+ intrinsic?: boolean;
52
+ andText?: boolean;
53
+ }
54
+ interface GridOpt {
55
+ gap?: string;
56
+ min?: string;
57
+ }
58
+ interface SwitcherOpt {
59
+ threshold?: string;
60
+ gap?: string;
61
+ limit?: number;
62
+ }
63
+ interface SidebarOpt {
64
+ sideWidth?: string;
65
+ contentMin?: string;
66
+ gap?: string;
67
+ }
68
+ interface CoverOpt {
69
+ minHeight?: string;
70
+ gap?: string;
71
+ padding?: string;
72
+ }
73
+ interface FrameOpt {
74
+ ratio?: string;
75
+ }
76
+ interface ReelOpt {
77
+ itemWidth?: string;
78
+ height?: string;
79
+ gap?: string;
80
+ }
81
+ interface ImposterOpt {
82
+ fixed?: boolean;
83
+ contain?: boolean;
84
+ margin?: string;
85
+ }
86
+ interface BoxOpt {
87
+ padding?: string;
88
+ border?: string;
89
+ }
90
+ type ElementOpt = Omit<ComponentPropsWithoutRef<"div">, "style">;
38
91
  interface Layout {
39
- stack(opts?: {
40
- gap?: string;
41
- }): string;
42
- cluster(opts?: {
43
- gap?: string;
44
- justify?: Properties["justify_content"];
45
- align?: Properties["align_items"];
46
- }): string;
47
- center(opts?: {
48
- max?: string;
49
- gutters?: string;
50
- intrinsic?: boolean;
51
- andText?: boolean;
52
- }): string;
53
- grid(opts?: {
54
- gap?: string;
55
- min?: string;
56
- }): string;
57
- switcher(opts?: {
58
- threshold?: string;
59
- gap?: string;
60
- limit?: number;
61
- }): string;
62
- sidebar(opts?: {
63
- sideWidth?: string;
64
- contentMin?: string;
65
- gap?: string;
66
- }): SidebarSlots;
67
- cover(opts?: {
68
- minHeight?: string;
69
- gap?: string;
70
- padding?: string;
71
- }): CoverSlots;
72
- frame(opts?: {
73
- ratio?: string;
74
- }): string;
75
- reel(opts?: {
76
- itemWidth?: string;
77
- height?: string;
78
- gap?: string;
79
- }): string;
80
- imposter(opts?: {
81
- fixed?: boolean;
82
- contain?: boolean;
83
- margin?: string;
84
- }): string;
85
- box(opts?: {
86
- padding?: string;
87
- border?: string;
88
- }): string;
92
+ stack(opts?: StackOpt): string;
93
+ cluster(opts?: ClusterOpt): string;
94
+ center(opts?: CenterOpt): string;
95
+ grid(opts?: GridOpt): string;
96
+ switcher(opts?: SwitcherOpt): string;
97
+ sidebar(opts?: SidebarOpt): SidebarSlots;
98
+ cover(opts?: CoverOpt): CoverSlots;
99
+ frame(opts?: FrameOpt): string;
100
+ reel(opts?: ReelOpt): string;
101
+ imposter(opts?: ImposterOpt): string;
102
+ box(opts?: BoxOpt): string;
103
+ Stack(props?: StackOpt & ElementOpt): ReactNode;
104
+ Cluster(props?: ClusterOpt & ElementOpt): ReactNode;
105
+ Center(props?: CenterOpt & ElementOpt): ReactNode;
106
+ Grid(props?: GridOpt & ElementOpt): ReactNode;
107
+ Switcher(props?: SwitcherOpt & ElementOpt): ReactNode;
108
+ Frame(props?: FrameOpt & ElementOpt): ReactNode;
109
+ Reel(props?: ReelOpt & ElementOpt): ReactNode;
110
+ Imposter(props?: ImposterOpt & ElementOpt): ReactNode;
111
+ Box(props?: BoxOpt & ElementOpt): ReactNode;
89
112
  }
113
+ declare function cx(...classes: (string | false | null | undefined)[]): string;
90
114
  declare function createLayout(theme?: LayoutTheme): Layout;
91
115
  //#endregion
92
- export { CoverSlots, Layout, LayoutDefaults, LayoutTheme, SidebarSlots, createLayout };
116
+ export { BoxOpt, CenterOpt, ClusterOpt, CoverOpt, CoverSlots, ElementOpt, FrameOpt, GridOpt, ImposterOpt, Layout, LayoutDefaults, LayoutTheme, ReelOpt, SidebarOpt, SidebarSlots, StackOpt, SwitcherOpt, createLayout, cx };
package/dist/layout.js CHANGED
@@ -1 +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:`65ch`,sidebarSideWidth:`30ch`,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:e?.wrap??a.clusterWrap??`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??a.sidebarSideWidth??`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};
1
+ import{n as e}from"./css-CPDjsrSK.js";import{jsx as t}from"react/jsx-runtime";const n={gap:`1rem`,clusterJustify:`flex-start`,clusterAlign:`center`,centerMax:`60ch`,gridMin:`16rem`,switcherThreshold:`30rem`,switcherLimit:4,sidebarContentMin:`65ch`,sidebarSideWidth:`30ch`,coverMinHeight:`100vh`,frameRatio:`16 / 9`};function r(...e){return e.filter(Boolean).join(` `)}function i(i={}){let a=i.css??e({layer:`low`}),o={...n,...i.defaults};function s(e){return a({display:`flex`,flex_direction:`column`,gap:e?.gap??o.stackGap??o.gap},{name:`stack`})}function c(e){return a({display:`flex`,flex_wrap:e?.wrap??o.clusterWrap??`wrap`,gap:e?.gap??o.clusterGap??o.gap,justify_content:e?.justify??o.clusterJustify,align_items:e?.align??o.clusterAlign},{name:`cluster`})}function l(e){return r(a({box_sizing:`border-box`,margin_inline:`auto`,max_inline_size:e?.max??o.centerMax},{name:`center`}),e?.gutters?a({padding_inline:e.gutters},{name:`center-gutters`}):``,e?.intrinsic?a({display:`flex`,flex_direction:`column`,align_items:`center`},{name:`center-intrinsic`}):``,e?.andText?a({text_align:`center`},{name:`center-andText`}):``)}function u(e){let t=e?.min??o.gridMin;return a({display:`grid`,gap:e?.gap??o.gridGap??o.gap,grid_template_columns:`repeat(auto-fit, minmax(min(${t}, 100%), 1fr))`},{name:`grid`})}function d(e){let t=e?.threshold??o.switcherThreshold,n=e?.limit??o.switcherLimit;return r(a({display:`flex`,flex_wrap:`wrap`,gap:e?.gap??o.switcherGap??o.gap},{name:`switcher`}),a({flex_grow:`1`,flex_basis:`calc((${t} - 100%) * 999)`},{selector:`& > *`,name:`switcher-item`}),a({flex_basis:`100%`},{selector:`& > :nth-last-child(n+${n+1})`,name:`switcher-item-last`}),a({flex_basis:`100%`},{selector:`& > :nth-last-child(n+${n+1}) ~ *`,name:`switcher-item-last-child`}))}function f(e){return{root:a({display:`flex`,flex_wrap:`wrap`,gap:e?.gap??o.sidebarGap??o.gap},{name:`sidebar`}),side:a({flex_grow:`1`,flex_basis:e?.sideWidth??o.sidebarSideWidth??`auto`},{name:`sidebar-side`}),content:a({flex_grow:`999`,flex_basis:`0`,min_inline_size:e?.contentMin??o.sidebarContentMin},{name:`sidebar-content`})}}function p(e){let t=e?.gap??o.gap,n=a({margin_block:`auto`},{name:`cover-centered`});return{root:r(a({display:`flex`,flex_direction:`column`,min_block_size:e?.minHeight??o.coverMinHeight,padding:e?.padding??t},{name:`cover`}),a({margin_block:t},{selector:`& > :not(.${n})`,name:`cover-gap`}),a({margin_block_start:`0`},{selector:`& > :first-child:not(.${n})`,name:`cover-gap-first`}),a({margin_block_end:`0`},{selector:`& > :last-child:not(.${n})`,name:`cover-gap-last`})),centered:n}}function m(e){return r(a({aspect_ratio:e?.ratio??o.frameRatio,overflow:`hidden`,display:`flex`,justify_content:`center`,align_items:`center`},{name:`frame`}),a({inline_size:`100%`,block_size:`100%`,object_fit:`cover`},{selector:`& > img, & > video`,name:`frame-img`}))}function h(e){return r(a({display:`flex`,block_size:e?.height??`auto`,overflow_x:`auto`,overflow_y:`hidden`,gap:e?.gap??o.gap},{name:`reel`}),a({flex:`0 0 ${e?.itemWidth??`auto`}`},{selector:`& > *`,name:`reel-child`}),a({block_size:`100%`,flex_basis:`auto`,inline_size:`auto`},{selector:`& > img`,name:`reel-img`}))}function g(e){let t=e?.margin??`0px`;return r(a({position:e?.fixed?`fixed`:`absolute`,inset_block_start:`50%`,inset_inline_start:`50%`,transform:`translate(-50%, -50%)`},{name:`imposter`}),e?.contain?a({overflow:`auto`,max_inline_size:`calc(100% - (${t} * 2))`,max_block_size:`calc(100% - (${t} * 2))`},{name:`imposter-contain`}):``)}function _(e){return r(a({box_sizing:`border-box`,padding:e?.padding??o.boxPadding??o.gap},{name:`box`}),e?.border?a({border:e.border},{name:`box-border`}):``)}function v({gap:e,className:n,children:i,...a}={}){return t(`div`,{className:r(s({gap:e}),n),...a,children:i})}function y({gap:e,wrap:n,justify:i,align:a,className:o,children:s,...l}={}){return t(`div`,{className:r(c({gap:e,wrap:n,justify:i,align:a}),o),...l,children:s})}function b({max:e,gutters:n,intrinsic:i,andText:a,className:o,children:s,...c}={}){return t(`div`,{className:r(l({max:e,gutters:n,intrinsic:i,andText:a}),o),...c,children:s})}function x({gap:e,min:n,className:i,children:a,...o}={}){return t(`div`,{className:r(u({gap:e,min:n}),i),...o,children:a})}function S({threshold:e,gap:n,limit:i,className:a,children:o,...s}={}){return t(`div`,{className:r(d({threshold:e,gap:n,limit:i}),a),...s,children:o})}function C({ratio:e,className:n,children:i,...a}={}){return t(`div`,{className:r(m({ratio:e}),n),...a,children:i})}function w({itemWidth:e,height:n,gap:i,className:a,children:o,...s}={}){return t(`div`,{className:r(h({itemWidth:e,height:n,gap:i}),a),...s,children:o})}function T({fixed:e,contain:n,margin:i,className:a,children:o,...s}={}){return t(`div`,{className:r(g({fixed:e,contain:n,margin:i}),a),...s,children:o})}function E({padding:e,border:n,className:i,children:a,...o}={}){return t(`div`,{className:r(_({padding:e,border:n}),i),...o,children:a})}return{stack:s,cluster:c,center:l,grid:u,switcher:d,sidebar:f,cover:p,frame:m,reel:h,imposter:g,box:_,Stack:v,Cluster:y,Center:b,Grid:x,Switcher:S,Frame:C,Reel:w,Imposter:T,Box:E}}export{i as createLayout,r as cx};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cirrojs",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "React islands SSG with strict CSP (no unsafe-inline). Vite-based, MPA-first.",
5
5
  "license": "MIT",
6
6
  "type": "module",