@xhub-short/core 0.1.0-beta.10 → 0.1.0-beta.11
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/dist/index.d.ts +20 -0
- package/dist/index.js +37 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -238,6 +238,26 @@ declare class FeedManager {
|
|
|
238
238
|
* Update a video in the feed (for optimistic updates)
|
|
239
239
|
*/
|
|
240
240
|
updateVideo(id: string, updates: Partial<VideoItem>): void;
|
|
241
|
+
/**
|
|
242
|
+
* Remove an item from the feed
|
|
243
|
+
*
|
|
244
|
+
* Used for:
|
|
245
|
+
* - Report: Remove reported content from feed
|
|
246
|
+
* - Not Interested: Remove content user doesn't want to see
|
|
247
|
+
*
|
|
248
|
+
* @param id - Content ID to remove
|
|
249
|
+
* @returns true if item was removed, false if not found
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```typescript
|
|
253
|
+
* // User reports a video
|
|
254
|
+
* const wasRemoved = feedManager.removeItem(videoId);
|
|
255
|
+
* if (wasRemoved) {
|
|
256
|
+
* // Navigate to next video
|
|
257
|
+
* }
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
removeItem(id: string): boolean;
|
|
241
261
|
/**
|
|
242
262
|
* Check if data is stale and needs revalidation
|
|
243
263
|
*/
|
package/dist/index.js
CHANGED
|
@@ -255,6 +255,40 @@ var _FeedManager = class _FeedManager {
|
|
|
255
255
|
this.store.setState({ itemsById: newItemsById });
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Remove an item from the feed
|
|
260
|
+
*
|
|
261
|
+
* Used for:
|
|
262
|
+
* - Report: Remove reported content from feed
|
|
263
|
+
* - Not Interested: Remove content user doesn't want to see
|
|
264
|
+
*
|
|
265
|
+
* @param id - Content ID to remove
|
|
266
|
+
* @returns true if item was removed, false if not found
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```typescript
|
|
270
|
+
* // User reports a video
|
|
271
|
+
* const wasRemoved = feedManager.removeItem(videoId);
|
|
272
|
+
* if (wasRemoved) {
|
|
273
|
+
* // Navigate to next video
|
|
274
|
+
* }
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
removeItem(id) {
|
|
278
|
+
const state = this.store.getState();
|
|
279
|
+
if (!state.itemsById.has(id)) {
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
const newItemsById = new Map(state.itemsById);
|
|
283
|
+
newItemsById.delete(id);
|
|
284
|
+
const newDisplayOrder = state.displayOrder.filter((itemId) => itemId !== id);
|
|
285
|
+
this.accessOrder.delete(id);
|
|
286
|
+
this.store.setState({
|
|
287
|
+
itemsById: newItemsById,
|
|
288
|
+
displayOrder: newDisplayOrder
|
|
289
|
+
});
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
258
292
|
/**
|
|
259
293
|
* Check if data is stale and needs revalidation
|
|
260
294
|
*/
|
|
@@ -811,7 +845,9 @@ var PlayerEngine = class {
|
|
|
811
845
|
loopCount: 0,
|
|
812
846
|
watchTime: 0,
|
|
813
847
|
error: null,
|
|
814
|
-
ended: false
|
|
848
|
+
ended: false,
|
|
849
|
+
playbackRate: 1
|
|
850
|
+
// Reset speed to normal when loading new video
|
|
815
851
|
});
|
|
816
852
|
this.emitEvent({ type: "videoChange", video });
|
|
817
853
|
this.logger?.debug(`[PlayerEngine] Loaded video: ${video.id}`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xhub-short/core",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.1.0-beta.
|
|
4
|
+
"version": "0.1.0-beta.11",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"zustand": "^5.0.0",
|
|
24
|
-
"@xhub-short/contracts": "0.1.0-beta.
|
|
24
|
+
"@xhub-short/contracts": "0.1.0-beta.11"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"tsup": "^8.3.0",
|
|
28
28
|
"typescript": "^5.7.0",
|
|
29
29
|
"vitest": "^2.1.0",
|
|
30
30
|
"@xhub-short/tsconfig": "0.0.0",
|
|
31
|
-
"@xhub-short/vitest-config": "0.0
|
|
31
|
+
"@xhub-short/vitest-config": "0.1.0-beta.10"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "tsup",
|