server-time-timer-yolabs-ui 1.0.8 → 1.0.9

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 (2) hide show
  1. package/README.md +147 -52
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,51 +1,53 @@
1
1
 
2
-
3
2
  # ⏱️ server-time-timer-yolabs-ui
4
3
 
5
- ** SharePoint styled React countdown timer UI for `server-time-timer-yolabs`**
4
+ **SharePoint-styled React countdown timer UI built on top of `server-time-timer-yolabs`.**
6
5
 
7
- Professional, **enterprise-grade React UI** for server-synchronized countdowns. Fully dynamic, customizable, and framework-agnostic core logic.
6
+ A **professional, enterprise-grade React UI** for **server-synchronized countdown timers**.
7
+ Designed for **accuracy, consistency, and corporate dashboards**.
8
8
 
9
9
  ---
10
10
 
11
11
  ## 🚀 Why Use This UI?
12
12
 
13
- Unlike traditional timers relying on the **client clock**:
13
+ Unlike traditional timers that rely on the **client’s local clock**, this UI uses **server time as the single source of truth**.
14
+
15
+ ### ✅ Key Advantages
14
16
 
15
- * 🔒 **Server time is the single source of truth** → accurate across devices
16
- * 🌍 **Same countdown across all platforms**
17
- * 🧩 **Dynamic sizes, layouts, themes, and colors**
18
- * ⚡ **Optional progress bar**
19
- * 🕒 **Optional units** (days, hours, minutes, seconds)
20
- * 🏢 **Enterprise-ready design** with FluentUI / SharePoint style
17
+ * 🔒 **Server-trusted time** → no client clock manipulation
18
+ * 🌍 **Consistent countdown across all devices**
19
+ * 🧩 **Dynamic layouts, sizes, themes, and colors**
20
+ * ⚡ **Optional animated progress bar**
21
+ * 🕒 **Configurable units** (days, hours, minutes, seconds)
22
+ * 🏢 **Enterprise UI** inspired by Fluent UI / SharePoint
21
23
 
22
24
  ---
23
25
 
24
- ### ⚡ Difference From Other Timers
26
+ ## ⚡ Difference From Other Timers
25
27
 
26
- | Feature | Normal Timers | `server-time-timer-yolabs-ui` |
27
- | -------------------------- | --------------- | --------------------------------- |
28
- | Source of Time | Client | Server (trusted) |
29
- | Consistency Across Devices | ❌ Can differ | ✅ Always same |
30
- | Drift Handling | ❌ None | ✅ Automatic correction |
31
- | Layouts | ❌ Fixed | ✅ Horizontal / Vertical / Compact |
32
- | Unit Display | ❌ Fixed | ✅ Optional per unit |
33
- | Progress Bar | ❌ Not built-in | ✅ Optional & dynamic |
34
- | Enterprise UI | ❌ Simple | ✅ SharePoint style |
35
- | Security | ❌ Easy to cheat | ✅ Resistant to manipulation |
28
+ | Feature | Normal Timers | server-time-timer-yolabs-ui |
29
+ | ------------------------ | --------------- | --------------------------------- |
30
+ | Time Source | Client | **Server (trusted)** |
31
+ | Cross-Device Consistency | ❌ Can differ | ✅ Always same |
32
+ | Time Drift Handling | ❌ None | ✅ Auto-corrected |
33
+ | Layouts | ❌ Fixed | ✅ Horizontal / Vertical / Compact |
34
+ | Unit Visibility | ❌ Fixed | ✅ Per-unit control |
35
+ | Progress Bar | ❌ Missing | ✅ Built-in |
36
+ | Enterprise Styling | ❌ Basic | ✅ SharePoint-style |
37
+ | Tamper Resistance | ❌ Easy to cheat | ✅ Secure |
36
38
 
37
39
  ---
38
40
 
39
41
  ## 📦 Installation
40
42
 
41
43
  ```bash
42
- npm install server-time-timer-yolabs-ui
44
+ npm install server-time-timer-yolabs-ui
43
45
  ```
44
46
 
45
47
  or
46
48
 
47
49
  ```bash
48
- yarn add server-time-timer-yolabs-ui
50
+ yarn add server-time-timer-yolabs-ui
49
51
  ```
50
52
 
