cirrojs 0.0.11 → 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 +10 -1
- package/dist/layout.d.ts +75 -51
- package/dist/layout.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,14 @@ 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
|
+
|
|
16
24
|
## [0.0.11] - 2026-06-28
|
|
17
25
|
|
|
18
26
|
### Added
|
|
@@ -91,7 +99,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
91
99
|
## 0.0.1 - 2026-06-15
|
|
92
100
|
- initial release
|
|
93
101
|
|
|
94
|
-
[Unreleased]: https://github.com/osawa-naotaka/cirro/compare/v0.0.
|
|
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
|
|
95
104
|
[0.0.11]: https://github.com/osawa-naotaka/cirro/compare/v0.0.10...v0.0.11
|
|
96
105
|
[0.0.10]: https://github.com/osawa-naotaka/cirro/compare/v0.0.9...v0.0.10
|
|
97
106
|
[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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
|
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};
|