cirrojs 0.0.10 → 0.0.12

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,24 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## [0.0.12] - 2026-06-28
17
+
18
+ ### Added
19
+ - 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.
20
+ - `ElementOpt`, the standard `div` attributes accepted by the component versions (inline `style` is excluded to preserve `style-src 'self'`).
21
+ - Exported the per-primitive option types: `StackOpt`, `ClusterOpt`, `CenterOpt`, `GridOpt`, `SwitcherOpt`, `SidebarOpt`, `CoverOpt`, `FrameOpt`, `ReelOpt`, `ImposterOpt`, and `BoxOpt`.
22
+ - `cx`, a helper for joining class names that drops falsy values.
23
+
24
+ ## [0.0.11] - 2026-06-28
25
+
26
+ ### Added
27
+ - `createLayout`'s `cluster` now accepts an optional `wrap` option (`Properties["flex_wrap"]`) to override its flex-wrap behavior.
28
+ - Two new `LayoutDefaults` fields: `clusterWrap`, the default flex-wrap applied by `cluster`, and `sidebarSideWidth`, the default inline size of the sidebar's side slot.
29
+
30
+ ### Changed
31
+ - The sidebar's side slot now defaults its `flex-basis` to `sidebarSideWidth` (default `30ch`) instead of `auto`.
32
+ - Changed the `sidebarContentMin` default from `50%` to `65ch`.
33
+
16
34
  ## [0.0.10] - 2026-06-27
17
35
 
18
36
  ### Added
@@ -81,7 +99,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
81
99
  ## 0.0.1 - 2026-06-15
82
100
  - initial release
83
101
 
84
- [Unreleased]: https://github.com/osawa-naotaka/cirro/compare/v0.0.10...HEAD
102
+ [Unreleased]: https://github.com/osawa-naotaka/cirro/compare/v0.0.12...HEAD
103
+ [0.0.12]: https://github.com/osawa-naotaka/cirro/compare/v0.0.11...v0.0.12
104
+ [0.0.11]: https://github.com/osawa-naotaka/cirro/compare/v0.0.10...v0.0.11
85
105
  [0.0.10]: https://github.com/osawa-naotaka/cirro/compare/v0.0.9...v0.0.10
86
106
  [0.0.9]: https://github.com/osawa-naotaka/cirro/compare/v0.0.8...v0.0.9
87
107
  [0.0.8]: https://github.com/osawa-naotaka/cirro/compare/v0.0.7...v0.0.8
package/dist/layout.d.ts CHANGED
@@ -1,11 +1,13 @@
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 {
6
7
  gap: string;
7
8
  stackGap?: string;
8
9
  clusterGap?: string;
10
+ clusterWrap?: Properties["flex_wrap"];
9
11
  gridGap?: string;
10
12
  switcherGap?: string;
11
13
  sidebarGap?: string;
@@ -16,6 +18,7 @@ interface LayoutDefaults {
16
18
  switcherThreshold: string;
17
19
  switcherLimit: number;
18
20
  sidebarContentMin: string;
21
+ sidebarSideWidth: string;
19
22
  coverMinHeight: string;
20
23
  frameRatio: string;
21
24
  boxPadding?: string;
@@ -33,58 +36,81 @@ interface CoverSlots {
33
36
  root: string;
34
37
  centered: string;
35
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">;
36
91
  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;
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;
87
112
  }
113
+ declare function cx(...classes: (string | false | null | undefined)[]): string;
88
114
  declare function createLayout(theme?: LayoutTheme): Layout;
89
115
  //#endregion
90
- 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:`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};
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})}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})}function l(e){return r(a({box_sizing:`border-box`,margin_inline:`auto`,max_inline_size:e?.max??o.centerMax}),e?.gutters?a({padding_inline:e.gutters}):``,e?.intrinsic?a({display:`flex`,flex_direction:`column`,align_items:`center`}):``,e?.andText?a({text_align:`center`}):``)}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))`})}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}),a({flex_grow:`1`,flex_basis:`calc((${t} - 100%) * 999)`},{selector:`& > *`}),a({flex_basis:`100%`},{selector:`& > :nth-last-child(n+${n+1})`}),a({flex_basis:`100%`},{selector:`& > :nth-last-child(n+${n+1}) ~ *`}))}function f(e){return{root:a({display:`flex`,flex_wrap:`wrap`,gap:e?.gap??o.sidebarGap??o.gap}),side:a({flex_grow:`1`,flex_basis:e?.sideWidth??o.sidebarSideWidth??`auto`}),content:a({flex_grow:`999`,flex_basis:`0`,min_inline_size:e?.contentMin??o.sidebarContentMin})}}function p(e){let t=e?.gap??o.gap,n=a({margin_block:`auto`});return{root:r(a({display:`flex`,flex_direction:`column`,min_block_size:e?.minHeight??o.coverMinHeight,padding:e?.padding??t}),a({margin_block:t},{selector:`& > :not(.${n})`}),a({margin_block_start:`0`},{selector:`& > :first-child:not(.${n})`}),a({margin_block_end:`0`},{selector:`& > :last-child:not(.${n})`})),centered:n}}function m(e){return r(a({aspect_ratio:e?.ratio??o.frameRatio,overflow:`hidden`,display:`flex`,justify_content:`center`,align_items:`center`}),a({inline_size:`100%`,block_size:`100%`,object_fit:`cover`},{selector:`& > img, & > video`}))}function h(e){return r(a({display:`flex`,block_size:e?.height??`auto`,overflow_x:`auto`,overflow_y:`hidden`,gap:e?.gap??o.gap}),a({flex:`0 0 ${e?.itemWidth??`auto`}`},{selector:`& > *`}),a({block_size:`100%`,flex_basis:`auto`,inline_size:`auto`},{selector:`& > 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%)`}),e?.contain?a({overflow:`auto`,max_inline_size:`calc(100% - (${t} * 2))`,max_block_size:`calc(100% - (${t} * 2))`}):``)}function _(e){return r(a({box_sizing:`border-box`,padding:e?.padding??o.boxPadding??o.gap}),e?.border?a({border:e.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.10",
3
+ "version": "0.0.12",
4
4
  "description": "React islands SSG with strict CSP (no unsafe-inline). Vite-based, MPA-first.",
5
5
  "license": "MIT",
6
6
  "type": "module",