@media-quest/engine 0.0.7 → 0.0.8
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/public-api.d.mts +35 -5
- package/dist/public-api.d.ts +35 -5
- package/dist/public-api.js +45 -3
- package/dist/public-api.mjs +41 -2
- package/package.json +2 -2
- package/src/commands/DCommand.ts +35 -34
- package/src/dto/SchemaDto.ts +45 -45
- package/src/player/dplayer.spec.ts +70 -69
- package/src/player/history-que.spec.ts +20 -19
- package/src/player/next-que.spec.ts +84 -83
- package/src/public-api.ts +1 -0
- package/src/rules/__test__/rule-engine.spec.ts +317 -316
- package/src/utils/ID.spec.ts +39 -0
- package/src/utils/ID.ts +71 -0
package/dist/public-api.d.mts
CHANGED
|
@@ -251,6 +251,37 @@ declare namespace DState {
|
|
|
251
251
|
export {};
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
+
type ID<B extends string> = string & {
|
|
255
|
+
__ID__: B;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Creates a object with helper functions for a specific ID type
|
|
259
|
+
* @param idName
|
|
260
|
+
*/
|
|
261
|
+
declare const createTypedIdSingleton: <const B extends string>(idName: B) => Readonly<{
|
|
262
|
+
create: () => ID<B>;
|
|
263
|
+
is: (id: string) => id is ID<B>;
|
|
264
|
+
ensure: (id: string) => ID<B>;
|
|
265
|
+
validateOrThrow: (id: string) => ID<B>;
|
|
266
|
+
name: B;
|
|
267
|
+
}>;
|
|
268
|
+
type SchemaID = ID<"SCHEMA">;
|
|
269
|
+
declare const SchemaID: Readonly<{
|
|
270
|
+
create: () => ID<"SCHEMA">;
|
|
271
|
+
is: (id: string) => id is ID<"SCHEMA">;
|
|
272
|
+
ensure: (id: string) => ID<"SCHEMA">;
|
|
273
|
+
validateOrThrow: (id: string) => ID<"SCHEMA">;
|
|
274
|
+
name: "SCHEMA";
|
|
275
|
+
}>;
|
|
276
|
+
type PageID = ID<"PAGE">;
|
|
277
|
+
declare const PageID: Readonly<{
|
|
278
|
+
create: () => ID<"PAGE">;
|
|
279
|
+
is: (id: string) => id is ID<"PAGE">;
|
|
280
|
+
ensure: (id: string) => ID<"PAGE">;
|
|
281
|
+
validateOrThrow: (id: string) => ID<"PAGE">;
|
|
282
|
+
name: "PAGE";
|
|
283
|
+
}>;
|
|
284
|
+
|
|
254
285
|
type CommandTarget = "VIDEO" | "AUDIO" | "ELEMENT" | "PAGE_QUE" | "ENGINE" | "STATE";
|
|
255
286
|
type CommandKind = `${Uppercase<CommandTarget>}_${Uppercase<string>}_COMMAND`;
|
|
256
287
|
type StateCommand = CommandDto<"STATE_MUTATE_COMMAND", "STATE", {
|
|
@@ -292,7 +323,7 @@ type ElementCommand = CommandDto<"ELEMENT_ANIMATE_COMMAND", "ELEMENT", Animation
|
|
|
292
323
|
type PageQueCommand = CommandDto<"PAGE_QUE_EXCLUDE_BY_TAG_COMMAND", "PAGE_QUE", {
|
|
293
324
|
tagIds: string[];
|
|
294
325
|
}> | CommandDto<"PAGE_QUE_EXCLUDE_BY_PAGE_ID_COMMAND", "PAGE_QUE", {
|
|
295
|
-
pageIds: Array<
|
|
326
|
+
pageIds: Array<PageID>;
|
|
296
327
|
}> | CommandDto<"PAGE_QUE_JUMP_TO_PAGE_COMMAND", "PAGE_QUE", {
|
|
297
328
|
readonly pageId: string;
|
|
298
329
|
}>;
|
|
@@ -398,7 +429,7 @@ declare namespace Rule {
|
|
|
398
429
|
|
|
399
430
|
type PageQueRules = Rule<PageQueCommand, never>;
|
|
400
431
|
interface PageDto {
|
|
401
|
-
readonly id:
|
|
432
|
+
readonly id: PageID;
|
|
402
433
|
readonly elements: Array<DElementDto>;
|
|
403
434
|
readonly tags?: string[];
|
|
404
435
|
readonly mainVideoId?: string;
|
|
@@ -413,8 +444,7 @@ interface PageSequenceDto {
|
|
|
413
444
|
readonly pages: Array<PageDto>;
|
|
414
445
|
}
|
|
415
446
|
interface SchemaDto {
|
|
416
|
-
readonly id:
|
|
417
|
-
readonly prefix: string;
|
|
447
|
+
readonly id: SchemaID;
|
|
418
448
|
readonly baseHeight: number;
|
|
419
449
|
readonly baseWidth: number;
|
|
420
450
|
readonly backgroundColor: string;
|
|
@@ -540,4 +570,4 @@ declare namespace DUtil {
|
|
|
540
570
|
const minFn: (lowerLimit: number) => (value: number) => number;
|
|
541
571
|
}
|
|
542
572
|
|
|
543
|
-
export { AnimationDto, AudioCommand, AudioPlayEvent, AutoPlayAudio, AutoPlayElement, AutoPlayPause, AutoPlayVideo, BooleanStateProperty, Condition, DAudioDto, DAudioEvent, DAutoPlaySequence, DCommand, DCss, DDivDto, DElementBaseDto, DElementDto, DEvent, DEventHandler, DImageEvent, DImgDto, DPageEvents, DState, DStyle, DTextDto, DUtil, DVideoDto, DVideoEvent, DWindowEvents, ElementCommand, EngineCommand, Fact, Match, NavigationCommand, PageDto, PageQueCommand, PageQueRules, PageSequenceDto, QueryChangedEvent, QueryChangedHandler, RandomObjectId, Rule, RuleEngine, RuleEngineError, SchemaDto, SchemaEngine, SolveResult, StateCommand, VideoCommand };
|
|
573
|
+
export { AnimationDto, AudioCommand, AudioPlayEvent, AutoPlayAudio, AutoPlayElement, AutoPlayPause, AutoPlayVideo, BooleanStateProperty, Condition, DAudioDto, DAudioEvent, DAutoPlaySequence, DCommand, DCss, DDivDto, DElementBaseDto, DElementDto, DEvent, DEventHandler, DImageEvent, DImgDto, DPageEvents, DState, DStyle, DTextDto, DUtil, DVideoDto, DVideoEvent, DWindowEvents, ElementCommand, EngineCommand, Fact, ID, Match, NavigationCommand, PageDto, PageID, PageQueCommand, PageQueRules, PageSequenceDto, QueryChangedEvent, QueryChangedHandler, RandomObjectId, Rule, RuleEngine, RuleEngineError, SchemaDto, SchemaEngine, SchemaID, SolveResult, StateCommand, VideoCommand, createTypedIdSingleton };
|
package/dist/public-api.d.ts
CHANGED
|
@@ -251,6 +251,37 @@ declare namespace DState {
|
|
|
251
251
|
export {};
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
+
type ID<B extends string> = string & {
|
|
255
|
+
__ID__: B;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Creates a object with helper functions for a specific ID type
|
|
259
|
+
* @param idName
|
|
260
|
+
*/
|
|
261
|
+
declare const createTypedIdSingleton: <const B extends string>(idName: B) => Readonly<{
|
|
262
|
+
create: () => ID<B>;
|
|
263
|
+
is: (id: string) => id is ID<B>;
|
|
264
|
+
ensure: (id: string) => ID<B>;
|
|
265
|
+
validateOrThrow: (id: string) => ID<B>;
|
|
266
|
+
name: B;
|
|
267
|
+
}>;
|
|
268
|
+
type SchemaID = ID<"SCHEMA">;
|
|
269
|
+
declare const SchemaID: Readonly<{
|
|
270
|
+
create: () => ID<"SCHEMA">;
|
|
271
|
+
is: (id: string) => id is ID<"SCHEMA">;
|
|
272
|
+
ensure: (id: string) => ID<"SCHEMA">;
|
|
273
|
+
validateOrThrow: (id: string) => ID<"SCHEMA">;
|
|
274
|
+
name: "SCHEMA";
|
|
275
|
+
}>;
|
|
276
|
+
type PageID = ID<"PAGE">;
|
|
277
|
+
declare const PageID: Readonly<{
|
|
278
|
+
create: () => ID<"PAGE">;
|
|
279
|
+
is: (id: string) => id is ID<"PAGE">;
|
|
280
|
+
ensure: (id: string) => ID<"PAGE">;
|
|
281
|
+
validateOrThrow: (id: string) => ID<"PAGE">;
|
|
282
|
+
name: "PAGE";
|
|
283
|
+
}>;
|
|
284
|
+
|
|
254
285
|
type CommandTarget = "VIDEO" | "AUDIO" | "ELEMENT" | "PAGE_QUE" | "ENGINE" | "STATE";
|
|
255
286
|
type CommandKind = `${Uppercase<CommandTarget>}_${Uppercase<string>}_COMMAND`;
|
|
256
287
|
type StateCommand = CommandDto<"STATE_MUTATE_COMMAND", "STATE", {
|
|
@@ -292,7 +323,7 @@ type ElementCommand = CommandDto<"ELEMENT_ANIMATE_COMMAND", "ELEMENT", Animation
|
|
|
292
323
|
type PageQueCommand = CommandDto<"PAGE_QUE_EXCLUDE_BY_TAG_COMMAND", "PAGE_QUE", {
|
|
293
324
|
tagIds: string[];
|
|
294
325
|
}> | CommandDto<"PAGE_QUE_EXCLUDE_BY_PAGE_ID_COMMAND", "PAGE_QUE", {
|
|
295
|
-
pageIds: Array<
|
|
326
|
+
pageIds: Array<PageID>;
|
|
296
327
|
}> | CommandDto<"PAGE_QUE_JUMP_TO_PAGE_COMMAND", "PAGE_QUE", {
|
|
297
328
|
readonly pageId: string;
|
|
298
329
|
}>;
|
|
@@ -398,7 +429,7 @@ declare namespace Rule {
|
|
|
398
429
|
|
|
399
430
|
type PageQueRules = Rule<PageQueCommand, never>;
|
|
400
431
|
interface PageDto {
|
|
401
|
-
readonly id:
|
|
432
|
+
readonly id: PageID;
|
|
402
433
|
readonly elements: Array<DElementDto>;
|
|
403
434
|
readonly tags?: string[];
|
|
404
435
|
readonly mainVideoId?: string;
|
|
@@ -413,8 +444,7 @@ interface PageSequenceDto {
|
|
|
413
444
|
readonly pages: Array<PageDto>;
|
|
414
445
|
}
|
|
415
446
|
interface SchemaDto {
|
|
416
|
-
readonly id:
|
|
417
|
-
readonly prefix: string;
|
|
447
|
+
readonly id: SchemaID;
|
|
418
448
|
readonly baseHeight: number;
|
|
419
449
|
readonly baseWidth: number;
|
|
420
450
|
readonly backgroundColor: string;
|
|
@@ -540,4 +570,4 @@ declare namespace DUtil {
|
|
|
540
570
|
const minFn: (lowerLimit: number) => (value: number) => number;
|
|
541
571
|
}
|
|
542
572
|
|
|
543
|
-
export { AnimationDto, AudioCommand, AudioPlayEvent, AutoPlayAudio, AutoPlayElement, AutoPlayPause, AutoPlayVideo, BooleanStateProperty, Condition, DAudioDto, DAudioEvent, DAutoPlaySequence, DCommand, DCss, DDivDto, DElementBaseDto, DElementDto, DEvent, DEventHandler, DImageEvent, DImgDto, DPageEvents, DState, DStyle, DTextDto, DUtil, DVideoDto, DVideoEvent, DWindowEvents, ElementCommand, EngineCommand, Fact, Match, NavigationCommand, PageDto, PageQueCommand, PageQueRules, PageSequenceDto, QueryChangedEvent, QueryChangedHandler, RandomObjectId, Rule, RuleEngine, RuleEngineError, SchemaDto, SchemaEngine, SolveResult, StateCommand, VideoCommand };
|
|
573
|
+
export { AnimationDto, AudioCommand, AudioPlayEvent, AutoPlayAudio, AutoPlayElement, AutoPlayPause, AutoPlayVideo, BooleanStateProperty, Condition, DAudioDto, DAudioEvent, DAutoPlaySequence, DCommand, DCss, DDivDto, DElementBaseDto, DElementDto, DEvent, DEventHandler, DImageEvent, DImgDto, DPageEvents, DState, DStyle, DTextDto, DUtil, DVideoDto, DVideoEvent, DWindowEvents, ElementCommand, EngineCommand, Fact, ID, Match, NavigationCommand, PageDto, PageID, PageQueCommand, PageQueRules, PageSequenceDto, QueryChangedEvent, QueryChangedHandler, RandomObjectId, Rule, RuleEngine, RuleEngineError, SchemaDto, SchemaEngine, SchemaID, SolveResult, StateCommand, VideoCommand, createTypedIdSingleton };
|