osi-cards-lib 1.5.2 → 1.5.3
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/README.md +176 -2
- package/fesm2022/osi-cards-lib.mjs +32209 -17455
- package/index.d.ts +7481 -3422
- package/package.json +1 -1
- package/styles/_components.scss +5 -4
- package/styles/_design-tokens.scss +3 -0
- package/styles/_index.scss +26 -0
- package/styles/_osi-cards-mixins.scss +428 -0
- package/styles/_osi-cards-tokens.scss +325 -0
- package/styles/_styles-scoped.scss +11 -10
- package/styles/_styles-standalone.scss +101 -100
- package/styles/bundles/_ai-card.scss +2 -1
- package/styles/bundles/_all.scss +4 -0
- package/styles/bundles/_base.scss +3 -0
- package/styles/bundles/_card-skeleton.scss +3 -0
- package/styles/bundles/_index.scss +3 -0
- package/styles/bundles/_section-analytics.scss +3 -0
- package/styles/bundles/_section-chart.scss +3 -0
- package/styles/bundles/_section-contact.scss +3 -0
- package/styles/bundles/_section-list.scss +3 -0
- package/styles/bundles/_section-news.scss +3 -0
- package/styles/bundles/_section-overview.scss +3 -0
- package/styles/bundles/_sections.scss +4 -0
- package/styles/bundles/_tokens-only.scss +3 -0
- package/styles/bundles/ai-card.css +1 -1
- package/styles/bundles/ai-card.expanded.css +1077 -24
- package/styles/bundles/all.css +1 -1
- package/styles/bundles/all.expanded.css +1077 -24
- package/styles/bundles/section-overview.css +1 -1
- package/styles/components/_ai-card-renderer.scss +3 -0
- package/styles/components/_badges.scss +3 -0
- package/styles/components/_hero-card.scss +3 -0
- package/styles/components/_image-fallback.scss +3 -0
- package/styles/components/cards/_ai-card.scss +48 -47
- package/styles/components/sections/_financials.scss +3 -4
- package/styles/components/sections/_info.scss +1 -1
- package/styles/components/sections/_overview.scss +12 -20
- package/styles/components/sections/_section-types.generated.scss +20 -34
- package/styles/components/sections/_unified-design.scss +833 -0
- package/styles/critical.scss +354 -0
- package/styles/layout/_feature-grid.scss +3 -0
- package/styles/layout/_masonry.scss +31 -31
- package/styles/micro-interactions.scss +3 -0
- package/styles/non-critical.scss +639 -0
- package/styles/osi-cards-scoped.css +1 -1
- package/styles/osi-cards-scoped.expanded.css +1031 -24
- package/styles/osi-cards-standalone.css +1 -1
- package/styles/osi-cards-standalone.expanded.css +1036 -29
- package/styles/osi-cards.css +1 -1
- package/styles/osi-cards.expanded.css +1033 -25
- package/styles/reset/_framework-reset.scss +3 -0
- package/styles/responsive.scss +3 -0
package/README.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# osi-cards-lib
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A comprehensive Angular library for rendering AI-generated cards with rich section types, streaming support, and complete CSS encapsulation.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **17 Section Types** - Info, Analytics, Chart, List, Contact, Network, Map, Event, Product, Solutions, Financials, and more
|
|
8
|
+
- **CSS Encapsulation** - Shadow DOM isolation with CSS Layers for easy style overrides
|
|
9
|
+
- **Streaming Support** - Progressive card rendering with LLM-style streaming simulation
|
|
10
|
+
- **Theme System** - Built-in themes with full customization via CSS custom properties
|
|
11
|
+
- **Plugin Architecture** - Extend with custom section types
|
|
12
|
+
- **Accessibility** - WCAG compliant with keyboard navigation and screen reader support
|
|
13
|
+
- **Performance** - OnPush change detection, virtual scrolling, and optimized rendering
|
|
4
14
|
|
|
5
15
|
## Installation
|
|
6
16
|
|
|
@@ -37,9 +47,173 @@ export class ExampleComponent {
|
|
|
37
47
|
}
|
|
38
48
|
```
|
|
39
49
|
|
|
50
|
+
## Using OsiCardsComponent (Simplified API)
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { OsiCardsComponent } from 'osi-cards-lib';
|
|
54
|
+
|
|
55
|
+
@Component({
|
|
56
|
+
selector: 'app-example',
|
|
57
|
+
standalone: true,
|
|
58
|
+
imports: [OsiCardsComponent],
|
|
59
|
+
template: `
|
|
60
|
+
<osi-cards
|
|
61
|
+
[card]="card"
|
|
62
|
+
theme="dark"
|
|
63
|
+
[tiltEnabled]="true"
|
|
64
|
+
(fieldClick)="onFieldClick($event)"
|
|
65
|
+
/>
|
|
66
|
+
`
|
|
67
|
+
})
|
|
68
|
+
export class ExampleComponent {
|
|
69
|
+
card: AICardConfig = { ... };
|
|
70
|
+
|
|
71
|
+
onFieldClick(event: CardFieldInteractionEvent) {
|
|
72
|
+
console.log('Field clicked:', event);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Card Presets
|
|
78
|
+
|
|
79
|
+
Quickly create common card types:
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { PresetFactory } from 'osi-cards-lib';
|
|
83
|
+
|
|
84
|
+
// Company card
|
|
85
|
+
const companyCard = PresetFactory.createCompany({
|
|
86
|
+
name: 'Acme Corp',
|
|
87
|
+
industry: 'Technology',
|
|
88
|
+
employees: '500+',
|
|
89
|
+
websiteUrl: 'https://acme.com'
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Analytics dashboard
|
|
93
|
+
const analyticsCard = PresetFactory.createAnalytics({
|
|
94
|
+
title: 'Sales Performance',
|
|
95
|
+
kpis: [
|
|
96
|
+
{ label: 'Revenue', value: '$1.2M', percentage: 105, trend: 'up' }
|
|
97
|
+
]
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Contact card
|
|
101
|
+
const contactCard = PresetFactory.createContact({
|
|
102
|
+
name: 'John Doe',
|
|
103
|
+
email: 'john@example.com'
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Theming
|
|
108
|
+
|
|
109
|
+
Apply themes globally or per-card:
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { ThemeService } from 'osi-cards-lib';
|
|
113
|
+
|
|
114
|
+
const themeService = inject(ThemeService);
|
|
115
|
+
|
|
116
|
+
// Set theme
|
|
117
|
+
themeService.setTheme('dark');
|
|
118
|
+
|
|
119
|
+
// Follow system preference
|
|
120
|
+
themeService.setTheme('system');
|
|
121
|
+
|
|
122
|
+
// Toggle theme
|
|
123
|
+
themeService.toggleTheme();
|
|
124
|
+
|
|
125
|
+
// Apply custom theme
|
|
126
|
+
themeService.applyCustomTheme({
|
|
127
|
+
name: 'brand',
|
|
128
|
+
colorScheme: 'light',
|
|
129
|
+
variables: {
|
|
130
|
+
'--osi-card-accent': '#6366f1',
|
|
131
|
+
'--osi-card-background': '#fafafa'
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Streaming Support
|
|
137
|
+
|
|
138
|
+
Simulate LLM streaming for progressive card generation:
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
import { OSICardsStreamingService } from 'osi-cards-lib';
|
|
142
|
+
|
|
143
|
+
const streaming = inject(OSICardsStreamingService);
|
|
144
|
+
|
|
145
|
+
// Subscribe to card updates
|
|
146
|
+
streaming.cardUpdates$.subscribe(update => {
|
|
147
|
+
this.card = update.partialConfig;
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// Start streaming
|
|
151
|
+
streaming.start(jsonString);
|
|
152
|
+
|
|
153
|
+
// Stop streaming
|
|
154
|
+
streaming.stop();
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Custom Section Plugins
|
|
158
|
+
|
|
159
|
+
Extend with your own section types:
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
import { SectionPluginRegistry, BaseSectionComponent, SectionPlugin } from 'osi-cards-lib';
|
|
163
|
+
|
|
164
|
+
@Component({
|
|
165
|
+
template: `<div class="custom-section">...</div>`
|
|
166
|
+
})
|
|
167
|
+
export class CustomSectionComponent extends BaseSectionComponent implements SectionPlugin {
|
|
168
|
+
static readonly PLUGIN_TYPE = 'custom-section';
|
|
169
|
+
|
|
170
|
+
getPluginType() { return CustomSectionComponent.PLUGIN_TYPE; }
|
|
171
|
+
canHandle(section) { return section.type === this.getPluginType(); }
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Register plugin
|
|
175
|
+
const registry = inject(SectionPluginRegistry);
|
|
176
|
+
registry.register({
|
|
177
|
+
type: 'custom-section',
|
|
178
|
+
name: 'Custom Section',
|
|
179
|
+
component: CustomSectionComponent
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Section Types
|
|
184
|
+
|
|
185
|
+
| Type | Description | Data |
|
|
186
|
+
|------|-------------|------|
|
|
187
|
+
| `info` | General information fields | fields |
|
|
188
|
+
| `analytics` | KPIs and metrics | fields |
|
|
189
|
+
| `chart` | Charts (bar, line, pie) | chartData |
|
|
190
|
+
| `list` | Lists with items | items |
|
|
191
|
+
| `contact-card` | Contact information | fields |
|
|
192
|
+
| `network-card` | Professional network | items |
|
|
193
|
+
| `map` | Geographic locations | items |
|
|
194
|
+
| `event` | Timeline/events | items |
|
|
195
|
+
| `product` | Product listings | items |
|
|
196
|
+
| `solutions` | Solutions/services | items |
|
|
197
|
+
| `financials` | Financial data | fields |
|
|
198
|
+
| `quotation` | Quotes/testimonials | fields |
|
|
199
|
+
| `text-reference` | Citations/references | fields |
|
|
200
|
+
| `brand-colors` | Color palettes | items |
|
|
201
|
+
| `news` | News articles | items |
|
|
202
|
+
| `social-media` | Social profiles | items |
|
|
203
|
+
| `overview` | Summary section | fields |
|
|
204
|
+
|
|
40
205
|
## Documentation
|
|
41
206
|
|
|
42
|
-
|
|
207
|
+
- [API Reference](../../docs/API.md)
|
|
208
|
+
- [Theming Guide](../../docs/THEMING_GUIDE.md)
|
|
209
|
+
- [Section Types Reference](../../docs/SECTION_TYPES.md)
|
|
210
|
+
- [Plugin System](../../docs/PLUGIN_SYSTEM.md)
|
|
211
|
+
- [Best Practices](../../docs/BEST_PRACTICES.md)
|
|
212
|
+
- [Migration Guide](../../docs/MIGRATION_GUIDE.md)
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
MIT
|
|
43
217
|
|
|
44
218
|
## Version
|
|
45
219
|
|