tkeron 4.0.0-beta.9 → 4.0.0

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.
Files changed (81) hide show
  1. package/{readme.md → README.md} +36 -4
  2. package/bun.lock +23 -21
  3. package/changelog.md +274 -8
  4. package/docs/best-practices.md +127 -101
  5. package/docs/cli-reference.md +58 -38
  6. package/docs/components-html.md +30 -24
  7. package/docs/components-typescript.md +110 -79
  8. package/docs/getting-started.md +24 -18
  9. package/docs/mcp-server.md +19 -36
  10. package/docs/overview.md +16 -10
  11. package/docs/pre-rendering.md +163 -157
  12. package/docs/testing.md +331 -0
  13. package/examples/basic_build/src/index.ts +5 -5
  14. package/examples/with_assets/src/index.ts +5 -5
  15. package/examples/with_com_html_priority/src/admin/admin-panel.com.html +1 -1
  16. package/examples/with_com_html_priority/src/admin/dashboard.html +16 -16
  17. package/examples/with_com_html_priority/src/admin/nested-stat.com.html +1 -1
  18. package/examples/with_com_html_priority/src/admin/site-header.com.html +1 -1
  19. package/examples/with_com_html_priority/src/blog/comment-item.com.html +1 -1
  20. package/examples/with_com_html_priority/src/blog/comment-section.com.html +1 -1
  21. package/examples/with_com_html_priority/src/blog/post.html +22 -19
  22. package/examples/with_com_html_priority/src/index.html +15 -15
  23. package/examples/with_com_html_priority/src/info-box.com.html +1 -1
  24. package/examples/with_com_html_priority/src/site-header.com.html +1 -1
  25. package/examples/with_com_mixed_priority/src/dashboard/main.html +17 -17
  26. package/examples/with_com_mixed_priority/src/dashboard/stats-widget.com.ts +1 -1
  27. package/examples/with_com_mixed_priority/src/footer-info.com.html +3 -1
  28. package/examples/with_com_mixed_priority/src/index.html +16 -16
  29. package/examples/with_com_mixed_priority/src/page-header.com.html +8 -1
  30. package/examples/with_com_mixed_priority/src/settings/config.html +16 -16
  31. package/examples/with_com_mixed_priority/src/settings/priority-test.com.html +3 -1
  32. package/examples/with_com_mixed_priority/src/users/profiles/activity-feed.com.ts +7 -3
  33. package/examples/with_com_mixed_priority/src/users/profiles/page-header.com.html +8 -1
  34. package/examples/with_com_mixed_priority/src/users/profiles/profile-actions.com.html +45 -4
  35. package/examples/with_com_mixed_priority/src/users/profiles/user-profile.com.ts +1 -1
  36. package/examples/with_com_mixed_priority/src/users/profiles/view.html +17 -17
  37. package/examples/with_com_ts/src/index.html +15 -11
  38. package/examples/with_com_ts_priority/src/analytics/chart-widget.com.ts +7 -5
  39. package/examples/with_com_ts_priority/src/analytics/report.html +16 -16
  40. package/examples/with_com_ts_priority/src/analytics/user-stats.com.ts +1 -1
  41. package/examples/with_com_ts_priority/src/data-table.com.ts +7 -4
  42. package/examples/with_com_ts_priority/src/index.html +15 -15
  43. package/examples/with_com_ts_priority/src/sales/regional/data-table.com.ts +8 -5
  44. package/examples/with_com_ts_priority/src/sales/regional/overview.html +16 -16
  45. package/examples/with_com_ts_priority/src/sales/regional/sales-summary.com.ts +7 -4
  46. package/examples/with_com_ts_priority/src/user-stats.com.ts +1 -1
  47. package/examples/with_component_iteration/src/card-list.com.ts +40 -12
  48. package/examples/with_component_iteration/src/engagement-meter.com.ts +11 -6
  49. package/examples/with_component_iteration/src/index.html +108 -51
  50. package/examples/with_component_iteration/src/index.ts +1 -1
  51. package/examples/with_component_iteration/src/note-box.com.html +12 -2
  52. package/examples/with_component_iteration/src/status-badge.com.ts +14 -7
  53. package/examples/with_component_iteration/src/user-card.com.ts +10 -9
  54. package/examples/with_pre/src/contact.pre.ts +3 -3
  55. package/examples/with_pre/src/index.ts +5 -5
  56. package/examples/with_pre/src/section/index.pre.ts +2 -4
  57. package/index.ts +31 -40
  58. package/mcp-server.ts +168 -445
  59. package/package.json +19 -8
  60. package/src/banner.ts +5 -4
  61. package/src/build.ts +29 -29
  62. package/src/buildDir.ts +36 -18
  63. package/src/buildEntrypoints.ts +17 -6
  64. package/src/buildWrapper.ts +21 -0
  65. package/src/cleanupOrphanedTempDirs.ts +31 -0
  66. package/src/createTestLogger.ts +24 -0
  67. package/src/develop.ts +47 -46
  68. package/src/getBuildResult.ts +146 -0
  69. package/src/index.ts +7 -0
  70. package/src/init.ts +39 -42
  71. package/src/initWrapper.ts +39 -26
  72. package/src/logger.ts +4 -11
  73. package/src/loggerObj.ts +13 -0
  74. package/src/processCom.ts +136 -108
  75. package/src/processComTs.ts +173 -151
  76. package/src/processPre.ts +24 -27
  77. package/src/promptUser.ts +15 -0
  78. package/src/setupSigintHandler.ts +6 -0
  79. package/src/silentLogger.ts +8 -0
  80. package/tests/test-helpers.ts +30 -0
  81. package/funciones.md +0 -63
