@universityofmaryland/web-feeds-library 1.0.6 → 1.0.7

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 CHANGED
@@ -1,217 +1,379 @@
1
1
  # University of Maryland Feeds Library
2
2
 
3
- [![Feeds Version](https://img.shields.io/badge/Feeds-v1.0.6-blue)](https://www.npmjs.com/package/@universityofmaryland/web-feeds-library)
3
+ [![Feeds Version](https://img.shields.io/badge/Feeds-v1.0.7-blue)](https://www.npmjs.com/package/@universityofmaryland/web-feeds-library)
4
4
 
5
- A collection of dynamic feed components for displaying University of Maryland content feeds including news articles, events, and academic information. This library simplifies the integration of live, updating content from UMD sources while maintaining brand consistency and performance optimization.
5
+ Dynamic content feed components for displaying University of Maryland news, events, and academic information with automatic updates, caching, and brand-compliant styling.
6
6
 
7
7
  ## Overview
8
8
 
9
- The UMD Feeds Library provides ready-to-use feed components that can be integrated into any web project. These components are designed to follow UMD brand guidelines and accessibility standards while providing a seamless way to display dynamic content. The library handles all aspects of content fetching, caching, error handling, and rendering, allowing developers to focus on integration rather than implementation details.
9
+ The UMD Feeds Library simplifies the integration of dynamic UMD content into any web application. It provides pre-built components for displaying news articles, event calendars, and academic program information that automatically sync with UMD data sources. Built on the Elements Library and styled with the Styles Library, these components ensure consistent presentation while handling all complexities of data fetching, caching, error handling, and responsive layouts.
10
10
 
11
11
  ## Installation
12
12
 
13
13
  ```bash
14
+ # Using npm
14
15
  npm install @universityofmaryland/web-feeds-library
15
- # or
16
+
17
+ # Using yarn
16
18
  yarn add @universityofmaryland/web-feeds-library
17
19
  ```
18
20
 
19
- ## Features
21
+ ### Peer Dependencies
20
22
 
21
- - **Responsive Layouts**: Grid, list, and featured layouts that work across all screen sizes
22
- - **Multiple Feed Types**: Support for news, events, and academic content
23
- - **Customizable**: Theme options, column configuration, and layout variations
24
- - **Accessibility**: ARIA-compliant with screen reader support
25
- - **Lazy Loading**: Optional lazy loading for improved performance
23
+ For complete styling and functionality:
26
24
 
27
- ## Usage
25
+ ```bash
26
+ npm install @universityofmaryland/web-styles-library
27
+ npm install @universityofmaryland/web-elements-library
28
+ ```
28
29
 
29
- ### Basic Example
30
+ ## Quick Start
30
31
 
31
- ```typescript
32
- import * as Feeds from '@universityofmaryland/web-feeds-library';
32
+ ```javascript
33
+ import { news, events } from '@universityofmaryland/web-feeds-library';
33
34
 
34
- // Create a news grid component
35
- const newsGrid = Feeds.news.grid({
35
+ // Create a news grid
36
+ const newsGrid = news.grid({
36
37
  token: 'your-api-token',
37
38
  numberOfColumnsToShow: 3,
38
- isThemeDark: false,
39
+ isThemeDark: false
39
40
  });
40
41
 
41
- // Add to DOM
42
+ // Add to your page
42
43
  document.querySelector('.news-container').appendChild(newsGrid.element);
43
44
  ```
44
45
 
45
- ## Available Feed Components
46
+ ## Feed Types
46
47
 
47
48
  ### News Feeds
48
49
 
49
- ```typescript
50
- // Grid layout for news
51
- const newsGrid = Feeds.news.grid({ token: 'your-api-token' });
50
+ Display UMD news articles in various layouts:
52
51
 
53
- // List layout for news
54
- const newsList = Feeds.news.list({ token: 'your-api-token' });
52
+ ```javascript
53
+ import { news } from '@universityofmaryland/web-feeds-library';
55
54
 
56
- // Featured news layout with prominent article
57
- const newsFeatured = Feeds.news.featured({
55
+ // Grid layout - Responsive card grid
56
+ const newsGrid = news.grid({
57
+ token: 'your-api-token',
58
+ numberOfColumnsToShow: 3,
59
+ isThemeDark: false,
60
+ isTransparent: false
61
+ });
62
+
63
+ // List layout - Vertical article list
64
+ const newsList = news.list({
65
+ token: 'your-api-token',
66
+ showImages: true,
67
+ showDates: true
68
+ });
69
+
70
+ // Featured layout - Hero article with sidebar
71
+ const newsFeatured = news.featured({
58
72
  token: 'your-api-token',
59
73
  isLazyLoad: true,
74
+ isLayoutReversed: false,
75
+ overwriteStickyPosition: 100
60
76
  });
61
77
  ```
62
78
 
63
79
  ### Event Feeds
64
80
 
65
- ```typescript
66
- // Grid layout for events
67
- const eventsGrid = Feeds.events.grid({ token: 'your-api-token' });
81
+ Display UMD events with calendar integration:
68
82
 
69
- // List layout for events
70
- const eventsList = Feeds.events.list({ token: 'your-api-token' });
83
+ ```javascript
84
+ import { events } from '@universityofmaryland/web-feeds-library';
71
85
 
72
- // Slider for events
73
- const eventsSlider = Feeds.events.slider({ token: 'your-api-token' });
86
+ // Grid layout - Event cards
87
+ const eventsGrid = events.grid({
88
+ token: 'your-api-token',
89
+ numberOfColumnsToShow: 3,
90
+ showPastEvents: false
91
+ });
92
+
93
+ // List layout - Chronological list
94
+ const eventsList = events.list({
95
+ token: 'your-api-token',
96
+ groupByDate: true,
97
+ maxEvents: 10
98
+ });
99
+
100
+ // Slider - Horizontal scroll
101
+ const eventsSlider = events.slider({
102
+ token: 'your-api-token',
103
+ slidesToShow: 4,
104
+ autoPlay: true
105
+ });
74
106
  ```
75
107
 
76
108
  ### Academic Feeds
77
109
 
78
- ```typescript
79
- // Slider for academic events
80
- const academicSlider = Feeds.academic.slider({ token: 'your-api-token' });
110
+ Display academic programs and information:
111
+
112
+ ```javascript
113
+ import { academic } from '@universityofmaryland/web-feeds-library';
114
+
115
+ // Academic event slider
116
+ const academicSlider = academic.slider({
117
+ token: 'your-api-token',
118
+ department: 'engineering',
119
+ programType: 'graduate'
120
+ });
81
121
  ```
82
122
 
83
- ## Component Configuration
123
+ ## Integration with Other Packages
84
124
 
85
- All feed components accept these common properties:
125
+ ### Styles Package Integration
86
126
 
87
- - `token` (required): API token for authentication
88
- - `isThemeDark`: Enable dark theme styling (default: false)
89
- - `isTransparent`: Use transparent background for cards (default: false)
127
+ Feeds automatically use UMD styles for consistent appearance:
90
128
 
91
- Grid-specific options:
129
+ ```html
130
+ <!-- Feeds inherit grid and spacing utilities -->
131
+ <div class="umd-layout-space-vertical-landing">
132
+ <div id="news-feed"></div>
133
+ </div>
134
+ ```
135
+
136
+ ### Elements Package Usage
137
+
138
+ Feeds are built using Elements for rendering:
139
+ - Card elements for item display
140
+ - Grid layouts from layout elements
141
+ - Typography from text elements
92
142
 
93
- - `numberOfColumnsToShow`: Number of columns to display (default: 3)
143
+ ### Components Package Compatibility
94
144
 
95
- Featured layout options:
145
+ Feeds can be wrapped in web components:
146
+
147
+ ```javascript
148
+ import { Components } from '@universityofmaryland/web-components-library';
149
+ import { news } from '@universityofmaryland/web-feeds-library';
150
+
151
+ // Initialize feed component wrapper
152
+ Components.feed.newsList();
153
+ // Feed will render inside the component
154
+ ```
96
155
 
97
- - `isLazyLoad`: Enable lazy loading of additional content
98
- - `isLayoutReversed`: Reverse the layout order
99
- - `overwriteStickyPosition`: Custom sticky position value
156
+ ## Configuration Options
100
157
 
101
- ### Custom Filtering and Sorting
158
+ ### Common Properties
102
159
 
103
- You can customize how feed items are filtered and sorted:
160
+ All feeds accept these base properties:
104
161
 
105
162
  ```typescript
106
- import * as Feeds from '@universityofmaryland/web-feeds-library';
163
+ interface BaseFeedProps {
164
+ token: string; // Required: API authentication token
165
+ isThemeDark?: boolean; // Dark theme styling
166
+ isTransparent?: boolean; // Transparent card backgrounds
167
+ onError?: (error: Error) => void; // Error handler
168
+ onLoad?: (items: any[]) => void; // Load complete handler
169
+ }
170
+ ```
171
+
172
+ ### Layout-Specific Options
173
+
174
+ **Grid Layout:**
175
+ ```typescript
176
+ interface GridProps extends BaseFeedProps {
177
+ numberOfColumnsToShow?: number; // 1-4, default: 3
178
+ gapSize?: 'small' | 'medium' | 'large';
179
+ minCardHeight?: number;
180
+ }
181
+ ```
182
+
183
+ **List Layout:**
184
+ ```typescript
185
+ interface ListProps extends BaseFeedProps {
186
+ showImages?: boolean;
187
+ showDates?: boolean;
188
+ showExcerpts?: boolean;
189
+ maxItems?: number;
190
+ }
191
+ ```
192
+
193
+ **Featured Layout:**
194
+ ```typescript
195
+ interface FeaturedProps extends BaseFeedProps {
196
+ isLazyLoad?: boolean;
197
+ isLayoutReversed?: boolean;
198
+ overwriteStickyPosition?: number;
199
+ sidebarItemCount?: number;
200
+ }
201
+ ```
107
202
 
108
- const newsGrid = Feeds.news.grid({
203
+ ## Advanced Features
204
+
205
+ ### Filtering and Sorting
206
+
207
+ ```javascript
208
+ const filteredNews = news.grid({
109
209
  token: 'your-api-token',
110
210
  filters: {
111
211
  categories: ['research', 'campus-life'],
112
- tags: ['featured'],
212
+ tags: ['featured', 'students'],
113
213
  dateRange: {
114
- start: '2023-01-01',
115
- end: '2023-12-31',
214
+ start: new Date('2024-01-01'),
215
+ end: new Date('2024-12-31')
116
216
  },
217
+ author: 'John Doe'
117
218
  },
118
- sortBy: 'date', // 'date', 'title', 'popularity'
119
- sortDirection: 'desc', // 'asc' or 'desc'
219
+ sortBy: 'date', // 'date' | 'title' | 'popularity'
220
+ sortDirection: 'desc' // 'asc' | 'desc'
120
221
  });
121
222
  ```
122
223
 
123
224
  ### Event Handling
124
225
 
125
- All feed components emit events that you can listen for. You can use the standard event listeners or our utility functions for better TypeScript support:
126
-
127
- ```typescript
128
- import * as Feeds from '@universityofmaryland/web-feeds-library';
129
- import { events } from '@universityofmaryland/web-feeds-library/utilities';
130
-
131
- const eventsFeed = Feeds.events.list({ token: 'your-api-token' });
132
- const container = document.querySelector('.events-container');
133
- container.appendChild(eventsFeed.element);
226
+ ```javascript
227
+ import { events } from '@universityofmaryland/web-feeds-library';
134
228
 
135
- // Method 1: Standard event listener approach
136
- eventsFeed.element.addEventListener(events.eventNames.FEED_LOADED, (event) => {
137
- console.log('Feed loaded with', event.detail.items.length, 'items');
229
+ const eventsFeed = events.list({
230
+ token: 'your-api-token',
231
+ onLoad: (items) => {
232
+ console.log(`Loaded ${items.length} events`);
233
+ },
234
+ onError: (error) => {
235
+ console.error('Feed error:', error);
236
+ // Show fallback content
237
+ },
238
+ onItemClick: (item) => {
239
+ // Custom click handler
240
+ console.log('Clicked:', item.title);
241
+ }
138
242
  });
139
243
 
140
- eventsFeed.element.addEventListener(events.eventNames.FEED_ERROR, (event) => {
141
- console.error('Feed error:', event.detail.error);
244
+ // Listen for feed updates
245
+ eventsFeed.element.addEventListener('feed:update', (e) => {
246
+ console.log('Feed updated with new items');
142
247
  });
248
+ ```
143
249
 
144
- // Method 2: Using the utility helper (provides proper type information)
145
- events.listen(eventsFeed.element, events.eventNames.FEED_LOADED, (detail) => {
146
- console.log('Feed loaded with', detail.items.length, 'items');
250
+ ### Pagination
251
+
252
+ ```javascript
253
+ const paginatedNews = news.list({
254
+ token: 'your-api-token',
255
+ itemsPerPage: 10,
256
+ showPagination: true,
257
+ onPageChange: (page) => {
258
+ console.log(`Navigated to page ${page}`);
259
+ }
147
260
  });
261
+ ```
148
262
 
149
- // With cleanup function for easy removal
150
- const removeListener = events.listen(
151
- eventsFeed.element,
152
- events.eventNames.FEED_ERROR,
153
- (detail) => {
154
- console.error('Feed error:', detail.error);
155
- },
156
- );
263
+ ### Custom Templates
264
+
265
+ Override default item rendering:
157
266
 
158
- // Later you should remove the listener if needed
159
- // removeListener();
267
+ ```javascript
268
+ const customNews = news.grid({
269
+ token: 'your-api-token',
270
+ renderItem: (item) => {
271
+ return `
272
+ <div class="custom-news-item">
273
+ <h3>${item.title}</h3>
274
+ <time>${item.date}</time>
275
+ <p>${item.excerpt}</p>
276
+ </div>
277
+ `;
278
+ }
279
+ });
160
280
  ```
161
281
 
162
- ## Performance Considerations
282
+ ## Performance Features
163
283
 
164
- The Feeds library is optimized for performance:
284
+ ### Lazy Loading
165
285
 
166
- - Content is lazy-loaded when elements enter the viewport
167
- - Network requests are cached and debounced
168
- - Images are optimized and responsive
169
- - Content is efficiently rendered with minimal DOM operations
286
+ Load content as users scroll:
170
287
 
171
- ## Accessibility
288
+ ```javascript
289
+ const lazyFeed = news.featured({
290
+ token: 'your-api-token',
291
+ isLazyLoad: true,
292
+ lazyLoadOffset: 200 // pixels before viewport
293
+ });
294
+ ```
172
295
 
173
- All feed components are built with accessibility in mind:
296
+ ### Caching
174
297
 
175
- - WCAG 2.1 AA compliant
176
- - Proper semantic markup with ARIA attributes
177
- - Keyboard navigable
178
- - Screen reader announcements for dynamic content updates
179
- - Support for reduced motion preferences
298
+ Automatic caching reduces API calls:
180
299
 
181
- ## Testing
300
+ ```javascript
301
+ const cachedFeed = events.grid({
302
+ token: 'your-api-token',
303
+ cacheTimeout: 300000, // 5 minutes
304
+ forceFresh: false // Use cache if available
305
+ });
306
+ ```
182
307
 
183
- The library uses Jest for unit testing. To run tests:
308
+ ### Infinite Scroll
184
309
 
185
- ```bash
186
- # Run all tests
187
- npm run test
310
+ ```javascript
311
+ const infiniteFeed = news.list({
312
+ token: 'your-api-token',
313
+ enableInfiniteScroll: true,
314
+ infiniteScrollThreshold: 100 // pixels from bottom
315
+ });
316
+ ```
188
317
 
189
- # Run tests in watch mode during development
190
- npm run test:watch
318
+ ## TypeScript Support
191
319
 
192
- # Run tests with coverage report
193
- npm run test:coverage
320
+ Full TypeScript definitions included:
321
+
322
+ ```typescript
323
+ import type {
324
+ NewsFeedProps,
325
+ EventsFeedProps,
326
+ FeedItem,
327
+ FeedEvents
328
+ } from '@universityofmaryland/web-feeds-library';
329
+
330
+ const newsProps: NewsFeedProps = {
331
+ token: 'token',
332
+ numberOfColumnsToShow: 3,
333
+ isThemeDark: false
334
+ };
194
335
  ```
195
336
 
196
- ## Release Process
337
+ ## Browser Support
197
338
 
198
- The release process requires all tests to pass before publishing:
339
+ - Chrome 90+
340
+ - Firefox 88+
341
+ - Safari 14+
342
+ - Edge 90+
343
+
344
+ ## Accessibility
345
+
346
+ All feed components are WCAG 2.1 AA compliant:
347
+ - Semantic HTML markup
348
+ - ARIA live regions for updates
349
+ - Keyboard navigation
350
+ - Screen reader announcements
351
+ - Skip links for long lists
352
+
353
+ ## Documentation
354
+
355
+ - **[Feed Components](https://umd-digital.github.io/design-system/docs/feeds/)** - Complete reference
356
+ - **[API Documentation](https://umd-digital.github.io/design-system/docs/feeds/modules/)** - TypeScript APIs
357
+ - **[Integration Examples](https://github.com/umd-digital/design-system/tree/main/packages/feeds/examples)** - Sample implementations
358
+ - **[Design System](https://designsystem.umd.edu)** - Full design system docs
359
+
360
+ ## Testing
199
361
 
200
362
  ```bash
201
- npm run release
202
- ```
363
+ # Run tests
364
+ npm test
203
365
 
204
- This will:
366
+ # Watch mode
367
+ npm run test:watch
205
368
 
206
- 1. Run all tests (and abort if any tests fail)
207
- 2. Clean the distribution directory
208
- 3. Build the project
209
- 4. Publish the package
369
+ # Coverage report
370
+ npm run test:coverage
371
+ ```
210
372
 
211
373
  ## Contributing
212
374
 
213
- For contribution guidelines, please refer to the main repository README.
375
+ See the [main repository](https://github.com/umd-digital/design-system) for contribution guidelines.
214
376
 
215
377
  ## License
216
378
 
217
- This project is licensed under the University of Maryland license.
379
+ University of Maryland
@@ -39,6 +39,7 @@ export declare const display: ({ entry, isThemeDark, }: {
39
39
  text: HTMLDivElement | null;
40
40
  eventMeta: {
41
41
  element: HTMLElement;
42
+ className: string;
42
43
  styles: string;
43
44
  };
44
45
  isThemeDark: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../source/composite/events/common/data.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,SAAS,CAAC;AACrC,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,WAAW,EACZ,MAAM,WAAW,CAAC;AAEnB,UAAU,aAAc,SAAQ,YAAY;IAC1C,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD;AAED,UAAU,YAAa,SAAQ,WAAW;CAAG;AAE7C,eAAO,MAAM,iBAAiB,UAAW,aAAa;;;;;;;;;;;;;;;;;;;;;;;CAMpD,CAAC;AAEH,eAAO,MAAM,YAAY,UAChB,YAAY,KAClB,SAAS,CAAC,oBAuBZ,CAAC;AAEF,eAAO,MAAM,OAAO,4BAGjB;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;;;;;;;;CAWC,CAAC"}
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../source/composite/events/common/data.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,SAAS,CAAC;AACrC,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,WAAW,EACZ,MAAM,WAAW,CAAC;AAEnB,UAAU,aAAc,SAAQ,YAAY;IAC1C,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD;AAED,UAAU,YAAa,SAAQ,WAAW;CAAG;AAE7C,eAAO,MAAM,iBAAiB,UAAW,aAAa;;;;;;;;;;;;;;;;;;;;;;;CAMpD,CAAC;AAEH,eAAO,MAAM,YAAY,UAChB,YAAY,KAClB,SAAS,CAAC,oBAuBZ,CAAC;AAEF,eAAO,MAAM,OAAO,4BAGjB;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;;;;;;;;;CAWC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@universityofmaryland/web-feeds-library",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "UMD Feed Elements",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -24,12 +24,6 @@
24
24
  "test:snapshot": "jest --updateSnapshot"
25
25
  },
26
26
  "dependencies": {
27
- "@types/postcss-js": "^4.0.4",
28
- "postcss-js": "^4.0.1",
29
- "tw-to-css": "^0.0.12"
30
- },
31
- "peerDependencies": {
32
- "@universityofmaryland/web-elements-library": "*",
33
- "@universityofmaryland/web-styles-library": "^1.1.0"
27
+ "@types/postcss-js": "^4.0.4"
34
28
  }
35
29
  }