@tuprolog/arg2p-ui 0.0.0-stage → 0.1.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 +48 -2
- package/dist/components/arg2p-editor.d.ts +73 -0
- package/dist/components/arg2p-editor.js +244 -0
- package/dist/components/arg2p-editor.js.map +1 -0
- package/dist/components/arg2p-flags.d.ts +58 -0
- package/dist/components/arg2p-flags.js +358 -0
- package/dist/components/arg2p-flags.js.map +1 -0
- package/dist/components/arg2p-framework.d.ts +102 -0
- package/dist/components/arg2p-framework.js +513 -0
- package/dist/components/arg2p-framework.js.map +1 -0
- package/dist/components/arg2p-graph.d.ts +112 -0
- package/dist/components/arg2p-graph.js +577 -0
- package/dist/components/arg2p-graph.js.map +1 -0
- package/dist/components/arg2p-solutions.d.ts +75 -0
- package/dist/components/arg2p-solutions.js +391 -0
- package/dist/components/arg2p-solutions.js.map +1 -0
- package/dist/data.d.ts +9 -0
- package/dist/data.js +11 -0
- package/dist/data.js.map +1 -0
- package/dist/editor/language.d.ts +9 -0
- package/dist/editor/language.js +78 -0
- package/dist/editor/language.js.map +1 -0
- package/dist/engine.d.ts +94 -0
- package/dist/engine.js +2 -0
- package/dist/engine.js.map +1 -0
- package/dist/flags/schema.d.ts +50 -0
- package/dist/flags/schema.js +195 -0
- package/dist/flags/schema.js.map +1 -0
- package/dist/flags/text.d.ts +18 -0
- package/dist/flags/text.js +85 -0
- package/dist/flags/text.js.map +1 -0
- package/dist/formats/declarations.d.ts +9 -0
- package/dist/formats/declarations.js +193 -0
- package/dist/formats/declarations.js.map +1 -0
- package/dist/formats/frameworks.d.ts +23 -0
- package/dist/formats/frameworks.js +130 -0
- package/dist/formats/frameworks.js.map +1 -0
- package/dist/graph/canvas.d.ts +21 -0
- package/dist/graph/canvas.js +76 -0
- package/dist/graph/canvas.js.map +1 -0
- package/dist/graph/drawing.d.ts +24 -0
- package/dist/graph/drawing.js +64 -0
- package/dist/graph/drawing.js.map +1 -0
- package/dist/graph/layout.d.ts +28 -0
- package/dist/graph/layout.js +167 -0
- package/dist/graph/layout.js.map +1 -0
- package/dist/graph/levels.d.ts +6 -0
- package/dist/graph/levels.js +25 -0
- package/dist/graph/levels.js.map +1 -0
- package/dist/graph/positions.d.ts +24 -0
- package/dist/graph/positions.js +43 -0
- package/dist/graph/positions.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/js/engine.d.ts +35 -0
- package/dist/js/engine.js +110 -0
- package/dist/js/engine.js.map +1 -0
- package/dist/js/host.d.ts +75 -0
- package/dist/js/host.js +237 -0
- package/dist/js/host.js.map +1 -0
- package/dist/js/index.d.ts +2 -0
- package/dist/js/index.js +4 -0
- package/dist/js/index.js.map +1 -0
- package/dist/js/worker.d.ts +1 -0
- package/dist/js/worker.js +7 -0
- package/dist/js/worker.js.map +1 -0
- package/dist/theme.d.ts +5 -0
- package/dist/theme.js +48 -0
- package/dist/theme.js.map +1 -0
- package/package.json +65 -4
package/README.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @tuprolog/arg2p-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The user interface of [Arg2P](https://tuprolog.github.io/arg2p-kt/) as web components: the
|
|
4
|
+
[playground](https://tuprolog.github.io/arg2p-kt-web/) is made of them, and so is the solver of the extension of VS
|
|
5
|
+
Code. They run on an engine that gives plain data: the solver of the browser (`@tuprolog/arg2p-ui/js`, in a worker),
|
|
6
|
+
or the language server of Arg2P on the JVM.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install @tuprolog/arg2p-ui @tuprolog/arg2p
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<arg2p-editor id="theory" kind="theory"></arg2p-editor>
|
|
14
|
+
<arg2p-editor id="query" kind="query"></arg2p-editor>
|
|
15
|
+
<arg2p-solutions></arg2p-solutions>
|
|
16
|
+
<arg2p-graph></arg2p-graph>
|
|
17
|
+
|
|
18
|
+
<script type="module">
|
|
19
|
+
import '@tuprolog/arg2p-ui';
|
|
20
|
+
import { JsEngine } from '@tuprolog/arg2p-ui/js';
|
|
21
|
+
|
|
22
|
+
const engine = new JsEngine();
|
|
23
|
+
const [theory, query] = ['#theory', '#query'].map(it => document.querySelector(it));
|
|
24
|
+
theory.engine = query.engine = engine;
|
|
25
|
+
const solutions = document.querySelector('arg2p-solutions');
|
|
26
|
+
const graph = document.querySelector('arg2p-graph');
|
|
27
|
+
solutions.addEventListener('arg2p-solution', e => graph.showSolution(e.detail.solution, e.detail.run));
|
|
28
|
+
query.addEventListener('arg2p-submit', async () => {
|
|
29
|
+
const run = await engine.solve({ theory: theory.value, query: query.value, flags: 'queryMode.' });
|
|
30
|
+
solutions.start(run);
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Components
|
|
36
|
+
|
|
37
|
+
| Element | |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| `<arg2p-editor>` | A theory, a query or flags (CodeMirror), its syntax errors shown as it is typed |
|
|
40
|
+
| `<arg2p-solutions>` | The solutions of a query, asked for one at a time |
|
|
41
|
+
| `<arg2p-graph>` | The argument graph of a solution: its stages, the popup of each argument, its picture |
|
|
42
|
+
| `<arg2p-framework>` | An abstract framework drawn: drawing writes its theory, its theory edited is drawn again |
|
|
43
|
+
| `<arg2p-flags>` | The flags, the profile first, each with its value in effect and where it comes from |
|
|
44
|
+
|
|
45
|
+
`@tuprolog/arg2p-ui/data` has what they are built on with no DOM: the contract of engines, the flags and profiles, the
|
|
46
|
+
formats of abstract frameworks (APX, TGF, ICCMA'23), the layout of graphs.
|
|
47
|
+
|
|
48
|
+
The components take their colours from custom properties (`--arg2p-surface`, `--arg2p-text`, `--arg2p-accent`, ...),
|
|
49
|
+
with a light theme otherwise.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type Text } from '@codemirror/state';
|
|
2
|
+
import { EditorView } from '@codemirror/view';
|
|
3
|
+
import { LitElement, type PropertyValues } from 'lit';
|
|
4
|
+
import type { Engine, SyntaxProblem } from '../engine.js';
|
|
5
|
+
export type EditorKind = 'theory' | 'query' | 'flags';
|
|
6
|
+
/** Where [problem] is in [doc]: its token, held within the text */
|
|
7
|
+
export declare function rangeOf(doc: Text, problem: Pick<SyntaxProblem, 'line' | 'column' | 'length'>): {
|
|
8
|
+
from: number;
|
|
9
|
+
to: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* An editor of a theory, a query or flags, in the language of arg2p. The engine checks the text once the typing
|
|
13
|
+
* settles: a syntax error is underlined (its message shows when hovering it), and written under the editor, which
|
|
14
|
+
* takes to it when tapped (touch screens have no hover). A query is one line: Enter submits it.
|
|
15
|
+
*
|
|
16
|
+
* Events: `arg2p-change` with the text, as it is typed; `arg2p-submit` when Enter is pressed in a query.
|
|
17
|
+
*/
|
|
18
|
+
export declare class Arg2pEditor extends LitElement {
|
|
19
|
+
static properties: {
|
|
20
|
+
value: {};
|
|
21
|
+
kind: {
|
|
22
|
+
reflect: boolean;
|
|
23
|
+
};
|
|
24
|
+
engine: {
|
|
25
|
+
attribute: boolean;
|
|
26
|
+
};
|
|
27
|
+
label: {};
|
|
28
|
+
placeholder: {};
|
|
29
|
+
readonly: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
reflect: boolean;
|
|
32
|
+
};
|
|
33
|
+
problem: {
|
|
34
|
+
state: boolean;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/** The text */
|
|
38
|
+
value: string;
|
|
39
|
+
kind: EditorKind;
|
|
40
|
+
/** What checks the text; without it, the text is not checked */
|
|
41
|
+
engine: Pick<Engine, 'check'> | null;
|
|
42
|
+
/** What the text is called in the messages (the theory, the flags, ...) */
|
|
43
|
+
label: string;
|
|
44
|
+
placeholder: string;
|
|
45
|
+
readonly: boolean;
|
|
46
|
+
private problem;
|
|
47
|
+
private view;
|
|
48
|
+
private readonly editable;
|
|
49
|
+
private readonly hint;
|
|
50
|
+
private readonly checking;
|
|
51
|
+
/** The editor, for what the element does not do itself */
|
|
52
|
+
get editor(): EditorView | null;
|
|
53
|
+
/** Shows [problem] (found by running, say) at once, and takes the editor to it */
|
|
54
|
+
report(problem: SyntaxProblem): void;
|
|
55
|
+
/** Takes the editor to [line] and [column] (from 1), focused */
|
|
56
|
+
reveal(line: number, column: number): void;
|
|
57
|
+
focus(): void;
|
|
58
|
+
protected firstUpdated(): void;
|
|
59
|
+
protected updated(changed: PropertyValues): void;
|
|
60
|
+
disconnectedCallback(): void;
|
|
61
|
+
connectedCallback(): void;
|
|
62
|
+
private extensions;
|
|
63
|
+
private check;
|
|
64
|
+
private diagnostic;
|
|
65
|
+
private emit;
|
|
66
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
67
|
+
static styles: import("lit").CSSResult[];
|
|
68
|
+
}
|
|
69
|
+
declare global {
|
|
70
|
+
interface HTMLElementTagNameMap {
|
|
71
|
+
'arg2p-editor': Arg2pEditor;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';
|
|
2
|
+
import { bracketMatching } from '@codemirror/language';
|
|
3
|
+
import { linter, setDiagnostics } from '@codemirror/lint';
|
|
4
|
+
import { highlightSelectionMatches, searchKeymap } from '@codemirror/search';
|
|
5
|
+
import { Compartment, EditorState, Prec } from '@codemirror/state';
|
|
6
|
+
import { EditorView, drawSelection, keymap, lineNumbers, placeholder } from '@codemirror/view';
|
|
7
|
+
import { LitElement, css, html, nothing } from 'lit';
|
|
8
|
+
import { arg2p } from '../editor/language.js';
|
|
9
|
+
import { tokens } from '../theme.js';
|
|
10
|
+
// How long the typing is let be before the text is checked
|
|
11
|
+
const CHECK_DELAY = 500;
|
|
12
|
+
/** Where [problem] is in [doc]: its token, held within the text */
|
|
13
|
+
export function rangeOf(doc, problem) {
|
|
14
|
+
const line = doc.line(Math.max(1, Math.min(problem.line, doc.lines)));
|
|
15
|
+
const from = line.from + Math.max(0, Math.min(problem.column - 1, line.length));
|
|
16
|
+
return { from, to: Math.max(from, Math.min(from + problem.length, line.to)) };
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* An editor of a theory, a query or flags, in the language of arg2p. The engine checks the text once the typing
|
|
20
|
+
* settles: a syntax error is underlined (its message shows when hovering it), and written under the editor, which
|
|
21
|
+
* takes to it when tapped (touch screens have no hover). A query is one line: Enter submits it.
|
|
22
|
+
*
|
|
23
|
+
* Events: `arg2p-change` with the text, as it is typed; `arg2p-submit` when Enter is pressed in a query.
|
|
24
|
+
*/
|
|
25
|
+
export class Arg2pEditor extends LitElement {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
/** The text */
|
|
29
|
+
this.value = '';
|
|
30
|
+
this.kind = 'theory';
|
|
31
|
+
/** What checks the text; without it, the text is not checked */
|
|
32
|
+
this.engine = null;
|
|
33
|
+
/** What the text is called in the messages (the theory, the flags, ...) */
|
|
34
|
+
this.label = '';
|
|
35
|
+
this.placeholder = '';
|
|
36
|
+
this.readonly = false;
|
|
37
|
+
// the syntax error shown, if any
|
|
38
|
+
this.problem = null;
|
|
39
|
+
this.view = null;
|
|
40
|
+
this.editable = new Compartment();
|
|
41
|
+
this.hint = new Compartment();
|
|
42
|
+
this.checking = new Compartment();
|
|
43
|
+
}
|
|
44
|
+
static { this.properties = {
|
|
45
|
+
value: {},
|
|
46
|
+
kind: { reflect: true },
|
|
47
|
+
engine: { attribute: false },
|
|
48
|
+
label: {},
|
|
49
|
+
placeholder: {},
|
|
50
|
+
readonly: { type: Boolean, reflect: true },
|
|
51
|
+
problem: { state: true },
|
|
52
|
+
}; }
|
|
53
|
+
/** The editor, for what the element does not do itself */
|
|
54
|
+
get editor() {
|
|
55
|
+
return this.view;
|
|
56
|
+
}
|
|
57
|
+
/** Shows [problem] (found by running, say) at once, and takes the editor to it */
|
|
58
|
+
report(problem) {
|
|
59
|
+
const view = this.view;
|
|
60
|
+
if (view === null)
|
|
61
|
+
return;
|
|
62
|
+
view.dispatch(setDiagnostics(view.state, [this.diagnostic(view.state.doc, problem)]));
|
|
63
|
+
this.problem = problem;
|
|
64
|
+
this.reveal(problem.line, problem.column);
|
|
65
|
+
}
|
|
66
|
+
/** Takes the editor to [line] and [column] (from 1), focused */
|
|
67
|
+
reveal(line, column) {
|
|
68
|
+
const view = this.view;
|
|
69
|
+
if (view === null)
|
|
70
|
+
return;
|
|
71
|
+
const { from } = rangeOf(view.state.doc, { line, column, length: 0 });
|
|
72
|
+
view.dispatch({ selection: { anchor: from }, effects: EditorView.scrollIntoView(from, { y: 'center' }) });
|
|
73
|
+
view.focus();
|
|
74
|
+
}
|
|
75
|
+
focus() {
|
|
76
|
+
this.view?.focus();
|
|
77
|
+
}
|
|
78
|
+
firstUpdated() {
|
|
79
|
+
this.view = new EditorView({
|
|
80
|
+
root: this.renderRoot,
|
|
81
|
+
parent: this.renderRoot.querySelector('.editor'),
|
|
82
|
+
state: EditorState.create({ doc: this.value, extensions: this.extensions() }),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
updated(changed) {
|
|
86
|
+
const view = this.view;
|
|
87
|
+
if (view === null)
|
|
88
|
+
return;
|
|
89
|
+
if (changed.has('value') && this.value !== view.state.doc.toString()) {
|
|
90
|
+
view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert: this.value } });
|
|
91
|
+
}
|
|
92
|
+
if (changed.has('readonly'))
|
|
93
|
+
view.dispatch({ effects: this.editable.reconfigure(EditorState.readOnly.of(this.readonly)) });
|
|
94
|
+
if (changed.has('placeholder'))
|
|
95
|
+
view.dispatch({ effects: this.hint.reconfigure(placeholder(this.placeholder)) });
|
|
96
|
+
if (changed.has('engine') || changed.has('kind'))
|
|
97
|
+
view.dispatch({ effects: this.checking.reconfigure(this.check()) });
|
|
98
|
+
}
|
|
99
|
+
disconnectedCallback() {
|
|
100
|
+
super.disconnectedCallback();
|
|
101
|
+
this.view?.destroy();
|
|
102
|
+
this.view = null;
|
|
103
|
+
}
|
|
104
|
+
connectedCallback() {
|
|
105
|
+
super.connectedCallback();
|
|
106
|
+
if (this.hasUpdated && this.view === null)
|
|
107
|
+
this.firstUpdated();
|
|
108
|
+
}
|
|
109
|
+
extensions() {
|
|
110
|
+
const query = this.kind === 'query';
|
|
111
|
+
return [
|
|
112
|
+
arg2p(),
|
|
113
|
+
history(),
|
|
114
|
+
drawSelection(),
|
|
115
|
+
bracketMatching(),
|
|
116
|
+
highlightSelectionMatches(),
|
|
117
|
+
query ? [] : lineNumbers(),
|
|
118
|
+
query ? [] : EditorView.lineWrapping,
|
|
119
|
+
// a query is one line: Enter submits it, and a text pasted in is joined on one line
|
|
120
|
+
query
|
|
121
|
+
? [
|
|
122
|
+
Prec.highest(keymap.of([{ key: 'Enter', run: () => (this.emit('arg2p-submit', { value: this.value }), true) }])),
|
|
123
|
+
EditorState.transactionFilter.of(tr => (tr.newDoc.lines > 1 ? [tr, { changes: { from: 0, to: tr.newDoc.length, insert: tr.newDoc.toString().replace(/\s*\n\s*/g, ' ') }, sequential: true }] : tr)),
|
|
124
|
+
]
|
|
125
|
+
: [],
|
|
126
|
+
keymap.of([...defaultKeymap, ...historyKeymap, ...searchKeymap, indentWithTab]),
|
|
127
|
+
this.editable.of(EditorState.readOnly.of(this.readonly)),
|
|
128
|
+
this.hint.of(placeholder(this.placeholder)),
|
|
129
|
+
this.checking.of(this.check()),
|
|
130
|
+
EditorView.updateListener.of(update => {
|
|
131
|
+
if (!update.docChanged)
|
|
132
|
+
return;
|
|
133
|
+
const value = update.state.doc.toString();
|
|
134
|
+
if (value === this.value)
|
|
135
|
+
return;
|
|
136
|
+
this.value = value;
|
|
137
|
+
this.emit('arg2p-change', { value });
|
|
138
|
+
}),
|
|
139
|
+
EditorView.theme({
|
|
140
|
+
'&': { height: '100%', backgroundColor: 'var(--_surface)', color: 'var(--_text)' },
|
|
141
|
+
'&.cm-focused': { outline: 'none' },
|
|
142
|
+
'.cm-scroller': { fontFamily: 'var(--_mono)', lineHeight: '1.5' },
|
|
143
|
+
// the text as typed: no ligature turns => into an arrow
|
|
144
|
+
'.cm-content': { caretColor: 'var(--_text)', fontVariantLigatures: 'none' },
|
|
145
|
+
'.cm-cursor, .cm-dropCursor': { borderLeftColor: 'var(--_text)' },
|
|
146
|
+
'.cm-gutters': { backgroundColor: 'var(--_surface-2)', color: 'var(--_muted)', border: 'none' },
|
|
147
|
+
'&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection': {
|
|
148
|
+
backgroundColor: 'color-mix(in srgb, var(--_accent) 25%, transparent) !important',
|
|
149
|
+
},
|
|
150
|
+
'.cm-placeholder': { color: 'var(--_muted)' },
|
|
151
|
+
'.cm-tooltip': { backgroundColor: 'var(--_surface)', color: 'var(--_text)', border: '1px solid var(--_border)' },
|
|
152
|
+
}),
|
|
153
|
+
];
|
|
154
|
+
}
|
|
155
|
+
// The check of the text by the engine, once the typing settles: the problem it finds is shown under the editor too
|
|
156
|
+
check() {
|
|
157
|
+
const engine = this.engine;
|
|
158
|
+
if (engine === null)
|
|
159
|
+
return [];
|
|
160
|
+
const kind = this.kind === 'query' ? 'query' : 'theory';
|
|
161
|
+
return linter(async (view) => {
|
|
162
|
+
const doc = view.state.doc;
|
|
163
|
+
let problem = null;
|
|
164
|
+
try {
|
|
165
|
+
problem = await engine.check(doc.toString(), kind);
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
// an engine that cannot check now (stopped, say) finds nothing
|
|
169
|
+
}
|
|
170
|
+
this.problem = problem;
|
|
171
|
+
return problem === null ? [] : [this.diagnostic(doc, problem)];
|
|
172
|
+
}, { delay: CHECK_DELAY });
|
|
173
|
+
}
|
|
174
|
+
diagnostic(doc, problem) {
|
|
175
|
+
return { ...rangeOf(doc, problem), severity: 'error', message: problem.message, source: 'arg2p' };
|
|
176
|
+
}
|
|
177
|
+
emit(type, detail) {
|
|
178
|
+
this.dispatchEvent(new CustomEvent(type, { detail, bubbles: true, composed: true }));
|
|
179
|
+
}
|
|
180
|
+
render() {
|
|
181
|
+
const problem = this.problem;
|
|
182
|
+
return html `
|
|
183
|
+
<div class="editor"></div>
|
|
184
|
+
${problem === null
|
|
185
|
+
? nothing
|
|
186
|
+
: html `
|
|
187
|
+
<div
|
|
188
|
+
class="problem"
|
|
189
|
+
role="button"
|
|
190
|
+
tabindex="0"
|
|
191
|
+
title="Go to the error"
|
|
192
|
+
@click=${() => this.reveal(problem.line, problem.column)}
|
|
193
|
+
@keydown=${(e) => {
|
|
194
|
+
if (e.key !== 'Enter' && e.key !== ' ')
|
|
195
|
+
return;
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
this.reveal(problem.line, problem.column);
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
<span class="place">${this.label ? `${this.label}, ` : ''}line ${problem.line}, col ${problem.column}</span>
|
|
201
|
+
<span>${problem.message}</span>
|
|
202
|
+
</div>
|
|
203
|
+
`}
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
static { this.styles = [
|
|
207
|
+
tokens,
|
|
208
|
+
css `
|
|
209
|
+
:host {
|
|
210
|
+
display: flex;
|
|
211
|
+
flex-direction: column;
|
|
212
|
+
min-height: 0;
|
|
213
|
+
border: 1px solid var(--_border);
|
|
214
|
+
border-radius: 4px;
|
|
215
|
+
overflow: hidden;
|
|
216
|
+
background: var(--_surface);
|
|
217
|
+
}
|
|
218
|
+
:host([kind='query']) {
|
|
219
|
+
flex: none;
|
|
220
|
+
}
|
|
221
|
+
.editor {
|
|
222
|
+
flex: 1;
|
|
223
|
+
min-height: 0;
|
|
224
|
+
font-size: 14px;
|
|
225
|
+
}
|
|
226
|
+
.problem {
|
|
227
|
+
display: flex;
|
|
228
|
+
gap: 8px;
|
|
229
|
+
padding: 4px 8px;
|
|
230
|
+
font-size: 12px;
|
|
231
|
+
color: var(--_error);
|
|
232
|
+
background: color-mix(in srgb, var(--_error) 8%, transparent);
|
|
233
|
+
border-top: 1px solid color-mix(in srgb, var(--_error) 30%, transparent);
|
|
234
|
+
cursor: pointer;
|
|
235
|
+
}
|
|
236
|
+
.place {
|
|
237
|
+
font-weight: 600;
|
|
238
|
+
white-space: nowrap;
|
|
239
|
+
}
|
|
240
|
+
`,
|
|
241
|
+
]; }
|
|
242
|
+
}
|
|
243
|
+
customElements.define('arg2p-editor', Arg2pEditor);
|
|
244
|
+
//# sourceMappingURL=arg2p-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arg2p-editor.js","sourceRoot":"","sources":["../../src/components/arg2p-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAmB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAA6B,MAAM,mBAAmB,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,2DAA2D;AAC3D,MAAM,WAAW,GAAG,GAAG,CAAC;AAIxB,mEAAmE;AACnE,MAAM,UAAU,OAAO,CAAC,GAAS,EAAE,OAA0D;IACzF,MAAM,IAA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C,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,OAAO,CAAC,IAAI,SAAS,OAAO,CAAC,MAAM;kCAC5F,OAAO,CAAC,OAAO;;mBAE9B;SACV,CAAC;IACN,CAAC;aAEe,WAAM,GAAG;QACrB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAgCF;KACJ,AAnCqB,CAmCpB;CACL;AAED,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { LitElement, type PropertyValues } from 'lit';
|
|
2
|
+
import type { Engine } from '../engine.js';
|
|
3
|
+
import { type Flag } from '../flags/schema.js';
|
|
4
|
+
/** Where the value of a flag in effect comes from */
|
|
5
|
+
export type Source = 'theory' | 'flags' | 'profile' | 'default';
|
|
6
|
+
/**
|
|
7
|
+
* The flags of the solver, as controls over their text (Prolog facts, the source of truth: every change rewrites the
|
|
8
|
+
* lines of its flag alone). The profile comes first: it presets the flags its framework needs, and the flags that mean
|
|
9
|
+
* something for it are shown, the others folded away. Every flag shows the value in effect for the theory, as the
|
|
10
|
+
* engine tells it, and where it comes from: the theory (which wins: it is changed in the theory), the flags, the
|
|
11
|
+
* profile, or the default. A flag the flags state can be reset, to take the value of the profile again.
|
|
12
|
+
*
|
|
13
|
+
* Events: `arg2p-flags-change` with the flags, after every change made with the controls.
|
|
14
|
+
*/
|
|
15
|
+
export declare class Arg2pFlags extends LitElement {
|
|
16
|
+
static properties: {
|
|
17
|
+
flags: {};
|
|
18
|
+
theory: {};
|
|
19
|
+
engine: {
|
|
20
|
+
attribute: boolean;
|
|
21
|
+
};
|
|
22
|
+
settings: {
|
|
23
|
+
state: boolean;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/** The flags, as Prolog facts */
|
|
27
|
+
flags: string;
|
|
28
|
+
/** The theory the flags are for: it may state flags, and its profile */
|
|
29
|
+
theory: string;
|
|
30
|
+
/** What tells the settings in effect; without it, the panel shows what the flags state */
|
|
31
|
+
engine: Pick<Engine, 'settings'> | null;
|
|
32
|
+
private settings;
|
|
33
|
+
private timer;
|
|
34
|
+
private asked;
|
|
35
|
+
protected updated(changed: PropertyValues): void;
|
|
36
|
+
disconnectedCallback(): void;
|
|
37
|
+
private ask;
|
|
38
|
+
/** The values in effect of [flag], and where they come from */
|
|
39
|
+
effective(flag: Pick<Flag, 'name'>): {
|
|
40
|
+
values: readonly string[];
|
|
41
|
+
source: Source;
|
|
42
|
+
};
|
|
43
|
+
private profile;
|
|
44
|
+
private change;
|
|
45
|
+
private set;
|
|
46
|
+
/** What the panel finds wrong with the flags in effect */
|
|
47
|
+
warnings(): string[];
|
|
48
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
49
|
+
private group;
|
|
50
|
+
private flag;
|
|
51
|
+
private badge;
|
|
52
|
+
static styles: import("lit").CSSResult[];
|
|
53
|
+
}
|
|
54
|
+
declare global {
|
|
55
|
+
interface HTMLElementTagNameMap {
|
|
56
|
+
'arg2p-flags': Arg2pFlags;
|
|
57
|
+
}
|
|
58
|
+
}
|