@@ -1,4 +1,6 @@
1
- <div style="background: #e74c3c; color: white; padding: 1rem; border-radius: 8px;">
1
+ <div
2
+ style="background: #e74c3c; color: white; padding: 1rem; border-radius: 8px"
3
+ >
2
4
  <h3>This is the HTML component</h3>
3
5
  <p>If you see this, the .com.ts version was NOT used</p>
4
6
  </div>
@@ -2,10 +2,12 @@ const activities = [
2
2
  { action: "Updated profile", time: "2 hours ago", icon: "✏️" },
3
3
  { action: "Posted a comment", time: "5 hours ago", icon: "💬" },
4
4
  { action: "Uploaded a file", time: "1 day ago", icon: "📁" },
5
- { action: "Joined the platform", time: "2 weeks ago", icon: "🎉" }
5
+ { action: "Joined the platform", time: "2 weeks ago", icon: "🎉" },
6
6
  ];
7
7
 
8
- const items = activities.map(act => `
8
+ const items = activities
9
+ .map(
10
+ (act) => `
9
11
  <div style="padding: 1rem; border-bottom: 1px solid #ecf0f1; display: flex; align-items: center; gap: 1rem;">
10
12
  <div style="font-size: 1.5rem;">${act.icon}</div>
11
13
  <div style="flex: 1;">
@@ -13,7 +15,9 @@ const items = activities.map(act => `
13
15
  <div style="font-size: 0.875rem; color: #666;">${act.time}</div>
14
16
  </div>
15
17
  </div>
16
- `).join('');
18
+ `,
19
+ )
20
+ .join("");
17
21
 
18
22
  com.innerHTML = `
19
23
  <div style="border: 2px solid #9b59b6; padding: 1rem; margin: 1rem 0; border-radius: 8px;">
@@ -1,4 +1,11 @@
1
- <header style="background: linear-gradient(90deg, #11998e 0%, #38ef7d 100%); color: white; padding: 2rem; text-align: center;">
1
+ <header
2
+ style="
3
+ background: linear-gradient(90deg, #11998e 0%, #38ef7d 100%);
4
+ color: white;
5
+ padding: 2rem;
6
+ text-align: center;
7
+ "
8
+ >
2
9
  <h2>👤 Profile Header (Deep Local HTML Override)</h2>
3
10
  <p>This HTML component is from users/profiles/ directory</p>
4
11
  </header>
@@ -1,5 +1,46 @@
1
- <div style="display: flex; gap: 0.5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #ddd;">
2
- <button style="padding: 0.5rem 1rem; background: #11998e; color: white; border: none; border-radius: 4px; cursor: pointer;">Edit Profile</button>
3
- <button style="padding: 0.5rem 1rem; background: #3498db; color: white; border: none; border-radius: 4px; cursor: pointer;">View Activity</button>
4
- <button style="padding: 0.5rem 1rem; background: #95a5a6; color: white; border: none; border-radius: 4px; cursor: pointer;">Settings</button>
1
+ <div
2
+ style="
3
+ display: flex;
4
+ gap: 0.5rem;
5
+ margin-top: 1rem;
6
+ padding-top: 1rem;
7
+ border-top: 1px solid #ddd;
8
+ "
9
+ >
10
+ <button
11
+ style="
12
+ padding: 0.5rem 1rem;
13
+ background: #11998e;
14
+ color: white;
15
+ border: none;
16
+ border-radius: 4px;
17
+ cursor: pointer;
18
+ "
19
+ >
20
+ Edit Profile
21
+ </button>
22
+ <button
23
+ style="
24
+ padding: 0.5rem 1rem;
25
+ background: #3498db;
26
+ color: white;
27
+ border: none;
28
+ border-radius: 4px;
29
+ cursor: pointer;
30
+ "
31
+ >
32
+ View Activity
33
+ </button>
34
+ <button
35
+ style="
36
+ padding: 0.5rem 1rem;
37
+ background: #95a5a6;
38
+ color: white;
39
+ border: none;
40
+ border-radius: 4px;
41
+ cursor: pointer;
42
+ "
43
+ >
44
+ Settings
45
+ </button>
5
46
  </div>
@@ -3,7 +3,7 @@ const user = {
3
3
  email: "jane@example.com",
4
4
  role: "Administrator",
5
5
  joined: "January 2024",
6
- avatar: "👩‍💼"
6
+ avatar: "👩‍💼",
7
7
  };
8
8
 
9
9
  com.innerHTML = `
@@ -1,19 +1,19 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Profile - Nested Priority</title>
7
- </head>
8
- <body>
9
- <h1>User Profile</h1>
10
-
11
- <section>
12
- <h2>Deep Nesting with Both Component Types</h2>
13
- <page-header></page-header>
14
- <user-profile></user-profile>
15
- <activity-feed></activity-feed>
16
- <footer-info></footer-info>
17
- </section>
18
- </body>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Profile - Nested Priority</title>
7
+ </head>
8
+ <body>
9
+ <h1>User Profile</h1>
10
+
11
+ <section>
12
+ <h2>Deep Nesting with Both Component Types</h2>
13
+ <page-header></page-header>
14
+ <user-profile></user-profile>
15
+ <activity-feed></activity-feed>
16
+ <footer-info></footer-info>
17
+ </section>
18
+ </body>
19
19
  </html>
@@ -1,18 +1,22 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>TypeScript Components Example</title>
7
- </head>
8
- <body>
7
+ </head>
8
+ <body>
9
9
  <h1>TypeScript Components Demo</h1>
10
-
11
- <user-card data-name="Alice" data-role="Developer" data-age="28"></user-card>
10
+
11
+ <user-card
12
+ data-name="Alice"
13
+ data-role="Developer"
14
+ data-age="28"
15
+ ></user-card>
12
16
  <user-card data-name="Bob" data-role="Designer" data-age="32"></user-card>
13
-
17
+
14
18
  <dynamic-list></dynamic-list>
15
-
19
+
16
20
  <greeting-message data-name="World"></greeting-message>
17
- </body>
21
+ </body>
18
22
  </html>
@@ -5,12 +5,13 @@ const dataPoints = [
5
5
  { label: "Tue", value: 200 },
6
6
  { label: "Wed", value: 150 },
7
7
  { label: "Thu", value: 300 },
8
- { label: "Fri", value: 250 }
8
+ { label: "Fri", value: 250 },
9
9
  ];
10
10
 
11
- const bars = dataPoints.map(point => {
12
- const height = (point.value / 300) * 100;
13
- return `
11
+ const bars = dataPoints
12
+ .map((point) => {
13
+ const height = (point.value / 300) * 100;
14
+ return `
14
15
  <div style="display: flex; flex-direction: column; align-items: center;">
15
16
  <div style="height: 150px; display: flex; align-items: flex-end;">
16
17
  <div style="width: 40px; height: ${height}%; background: #667eea;"></div>
@@ -19,7 +20,8 @@ const bars = dataPoints.map(point => {
19
20
  <div style="font-size: 0.75rem; color: #666;">${point.value}</div>
20
21
  </div>
21
22
  `;
22
- }).join('');
23
+ })
24
+ .join("");
23
25
 
