@molecule/app-card-grid-angular 0.0.0-stage → 0.0.1-stage
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/LICENSE +202 -0
- package/README.md +339 -2
- package/dist/bento-grid.component.d.ts +83 -0
- package/dist/bento-grid.component.d.ts.map +1 -0
- package/dist/bento-grid.component.js +170 -0
- package/dist/bento-grid.component.js.map +1 -0
- package/dist/card-grid.component.d.ts +33 -0
- package/dist/card-grid.component.d.ts.map +1 -0
- package/dist/card-grid.component.js +62 -0
- package/dist/card-grid.component.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +60 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +69 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,340 @@
|
|
|
1
|
-
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-11-15T09:11:03.511Z
|
|
7
|
+
-->
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
# @molecule/app-card-grid-angular
|
|
10
|
+
|
|
11
|
+
Angular card-grid and bento-grid layouts.
|
|
12
|
+
|
|
13
|
+
Exports:
|
|
14
|
+
|
|
15
|
+
- `<CardGrid>` — responsive grid with configurable column count.
|
|
16
|
+
- `<BentoGrid>` — col/row-span or named-areas layout for mixed-size cards.
|
|
17
|
+
|
|
18
|
+
This is the Angular counterpart of `@molecule/app-card-grid-react`: the same
|
|
19
|
+
exports, the same props (React names), and the same DOM for the same input.
|
|
20
|
+
|
|
21
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
22
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
23
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { Component } from '@angular/core'
|
|
29
|
+
import { BentoGrid, CardGrid } from '@molecule/app-card-grid-angular'
|
|
30
|
+
|
|
31
|
+
@Component({
|
|
32
|
+
selector: 'app-grids',
|
|
33
|
+
standalone: true,
|
|
34
|
+
imports: [CardGrid, BentoGrid],
|
|
35
|
+
template: `
|
|
36
|
+
<div mol-card-grid [columns]="3" gap="md">
|
|
37
|
+
<app-product-card [product]="products[0]" />
|
|
38
|
+
<app-product-card [product]="products[1]" />
|
|
39
|
+
<app-product-card [product]="products[2]" />
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div mol-bento-grid [items]="bentoItems"></div>
|
|
43
|
+
`,
|
|
44
|
+
})
|
|
45
|
+
export class Grids {
|
|
46
|
+
bentoItems = [
|
|
47
|
+
{ id: 'hero', content: this.hero, colSpan: 8, rowSpan: 2 },
|
|
48
|
+
{ id: 'stats', content: this.stats, colSpan: 4 },
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Type
|
|
54
|
+
|
|
55
|
+
`feature`
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm install @molecule/app-card-grid-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## API
|
|
64
|
+
|
|
65
|
+
### Interfaces
|
|
66
|
+
|
|
67
|
+
#### `BentoItem`
|
|
68
|
+
|
|
69
|
+
Data descriptor for a single cell in a BentoGrid layout.
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
interface BentoItem {
|
|
73
|
+
/** Unique item identifier (the `@for` track key). */
|
|
74
|
+
id: string
|
|
75
|
+
/** Card content (a node template or text). */
|
|
76
|
+
content: BentoItemContent
|
|
77
|
+
/** CSS grid-column-span (1-12). Defaults to 4. */
|
|
78
|
+
colSpan?: number
|
|
79
|
+
/** CSS grid-row-span (1-6). Defaults to 1. */
|
|
80
|
+
rowSpan?: number
|
|
81
|
+
/** Named grid-area when using `areas` layout. */
|
|
82
|
+
area?: string
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### `BentoGridProps`
|
|
87
|
+
|
|
88
|
+
Props for {@link BentoGrid}.
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
interface BentoGridProps {
|
|
92
|
+
/** Items to render. */
|
|
93
|
+
items: BentoItem[]
|
|
94
|
+
/**
|
|
95
|
+
* Optional `grid-template-areas` string (e.g. `'a a b' 'c d d'`). When
|
|
96
|
+
* provided, each `BentoItem.area` must match a token in the template.
|
|
97
|
+
*/
|
|
98
|
+
areas?: string
|
|
99
|
+
/** Default column count when `areas` is absent. Defaults to 12. */
|
|
100
|
+
columns?: number
|
|
101
|
+
/** Gap between items. */
|
|
102
|
+
gap?: 'xs' | 'sm' | 'md' | 'lg'
|
|
103
|
+
/** Extra classes. */
|
|
104
|
+
className?: string
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### `CardGridProps`
|
|
109
|
+
|
|
110
|
+
Props for {@link CardGrid}. The cards are projected content in Angular (an
|
|
111
|
+
input cannot carry a node), so `children` is typed `unknown`: pass it in the
|
|
112
|
+
host template, not as a value.
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
interface CardGridProps {
|
|
116
|
+
/** Cards, projected as the element's default content. */
|
|
117
|
+
children?: unknown
|
|
118
|
+
/** Column count at the md+ breakpoint. 1–6. Defaults to 3. */
|
|
119
|
+
columns?: 1 | 2 | 3 | 4 | 5 | 6
|
|
120
|
+
/** Gap between cards. */
|
|
121
|
+
gap?: 'xs' | 'sm' | 'md' | 'lg'
|
|
122
|
+
/** Extra classes. */
|
|
123
|
+
className?: string
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Classes
|
|
128
|
+
|
|
129
|
+
#### `BentoGrid`
|
|
130
|
+
|
|
131
|
+
BentoGrid component.
|
|
132
|
+
|
|
133
|
+
Items span multiple cells for a magazine / dashboard layout. The host IS the
|
|
134
|
+
root `<div>` (`div[mol-bento-grid]`), matching React's root exactly. Works in
|
|
135
|
+
two modes: (a) col/row-span driven, (b) named-areas driven via the `areas`
|
|
136
|
+
input. Node-valued item content is an `ng-template` reference rendered
|
|
137
|
+
through `NgTemplateOutlet`; string / number content renders as text.
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
@Component({
|
|
141
|
+
selector: 'div[mol-bento-grid]',
|
|
142
|
+
standalone: true,
|
|
143
|
+
imports: [NgTemplateOutlet],
|
|
144
|
+
inputs: ['items', 'areas', 'columns', 'gap', 'className'],
|
|
145
|
+
host: {
|
|
146
|
+
'[class]': 'classes()',
|
|
147
|
+
'[style.display]': "'grid'",
|
|
148
|
+
'[style.grid-template-columns]': 'gridTemplateColumns()',
|
|
149
|
+
'[style.grid-template-areas]': 'gridTemplateAreas()',
|
|
150
|
+
},
|
|
151
|
+
template: `@for (item of items; track item.id) {
|
|
152
|
+
<div
|
|
153
|
+
[style.grid-column]="columnSpan(item)"
|
|
154
|
+
[style.grid-row]="rowSpan(item)"
|
|
155
|
+
[style.grid-area]="areaOf(item)"
|
|
156
|
+
>
|
|
157
|
+
@if (isNode(item.content)) {
|
|
158
|
+
<ng-container [ngTemplateOutlet]="item.content" />
|
|
159
|
+
} @else {
|
|
160
|
+
<ng-container>{{ textOf(item.content) }}</ng-container>
|
|
161
|
+
}
|
|
162
|
+
</div>
|
|
163
|
+
}`,
|
|
164
|
+
})
|
|
165
|
+
export class BentoGrid {
|
|
166
|
+
/** Items to render. */
|
|
167
|
+
items: BentoItem[] = []
|
|
168
|
+
/** Optional `grid-template-areas` string. */
|
|
169
|
+
areas?: string
|
|
170
|
+
/** Default column count when `areas` is absent (defaults to `12`). */
|
|
171
|
+
columns?: number
|
|
172
|
+
/** Gap between items (defaults to `'md'` at read time). */
|
|
173
|
+
gap?: 'xs' | 'sm' | 'md' | 'lg'
|
|
174
|
+
/** Extra classes. */
|
|
175
|
+
className?: string
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The current class map.
|
|
179
|
+
* @returns The UIClassMap.
|
|
180
|
+
*/
|
|
181
|
+
cm(): UIClassMap {
|
|
182
|
+
return getClassMap()
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Computes the grid class list (React's `cm.grid({ gap })` plus the extra
|
|
187
|
+
* `className`).
|
|
188
|
+
* @returns The class string.
|
|
189
|
+
*/
|
|
190
|
+
classes(): string {
|
|
191
|
+
return this.cm().cn(this.cm().grid({ gap: this.gap ?? 'md' }), this.className)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The host's `grid-template-columns` in span mode; absent in areas mode
|
|
196
|
+
* (React writes one or the other).
|
|
197
|
+
* @returns The CSS value, or null for no declaration.
|
|
198
|
+
*/
|
|
199
|
+
gridTemplateColumns(): string | null {
|
|
200
|
+
return this.areas ? null : `repeat(${this.columns ?? 12}, minmax(0, 1fr))`
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* The host's `grid-template-areas` in areas mode; absent in span mode.
|
|
205
|
+
* @returns The CSS value, or null for no declaration.
|
|
206
|
+
*/
|
|
207
|
+
gridTemplateAreas(): string | null {
|
|
208
|
+
return this.areas ?? null
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* An item's `grid-column` in span mode (React's `span ${colSpan ?? 4}`).
|
|
213
|
+
* @param item - The item.
|
|
214
|
+
* @returns The CSS value, or null in areas mode.
|
|
215
|
+
*/
|
|
216
|
+
columnSpan(item: BentoItem): string | null {
|
|
217
|
+
return this.areas ? null : `span ${item.colSpan ?? 4}`
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* An item's `grid-row` in span mode (React's `span ${rowSpan ?? 1}`).
|
|
222
|
+
* @param item - The item.
|
|
223
|
+
* @returns The CSS value, or null in areas mode.
|
|
224
|
+
*/
|
|
225
|
+
rowSpan(item: BentoItem): string | null {
|
|
226
|
+
return this.areas ? null : `span ${item.rowSpan ?? 1}`
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* An item's `grid-area` in areas mode; absent in span mode and when the item
|
|
231
|
+
* sets no area (React renders no declaration).
|
|
232
|
+
* @param item - The item.
|
|
233
|
+
* @returns The CSS value, or null for no declaration.
|
|
234
|
+
*/
|
|
235
|
+
areaOf(item: BentoItem): string | null {
|
|
236
|
+
return this.areas ? (item.area ?? null) : null
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Whether item content holds a node (an `ng-template` reference) rather than
|
|
241
|
+
* text.
|
|
242
|
+
* @param value - The item content.
|
|
243
|
+
* @returns True when it renders through a template outlet.
|
|
244
|
+
*/
|
|
245
|
+
isNode(value: BentoItem['content']): value is TemplateRef<unknown> {
|
|
246
|
+
return value instanceof TemplateRef
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* The text a content field renders (React renders strings and numbers as
|
|
251
|
+
* text).
|
|
252
|
+
* @param value - The item content.
|
|
253
|
+
* @returns The text, or `''` for a node field.
|
|
254
|
+
*/
|
|
255
|
+
textOf(value: BentoItem['content']): string {
|
|
256
|
+
return typeof value === 'string' || typeof value === 'number' ? String(value) : ''
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### `CardGrid`
|
|
262
|
+
|
|
263
|
+
CardGrid component.
|
|
264
|
+
|
|
265
|
+
The generic responsive card grid. The host IS the root `<div>`
|
|
266
|
+
(`div[mol-card-grid]`), matching React's root exactly; the cards are the
|
|
267
|
+
element's default projected content, so they land inside that div just as
|
|
268
|
+
React's `children` do. Collapses to one column on narrow viewports and grows
|
|
269
|
+
to `columns` on md+ via the ClassMap grid.
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
@Component({
|
|
273
|
+
selector: 'div[mol-card-grid]',
|
|
274
|
+
standalone: true,
|
|
275
|
+
inputs: ['columns', 'gap', 'className'],
|
|
276
|
+
host: {
|
|
277
|
+
'[class]': 'classes()',
|
|
278
|
+
},
|
|
279
|
+
template: '<ng-content></ng-content>',
|
|
280
|
+
})
|
|
281
|
+
export class CardGrid {
|
|
282
|
+
/** Column count at the md+ breakpoint (defaults to `3` at read time). */
|
|
283
|
+
columns?: 1 | 2 | 3 | 4 | 5 | 6
|
|
284
|
+
/** Gap between cards (defaults to `'md'` at read time). */
|
|
285
|
+
gap?: 'xs' | 'sm' | 'md' | 'lg'
|
|
286
|
+
/** Extra classes. */
|
|
287
|
+
className?: string
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* The current class map.
|
|
291
|
+
* @returns The UIClassMap.
|
|
292
|
+
*/
|
|
293
|
+
cm(): UIClassMap {
|
|
294
|
+
return getClassMap()
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Computes the grid class list (React's `cm.grid({ cols, gap })` plus the
|
|
299
|
+
* extra `className`).
|
|
300
|
+
* @returns The class string.
|
|
301
|
+
*/
|
|
302
|
+
classes(): string {
|
|
303
|
+
return this.cm().cn(
|
|
304
|
+
this.cm().grid({ cols: this.columns ?? 3, gap: this.gap ?? 'md' }),
|
|
305
|
+
this.className,
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Injection Notes
|
|
312
|
+
|
|
313
|
+
### Requirements
|
|
314
|
+
|
|
315
|
+
Peer dependencies:
|
|
316
|
+
|
|
317
|
+
- `@angular/common` ^22.0.0
|
|
318
|
+
- `@angular/core` ^22.0.0
|
|
319
|
+
- `@angular/platform-browser` ^22.0.0
|
|
320
|
+
- `@molecule/app-angular` ^3.5.0
|
|
321
|
+
- `@molecule/app-ui` ^1.0.1
|
|
322
|
+
- `@molecule/app-ui-angular` ^1.1.0
|
|
323
|
+
|
|
324
|
+
### Runtime Dependencies
|
|
325
|
+
|
|
326
|
+
- `@angular/common`
|
|
327
|
+
- `@angular/core`
|
|
328
|
+
- `@angular/platform-browser`
|
|
329
|
+
- `@molecule/app-angular`
|
|
330
|
+
- `@molecule/app-ui`
|
|
331
|
+
- `@molecule/app-ui-angular`
|
|
332
|
+
|
|
333
|
+
`CardGrid` collapses to one column on narrow viewports and grows to
|
|
334
|
+
`columns` (1–6) at the md+ breakpoint via the ClassMap grid. In
|
|
335
|
+
`BentoGrid`, span mode uses a `columns`-wide grid (default 12) with
|
|
336
|
+
per-item `colSpan`/`rowSpan`; passing `areas` switches to named
|
|
337
|
+
`grid-template-areas` — then every item must set a matching `area`
|
|
338
|
+
token or it falls out of the template. Node values are projected content:
|
|
339
|
+
`CardGrid`'s cards are the element's default content, and a
|
|
340
|
+
`BentoItem.content` is an `ng-template` reference or text.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
3
|
+
import type { BentoItem } from './types.js';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* BentoGrid component.
|
|
7
|
+
*
|
|
8
|
+
* Items span multiple cells for a magazine / dashboard layout. The host IS the
|
|
9
|
+
* root `<div>` (`div[mol-bento-grid]`), matching React's root exactly. Works in
|
|
10
|
+
* two modes: (a) col/row-span driven, (b) named-areas driven via the `areas`
|
|
11
|
+
* input. Node-valued item content is an `ng-template` reference rendered
|
|
12
|
+
* through `NgTemplateOutlet`; string / number content renders as text.
|
|
13
|
+
*/
|
|
14
|
+
export declare class BentoGrid {
|
|
15
|
+
/** Items to render. */
|
|
16
|
+
items: BentoItem[];
|
|
17
|
+
/** Optional `grid-template-areas` string. */
|
|
18
|
+
areas?: string;
|
|
19
|
+
/** Default column count when `areas` is absent (defaults to `12`). */
|
|
20
|
+
columns?: number;
|
|
21
|
+
/** Gap between items (defaults to `'md'` at read time). */
|
|
22
|
+
gap?: 'xs' | 'sm' | 'md' | 'lg';
|
|
23
|
+
/** Extra classes. */
|
|
24
|
+
className?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The current class map.
|
|
27
|
+
* @returns The UIClassMap.
|
|
28
|
+
*/
|
|
29
|
+
cm(): UIClassMap;
|
|
30
|
+
/**
|
|
31
|
+
* Computes the grid class list (React's `cm.grid({ gap })` plus the extra
|
|
32
|
+
* `className`).
|
|
33
|
+
* @returns The class string.
|
|
34
|
+
*/
|
|
35
|
+
classes(): string;
|
|
36
|
+
/**
|
|
37
|
+
* The host's `grid-template-columns` in span mode; absent in areas mode
|
|
38
|
+
* (React writes one or the other).
|
|
39
|
+
* @returns The CSS value, or null for no declaration.
|
|
40
|
+
*/
|
|
41
|
+
gridTemplateColumns(): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* The host's `grid-template-areas` in areas mode; absent in span mode.
|
|
44
|
+
* @returns The CSS value, or null for no declaration.
|
|
45
|
+
*/
|
|
46
|
+
gridTemplateAreas(): string | null;
|
|
47
|
+
/**
|
|
48
|
+
* An item's `grid-column` in span mode (React's `span ${colSpan ?? 4}`).
|
|
49
|
+
* @param item - The item.
|
|
50
|
+
* @returns The CSS value, or null in areas mode.
|
|
51
|
+
*/
|
|
52
|
+
columnSpan(item: BentoItem): string | null;
|
|
53
|
+
/**
|
|
54
|
+
* An item's `grid-row` in span mode (React's `span ${rowSpan ?? 1}`).
|
|
55
|
+
* @param item - The item.
|
|
56
|
+
* @returns The CSS value, or null in areas mode.
|
|
57
|
+
*/
|
|
58
|
+
rowSpan(item: BentoItem): string | null;
|
|
59
|
+
/**
|
|
60
|
+
* An item's `grid-area` in areas mode; absent in span mode and when the item
|
|
61
|
+
* sets no area (React renders no declaration).
|
|
62
|
+
* @param item - The item.
|
|
63
|
+
* @returns The CSS value, or null for no declaration.
|
|
64
|
+
*/
|
|
65
|
+
areaOf(item: BentoItem): string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Whether item content holds a node (an `ng-template` reference) rather than
|
|
68
|
+
* text.
|
|
69
|
+
* @param value - The item content.
|
|
70
|
+
* @returns True when it renders through a template outlet.
|
|
71
|
+
*/
|
|
72
|
+
isNode(value: BentoItem['content']): value is TemplateRef<unknown>;
|
|
73
|
+
/**
|
|
74
|
+
* The text a content field renders (React renders strings and numbers as
|
|
75
|
+
* text).
|
|
76
|
+
* @param value - The item content.
|
|
77
|
+
* @returns The text, or `''` for a node field.
|
|
78
|
+
*/
|
|
79
|
+
textOf(value: BentoItem['content']): string;
|
|
80
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BentoGrid, never>;
|
|
81
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BentoGrid, "div[mol-bento-grid]", never, { "items": { "alias": "items"; "required": false; }; "areas": { "alias": "areas"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "gap": { "alias": "gap"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, never, true, never>;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=bento-grid.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bento-grid.component.d.ts","sourceRoot":"","sources":["../src/bento-grid.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAa,WAAW,EAAE,MAAM,eAAe,CAAA;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;;AAE3C;;;;;;;;GAQG;AACH,qBAyBa,SAAS;IACpB,uBAAuB;IACvB,KAAK,EAAE,SAAS,EAAE,CAAK;IACvB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2DAA2D;IAC3D,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IAC/B,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;;OAIG;IACH,OAAO,IAAI,MAAM;IAIjB;;;;OAIG;IACH,mBAAmB,IAAI,MAAM,GAAG,IAAI;IAIpC;;;OAGG;IACH,iBAAiB,IAAI,MAAM,GAAG,IAAI;IAIlC;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI;IAI1C;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI;IAIvC;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI;IAItC;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC;IAIlE;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,MAAM;yCA1FhC,SAAS;2CAAT,SAAS;CA6FrB"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BentoGrid component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { Component, TemplateRef } from '@angular/core';
|
|
8
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
const _forTrack0 = ($index, $item) => $item.id;
|
|
11
|
+
function BentoGrid_For_1_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
12
|
+
i0.ɵɵelementContainer(0, 1);
|
|
13
|
+
} if (rf & 2) {
|
|
14
|
+
const item_r1 = i0.ɵɵnextContext().$implicit;
|
|
15
|
+
i0.ɵɵproperty("ngTemplateOutlet", item_r1.content);
|
|
16
|
+
} }
|
|
17
|
+
function BentoGrid_For_1_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
18
|
+
i0.ɵɵelementContainerStart(0);
|
|
19
|
+
i0.ɵɵtext(1);
|
|
20
|
+
i0.ɵɵelementContainerEnd();
|
|
21
|
+
} if (rf & 2) {
|
|
22
|
+
const item_r1 = i0.ɵɵnextContext().$implicit;
|
|
23
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
24
|
+
i0.ɵɵadvance();
|
|
25
|
+
i0.ɵɵtextInterpolate(ctx_r1.textOf(item_r1.content));
|
|
26
|
+
} }
|
|
27
|
+
function BentoGrid_For_1_Template(rf, ctx) { if (rf & 1) {
|
|
28
|
+
i0.ɵɵelementStart(0, "div");
|
|
29
|
+
i0.ɵɵconditionalCreate(1, BentoGrid_For_1_Conditional_1_Template, 1, 1, "ng-container", 1)(2, BentoGrid_For_1_Conditional_2_Template, 2, 1, "ng-container");
|
|
30
|
+
i0.ɵɵelementEnd();
|
|
31
|
+
} if (rf & 2) {
|
|
32
|
+
const item_r1 = ctx.$implicit;
|
|
33
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
34
|
+
i0.ɵɵstyleProp("grid-column", ctx_r1.columnSpan(item_r1))("grid-row", ctx_r1.rowSpan(item_r1))("grid-area", ctx_r1.areaOf(item_r1));
|
|
35
|
+
i0.ɵɵadvance();
|
|
36
|
+
i0.ɵɵconditional(ctx_r1.isNode(item_r1.content) ? 1 : 2);
|
|
37
|
+
} }
|
|
38
|
+
/**
|
|
39
|
+
* BentoGrid component.
|
|
40
|
+
*
|
|
41
|
+
* Items span multiple cells for a magazine / dashboard layout. The host IS the
|
|
42
|
+
* root `<div>` (`div[mol-bento-grid]`), matching React's root exactly. Works in
|
|
43
|
+
* two modes: (a) col/row-span driven, (b) named-areas driven via the `areas`
|
|
44
|
+
* input. Node-valued item content is an `ng-template` reference rendered
|
|
45
|
+
* through `NgTemplateOutlet`; string / number content renders as text.
|
|
46
|
+
*/
|
|
47
|
+
export class BentoGrid {
|
|
48
|
+
/** Items to render. */
|
|
49
|
+
items = [];
|
|
50
|
+
/** Optional `grid-template-areas` string. */
|
|
51
|
+
areas;
|
|
52
|
+
/** Default column count when `areas` is absent (defaults to `12`). */
|
|
53
|
+
columns;
|
|
54
|
+
/** Gap between items (defaults to `'md'` at read time). */
|
|
55
|
+
gap;
|
|
56
|
+
/** Extra classes. */
|
|
57
|
+
className;
|
|
58
|
+
/**
|
|
59
|
+
* The current class map.
|
|
60
|
+
* @returns The UIClassMap.
|
|
61
|
+
*/
|
|
62
|
+
cm() {
|
|
63
|
+
return getClassMap();
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Computes the grid class list (React's `cm.grid({ gap })` plus the extra
|
|
67
|
+
* `className`).
|
|
68
|
+
* @returns The class string.
|
|
69
|
+
*/
|
|
70
|
+
classes() {
|
|
71
|
+
return this.cm().cn(this.cm().grid({ gap: this.gap ?? 'md' }), this.className);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The host's `grid-template-columns` in span mode; absent in areas mode
|
|
75
|
+
* (React writes one or the other).
|
|
76
|
+
* @returns The CSS value, or null for no declaration.
|
|
77
|
+
*/
|
|
78
|
+
gridTemplateColumns() {
|
|
79
|
+
return this.areas ? null : `repeat(${this.columns ?? 12}, minmax(0, 1fr))`;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The host's `grid-template-areas` in areas mode; absent in span mode.
|
|
83
|
+
* @returns The CSS value, or null for no declaration.
|
|
84
|
+
*/
|
|
85
|
+
gridTemplateAreas() {
|
|
86
|
+
return this.areas ?? null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* An item's `grid-column` in span mode (React's `span ${colSpan ?? 4}`).
|
|
90
|
+
* @param item - The item.
|
|
91
|
+
* @returns The CSS value, or null in areas mode.
|
|
92
|
+
*/
|
|
93
|
+
columnSpan(item) {
|
|
94
|
+
return this.areas ? null : `span ${item.colSpan ?? 4}`;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* An item's `grid-row` in span mode (React's `span ${rowSpan ?? 1}`).
|
|
98
|
+
* @param item - The item.
|
|
99
|
+
* @returns The CSS value, or null in areas mode.
|
|
100
|
+
*/
|
|
101
|
+
rowSpan(item) {
|
|
102
|
+
return this.areas ? null : `span ${item.rowSpan ?? 1}`;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* An item's `grid-area` in areas mode; absent in span mode and when the item
|
|
106
|
+
* sets no area (React renders no declaration).
|
|
107
|
+
* @param item - The item.
|
|
108
|
+
* @returns The CSS value, or null for no declaration.
|
|
109
|
+
*/
|
|
110
|
+
areaOf(item) {
|
|
111
|
+
return this.areas ? (item.area ?? null) : null;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Whether item content holds a node (an `ng-template` reference) rather than
|
|
115
|
+
* text.
|
|
116
|
+
* @param value - The item content.
|
|
117
|
+
* @returns True when it renders through a template outlet.
|
|
118
|
+
*/
|
|
119
|
+
isNode(value) {
|
|
120
|
+
return value instanceof TemplateRef;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The text a content field renders (React renders strings and numbers as
|
|
124
|
+
* text).
|
|
125
|
+
* @param value - The item content.
|
|
126
|
+
* @returns The text, or `''` for a node field.
|
|
127
|
+
*/
|
|
128
|
+
textOf(value) {
|
|
129
|
+
return typeof value === 'string' || typeof value === 'number' ? String(value) : '';
|
|
130
|
+
}
|
|
131
|
+
static ɵfac = function BentoGrid_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BentoGrid)(); };
|
|
132
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: BentoGrid, selectors: [["div", "mol-bento-grid", ""]], hostVars: 8, hostBindings: function BentoGrid_HostBindings(rf, ctx) { if (rf & 2) {
|
|
133
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
134
|
+
i0.ɵɵstyleProp("display", "grid")("grid-template-columns", ctx.gridTemplateColumns())("grid-template-areas", ctx.gridTemplateAreas());
|
|
135
|
+
} }, inputs: { items: "items", areas: "areas", columns: "columns", gap: "gap", className: "className" }, decls: 2, vars: 0, consts: [[3, "grid-column", "grid-row", "grid-area"], [3, "ngTemplateOutlet"]], template: function BentoGrid_Template(rf, ctx) { if (rf & 1) {
|
|
136
|
+
i0.ɵɵrepeaterCreate(0, BentoGrid_For_1_Template, 3, 7, "div", 0, _forTrack0);
|
|
137
|
+
} if (rf & 2) {
|
|
138
|
+
i0.ɵɵrepeater(ctx.items);
|
|
139
|
+
} }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
|
|
140
|
+
}
|
|
141
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BentoGrid, [{
|
|
142
|
+
type: Component,
|
|
143
|
+
args: [{
|
|
144
|
+
selector: 'div[mol-bento-grid]',
|
|
145
|
+
standalone: true,
|
|
146
|
+
imports: [NgTemplateOutlet],
|
|
147
|
+
inputs: ['items', 'areas', 'columns', 'gap', 'className'],
|
|
148
|
+
host: {
|
|
149
|
+
'[class]': 'classes()',
|
|
150
|
+
'[style.display]': "'grid'",
|
|
151
|
+
'[style.grid-template-columns]': 'gridTemplateColumns()',
|
|
152
|
+
'[style.grid-template-areas]': 'gridTemplateAreas()',
|
|
153
|
+
},
|
|
154
|
+
template: `@for (item of items; track item.id) {
|
|
155
|
+
<div
|
|
156
|
+
[style.grid-column]="columnSpan(item)"
|
|
157
|
+
[style.grid-row]="rowSpan(item)"
|
|
158
|
+
[style.grid-area]="areaOf(item)"
|
|
159
|
+
>
|
|
160
|
+
@if (isNode(item.content)) {
|
|
161
|
+
<ng-container [ngTemplateOutlet]="item.content" />
|
|
162
|
+
} @else {
|
|
163
|
+
<ng-container>{{ textOf(item.content) }}</ng-container>
|
|
164
|
+
}
|
|
165
|
+
</div>
|
|
166
|
+
}`,
|
|
167
|
+
}]
|
|
168
|
+
}], null, null); })();
|
|
169
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BentoGrid, { className: "BentoGrid", filePath: "bento-grid.component.ts", lineNumber: 49 }); })();
|
|
170
|
+
//# sourceMappingURL=bento-grid.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bento-grid.component.js","sourceRoot":"","sources":["../src/bento-grid.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAGtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;;;;IA+BtC,2BAAkD;;;IAApC,kDAAiC;;;IAE/C,6BAAc;IAAA,YAA0B;;;;;IAA1B,cAA0B;IAA1B,oDAA0B;;;IAR5C,2BAIC;IAGG,AAFF,0FAA4B,iEAEnB;IAGX,iBAAM;;;;IAPJ,AADA,AADA,yDAAsC,qCACN,qCACA;IAEhC,cAIC;IAJD,wDAIC;;AA9BP;;;;;;;;GAQG;AA0BH,MAAM,OAAO,SAAS;IACpB,uBAAuB;IACvB,KAAK,GAAgB,EAAE,CAAA;IACvB,6CAA6C;IAC7C,KAAK,CAAS;IACd,sEAAsE;IACtE,OAAO,CAAS;IAChB,2DAA2D;IAC3D,GAAG,CAA4B;IAC/B,qBAAqB;IACrB,SAAS,CAAS;IAElB;;;OAGG;IACH,EAAE;QACA,OAAO,WAAW,EAAE,CAAA;IACtB,CAAC;IAED;;;;OAIG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IAChF,CAAC;IAED;;;;OAIG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,OAAO,IAAI,EAAE,mBAAmB,CAAA;IAC5E,CAAC;IAED;;;OAGG;IACH,iBAAiB;QACf,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAA;IAC3B,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,IAAe;QACxB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,OAAO,IAAI,CAAC,EAAE,CAAA;IACxD,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,IAAe;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,OAAO,IAAI,CAAC,EAAE,CAAA;IACxD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,IAAe;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAChD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAA2B;QAChC,OAAO,KAAK,YAAY,WAAW,CAAA;IACrC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAA2B;QAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACpF,CAAC;mGA5FU,SAAS;6DAAT,SAAS;YAAT,cAAA,aAAS,CAAA;YAAT,0BAAA,MAAM,CAAG,0BAAT,yBACJ,CADa,wBAAT,uBACN,CADe;;YAdT,4EAYV;;YAZU,wBAYV;4BApBS,gBAAgB;;iFAsBf,SAAS;cAzBrB,SAAS;eAAC;gBACT,QAAQ,EAAE,qBAAqB;gBAC/B,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;gBAC3B,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,CAAC;gBACzD,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;oBACtB,iBAAiB,EAAE,QAAQ;oBAC3B,+BAA+B,EAAE,uBAAuB;oBACxD,6BAA6B,EAAE,qBAAqB;iBACrD;gBACD,QAAQ,EAAE;;;;;;;;;;;;IAYR;aACH;;kFACY,SAAS"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* CardGrid component.
|
|
5
|
+
*
|
|
6
|
+
* The generic responsive card grid. The host IS the root `<div>`
|
|
7
|
+
* (`div[mol-card-grid]`), matching React's root exactly; the cards are the
|
|
8
|
+
* element's default projected content, so they land inside that div just as
|
|
9
|
+
* React's `children` do. Collapses to one column on narrow viewports and grows
|
|
10
|
+
* to `columns` on md+ via the ClassMap grid.
|
|
11
|
+
*/
|
|
12
|
+
export declare class CardGrid {
|
|
13
|
+
/** Column count at the md+ breakpoint (defaults to `3` at read time). */
|
|
14
|
+
columns?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
15
|
+
/** Gap between cards (defaults to `'md'` at read time). */
|
|
16
|
+
gap?: 'xs' | 'sm' | 'md' | 'lg';
|
|
17
|
+
/** Extra classes. */
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The current class map.
|
|
21
|
+
* @returns The UIClassMap.
|
|
22
|
+
*/
|
|
23
|
+
cm(): UIClassMap;
|
|
24
|
+
/**
|
|
25
|
+
* Computes the grid class list (React's `cm.grid({ cols, gap })` plus the
|
|
26
|
+
* extra `className`).
|
|
27
|
+
* @returns The class string.
|
|
28
|
+
*/
|
|
29
|
+
classes(): string;
|
|
30
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CardGrid, never>;
|
|
31
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CardGrid, "div[mol-card-grid]", never, { "columns": { "alias": "columns"; "required": false; }; "gap": { "alias": "gap"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=card-grid.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-grid.component.d.ts","sourceRoot":"","sources":["../src/card-grid.component.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAGlD;;;;;;;;GAQG;AACH,qBASa,QAAQ;IACnB,yEAAyE;IACzE,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC/B,2DAA2D;IAC3D,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IAC/B,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;;OAIG;IACH,OAAO,IAAI,MAAM;yCArBN,QAAQ;2CAAR,QAAQ;CA2BpB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CardGrid component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { Component } from '@angular/core';
|
|
7
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
const _c0 = ["*"];
|
|
10
|
+
/**
|
|
11
|
+
* CardGrid component.
|
|
12
|
+
*
|
|
13
|
+
* The generic responsive card grid. The host IS the root `<div>`
|
|
14
|
+
* (`div[mol-card-grid]`), matching React's root exactly; the cards are the
|
|
15
|
+
* element's default projected content, so they land inside that div just as
|
|
16
|
+
* React's `children` do. Collapses to one column on narrow viewports and grows
|
|
17
|
+
* to `columns` on md+ via the ClassMap grid.
|
|
18
|
+
*/
|
|
19
|
+
export class CardGrid {
|
|
20
|
+
/** Column count at the md+ breakpoint (defaults to `3` at read time). */
|
|
21
|
+
columns;
|
|
22
|
+
/** Gap between cards (defaults to `'md'` at read time). */
|
|
23
|
+
gap;
|
|
24
|
+
/** Extra classes. */
|
|
25
|
+
className;
|
|
26
|
+
/**
|
|
27
|
+
* The current class map.
|
|
28
|
+
* @returns The UIClassMap.
|
|
29
|
+
*/
|
|
30
|
+
cm() {
|
|
31
|
+
return getClassMap();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Computes the grid class list (React's `cm.grid({ cols, gap })` plus the
|
|
35
|
+
* extra `className`).
|
|
36
|
+
* @returns The class string.
|
|
37
|
+
*/
|
|
38
|
+
classes() {
|
|
39
|
+
return this.cm().cn(this.cm().grid({ cols: this.columns ?? 3, gap: this.gap ?? 'md' }), this.className);
|
|
40
|
+
}
|
|
41
|
+
static ɵfac = function CardGrid_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CardGrid)(); };
|
|
42
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CardGrid, selectors: [["div", "mol-card-grid", ""]], hostVars: 2, hostBindings: function CardGrid_HostBindings(rf, ctx) { if (rf & 2) {
|
|
43
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
44
|
+
} }, inputs: { columns: "columns", gap: "gap", className: "className" }, ngContentSelectors: _c0, decls: 1, vars: 0, template: function CardGrid_Template(rf, ctx) { if (rf & 1) {
|
|
45
|
+
i0.ɵɵprojectionDef();
|
|
46
|
+
i0.ɵɵprojection(0);
|
|
47
|
+
} }, encapsulation: 2 });
|
|
48
|
+
}
|
|
49
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CardGrid, [{
|
|
50
|
+
type: Component,
|
|
51
|
+
args: [{
|
|
52
|
+
selector: 'div[mol-card-grid]',
|
|
53
|
+
standalone: true,
|
|
54
|
+
inputs: ['columns', 'gap', 'className'],
|
|
55
|
+
host: {
|
|
56
|
+
'[class]': 'classes()',
|
|
57
|
+
},
|
|
58
|
+
template: '<ng-content></ng-content>',
|
|
59
|
+
}]
|
|
60
|
+
}], null, null); })();
|
|
61
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CardGrid, { className: "CardGrid", filePath: "card-grid.component.ts", lineNumber: 30 }); })();
|
|
62
|
+
//# sourceMappingURL=card-grid.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-grid.component.js","sourceRoot":"","sources":["../src/card-grid.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;;;AAE9C;;;;;;;;GAQG;AAUH,MAAM,OAAO,QAAQ;IACnB,yEAAyE;IACzE,OAAO,CAAwB;IAC/B,2DAA2D;IAC3D,GAAG,CAA4B;IAC/B,qBAAqB;IACrB,SAAS,CAAS;IAElB;;;OAGG;IACH,EAAE;QACA,OAAO,WAAW,EAAE,CAAA;IACtB,CAAC;IAED;;;;OAIG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CACjB,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,EAClE,IAAI,CAAC,SAAS,CACf,CAAA;IACH,CAAC;kGA1BU,QAAQ;6DAAR,QAAQ;YAAR,cAAA,aAAS,CAAD;;;YAFR,kBAAyB;;;iFAEzB,QAAQ;cATpB,SAAS;eAAC;gBACT,QAAQ,EAAE,oBAAoB;gBAC9B,UAAU,EAAE,IAAI;gBAChB,MAAM,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,WAAW,CAAC;gBACvC,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;iBACvB;gBACD,QAAQ,EAAE,2BAA2B;aACtC;;kFACY,QAAQ"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular card-grid and bento-grid layouts.
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* - `<CardGrid>` — responsive grid with configurable column count.
|
|
6
|
+
* - `<BentoGrid>` — col/row-span or named-areas layout for mixed-size cards.
|
|
7
|
+
*
|
|
8
|
+
* This is the Angular counterpart of `@molecule/app-card-grid-react`: the same
|
|
9
|
+
* exports, the same props (React names), and the same DOM for the same input.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Component } from '@angular/core'
|
|
14
|
+
* import { BentoGrid, CardGrid } from '@molecule/app-card-grid-angular'
|
|
15
|
+
*
|
|
16
|
+
* @Component({
|
|
17
|
+
* selector: 'app-grids',
|
|
18
|
+
* standalone: true,
|
|
19
|
+
* imports: [CardGrid, BentoGrid],
|
|
20
|
+
* template: `
|
|
21
|
+
* <div mol-card-grid [columns]="3" gap="md">
|
|
22
|
+
* <app-product-card [product]="products[0]" />
|
|
23
|
+
* <app-product-card [product]="products[1]" />
|
|
24
|
+
* <app-product-card [product]="products[2]" />
|
|
25
|
+
* </div>
|
|
26
|
+
*
|
|
27
|
+
* <div mol-bento-grid [items]="bentoItems"></div>
|
|
28
|
+
* `,
|
|
29
|
+
* })
|
|
30
|
+
* export class Grids {
|
|
31
|
+
* bentoItems = [
|
|
32
|
+
* { id: 'hero', content: this.hero, colSpan: 8, rowSpan: 2 },
|
|
33
|
+
* { id: 'stats', content: this.stats, colSpan: 4 },
|
|
34
|
+
* ]
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* `CardGrid` collapses to one column on narrow viewports and grows to
|
|
40
|
+
* `columns` (1–6) at the md+ breakpoint via the ClassMap grid. In
|
|
41
|
+
* `BentoGrid`, span mode uses a `columns`-wide grid (default 12) with
|
|
42
|
+
* per-item `colSpan`/`rowSpan`; passing `areas` switches to named
|
|
43
|
+
* `grid-template-areas` — then every item must set a matching `area`
|
|
44
|
+
* token or it falls out of the template. Node values are projected content:
|
|
45
|
+
* `CardGrid`'s cards are the element's default content, and a
|
|
46
|
+
* `BentoItem.content` is an `ng-template` reference or text.
|
|
47
|
+
*
|
|
48
|
+
* @module
|
|
49
|
+
*/
|
|
50
|
+
export * from './bento-grid.component.js';
|
|
51
|
+
export * from './card-grid.component.js';
|
|
52
|
+
export * from './types.js';
|
|
53
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular card-grid and bento-grid layouts.
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* - `<CardGrid>` — responsive grid with configurable column count.
|
|
6
|
+
* - `<BentoGrid>` — col/row-span or named-areas layout for mixed-size cards.
|
|
7
|
+
*
|
|
8
|
+
* This is the Angular counterpart of `@molecule/app-card-grid-react`: the same
|
|
9
|
+
* exports, the same props (React names), and the same DOM for the same input.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Component } from '@angular/core'
|
|
14
|
+
* import { BentoGrid, CardGrid } from '@molecule/app-card-grid-angular'
|
|
15
|
+
*
|
|
16
|
+
* @Component({
|
|
17
|
+
* selector: 'app-grids',
|
|
18
|
+
* standalone: true,
|
|
19
|
+
* imports: [CardGrid, BentoGrid],
|
|
20
|
+
* template: `
|
|
21
|
+
* <div mol-card-grid [columns]="3" gap="md">
|
|
22
|
+
* <app-product-card [product]="products[0]" />
|
|
23
|
+
* <app-product-card [product]="products[1]" />
|
|
24
|
+
* <app-product-card [product]="products[2]" />
|
|
25
|
+
* </div>
|
|
26
|
+
*
|
|
27
|
+
* <div mol-bento-grid [items]="bentoItems"></div>
|
|
28
|
+
* `,
|
|
29
|
+
* })
|
|
30
|
+
* export class Grids {
|
|
31
|
+
* bentoItems = [
|
|
32
|
+
* { id: 'hero', content: this.hero, colSpan: 8, rowSpan: 2 },
|
|
33
|
+
* { id: 'stats', content: this.stats, colSpan: 4 },
|
|
34
|
+
* ]
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* `CardGrid` collapses to one column on narrow viewports and grows to
|
|
40
|
+
* `columns` (1–6) at the md+ breakpoint via the ClassMap grid. In
|
|
41
|
+
* `BentoGrid`, span mode uses a `columns`-wide grid (default 12) with
|
|
42
|
+
* per-item `colSpan`/`rowSpan`; passing `areas` switches to named
|
|
43
|
+
* `grid-template-areas` — then every item must set a matching `area`
|
|
44
|
+
* token or it falls out of the template. Node values are projected content:
|
|
45
|
+
* `CardGrid`'s cards are the element's default content, and a
|
|
46
|
+
* `BentoItem.content` is an `ng-template` reference or text.
|
|
47
|
+
*
|
|
48
|
+
* @module
|
|
49
|
+
*/
|
|
50
|
+
export * from './bento-grid.component.js';
|
|
51
|
+
export * from './card-grid.component.js';
|
|
52
|
+
export * from './types.js';
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,YAAY,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of `@molecule/app-card-grid-angular` — the Angular counterpart of
|
|
3
|
+
* `@molecule/app-card-grid-react`, same props and DOM.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { TemplateRef } from '@angular/core';
|
|
8
|
+
/**
|
|
9
|
+
* A node-valued item content (React's `ReactNode`): in Angular it is text (a
|
|
10
|
+
* string or number) or an `ng-template` reference rendered through
|
|
11
|
+
* `NgTemplateOutlet` where the node would render. Not exported — React has no
|
|
12
|
+
* matching public type, and the export surface must stay identical.
|
|
13
|
+
*/
|
|
14
|
+
type BentoItemContent = TemplateRef<unknown> | string | number;
|
|
15
|
+
/** Data descriptor for a single cell in a BentoGrid layout. */
|
|
16
|
+
export interface BentoItem {
|
|
17
|
+
/** Unique item identifier (the `@for` track key). */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Card content (a node template or text). */
|
|
20
|
+
content: BentoItemContent;
|
|
21
|
+
/** CSS grid-column-span (1-12). Defaults to 4. */
|
|
22
|
+
colSpan?: number;
|
|
23
|
+
/** CSS grid-row-span (1-6). Defaults to 1. */
|
|
24
|
+
rowSpan?: number;
|
|
25
|
+
/** Named grid-area when using `areas` layout. */
|
|
26
|
+
area?: string;
|
|
27
|
+
}
|
|
28
|
+
/** Props for {@link BentoGrid}. */
|
|
29
|
+
export interface BentoGridProps {
|
|
30
|
+
/** Items to render. */
|
|
31
|
+
items: BentoItem[];
|
|
32
|
+
/**
|
|
33
|
+
* Optional `grid-template-areas` string (e.g. `'a a b' 'c d d'`). When
|
|
34
|
+
* provided, each `BentoItem.area` must match a token in the template.
|
|
35
|
+
*/
|
|
36
|
+
areas?: string;
|
|
37
|
+
/** Default column count when `areas` is absent. Defaults to 12. */
|
|
38
|
+
columns?: number;
|
|
39
|
+
/** Gap between items. */
|
|
40
|
+
gap?: 'xs' | 'sm' | 'md' | 'lg';
|
|
41
|
+
/** Extra classes. */
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Props for {@link CardGrid}. The cards are projected content in Angular (an
|
|
46
|
+
* input cannot carry a node), so `children` is typed `unknown`: pass it in the
|
|
47
|
+
* host template, not as a value.
|
|
48
|
+
*/
|
|
49
|
+
export interface CardGridProps {
|
|
50
|
+
/** Cards, projected as the element's default content. */
|
|
51
|
+
children?: unknown;
|
|
52
|
+
/** Column count at the md+ breakpoint. 1–6. Defaults to 3. */
|
|
53
|
+
columns?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
54
|
+
/** Gap between cards. */
|
|
55
|
+
gap?: 'xs' | 'sm' | 'md' | 'lg';
|
|
56
|
+
/** Extra classes. */
|
|
57
|
+
className?: string;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;;GAKG;AACH,KAAK,gBAAgB,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;AAE9D,+DAA+D;AAC/D,MAAM,WAAW,SAAS;IACxB,qDAAqD;IACrD,EAAE,EAAE,MAAM,CAAA;IACV,8CAA8C;IAC9C,OAAO,EAAE,gBAAgB,CAAA;IACzB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,uBAAuB;IACvB,KAAK,EAAE,SAAS,EAAE,CAAA;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,yBAAyB;IACzB,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IAC/B,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC/B,yBAAyB;IACzB,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IAC/B,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-card-grid-angular",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1-stage",
|
|
4
|
+
"description": "Responsive Angular card grid and bento-grid layouts",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-card-grid-angular",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "ngc",
|
|
21
|
+
"dev": "ngc --watch",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"molecule",
|
|
27
|
+
"card-grid",
|
|
28
|
+
"angular"
|
|
29
|
+
],
|
|
30
|
+
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
35
|
+
"directory": "packages/app/features/card-grid-angular"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
40
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@angular/common": "^22.0.0",
|
|
46
|
+
"@angular/core": "^22.0.0",
|
|
47
|
+
"@angular/platform-browser": "^22.0.0",
|
|
48
|
+
"@molecule/app-angular": "^3.5.0",
|
|
49
|
+
"@molecule/app-ui": "^1.0.1",
|
|
50
|
+
"@molecule/app-ui-angular": "^1.1.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@angular/common": "22.2.3",
|
|
54
|
+
"@angular/compiler": "22.2.3",
|
|
55
|
+
"@angular/compiler-cli": "22.2.3",
|
|
56
|
+
"@angular/core": "22.2.3",
|
|
57
|
+
"@angular/platform-browser": "22.2.3",
|
|
58
|
+
"@molecule/app-angular": "3.6.0",
|
|
59
|
+
"@molecule/app-framework-conformance": "0.0.0",
|
|
60
|
+
"@molecule/app-i18n": "1.2.1",
|
|
61
|
+
"@molecule/app-icons": "1.0.4",
|
|
62
|
+
"@molecule/app-ui": "1.3.11",
|
|
63
|
+
"@molecule/app-ui-angular": "1.1.2",
|
|
64
|
+
"@types/node": "26.6.5",
|
|
65
|
+
"jsdom": "30.1.3",
|
|
66
|
+
"rxjs": "7.8.2",
|
|
67
|
+
"typescript": "6.0.3",
|
|
68
|
+
"vitest": "4.1.12",
|
|
69
|
+
"zone.js": "0.16.3"
|
|
70
|
+
}
|
|
71
|
+
}
|