dequel-editor 0.4.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 ADDED
@@ -0,0 +1,127 @@
1
+ # dequel-editor
2
+
3
+ A CodeMirror 6-based editor for [Dequel](https://github.com/nocksock/dequel), a human-friendly query language.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install dequel-editor
9
+ # or
10
+ pnpm add dequel-editor
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Web Component (Full Bundle)
16
+
17
+ The simplest way to use the editor - just import and use the custom element:
18
+
19
+ ```html
20
+ <script type="module">
21
+ import 'dequel-editor'
22
+ </script>
23
+
24
+ <dequel-editor
25
+ id="my-editor"
26
+ name="query"
27
+ endpoint="/api/completions"
28
+ ></dequel-editor>
29
+ ```
30
+
31
+ Don't forget to include the styles:
32
+
33
+ ```html
34
+ <link rel="stylesheet" href="node_modules/dequel-editor/dist/style.css">
35
+ ```
36
+
37
+ Or import in your JavaScript:
38
+
39
+ ```javascript
40
+ import 'dequel-editor'
41
+ import 'dequel-editor/style.css'
42
+ ```
43
+
44
+ ### Language Plugin Only
45
+
46
+ If you already have CodeMirror in your app and just want the Dequel language support:
47
+
48
+ ```javascript
49
+ import { DequelLang } from 'dequel-editor/lang'
50
+ import { EditorView, basicSetup } from 'codemirror'
51
+
52
+ new EditorView({
53
+ extensions: [basicSetup, DequelLang()],
54
+ parent: document.getElementById('editor'),
55
+ })
56
+ ```
57
+
58
+ This export externalizes CodeMirror dependencies for better tree-shaking.
59
+
60
+ ### Phoenix/Elixir Integration
61
+
62
+ If you're using the [dequel](https://hex.pm/packages/dequel) Hex package:
63
+
64
+ ```javascript
65
+ // In assets/js/app.js
66
+ import "../../deps/dequel/priv/static/dequel-editor.js"
67
+ ```
68
+
69
+ ## Web Component API
70
+
71
+ ### Attributes
72
+
73
+ | Attribute | Required | Description |
74
+ |-----------|----------|-------------|
75
+ | `name` | Yes | Form field name |
76
+ | `endpoint` | Yes | URL for query preview/validation |
77
+ | `autocompletions` | No | URL for field schema (enables autocomplete) |
78
+ | `suggestions` | No | URL for query suggestions widget |
79
+ | `value` | No | Initial query value |
80
+ | `locale` | No | Locale for i18n (default: auto-detect) |
81
+
82
+ ### Events
83
+
84
+ | Event | Detail | Description |
85
+ |-------|--------|-------------|
86
+ | `input` | `string` | Fired when query changes |
87
+
88
+ ### Form Integration
89
+
90
+ The editor is a form-associated custom element:
91
+
92
+ ```html
93
+ <form>
94
+ <dequel-editor name="query" endpoint="/api/preview"></dequel-editor>
95
+ <button type="submit">Search</button>
96
+ </form>
97
+ ```
98
+
99
+ Press `Ctrl+Enter` (or `Cmd+Enter` on Mac) to submit the form.
100
+
101
+ ## API Endpoints
102
+
103
+ The editor expects endpoints to return JSON in specific formats:
104
+
105
+ ### Completion Schema (`autocompletions` attribute)
106
+
107
+ ```json
108
+ {
109
+ "fields": [
110
+ {
111
+ "name": "status",
112
+ "title": "Status",
113
+ "description": "Filter by item status",
114
+ "type": "string",
115
+ "values": ["active", "inactive", "pending"]
116
+ }
117
+ ]
118
+ }
119
+ ```
120
+
121
+ ### Query Preview (`endpoint` attribute)
122
+
123
+ The endpoint receives the query and should return validation/preview results.
124
+
125
+ ## License
126
+
127
+ MIT
@@ -0,0 +1,24 @@
1
+ const e = "Debug", n = {
2
+ "Loading suggestions...": "Vorschlaege werden geladen...",
3
+ "Narrow your search": "Suche eingrenzen",
4
+ "Condition modifiers": "Bedingungsmodifikatoren",
5
+ Debug: e,
6
+ "Exact match": "Exakte Uebereinstimmung",
7
+ "Contains the given text": "Enthaelt den angegebenen Text",
8
+ "Starts with the given text": "Beginnt mit dem angegebenen Text",
9
+ "Ends with the given text": "Endet mit dem angegebenen Text",
10
+ "Match one of these values": "Entspricht einem dieser Werte",
11
+ "After this date": "Nach diesem Datum",
12
+ "Before this date": "Vor diesem Datum",
13
+ "Between two dates": "Zwischen zwei Daten",
14
+ "Remove negation": "Negation entfernen",
15
+ "Exclude from results": "Von Ergebnissen ausschliessen",
16
+ "Enable condition": "Bedingung aktivieren",
17
+ "Disable condition": "Bedingung deaktivieren",
18
+ "Add another condition": "Weitere Bedingung hinzufuegen",
19
+ "Syntax error": "Syntaxfehler"
20
+ };
21
+ export {
22
+ e as Debug,
23
+ n as default
24
+ };