24
26
  com.innerHTML = `
25
27
  <div style="border: 3px solid #667eea; padding: 1rem; margin: 1rem 0; border-radius: 8px;">
@@ -1,18 +1,18 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Analytics Dashboard</title>
7
- </head>
8
- <body>
9
- <h1>Analytics Dashboard</h1>
10
-
11
- <section>
12
- <h2>Local Components Override Root</h2>
13
- <user-stats></user-stats>
14
- <data-table></data-table>
15
- <chart-widget type="bar"></chart-widget>
16
- </section>
17
- </body>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Analytics Dashboard</title>
7
+ </head>
8
+ <body>
9
+ <h1>Analytics Dashboard</h1>
10
+
11
+ <section>
12
+ <h2>Local Components Override Root</h2>
13
+ <user-stats></user-stats>
14
+ <data-table></data-table>
15
+ <chart-widget type="bar"></chart-widget>
16
+ </section>
17
+ </body>
18
18
  </html>
@@ -2,7 +2,7 @@ const stats = {
2
2
  total: 5000,
3
3
  active: 4200,
4
4
  premium: 800,
5
- growth: "+15%"
5
+ growth: "+15%",
6
6
  };
7
7
 
8
8
  com.innerHTML = `
@@ -1,12 +1,15 @@
1
1
  const data = [
2
2
  { id: 1, name: "Item A", value: 100 },
3
3
  { id: 2, name: "Item B", value: 200 },
4
- { id: 3, name: "Item C", value: 300 }
4
+ { id: 3, name: "Item C", value: 300 },
5
5
  ];