51
53
  ---
@@ -53,7 +55,6 @@ yarn add server-time-timer-yolabs-ui
53
55
  ## 🔧 React / Next.js Usage
54
56
 
55
57
  ```tsx
56
- import React from 'react';
57
58
  import { ServerTimerUI } from 'server-time-timer-yolabs-ui';
58
59
 
59
60
  export default function App() {
@@ -61,18 +62,28 @@ export default function App() {
61
62
  <ServerTimerUI
62
63
  serverNow="2025-12-25T12:00:00Z"
63
64
  endTime="2025-12-25T12:10:00Z"
65
+
64
66
  size="lg"
65
67
  layout="horizontal"
66
68
  theme="brand"
69
+
67
70
  showProgress={true}
71
+
68
72
  customColors={{
69
73
  background: '#fef9f3',
70
74
  text: '#323130',
71
75
  unitBackground: '#fffbdd',
72
76
  progress: '#0078d4'
73
77
  }}
74
- showUnits={{ days: true, hours: true, minutes: true, seconds: true }}
75
- onEnd={() => alert('Time is up!')}
78
+
79
+ showUnits={{
80
+ days: true,
81
+ hours: true,
82
+ minutes: true,
83
+ seconds: true
84
+ }}
85
+
86
+ onEnd={() => alert('⏰ Time is up!')}
76
87
  />
77
88
  );
78
89
  }
@@ -84,21 +95,40 @@ export default function App() {
84
95
 
85
96
  ```ts
