advanced-poe-filter-parser 0.9.0 → 0.9.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Advanced PoE Filter Parser [![Test and Lint](https://github.com/isuke/advanced-poe-filter-parser/actions/workflows/main.yml/badge.svg)](https://github.com/isuke/advanced-poe-filter-parser/actions/workflows/main.yml) [![git-consistent friendly](https://img.shields.io/badge/git--consistent-friendly-brightgreen.svg)](https://github.com/isuke/git-consistent) [![MIT](https://img.shields.io/github/license/mashape/apistatus.svg)](https://raw.githubusercontent.com/isuke/vscode-advanced-poe-filter/master/LICENSE) [![npm](https://img.shields.io/npm/v/advanced-poe-filter-parser.svg)](https://www.npmjs.com/package/advanced-poe-filter-parser)
1
+ # Advanced PoE Filter Parser [![Test and Lint](https://github.com/isuke/advanced-poe-filter-parser/actions/workflows/main.yml/badge.svg)](https://github.com/isuke/advanced-poe-filter-parser/actions/workflows/main.yml) [![git-consistent friendly](https://img.shields.io/badge/git--consistent-friendly-brightgreen.svg)](https://github.com/isuke/git-consistent) [![MIT](https://img.shields.io/github/license/mashape/apistatus.svg)](https://raw.githubusercontent.com/isuke/advanced-poe-filter-parser/main/LICENSE) [![npm](https://img.shields.io/npm/v/advanced-poe-filter-parser.svg)](https://www.npmjs.com/package/advanced-poe-filter-parser)
2
2
 
3
- Advanced PoE Filter is used by [Filter of Kalarandra](https://filter-of-kalandra.netlify.com/).
3
+ Advanced PoE Filter is used by [Filter of Kalandra](https://filter-of-kalandra.netlify.com/).
4
4
 
5
5
  ## Usage
6
6
 
package/lib/parser.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ type Activity = "Show" | "Hide" | "Unset" | "Ignore"
2
+
3
+ type BranchType = "Fork" | "Mixin"
4
+
1
5
  type MatchOperator = "==" | "="
2
6
  type NumOperator = "<=" | ">=" | "<" | ">" | "="
3
7
 
@@ -6,8 +10,10 @@ type Influence = "Shaper" | "Elder" | "Crusader" | "Hunter" | "Redeemer" | "Warl
6
10
  type GemQualityType = "Superior" | "Divergent" | "Anomalous" | "Phantasmal"
7
11
  type SocketType = "R" | "G" | "B" | "W" | "A" | "D"
8
12
 
13
+ type ColorName = "Red" | "Green" | "Blue" | "Brown" | "White" | "Yellow" | "Cyan" | "Grey" | "Orange" | "Pink" | "Purple"
14
+
9
15
  type MinimapIconSize = 0 | 1 | 2 | "0" | "1" | "2" | "Largest" | "Medium" | "Small"
10
- type MinimapIconColor = "Red" | "Green" | "Blue" | "Brown" | "White" | "Yellow" | "Cyan" | "Grey" | "Orange" | "Pink" | "Purple"
16
+ type MinimapIconColor = ColorName
11
17
  type MinimapIconShape =
12
18
  | "Circle"
13
19
  | "Diamond"
@@ -21,24 +27,8 @@ type MinimapIconShape =
21
27
  | "Kite"
22
28
  | "Pentagon"
23
29
  | "UpsideDownHouse"
24
- type PlayEffectColor = "Red" | "Green" | "Blue" | "Brown" | "White" | "Yellow" | "Cyan" | "Grey" | "Orange" | "Pink" | "Purple"
30
+ type PlayEffectColor = ColorName
25
31
  type SoundId =
26
- | 1
27
- | 2
28
- | 3
29
- | 4
30
- | 5
31
- | 6
32
- | 7
33
- | 8
34
- | 9
35
- | 10
36
- | 11
37
- | 12
38
- | 13
39
- | 14
40
- | 15
41
- | 16
42
32
  | "1"
43
33
  | "2"
44
34
  | "3"
@@ -55,6 +45,22 @@ type SoundId =
55
45
  | "14"
56
46
  | "15"
57
47
  | "16"
48
+ | "Sh01"
49
+ | "Sh02"
50
+ | "Sh03"
51
+ | "Sh04"
52
+ | "Sh05"
53
+ | "Sh06"
54
+ | "Sh07"
55
+ | "Sh08"
56
+ | "Sh09"
57
+ | "Sh10"
58
+ | "Sh11"
59
+ | "Sh12"
60
+ | "Sh13"
61
+ | "Sh14"
62
+ | "Sh15"
63
+ | "Sh16"
58
64
  | "ShAlchemy"
59
65
  | "ShBlessed"
60
66
  | "ShChaos"
@@ -66,14 +72,17 @@ type SoundId =
66
72
  | "ShRegal"
67
73
  | "ShVaal"
68
74
 
75
+ type RGBA = { rgb: { r: number; g: number; b: number }; alpha: number }
76
+ type Sound = { id: SoundId; volume: number | undefined }
77
+
69
78
  type AdvancedBlock = {
70
79
  id: string
71
80
  name: string
72
- activity: string
81
+ activity: Activity
73
82
  conditions: {
74
83
  Class?: { ope: MatchOperator; vals: string[] }
75
84
  BaseType?: { ope: MatchOperator; vals: string[] }
76
- Rarity?: `${MatchOperator} ${Rarity}`
85
+ Rarity?: `${MatchOperator} ${Rarity}` | Rarity
77
86
  BaseDefencePercentile?: `${NumOperator} ${number}`
78
87
  BaseArmour?: `${NumOperator} ${number}`
79
88
  BaseEnergyShield?: `${NumOperator} ${number}`
@@ -119,13 +128,13 @@ type AdvancedBlock = {
119
128
  }
120
129
  actions: {
121
130
  SetFontSize?: number
122
- SetTextColor?: { rgb: { r: number; g: number; b: number }; alpha: number }
123
- SetBackgroundColor?: { rgb: { r: number; g: number; b: number }; alpha: number }
124
- SetBorderColor?: { rgb: { r: number; g: number; b: number }; alpha: number }
131
+ SetTextColor?: RGBA
132
+ SetBackgroundColor?: RGBA
133
+ SetBorderColor?: RGBA
125
134
  MinimapIcon?: { size: MinimapIconSize; color: MinimapIconColor; shape: MinimapIconShape }
126
135
  PlayEffect?: { color: PlayEffectColor; temp: boolean }
127
- PlayAlertSound?: { id: SoundId; volume: number | undefined }
128
- PlayAlertSoundPositional?: { id: SoundId; volume: number | undefined }
136
+ PlayAlertSound?: Sound
137
+ PlayAlertSoundPositional?: Sound
129
138
  CustomAlertSound?: {
130
139
  filePath: string
131
140
  volume: number | undefined
@@ -133,7 +142,7 @@ type AdvancedBlock = {
133
142
  DisableDropSound?: boolean
134
143
  EnableDropSound?: boolean
135
144
  }
136
- branches: Array<Branch>
145
+ branches: Branch[]
137
146
  location: {
138
147
  start: { line: number; column: number; offset: number }
139
148
  end: { line: number; column: number; offset: number }
@@ -142,18 +151,28 @@ type AdvancedBlock = {
142
151
 
143
152
  type Branch = {
144
153
  name: string
145
- type: string
146
- blocks: Array<AdvancedBlock>
154
+ type: BranchType
155
+ blocks: AdvancedBlock[]
147
156
  }
148
157
 
149
158
  type Condition = keyof AdvancedBlock["conditions"]
150
159
  type Action = keyof AdvancedBlock["actions"]
151
160
 
152
- export function parse(input: string): AdvancedBlock[]
153
-
154
- export class SyntaxError {
155
- public message: any
156
- public expected: any
157
- public found: any
158
- public location: any
161
+ type SyntaxError = {
162
+ message: string
163
+ found?: string
164
+ location: {
165
+ start: {
166
+ offset: number
167
+ line: number
168
+ column: number
169
+ }
170
+ end: {
171
+ offset: number
172
+ line: number
173
+ column: number
174
+ }
175
+ }
159
176
  }
177
+
178
+ export function parse(input: string): AdvancedBlock[]