6
6
 
7
- const rows = data.map(item =>
8
- `<tr><td>${item.id}</td><td>${item.name}</td><td>${item.value}</td></tr>`
9
- ).join('');
7
+ const rows = data
8
+ .map(
9
+ (item) =>
10
+ `<tr><td>${item.id}</td><td>${item.name}</td><td>${item.value}</td></tr>`,
11
+ )
12
+ .join("");
10
13
 
11
14
  com.innerHTML = `
12
15
  <div style="border: 2px solid #3498db; padding: 1rem; margin: 1rem 0;">
@@ -1,17 +1,17 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Component Priority - TypeScript Components</title>
7
- </head>
8
- <body>
9
- <h1>TypeScript Component Priority Demo</h1>
10
-
11
- <section>
12
- <h2>Root Level Components</h2>
13
- <user-stats></user-stats>
14
- <data-table></data-table>
15
- </section>
16
- </body>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Component Priority - TypeScript Components</title>
7
+ </head>
8
+ <body>
9
+ <h1>TypeScript Component Priority Demo</h1>
10
+
11
+ <section>
12
+ <h2>Root Level Components</h2>
13
+ <user-stats></user-stats>
14
+ <data-table></data-table>
15
+ </section>
16
+ </body>
17
17
  </html>
@@ -2,16 +2,19 @@ const regionalData = [
2
2
  { region: "North", sales: 45000, orders: 123 },
3
3
  { region: "South", sales: 38000, orders: 98 },
4
4
  { region: "East", sales: 52000, orders: 145 },
5
- { region: "West", sales: 41000, orders: 110 }
5
+ { region: "West", sales: 41000, orders: 110 },
6
6
  ];
7
7
 
8
- const rows = regionalData.map(item =>
9
- `<tr style="border-bottom: 1px solid #ecf0f1;">
8
+ const rows = regionalData
9
+ .map(
10
+ (item) =>
11
+ `<tr style="border-bottom: 1px solid #ecf0f1;">
10
12
  <td style="padding: 0.75rem;">${item.region}</td>
11
13
  <td style="padding: 0.75rem;">$${item.sales.toLocaleString()}</td>
12
14
  <td style="padding: 0.75rem;">${item.orders}</td>
13
- </tr>`
14
- ).join('');
15
+ </tr>`,
16
+ )
17
+ .join("");
15
18
 
16
19
  com.innerHTML = `