86
97
  export interface ServerTimerUIProps {
87
- serverNow: string;
88
- endTime: string;
89
- size?: 'sm' | 'md' | 'lg';
90
- layout?: 'horizontal' | 'vertical' | 'compact';
91
- theme?: 'light' | 'dark' | 'brand';
92
- showProgress?: boolean;
93
- onEnd?: () => void;
94
- className?: string;
95
- customColors?: {
98
+ /** Server UTC time (ISO string) */
99
+ serverNow: string;
100
+
101
+ /** Countdown end UTC time (ISO string) */
102
+ endTime: string;
103
+
104
+ /** Visual size */
105
+ size?: 'sm' | 'md' | 'lg';
106
+
107
+ /** Layout direction */
108
+ layout?: 'horizontal' | 'vertical' | 'compact';
109
+
110
+ /** Built-in theme */
111
+ theme?: 'light' | 'dark' | 'brand';
112
+
113
+ /** Show animated progress bar */
114
+ showProgress?: boolean;
115
+
116
+ /** Called once when timer reaches zero */
117
+ onEnd?: () => void;
118
+
119
+ /** Optional wrapper class */
120
+ className?: string;
121
+
122
+ /** Override theme colors */
123
+ customColors?: {
96
124
  background?: string;
97
125
  text?: string;
98
126
  unitBackground?: string;
99
127
  progress?: string;
100
128
  };
101
- showUnits?: {
129
+
130
+ /** Control visible time units */
131
+ showUnits?: {
102
132
  days?: boolean;
103
133
  hours?: boolean;
104
134
  minutes?: boolean;
@@ -111,9 +141,38 @@ export interface ServerTimerUIProps {
111
141
 
112
142
  ## 🎨 Layouts
113
143
 
114
- * **Horizontal** – units in a row
115
- * **Vertical** – units stacked
116
- * **Compact** small, space-saving units
144
+ ### Horizontal (default)
145
+
146
+ Units displayed in a row.
147
+ ✔ Dashboards
148
+ ✔ Desktop views
149
+
150
+ ### Vertical
151
+
152
+ Units stacked vertically.
153
+ ✔ Mobile
154
+ ✔ Side panels
155
+
156
+ ### Compact
157
+
158
+ Minimal, label-free layout.
159
+ ✔ Cards
160
+ ✔ Headers
161
+ ✔ Space-constrained UIs
162
+
163
+ ---
164
+
165
+ ## 🎭 Themes
166
+
167
+ Built-in themes are located in the `themes` folder:
168
+
169
+ * `light` – light style
170
+ * `dark` – Enterprise dark mode
171
+ * `brand` – Corporate / SharePoint branding
172
+
173
+ ```tsx
174
+ <ServerTimerUI theme="dark" />
175
+ ```
117
176
 
118
177
  ---
119
178
 
@@ -128,42 +187,66 @@ customColors={{
128
187
  }}
129
188
  ```
130
189
 
131
- ✅ Optional, fallback to theme defaults.
190
+ ✅ Optional
191
+ ✅ Automatically overrides theme defaults
132
192
 
133
193
  ---
134
194
 
135
195
  ## 🕒 Optional Units
136
196
 
137
197
  ```ts
138
- showUnits={{ days: false, hours: true, minutes: true, seconds: true }}
198
+ showUnits={{
199
+ days: false,
200
+ hours: true,
201
+ minutes: true,
202
+ seconds: true
203
+ }}
139
204
  ```
140
205
 
141
- Hide or show units dynamically.
206
+ Hide unused units
207
+ ✔ Cleaner UI for short timers
142
208
 
143
209
  ---
144
210
 
145
- ## 🔁 Resync for Long Timers
211
+ ## 📱 Responsiveness & Overflow Safety
212
+
213
+ * Uses `flex-wrap` to prevent overflow
214
+ * Auto-scales typography by `size`
215
+ * Vertical layout recommended for small screens
216
+ * Numbers never jump or resize unexpectedly
217
+
218
+ ✔ Mobile-safe
219
+ ✔ Dashboard-safe
220
+
221
+ ---
222
+
223
+ ## 🔁 Server Re-Sync (Long Timers)
224
+
225
+ For long-running timers, periodically resync with the server:
146
226
 
147
227
  ```ts
148
228
  setInterval(async () => {
149
229
  const res = await fetch('/api/server-time');
150
230
  const data = await res.json();
151
231
  timer.sync(data.now);
152
- }, 30000); // every 30 seconds
232
+ }, 30000);
153
233
  ```
154
234
 
235
+ ✔ Prevents long-term drift
236
+ ✔ Enterprise-grade accuracy
237
+
155
238
  ---
156
239
 
157
240
  ## 🔧 Angular / Framework-Agnostic Usage
158
241
 
159
- Use the **core package** (`server-time-timer-yolabs`) for Angular or Vanilla JS:
242
+ For Angular, Vue, or Vanilla JS, use the **core engine**:
160
243
 
161
244
  ```ts
162
245
  import { createServerTimer } from 'server-time-timer-yolabs';
163
246
 
164
247
  const timer = createServerTimer({
165
248
  serverNow: new Date().toISOString(),
166
- endTime: new Date(Date.now() + 10*60*1000).toISOString()
249
+ endTime: new Date(Date.now() + 10 * 60 * 1000).toISOString()
167
250
  });
168
251
 
169
252
  timer.onTick((t) => {
@@ -173,24 +256,36 @@ timer.onTick((t) => {
173
256
  timer.start();
174
257
  ```
175
258
 
176
- Wrap values in your own Angular components for UI.
259
+ Wrap values in your own UI layer
260
+ ✔ React UI package remains optional
177
261
 
178
262
  ---
179
263
 
180
- ## 🏢 Use Cases
264
+ ## 🏢 Common Use Cases
181
265
 
182
266
  * 🎟️ Lottery & raffle systems
183
- * 🛒 Flash sales & limited offers
267
+ * 🛒 Flash sales & promotions
184
268
  * 📝 Online exams & quizzes
185
- * 🎮 Games & events
269
+ * 🎮 Games & live events
186
270
  * 📱 Telegram Mini Apps
187
- * 🌐 Distributed enterprise apps
271
+ * 🌐 Distributed enterprise dashboards
272
+ * 🏢 SharePoint / SPFx solutions
188
273
 
189
274
  ---
190
275
 
191
276
  ## 📜 License
192
277
 
193
- yolabs © Yonas
278
+ **Yonas**
279
+ © **YoLabs**
194
280
 
195
281
  ---
196
282
 
283
+ ## ✅ Final Notes
284
+
285
+ This package is designed for **mission-critical timers** where:
286
+
287
+ * Accuracy matters
288
+ * Client manipulation must be avoided
289
+ * UI consistency is required across platforms
290
+
291
+ ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "server-time-timer-yolabs-ui",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "FluentUI/SharePoint styled React countdown timer UI for server-time-timer-yoLabs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",