@xibosignage/xibo-layout-renderer 1.0.2 → 1.0.4

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.
@@ -0,0 +1,32 @@
1
+ import { ILayout, OptionsType } from '../../types';
2
+ import './action-controller.css';
3
+ export declare class Action {
4
+ readonly id: string;
5
+ readonly xml: Element;
6
+ constructor(id: string, xml: Element);
7
+ }
8
+ export declare class ActionsWrapper extends HTMLDivElement {
9
+ constructor();
10
+ }
11
+ export type InactOptions = {
12
+ [k: string]: any;
13
+ } & OptionsType['previewTranslations'];
14
+ export default class ActionController {
15
+ readonly parent: ILayout;
16
+ readonly actions: Action[];
17
+ readonly options: InactOptions;
18
+ readonly $actionController: ActionsWrapper;
19
+ readonly $actionListContainer: Element | null;
20
+ translations: any;
21
+ constructor(parent: ILayout, actions: Action[], options: InactOptions);
22
+ init(): void;
23
+ openLayoutInNewTab(layoutCode: string, options: InactOptions): void;
24
+ /** Change media in region (next/previous) */
25
+ nextMediaInRegion(regionId: string, actionType: string): void;
26
+ loadMediaInRegion(regionId: string, widgetId: string): void;
27
+ /** Run action based on action data */
28
+ runAction(actionData: {
29
+ [k: string]: any;
30
+ }, options: InactOptions): void;
31
+ initTouchActions(): void;
32
+ }
@@ -0,0 +1 @@
1
+ export { default, Action, ActionsWrapper, InactOptions, } from './ActionController';
@@ -28,4 +28,7 @@ export declare function getIndexByLayoutId(layoutsInput: InputLayoutType[], layo
28
28
  export declare function isEmpty(input: any): boolean;
29
29
  export declare const splashScreenLayoutObj: InputLayoutType;
30
30
  export declare function splashScreenDOM(): HTMLImageElement;
31
+ export declare function getAllAttributes(elem: Element): {
32
+ [k: string]: any;
33
+ };
31
34
  export {};
@@ -2,6 +2,7 @@ import { Emitter, Unsubscribe } from 'nanoevents';
2
2
  import { IRegion } from '../Region';
3
3
  import { ILayoutEvents } from '../../Modules/Layout';
4
4
  import { IXlr } from '../XLR';
5
+ import InteractiveActions, { Action } from '../../Modules/ActionController';
5
6
  export type InputLayoutType = {
6
7
  layoutId: number | null;
7
8
  path?: string;
@@ -23,6 +24,9 @@ export type OptionsType = {
23
24
  cmsKey: string | null;
24
25
  hardwareKey: string | null;
25
26
  };
27
+ previewTranslations?: {
28
+ [k: string]: any;
29
+ };
26
30
  };
27
31
  export interface ILayout {
28
32
  id: number | null;
@@ -45,10 +49,10 @@ export interface ILayout {
45
49
  regionMaxZIndex: number;
46
50
  ready: boolean;
47
51
  regionObjects: IRegion[];
48
- drawer: String[];
52
+ drawer: Element | null;
49
53
  allExpired: boolean;
50
54
  regions: IRegion[];
51
- actions: String[];
55
+ actions: Action[];
52
56
  options: OptionsType;
53
57
  done: boolean;
54
58
  allEnded: boolean;
@@ -64,6 +68,7 @@ export interface ILayout {
64
68
  stopAllMedia(): Promise<void>;
65
69
  resetLayout(): Promise<void>;
66
70
  index: number;
71
+ actionController: InteractiveActions | undefined;
67
72
  }
68
73
  export declare const initialLayout: ILayout;
69
74
  export type GetLayoutParamType = {
@@ -9,9 +9,10 @@ export interface IRegion {
9
9
  layout: ILayout;
10
10
  id: string;
11
11
  regionId: string;
12
+ uniqueId: string;
12
13
  xml: null | Element;
13
14
  mediaObjects: IMedia[];
14
- mediaObjectsActions: String[];
15
+ mediaObjectsActions: IMedia[];
15
16
  currentMedia: number;
16
17
  complete: boolean;
17
18
  containerName: string;
@@ -36,6 +37,7 @@ export interface IRegion {
36
37
  emitter?: Emitter<DefaultEvents>;
37
38
  prepareRegion(): void;
38
39
  playNextMedia(): void;
40
+ playPreviousMedia(): void;
39
41
  transitionNodes(oldMedia: IMedia | undefined, newMedia: IMedia | undefined): void;
40
42
  finished(): void;
41
43
  run(): void;
package/dist/styles.css CHANGED
@@ -168,4 +168,112 @@ div.preview-ended a {
168
168
  @keyframes elemFadeOut {
169
169
  0% { opacity: 1; }
170
170
  100% { opacity: 0; }
171
+ }
172
+ div.action-controller {
173
+ position: absolute;
174
+ top: 6px;
175
+ left: 6px;
176
+ z-index: 1001;
177
+ font-family: monospace, monospace;
178
+ font-size: 0.75rem;
179
+ background-color: #363636;
180
+ border-radius: 4px;
181
+ opacity: 0.95;
182
+ filter: alpha(opacity = 90);
183
+ display: flex;
184
+ flex-direction: column;
185
+ width: 300px;
186
+ max-height: 80%;
187
+ overflow-y: auto;
188
+ scrollbar-width: thin;
189
+ }
190
+ div.action-controller .action-controller-title {
191
+ width: calc(300px - 8px);
192
+ z-index: 2;
193
+ padding: 4px;
194
+ color: #fff;
195
+ cursor: grab;
196
+ position: fixed;
197
+ border-radius: 4px;
198
+ background-color: #363636;
199
+ }
200
+ div.action-controller .action-controller-title .toggle {
201
+ cursor: pointer;
202
+ color: inherit;
203
+ width: 24px;
204
+ height: 18px;
205
+ padding: 0;
206
+ background-color: #5f5f5f;
207
+ border: none;
208
+ border-radius: 3px;
209
+ line-height: 12px;
210
+ font-weight: bold;
211
+ }
212
+ div.action-controller .action-controller-title .toggle:after {
213
+ content: ' \002D';
214
+ }
215
+ div.action-controller.d-none .action-controller-title .toggle:after {
216
+ content: ' \002B';
217
+ }
218
+ div.action-controller .action-controller-title .title {
219
+ margin-left: 4px;
220
+ }
221
+ div.action-controller .actions-container {
222
+ margin-top: 24px;
223
+ padding: 4px;
224
+ }
225
+
226
+ div.action-controller.d-none {
227
+ min-width: 100px;
228
+ opacity: 0.5;
229
+ filter: alpha(opacity=50); /* IE8 and lower */
230
+ }
231
+
232
+ div.action-controller.d-none .actions-container {
233
+ display: none;
234
+ }
235
+
236
+ div.action-controller.d-none:hover {
237
+ opacity: 0.8;
238
+ filter: alpha(opacity=80); /* IE8 and lower */
239
+ }
240
+
241
+ div.action-controller.d-none .action {
242
+ display: none;
243
+ }
244
+
245
+ div.action-controller .action {
246
+ position: relative;
247
+ height: 20px;
248
+ border-radius: 4px;
249
+ margin-bottom: 4px;
250
+ background-color: #337ab7;
251
+ padding: 2px 4px;
252
+ color: #f3f3f3;
253
+ line-height: 20px;
254
+ display: flex;
255
+ justify-content: space-between;
256
+ }
257
+
258
+ div.action-controller .action:hover {
259
+ background-color: #4289c7;
260
+ }
261
+
262
+ div.action-controller .action:not([triggerType="webhook"]) {
263
+ display: none;
264
+ }
265
+
266
+ .clickable {
267
+ cursor: pointer;
268
+ }
269
+ .noselect {
270
+ -webkit-touch-callout: none;
271
+ -webkit-user-select: none;
272
+ -khtml-user-select: none;
273
+ -moz-user-select: none;
274
+ -ms-user-select: none;
275
+ user-select: none;
276
+ }
277
+ iframe {
278
+ pointer-events: none;
171
279
  }