17
20
  <div style="border: 3px solid #e74c3c; padding: 1rem; margin: 1rem 0; border-radius: 8px;">
@@ -1,18 +1,18 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Sales Overview</title>
7
- </head>
8
- <body>
9
- <h1>Sales Overview</h1>
10
-
11
- <section>
12
- <h2>Multi-level Nesting</h2>
13
- <user-stats></user-stats>
14
- <data-table></data-table>
15
- <sales-summary></sales-summary>
16
- </section>
17
- </body>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Sales Overview</title>
7
+ </head>
8
+ <body>
9
+ <h1>Sales Overview</h1>
10
+
11
+ <section>
12
+ <h2>Multi-level Nesting</h2>
13
+ <user-stats></user-stats>
14
+ <data-table></data-table>
15
+ <sales-summary></sales-summary>
16
+ </section>
17
+ </body>
18
18
  </html>
@@ -2,14 +2,17 @@ const regions = ["North", "South", "East", "West"];
2
2
  const totalSales = 176000;
3
3
  const avgPerRegion = totalSales / regions.length;
4
4
 
5
- const regionCards = regions.map(region =>
6
- `<div style="background: #f8f9fa; padding: 0.75rem; border-radius: 4px; text-align: center;">
5
+ const regionCards = regions
6
+ .map(
7
+ (region) =>
8
+ `<div style="background: #f8f9fa; padding: 0.75rem; border-radius: 4px; text-align: center;">
7
9
  <strong>${region}</strong>
8
10
  <div style="font-size: 0.875rem; color: #666; margin-top: 0.25rem;">
9
11
  ~$${avgPerRegion.toLocaleString()}
10
12
  </div>
11
- </div>`
12
- ).join('');
13
+ </div>`,
14
+ )
15
+ .join("");
13
16
 
14
17
  com.innerHTML = `
15
18
  <div style="background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: white; padding: 1.5rem; border-radius: 12px; margin: 1rem 0;">
@@ -1,7 +1,7 @@
1
1
  const stats = {
2
2
  total: 1000,
3
3
  active: 750,
4
- pending: 250
4
+ pending: 250,
5
5
  };
6
6
 
7
7
  com.innerHTML = `
@@ -1,34 +1,62 @@
1
1
  // ITERATION 1: This .com.ts fetches/processes data and generates dynamic content
2
2
  // It simulates fetching user data and calculates statistics
3
3
 
4
- const count = parseInt(com.getAttribute('count') || '5');
4
+ const count = parseInt(com.getAttribute("count") || "5");
5
5
 
6
6
  // Simulating data processing - real TS logic here
7
7
  const users = [
8
- { name: 'Alice Johnson', role: 'admin', loginCount: 342, lastLogin: Date.now() - 2 * 60 * 60 * 1000 },
9
- { name: 'Bob Smith', role: 'user', loginCount: 128, lastLogin: Date.now() - 5 * 60 * 60 * 1000 },
10
- { name: 'Carol White', role: 'moderator', loginCount: 256, lastLogin: Date.now() - 1 * 60 * 60 * 1000 },
11
- { name: 'David Brown', role: 'user', loginCount: 89, lastLogin: Date.now() - 24 * 60 * 60 * 1000 },
12
- { name: 'Eve Davis', role: 'admin', loginCount: 512, lastLogin: Date.now() - 30 * 60 * 1000 }
8
+ {
9
+ name: "Alice Johnson",
10
+ role: "admin",
11
+ loginCount: 342,
12
+ lastLogin: Date.now() - 30 * 60 * 1000,
13
+ }, // 30min ago - online
14
+ {
15
+ name: "Bob Smith",
16
+ role: "user",
17
+ loginCount: 128,
18
+ lastLogin: Date.now() - 5 * 60 * 60 * 1000,
19
+ },
20
+ {
21
+ name: "Carol White",
22
+ role: "moderator",
23
+ loginCount: 256,
24
+ lastLogin: Date.now() - 1 * 60 * 60 * 1000,
25
+ },
26
+ {
27
+ name: "David Brown",
28
+ role: "user",
29
+ loginCount: 89,
30
+ lastLogin: Date.now() - 24 * 60 * 60 * 1000,
31
+ },
32
+ {
33
+ name: "Eve Davis",
34
+ role: "admin",
35
+ loginCount: 512,
36
+ lastLogin: Date.now() - 30 * 60 * 1000,
37
+ },
13
38
  ];
14
39
 
15
40
  // TypeScript processing: calculate engagement score
16
- const processedUsers = users.slice(0, count).map(user => {
41
+ const processedUsers = users.slice(0, count).map((user) => {
17
42
  const hoursAgo = Math.floor((Date.now() - user.lastLogin) / (1000 * 60 * 60));
18
- const engagementScore = Math.min(100, Math.floor((user.loginCount / 10) + (24 - Math.min(hoursAgo, 24)) * 2));
19
-
43
+ const engagementScore = Math.min(
44
+ 100,
45
+ Math.floor(user.loginCount / 10 + (24 - Math.min(hoursAgo, 24)) * 2),
46
+ );
47
+
20
48
  return {
21
49
  ...user,
22
50
  hoursAgo,
23
51
  engagementScore,
24
- status: hoursAgo < 1 ? 'online' : hoursAgo < 24 ? 'recent' : 'away'
52
+ status: hoursAgo < 1 ? "online" : hoursAgo < 24 ? "recent" : "away",
25
53
  };
26
54
  });
27
55
 
28
56
  // Generate <user-card> components with computed data
29
57
  let html = '<div style="display: grid; gap: 1rem;">';
30
58
 
31
- processedUsers.forEach(user => {
59
+ processedUsers.forEach((user) => {
32
60
  // Each user-card will be processed by user-card.com.html (static template)
33
61
  html += `<user-card
34
62
  name="${user.name}"
@@ -39,6 +67,6 @@ processedUsers.forEach(user => {
39
67
  </user-card>`;
40
68
  });
41
69
 
42
- html += '</div>';
70
+ html += "</div>";
43
71
 
44
72
  com.innerHTML = html;
@@ -1,23 +1,28 @@
1
1
  // ITERATION 3: This .com.ts processes <engagement-meter> and performs CALCULATIONS
2
2
  // Real TypeScript processing: percentage calculations, conditional rendering
3
3
 
4
- const engagement = parseInt(com.getAttribute('engagement') || '0');
4
+ const engagement = parseInt(com.getAttribute("engagement") || "0");
5
5
 
6
6
  // TypeScript calculations and logic
7
7
  const percentage = Math.min(100, Math.max(0, engagement));
8
- const level = percentage >= 75 ? 'high' : percentage >= 40 ? 'medium' : 'low';
8
+ const level = percentage >= 75 ? "high" : percentage >= 40 ? "medium" : "low";
9
9
 
10
10
  // Conditional color based on calculated level
11
11
  const colors = {
12
- high: { bar: '#27ae60', bg: '#d5f4e6', text: '#27ae60' },
13
- medium: { bar: '#f39c12', bg: '#fef5e7', text: '#f39c12' },
14
- low: { bar: '#e74c3c', bg: '#fadbd8', text: '#e74c3c' }
12
+ high: { bar: "#27ae60", bg: "#d5f4e6", text: "#27ae60" },
13
+ medium: { bar: "#f39c12", bg: "#fef5e7", text: "#f39c12" },
14
+ low: { bar: "#e74c3c", bg: "#fadbd8", text: "#e74c3c" },
15
15
  };
16
16
 
17
17
  const color = colors[level];
18
18
 
19
19
  // TypeScript string manipulation and template generation
20
- const label = level === 'high' ? '🔥 Active' : level === 'medium' ? '📊 Moderate' : '💤 Low';
20
+ const label =
21
+ level === "high"
22
+ ? "🔥 Active"
23
+ : level === "medium"
24
+ ? "📊 Moderate"
25
+ : "💤 Low";
21
26
 
22
27
  com.innerHTML = `
23
28
  <div style="margin: 0.5rem 0;">