@ray-js/ipc-player-integration 0.0.24 → 0.0.25-beta-1

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/lib/ctx/ctx.js +33 -23
  2. package/package.json +1 -1
package/lib/ctx/ctx.js CHANGED
@@ -1,3 +1,4 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import "core-js/modules/esnext.iterator.constructor.js";
2
3
  import "core-js/modules/esnext.iterator.filter.js";
3
4
  import "core-js/modules/esnext.iterator.find.js";
@@ -115,11 +116,32 @@ export const createUseCtx = _ref => {
115
116
  });
116
117
  }
117
118
  }, [devId, _playState]);
118
-
119
119
  // 获取content数据
120
+ const getContent = () => {
121
+ const store = getDefaultStore();
122
+ return {
123
+ topLeft: store.get(topLeftContent),
124
+ topRight: store.get(topRightContent),
125
+ bottomLeft: store.get(bottomLeftContent),
126
+ bottomRight: store.get(bottomRightContent),
127
+ absolute: store.get(absoluteContent)
128
+ };
129
+ };
120
130
 
121
131
  // 根据类型更新content数据
122
-
132
+ const updateContent = (type, data) => {
133
+ if (type === 'topLeft') {
134
+ updateAtom(topLeftContent, data);
135
+ } else if (type === 'topRight') {
136
+ updateAtom(topRightContent, data);
137
+ } else if (type === 'bottomLeft') {
138
+ updateAtom(bottomLeftContent, data);
139
+ } else if (type === 'bottomRight') {
140
+ updateAtom(bottomRightContent, data);
141
+ } else {
142
+ updateAtom(absoluteContent, data);
143
+ }
144
+ };
123
145
  const changeContentHiddenData = (type, id, hidden) => {
124
146
  const store = getDefaultStore();
125
147
  let targetStore;
@@ -466,27 +488,15 @@ export const createUseCtx = _ref => {
466
488
  updateAtom(absoluteContent, prevValue => prevValue.filter(item => item.id !== id));
467
489
  }
468
490
  },
469
- getContent: () => {
470
- const store = getDefaultStore();
471
- return {
472
- topLeft: store.get(topLeftContent),
473
- topRight: store.get(topRightContent),
474
- bottomLeft: store.get(bottomLeftContent),
475
- bottomRight: store.get(bottomRightContent),
476
- absolute: store.get(absoluteContent)
477
- };
478
- },
479
- updateContent: (type, data) => {
480
- if (type === 'topLeft') {
481
- updateAtom(topLeftContent, data);
482
- } else if (type === 'topRight') {
483
- updateAtom(topRightContent, data);
484
- } else if (type === 'bottomLeft') {
485
- updateAtom(bottomLeftContent, data);
486
- } else if (type === 'bottomRight') {
487
- updateAtom(bottomRightContent, data);
488
- } else {
489
- updateAtom(absoluteContent, data);
491
+ getContent,
492
+ updateContent,
493
+ updateContentItemById: (type, id, config) => {
494
+ const contents = getContent()[type];
495
+ const target = contents.find(item => item.id === id);
496
+ if (target) {
497
+ const newContent = _objectSpread(_objectSpread({}, target), config);
498
+ const newContents = contents.map(item => item.id === id ? newContent : item);
499
+ updateContent(type, newContents);
490
500
  }
491
501
  },
492
502
  hideContent: (type, id) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.24",
3
+ "version": "0.0.25-beta-1",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [