webgal-parser 4.4.9 → 4.4.14-2

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 (48) hide show
  1. package/.prettierrc +19 -0
  2. package/build/cjs/config/scriptConfig.d.ts +6 -1
  3. package/build/cjs/index.cjs +232 -182
  4. package/build/cjs/index.d.ts +15 -6
  5. package/build/cjs/interface/sceneInterface.d.ts +4 -3
  6. package/build/cjs/sceneParser.d.ts +5 -4
  7. package/build/cjs/scriptParser/argsParser.d.ts +2 -2
  8. package/build/cjs/scriptParser/commandParser.d.ts +4 -3
  9. package/build/cjs/scriptParser/contentParser.d.ts +1 -1
  10. package/build/cjs/scriptParser/scriptParser.d.ts +4 -3
  11. package/build/cjs/scriptParser/subSceneScanner.d.ts +1 -1
  12. package/build/cjs/styleParser/index.d.ts +5 -0
  13. package/build/es/config/scriptConfig.d.ts +6 -1
  14. package/build/es/index.d.ts +15 -6
  15. package/build/es/index.js +232 -182
  16. package/build/es/interface/sceneInterface.d.ts +4 -3
  17. package/build/es/sceneParser.d.ts +5 -4
  18. package/build/es/scriptParser/argsParser.d.ts +2 -2
  19. package/build/es/scriptParser/commandParser.d.ts +4 -3
  20. package/build/es/scriptParser/contentParser.d.ts +1 -1
  21. package/build/es/scriptParser/scriptParser.d.ts +4 -3
  22. package/build/es/scriptParser/subSceneScanner.d.ts +1 -1
  23. package/build/es/styleParser/index.d.ts +5 -0
  24. package/build/types/config/scriptConfig.d.ts +6 -1
  25. package/build/types/index.d.ts +15 -6
  26. package/build/types/interface/sceneInterface.d.ts +4 -3
  27. package/build/types/sceneParser.d.ts +5 -4
  28. package/build/types/scriptParser/argsParser.d.ts +2 -2
  29. package/build/types/scriptParser/commandParser.d.ts +4 -3
  30. package/build/types/scriptParser/contentParser.d.ts +1 -1
  31. package/build/types/scriptParser/scriptParser.d.ts +4 -3
  32. package/build/types/scriptParser/subSceneScanner.d.ts +1 -1
  33. package/build/types/styleParser/index.d.ts +5 -0
  34. package/build/umd/index.global.js +232 -182
  35. package/package.json +2 -2
  36. package/src/config/scriptConfig.ts +9 -5
  37. package/src/configParser/configParser.ts +37 -25
  38. package/src/index.ts +66 -30
  39. package/src/interface/sceneInterface.ts +4 -3
  40. package/src/parser4/index.ts +1 -1
  41. package/src/sceneParser.ts +36 -17
  42. package/src/scriptParser/argsParser.ts +17 -14
  43. package/src/scriptParser/assetsScanner.ts +5 -1
  44. package/src/scriptParser/commandParser.ts +31 -23
  45. package/src/scriptParser/contentParser.ts +14 -10
  46. package/src/scriptParser/scriptParser.ts +38 -20
  47. package/src/scriptParser/subSceneScanner.ts +11 -5
  48. package/src/styleParser/index.ts +39 -0
@@ -1,9 +1,10 @@
1
- import { ISentence } from "../interface/sceneInterface";
1
+ import { commandType, ISentence } from '../interface/sceneInterface';
2
+ import { ConfigMap } from '../config/scriptConfig';
2
3
  /**
3
4
  * 语句解析器
4
5
  * @param sentenceRaw 原始语句
5
6
  * @param assetSetter
6
7
  * @param ADD_NEXT_ARG_LIST
7
- * @param SCRIPT_CONFIG
8
+ * @param SCRIPT_CONFIG_MAP
8
9
  */
9
- export declare const scriptParser: (sentenceRaw: string, assetSetter: any, ADD_NEXT_ARG_LIST: any, SCRIPT_CONFIG: any) => ISentence;
10
+ export declare const scriptParser: (sentenceRaw: string, assetSetter: any, ADD_NEXT_ARG_LIST: commandType[], SCRIPT_CONFIG_MAP: ConfigMap) => ISentence;
@@ -3,5 +3,5 @@
3
3
  * @param content 语句内容
4
4
  * @return {Array<string>} 子场景列表
5
5
  */
6
- import { commandType } from "../interface/sceneInterface";
6
+ import { commandType } from '../interface/sceneInterface';
7
7
  export declare const subSceneScanner: (command: commandType, content: string) => Array<string>;
@@ -0,0 +1,5 @@
1
+ export interface IWebGALStyleObj {
2
+ classNameStyles: Record<string, string>;
3
+ others: string;
4
+ }
5
+ export declare function scss2cssinjsParser(scssString: string): IWebGALStyleObj;
@@ -1,6 +1,11 @@
1
- import { commandType } from "../interface/sceneInterface";
1
+ import { commandType } from '../interface/sceneInterface';
2
2
  export declare const SCRIPT_CONFIG: {
3
3
  scriptString: string;
4
4
  scriptType: commandType;
5
5
  }[];
6
6
  export declare const ADD_NEXT_ARG_LIST: commandType[];
7
+ export type ConfigMap = Map<string, ConfigItem>;
8
+ export type ConfigItem = {
9
+ scriptString: string;
10
+ scriptType: commandType;
11
+ };
@@ -1,15 +1,24 @@
1
- import { IAsset } from "./interface/sceneInterface";
2
- import { fileType } from "./interface/assets";
3
- import { ADD_NEXT_ARG_LIST, SCRIPT_CONFIG } from "./config/scriptConfig";
4
- import { WebgalConfig } from "./configParser/configParser";
1
+ import { ADD_NEXT_ARG_LIST, SCRIPT_CONFIG, ConfigMap, ConfigItem } from './config/scriptConfig';
2
+ import { WebgalConfig } from './configParser/configParser';
3
+ import { fileType } from './interface/assets';
4
+ import { IAsset } from './interface/sceneInterface';
5
+ import { IWebGALStyleObj } from "@/styleParser";
5
6
  export default class SceneParser {
6
7
  private readonly assetsPrefetcher;
7
8
  private readonly assetSetter;
8
9
  private readonly ADD_NEXT_ARG_LIST;
9
- private readonly SCRIPT_CONFIG;
10
- constructor(assetsPrefetcher: ((assetList: Array<IAsset>) => void), assetSetter: (fileName: string, assetType: fileType) => string, ADD_NEXT_ARG_LIST: Array<number>, SCRIPT_CONFIG: Array<any>);
10
+ private readonly SCRIPT_CONFIG_MAP;
11
+ constructor(assetsPrefetcher: (assetList: IAsset[]) => void, assetSetter: (fileName: string, assetType: fileType) => string, ADD_NEXT_ARG_LIST: number[], SCRIPT_CONFIG_INPUT: ConfigItem[] | ConfigMap);
12
+ /**
13
+ * 解析场景
14
+ * @param rawScene 原始场景
15
+ * @param sceneName 场景名称
16
+ * @param sceneUrl 场景url
17
+ * @return 解析后的场景
18
+ */
11
19
  parse(rawScene: string, sceneName: string, sceneUrl: string): import("./interface/sceneInterface").IScene;
12
20
  parseConfig(configText: string): WebgalConfig;
13
21
  stringifyConfig(config: WebgalConfig): string;
22
+ parseScssToWebgalStyleObj(scssString: string): IWebGALStyleObj;
14
23
  }
15
24
  export { ADD_NEXT_ARG_LIST, SCRIPT_CONFIG };
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * 语句类型
3
3
  */
4
- import { sceneEntry } from "./runtimeInterface";
5
- import { fileType } from "./assets";
4
+ import { sceneEntry } from './runtimeInterface';
5
+ import { fileType } from './assets';
6
6
  export declare enum commandType {
7
7
  say = 0,
8
8
  changeBg = 1,
@@ -35,7 +35,8 @@ export declare enum commandType {
35
35
  comment = 28,
36
36
  setTransform = 29,
37
37
  setTransition = 30,
38
- getUserInput = 31
38
+ getUserInput = 31,
39
+ applyStyle = 32
39
40
  }
40
41
  /**
41
42
  * 单个参数接口
@@ -1,5 +1,6 @@
1
- import { IAsset, IScene } from "./interface/sceneInterface";
2
- import { fileType } from "./interface/assets";
1
+ import { commandType, IAsset, IScene } from './interface/sceneInterface';
2
+ import { fileType } from './interface/assets';
3
+ import { ConfigMap } from './config/scriptConfig';
3
4
  /**
4
5
  * 场景解析器
5
6
  * @param rawScene 原始场景
@@ -8,7 +9,7 @@ import { fileType } from "./interface/assets";
8
9
  * @param assetsPrefetcher
9
10
  * @param assetSetter
10
11
  * @param ADD_NEXT_ARG_LIST
11
- * @param SCRIPT_CONFIG
12
+ * @param SCRIPT_CONFIG_MAP
12
13
  * @return {IScene} 解析后的场景
13
14
  */
14
- export declare const sceneParser: (rawScene: string, sceneName: string, sceneUrl: string, assetsPrefetcher: (assetList: Array<IAsset>) => void, assetSetter: (fileName: string, assetType: fileType) => string, ADD_NEXT_ARG_LIST: any, SCRIPT_CONFIG: any) => IScene;
15
+ export declare const sceneParser: (rawScene: string, sceneName: string, sceneUrl: string, assetsPrefetcher: (assetList: Array<IAsset>) => void, assetSetter: (fileName: string, assetType: fileType) => string, ADD_NEXT_ARG_LIST: commandType[], SCRIPT_CONFIG_MAP: ConfigMap) => IScene;
@@ -1,5 +1,5 @@
1
- import { arg } from "../interface/sceneInterface";
2
- import { fileType } from "../interface/assets";
1
+ import { arg } from '../interface/sceneInterface';
2
+ import { fileType } from '../interface/assets';
3
3
  /**
4
4
  * 参数解析器
5
5
  * @param argsRaw 原始参数字符串
@@ -1,9 +1,10 @@
1
- import { parsedCommand } from "../interface/sceneInterface";
1
+ import { ConfigMap } from '../config/scriptConfig';
2
+ import { commandType, parsedCommand } from '../interface/sceneInterface';
2
3
  /**
3
4
  * 处理命令
4
5
  * @param commandRaw
5
6
  * @param ADD_NEXT_ARG_LIST
6
- * @param SCRIPT_CONFIG
7
+ * @param SCRIPT_CONFIG_MAP
7
8
  * @return {parsedCommand} 处理后的命令
8
9
  */
9
- export declare const commandParser: (commandRaw: string, ADD_NEXT_ARG_LIST: any, SCRIPT_CONFIG: any) => parsedCommand;
10
+ export declare const commandParser: (commandRaw: string, ADD_NEXT_ARG_LIST: commandType[], SCRIPT_CONFIG_MAP: ConfigMap) => parsedCommand;
@@ -1,4 +1,4 @@
1
- import { commandType } from "../interface/sceneInterface";
1
+ import { commandType } from '../interface/sceneInterface';
2
2
  /**
3
3
  * 解析语句内容的函数,主要作用是把文件名改为绝对地址或相对地址(根据使用情况而定)
4
4
  * @param contentRaw 原始语句内容
@@ -1,9 +1,10 @@
1
- import { ISentence } from "../interface/sceneInterface";
1
+ import { commandType, ISentence } from '../interface/sceneInterface';
2
+ import { ConfigMap } from '../config/scriptConfig';
2
3
  /**
3
4
  * 语句解析器
4
5
  * @param sentenceRaw 原始语句
5
6
  * @param assetSetter
6
7
  * @param ADD_NEXT_ARG_LIST
7
- * @param SCRIPT_CONFIG
8
+ * @param SCRIPT_CONFIG_MAP
8
9
  */
9
- export declare const scriptParser: (sentenceRaw: string, assetSetter: any, ADD_NEXT_ARG_LIST: any, SCRIPT_CONFIG: any) => ISentence;
10
+ export declare const scriptParser: (sentenceRaw: string, assetSetter: any, ADD_NEXT_ARG_LIST: commandType[], SCRIPT_CONFIG_MAP: ConfigMap) => ISentence;
@@ -3,5 +3,5 @@
3
3
  * @param content 语句内容
4
4
  * @return {Array<string>} 子场景列表
5
5
  */
6
- import { commandType } from "../interface/sceneInterface";
6
+ import { commandType } from '../interface/sceneInterface';
7
7
  export declare const subSceneScanner: (command: commandType, content: string) => Array<string>;
@@ -0,0 +1,5 @@
1
+ export interface IWebGALStyleObj {
2
+ classNameStyles: Record<string, string>;
3
+ others: string;
4
+ }
5
+ export declare function scss2cssinjsParser(scssString: string): IWebGALStyleObj;