pdl-editor 0.30.0
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 +30 -0
- package/assets/language-configuration.json +48 -0
- package/assets/pdl.tmLanguage.json +191 -0
- package/dist/index.cjs +863 -0
- package/dist/index.d.cts +117 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.mjs +832 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# pdl-editor
|
|
2
|
+
|
|
3
|
+
Reusable Monaco and React editor integration for PDL `0.30.x` browser hosts.
|
|
4
|
+
|
|
5
|
+
The package owns editor wiring only: language registration, TextMate grammar
|
|
6
|
+
setup, the default light theme, marker conversion, Monaco providers, structural
|
|
7
|
+
editor-service runtime types, and a thin `<PdlEditor />` component. Hosts keep
|
|
8
|
+
runtime loading, execution buttons, output panels, routing, and application
|
|
9
|
+
state.
|
|
10
|
+
|
|
11
|
+
PDL binding and column highlighting is delivered through the shared
|
|
12
|
+
editor-service semantic-token ABI exposed by `pdl-wasm` and consumed here by the
|
|
13
|
+
Monaco provider. Browser hosts should update these packages instead of adding
|
|
14
|
+
PDL-specific parser or token classification logic.
|
|
15
|
+
|
|
16
|
+
Published packages expose `dist/index.mjs`, `dist/index.cjs`, and
|
|
17
|
+
`dist/index.d.ts`, while static TextMate and language-configuration assets stay
|
|
18
|
+
available through package subpath exports. Use source mode during local
|
|
19
|
+
cross-repo development:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { PdlEditor } from "pdl-editor";
|
|
23
|
+
import { loadPdlRuntime } from "pdl-wasm";
|
|
24
|
+
|
|
25
|
+
const runtime = await loadPdlRuntime({ wasmUrl: "/wasm/pdl.wasm" });
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Use packed mode before publishing by running `npm pack --dry-run` in
|
|
29
|
+
`packages/wasm` and `editors/monaco`, then inspecting the file lists for
|
|
30
|
+
`dist/`, declarations, README, package metadata, and editor assets.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"comments": {
|
|
3
|
+
"lineComment": "//",
|
|
4
|
+
"blockComment": [
|
|
5
|
+
"/*",
|
|
6
|
+
"*/"
|
|
7
|
+
]
|
|
8
|
+
},
|
|
9
|
+
"brackets": [
|
|
10
|
+
[
|
|
11
|
+
"(",
|
|
12
|
+
")"
|
|
13
|
+
]
|
|
14
|
+
],
|
|
15
|
+
"autoClosingPairs": [
|
|
16
|
+
{
|
|
17
|
+
"open": "\"",
|
|
18
|
+
"close": "\""
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"open": "`",
|
|
22
|
+
"close": "`"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"open": "(",
|
|
26
|
+
"close": ")"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"surroundingPairs": [
|
|
30
|
+
{
|
|
31
|
+
"open": "\"",
|
|
32
|
+
"close": "\""
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"open": "`",
|
|
36
|
+
"close": "`"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"open": "(",
|
|
40
|
+
"close": ")"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^`~!@#$%^&*()+={}\\[\\]\\\\|;:'\",.<>/?\\s]+)",
|
|
44
|
+
"indentationRules": {
|
|
45
|
+
"increaseIndentPattern": "^\\s*let\\s+[A-Za-z_][A-Za-z0-9_]*\\s*=\\s*$",
|
|
46
|
+
"decreaseIndentPattern": "^\\s*$"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
3
|
+
"name": "PDL",
|
|
4
|
+
"scopeName": "source.pdl",
|
|
5
|
+
"patterns": [
|
|
6
|
+
{
|
|
7
|
+
"include": "#comments"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"include": "#strings"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"include": "#backtickColumns"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"include": "#numbers"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"include": "#contextReferences"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"include": "#operators"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"include": "#declarations"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"include": "#keywords"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"include": "#functions"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"repository": {
|
|
35
|
+
"comments": {
|
|
36
|
+
"patterns": [
|
|
37
|
+
{
|
|
38
|
+
"name": "comment.line.double-slash.pdl",
|
|
39
|
+
"match": "//.*$"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "comment.block.pdl",
|
|
43
|
+
"begin": "/\\*",
|
|
44
|
+
"end": "\\*/"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"strings": {
|
|
49
|
+
"patterns": [
|
|
50
|
+
{
|
|
51
|
+
"name": "string.quoted.double.pdl",
|
|
52
|
+
"begin": "\"",
|
|
53
|
+
"end": "\"",
|
|
54
|
+
"patterns": [
|
|
55
|
+
{
|
|
56
|
+
"name": "constant.character.escape.pdl",
|
|
57
|
+
"match": "\\\\(?:[\"\\\\nrt]|u\\{[0-9A-Fa-f]+\\})"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"backtickColumns": {
|
|
64
|
+
"patterns": [
|
|
65
|
+
{
|
|
66
|
+
"name": "variable.other.column.pdl",
|
|
67
|
+
"begin": "`",
|
|
68
|
+
"end": "`",
|
|
69
|
+
"patterns": [
|
|
70
|
+
{
|
|
71
|
+
"name": "constant.character.escape.pdl",
|
|
72
|
+
"match": "\\\\(?:[`\\\\])"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"numbers": {
|
|
79
|
+
"patterns": [
|
|
80
|
+
{
|
|
81
|
+
"name": "constant.numeric.pdl",
|
|
82
|
+
"match": "\\b[0-9]+(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"operators": {
|
|
87
|
+
"patterns": [
|
|
88
|
+
{
|
|
89
|
+
"name": "keyword.operator.pdl",
|
|
90
|
+
"match": "\\|"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "keyword.operator.comparison.pdl",
|
|
94
|
+
"match": "==|!=|<=|>=|<|>"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "keyword.operator.arithmetic.pdl",
|
|
98
|
+
"match": "[+\\-*/%]"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "keyword.operator.context.pdl",
|
|
102
|
+
"match": "[$@]"
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"contextReferences": {
|
|
107
|
+
"patterns": [
|
|
108
|
+
{
|
|
109
|
+
"name": "variable.parameter.context.pdl",
|
|
110
|
+
"match": "[$@][A-Za-z_][A-Za-z0-9_]*\\b"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"declarations": {
|
|
115
|
+
"patterns": [
|
|
116
|
+
{
|
|
117
|
+
"name": "meta.context.declaration.pdl",
|
|
118
|
+
"match": "\\b(param|state)\\s+([A-Za-z_][A-Za-z0-9_]*)\\b",
|
|
119
|
+
"captures": {
|
|
120
|
+
"1": {
|
|
121
|
+
"name": "keyword.declaration.pdl"
|
|
122
|
+
},
|
|
123
|
+
"2": {
|
|
124
|
+
"name": "variable.parameter.declaration.pdl"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "meta.binding.declaration.pdl",
|
|
130
|
+
"match": "\\b(let)\\s+([A-Za-z_][A-Za-z0-9_]*)\\b",
|
|
131
|
+
"captures": {
|
|
132
|
+
"1": {
|
|
133
|
+
"name": "keyword.declaration.pdl"
|
|
134
|
+
},
|
|
135
|
+
"2": {
|
|
136
|
+
"name": "variable.other.declaration.pdl"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "meta.output.declaration.pdl",
|
|
142
|
+
"match": "\\b(output)\\s+([A-Za-z_][A-Za-z0-9_]*)\\b",
|
|
143
|
+
"captures": {
|
|
144
|
+
"1": {
|
|
145
|
+
"name": "keyword.declaration.pdl"
|
|
146
|
+
},
|
|
147
|
+
"2": {
|
|
148
|
+
"name": "entity.name.function.output.pdl"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "variable.parameter.pdl",
|
|
154
|
+
"match": "\\b[A-Za-z_][A-Za-z0-9_]*\\b(?=\\s*=(?!=))"
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
"keywords": {
|
|
159
|
+
"patterns": [
|
|
160
|
+
{
|
|
161
|
+
"name": "keyword.control.pdl",
|
|
162
|
+
"match": "\\b(?:let|output|param|state|load|filter|select|drop|rename|mutate|group_by|agg|sort|limit|join|union|distinct|pivot_longer|complete|save|on|kind|by_name|names_to|values_to|fill|format|over|partition_by|order_by|rows|between|unbounded_preceding|current_row|unbounded_following|preceding|following|stdin|stdout|and|or|not|asc|desc|inner|left|right|full|semi|anti|nulls_first|nulls_last)\\b"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "constant.language.pdl",
|
|
166
|
+
"match": "\\b(?:true|false|null)\\b"
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
"functions": {
|
|
171
|
+
"patterns": [
|
|
172
|
+
{
|
|
173
|
+
"name": "support.function.window.pdl",
|
|
174
|
+
"match": "\\b(?:count|count_distinct|sum|mean|min|max)\\b(?=\\s*\\([^)]*\\)\\s*over\\b)"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "support.function.aggregate.pdl",
|
|
178
|
+
"match": "\\b(?:count|count_distinct|sum|mean|min|max)\\b(?=\\s*\\()"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "support.function.scalar.pdl",
|
|
182
|
+
"match": "\\b(?:is_null|not_null|coalesce|concat|lower|upper|trim|to_number|abs|round|if_else|col)\\b(?=\\s*\\()"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "support.function.window.pdl",
|
|
186
|
+
"match": "\\b(?:row_number|rank|dense_rank|percent_rank|cume_dist|lag|lead|first_value|last_value)\\b(?=\\s*\\()"
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|