@techninja/clearstack 0.3.45 → 0.3.46

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.
@@ -79,12 +79,16 @@ export function buildContext(config, itemData, site) {
79
79
  const emoji = /** @type {string} */ (item.emoji || itemData.emoji || '');
80
80
  const tags = /** @type {string[]} */ (item.tags || itemData.tags || []);
81
81
  const tagsHtml = tags.map((t) => `<div class="tag">#${t}</div>`).join('');
82
- const postTitle = item.title || item.caption || item.name || '';
83
- const logoSrc = item.logo?.wordmark || item.logo?.mark || '';
82
+ const postTitle = /** @type {string} */ (item.title || item.caption || item.name || '');
83
+ const logo = /** @type {{wordmark?: string, mark?: string}} */ (item.logo || {});
84
+ const logoSrc = logo.wordmark || logo.mark || '';
84
85
  const itemLogoHtml = logoSrc ? `<img src="${logoSrc}" alt="${postTitle}">` : '';
85
- const dateFormatted = item.date ? new Date(item.date).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }) : '';
86
- const mediaUrl = resolvedImage || (item.files?.[0] ? `https://data.tn42.com/assets-media/${item.files[0]}` : '');
87
- const isVideo = item.type === 'video' || (item.files?.[0] || '').endsWith('.mp4');
86
+ const rawDate = /** @type {string|number} */ (item.date || '');
87
+ const dateFormatted = rawDate ? new Date(rawDate).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }) : '';
88
+ const files = /** @type {string[]} */ (item.files || []);
89
+ const mediaUrl = resolvedImage || (files[0] ? `https://data.tn42.com/assets-media/${files[0]}` : '');
90
+ const isVideo = item.type === 'video' || (files[0] || '').endsWith('.mp4');
91
+ const price = /** @type {number} */ (item.price || 0);
88
92
 
89
93
  return {
90
94
  ...itemData, ...item,
@@ -105,7 +109,7 @@ export function buildContext(config, itemData, site) {
105
109
  : mediaUrl ? `<img src="${mediaUrl}" style="position:absolute;inset:0;width:100%;height:100%;object-fit:cover">` : '',
106
110
  variantsFormatted: formatNum(item.expected_variants),
107
111
  uniqueFormatted: formatNum(item.estimated_unique_variants),
108
- priceFormatted: item.price ? `$${(item.price / 100).toFixed(2)}` : '',
112
+ priceFormatted: price ? `$${(price / 100).toFixed(2)}` : '',
109
113
  imageHtml: resolvedImage ? `<img class="hero" src="${resolvedImage}">` : '',
110
114
  cardClass: resolvedImage ? 'card-with-image' : '',
111
115
  siteLogo: site.logo ? `<img class="logo" src="${site.logo}">` : '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techninja/clearstack",
3
- "version": "0.3.45",
3
+ "version": "0.3.46",
4
4
  "type": "module",
5
5
  "description": "A no-build web component framework specification — scaffold, validate, and evolve spec-compliant projects",
6
6
  "bin": {