@lblod/ember-rdfa-editor-lblod-plugins 37.2.0 → 37.2.1-dev.34534679eaf5d030e66f8a99790dd2a7af28314c
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/.changeset/tame-dryers-shout.md +5 -0
- package/CHANGELOG.md +6 -0
- package/addon/plugins/document-validation-plugin/index.ts +3 -14
- package/addon/plugins/location-plugin/contextual-actions/index.ts +2 -1
- package/addon/plugins/location-plugin/utils/replace-location.ts +12 -9
- package/addon/plugins/locked-placeholder-plugin/utils/replace-content-function.ts +1 -1
- package/addon/plugins/structure-plugin/monads/insert-structure.ts +5 -2
- package/addon/utils/option.ts +1 -1
- package/declarations/addon/components/document-validation-plugin/card.d.ts +6 -6
- package/declarations/addon/plugins/document-validation-plugin/index.d.ts +0 -2
- package/declarations/addon/plugins/location-plugin/contextual-actions/index.d.ts +2 -2
- package/declarations/addon/plugins/location-plugin/utils/replace-location.d.ts +1 -1
- package/declarations/addon/plugins/structure-plugin/structure-types.d.ts +1 -1
- package/declarations/addon/utils/option.d.ts +1 -1
- package/package.json +3 -4
- package/app/models/template.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 37.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#663](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/663) [`4938095`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/49380955ce5c33beac6013cea02a684558aa0701) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Use parse slice to not include unneeded paragraphs on the inline locked placeholders parse
|
|
8
|
+
|
|
3
9
|
## 37.2.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -9,12 +9,7 @@ import {
|
|
|
9
9
|
SayController,
|
|
10
10
|
} from '@lblod/ember-rdfa-editor';
|
|
11
11
|
import removeQuotes from '@lblod/ember-rdfa-editor-lblod-plugins/utils/remove-quotes';
|
|
12
|
-
import {
|
|
13
|
-
DataFactory,
|
|
14
|
-
DatasetCore,
|
|
15
|
-
DatasetCoreFactory,
|
|
16
|
-
Quad,
|
|
17
|
-
} from '@rdfjs/types';
|
|
12
|
+
import { DatasetCore, Quad } from '@rdfjs/types';
|
|
18
13
|
import ValidationReport from 'rdf-validate-shacl/src/validation-report';
|
|
19
14
|
import { SayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
20
15
|
import {
|
|
@@ -55,11 +50,6 @@ export interface DocumentValidationPluginArgs {
|
|
|
55
50
|
rules: Rule[];
|
|
56
51
|
}
|
|
57
52
|
|
|
58
|
-
export type ShaclValidationReport = ValidationReport.ValidationReport<
|
|
59
|
-
DataFactory<Quad, Quad> &
|
|
60
|
-
DatasetCoreFactory<Quad, Quad, DatasetCore<Quad, Quad>>
|
|
61
|
-
>;
|
|
62
|
-
|
|
63
53
|
type PropertyWithError = {
|
|
64
54
|
message: string;
|
|
65
55
|
subject: string | undefined;
|
|
@@ -133,10 +123,9 @@ async function validationCallback(view: EditorView, documentHtml: string) {
|
|
|
133
123
|
const shacl = await parse(documentShape);
|
|
134
124
|
|
|
135
125
|
const validator = new SHACLValidator(shacl, {
|
|
136
|
-
// @ts-expect-error ts doesn't recognize the configuration parameter not sure why
|
|
137
126
|
allowNamedNodeInList: true,
|
|
138
127
|
});
|
|
139
|
-
const report = validator.validate(rdf);
|
|
128
|
+
const report = await validator.validate(rdf);
|
|
140
129
|
const sayFactory = new SayDataFactory();
|
|
141
130
|
const propertyPred = sayFactory.namedNode(
|
|
142
131
|
'http://www.w3.org/ns/shacl#property',
|
|
@@ -159,7 +148,7 @@ async function validationCallback(view: EditorView, documentHtml: string) {
|
|
|
159
148
|
message: removeQuotes(message),
|
|
160
149
|
subject: r.focusNode?.value,
|
|
161
150
|
shape: sourceShape.value,
|
|
162
|
-
constraint: r.sourceConstraintComponent?.value
|
|
151
|
+
constraint: r.sourceConstraintComponent?.value,
|
|
163
152
|
});
|
|
164
153
|
}
|
|
165
154
|
}
|
|
@@ -8,6 +8,7 @@ import { replaceLocationCommand } from '../utils/replace-location';
|
|
|
8
8
|
import { Area, Place } from '../utils/geo-helpers';
|
|
9
9
|
import { Address } from '../utils/address-helpers';
|
|
10
10
|
import { getLocationUri } from '../_private/utils/location-helpers';
|
|
11
|
+
import { ContextualActionGroup } from '@lblod/ember-rdfa-editor/plugins/contextual-actions';
|
|
11
12
|
|
|
12
13
|
const otherElementsGroupId =
|
|
13
14
|
'other-elements-e01f46a0-b323-4add-8035-d81dc2e8578d';
|
|
@@ -118,6 +119,6 @@ export function getContextualActionGroups() {
|
|
|
118
119
|
),
|
|
119
120
|
sticky: 'bottom',
|
|
120
121
|
},
|
|
121
|
-
];
|
|
122
|
+
] satisfies ContextualActionGroup[];
|
|
122
123
|
};
|
|
123
124
|
}
|
|
@@ -40,7 +40,7 @@ export function replaceLocationCommand(
|
|
|
40
40
|
node: ResolvedPNode,
|
|
41
41
|
location: Address | Place | Area,
|
|
42
42
|
) {
|
|
43
|
-
return function (state: EditorState, dispatch
|
|
43
|
+
return function (state: EditorState, dispatch?: (tr: Transaction) => void) {
|
|
44
44
|
const df = new SayDataFactory();
|
|
45
45
|
const { pos, value: locNode } = node;
|
|
46
46
|
// The location's subject has likely changed, so we should update the external links too
|
|
@@ -57,7 +57,7 @@ export function replaceLocationCommand(
|
|
|
57
57
|
}
|
|
58
58
|
}); // update the location value and the external triples
|
|
59
59
|
const tr = state.tr;
|
|
60
|
-
const setLocationTr = transactionCombinator(
|
|
60
|
+
const { transaction: setLocationTr, result } = transactionCombinator(
|
|
61
61
|
state,
|
|
62
62
|
tr
|
|
63
63
|
.setNodeAttribute(pos, 'value', location)
|
|
@@ -71,13 +71,16 @@ export function replaceLocationCommand(
|
|
|
71
71
|
keepProperties: false,
|
|
72
72
|
keepExternalTriples: true,
|
|
73
73
|
}),
|
|
74
|
-
])
|
|
74
|
+
]);
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
if (dispatch) {
|
|
77
|
+
const newSelection = moveNodeSelectionForward(
|
|
78
|
+
state.selection.map(setLocationTr.doc, setLocationTr.mapping),
|
|
79
|
+
setLocationTr.doc,
|
|
80
|
+
);
|
|
81
|
+
setLocationTr.setSelection(newSelection);
|
|
82
|
+
dispatch(setLocationTr);
|
|
83
|
+
}
|
|
84
|
+
return result.every((res) => res);
|
|
82
85
|
};
|
|
83
86
|
}
|
|
@@ -67,7 +67,7 @@ function replacePlaceholderWithHtml(
|
|
|
67
67
|
) {
|
|
68
68
|
return (state: EditorState) => {
|
|
69
69
|
const domParser = new DOMParser();
|
|
70
|
-
const contentFragment = ProseParser.fromSchema(state.schema).
|
|
70
|
+
const contentFragment = ProseParser.fromSchema(state.schema).parseSlice(
|
|
71
71
|
domParser.parseFromString(value, 'text/html'),
|
|
72
72
|
).content;
|
|
73
73
|
const tr = state.tr;
|
|
@@ -83,7 +83,10 @@ export function findHowToInsertStructure(
|
|
|
83
83
|
|
|
84
84
|
const closestAncestorRank = parentStructures[0]?.rank;
|
|
85
85
|
// ### Either there is no parent structure or the nearest parent is higher in the hierarchy
|
|
86
|
-
if (
|
|
86
|
+
if (
|
|
87
|
+
parentStructures.length === 0 ||
|
|
88
|
+
(closestAncestorRank && closestAncestorRank < hierarchyRank)
|
|
89
|
+
) {
|
|
87
90
|
if (
|
|
88
91
|
selection instanceof NodeSelection &&
|
|
89
92
|
isHierarchyNode(selection.node)
|
|
@@ -112,7 +115,7 @@ export function findHowToInsertStructure(
|
|
|
112
115
|
// ### We have parent structures that are lower in the hierarchy, so find one where we can insert
|
|
113
116
|
for (let i = 0; i < parentStructures.length; i++) {
|
|
114
117
|
const parentStructure = parentStructures[i];
|
|
115
|
-
const parentRank = parentStructure.rank;
|
|
118
|
+
const parentRank = parentStructure.rank ?? -1;
|
|
116
119
|
if (hierarchyRank === parentRank) {
|
|
117
120
|
// ### If parent we are looking at is same structure type, put an empty structure after that one
|
|
118
121
|
const insertLocation =
|
package/addon/utils/option.ts
CHANGED
|
@@ -73,12 +73,12 @@ export default class DocumentValidationPluginCard extends Component<Sig> {
|
|
|
73
73
|
openDeveloperModal: (event: Event) => void;
|
|
74
74
|
closeDeveloperModal: () => void;
|
|
75
75
|
get formattedValidationResult(): {
|
|
76
|
-
focusNode: string
|
|
77
|
-
path: string
|
|
78
|
-
severity: string
|
|
79
|
-
sourceConstraintComponent: string
|
|
80
|
-
sourceShape: string
|
|
81
|
-
value: string
|
|
76
|
+
focusNode: string;
|
|
77
|
+
path: string;
|
|
78
|
+
severity: string;
|
|
79
|
+
sourceConstraintComponent: string;
|
|
80
|
+
sourceShape: string;
|
|
81
|
+
value: string;
|
|
82
82
|
}[] | undefined;
|
|
83
83
|
}
|
|
84
84
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ProsePlugin, PluginKey, EditorView, SayController } from '@lblod/ember-rdfa-editor';
|
|
2
|
-
import { DataFactory, DatasetCore, DatasetCoreFactory, Quad } from '@rdfjs/types';
|
|
3
2
|
import ValidationReport from 'rdf-validate-shacl/src/validation-report';
|
|
4
3
|
export declare const documentValidationPluginKey: PluginKey<DocumentValidationPluginState>;
|
|
5
4
|
type Violation = {
|
|
@@ -25,7 +24,6 @@ export interface DocumentValidationPluginArgs {
|
|
|
25
24
|
documentShape: string;
|
|
26
25
|
rules: Rule[];
|
|
27
26
|
}
|
|
28
|
-
export type ShaclValidationReport = ValidationReport.ValidationReport<DataFactory<Quad, Quad> & DatasetCoreFactory<Quad, Quad, DatasetCore<Quad, Quad>>>;
|
|
29
27
|
type PropertyWithError = {
|
|
30
28
|
message: string;
|
|
31
29
|
subject: string | undefined;
|
|
@@ -3,7 +3,7 @@ export declare function getContextualActions(): (state: EditorState, searchQuery
|
|
|
3
3
|
label: string;
|
|
4
4
|
id: string;
|
|
5
5
|
group: string;
|
|
6
|
-
command: (state: EditorState, dispatch
|
|
6
|
+
command: (state: EditorState, dispatch?: (tr: import("@lblod/ember-rdfa-editor").Transaction) => void) => boolean;
|
|
7
7
|
}[];
|
|
8
8
|
export declare function getContextualActionGroups(): (state: EditorState) => ({
|
|
9
9
|
id: string;
|
|
@@ -12,5 +12,5 @@ export declare function getContextualActionGroups(): (state: EditorState) => ({
|
|
|
12
12
|
} | {
|
|
13
13
|
id: string;
|
|
14
14
|
label: string;
|
|
15
|
-
sticky:
|
|
15
|
+
sticky: "bottom";
|
|
16
16
|
})[];
|
|
@@ -2,4 +2,4 @@ import { ResolvedPNode } from '@lblod/ember-rdfa-editor/utils/_private/types';
|
|
|
2
2
|
import { Address } from './address-helpers';
|
|
3
3
|
import { Area, Place } from './geo-helpers';
|
|
4
4
|
import { EditorState, Transaction } from '@lblod/ember-rdfa-editor';
|
|
5
|
-
export declare function replaceLocationCommand(node: ResolvedPNode, location: Address | Place | Area): (state: EditorState, dispatch
|
|
5
|
+
export declare function replaceLocationCommand(node: ResolvedPNode, location: Address | Place | Area): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
@@ -8,7 +8,7 @@ export type Option<A> = A | None;
|
|
|
8
8
|
export declare function expect<A>(msg: string, thing: Option<A>): A;
|
|
9
9
|
export declare function unwrap<A>(thing: Option<A>): A;
|
|
10
10
|
export declare function unwrapOr<A>(defaultValue: A, thing: Option<A>): A;
|
|
11
|
-
export declare function optionMap<A, U>(func: (thing: A) => U
|
|
11
|
+
export declare function optionMap<A, U>(func: (thing: A) => U, thing: Option<A>): Option<U>;
|
|
12
12
|
export declare function optionMapOr<A, U>(defaultValue: U, func: (thing: A) => U, thing: Option<A>): U;
|
|
13
13
|
export declare function isSome<A>(thing: Option<A>): thing is A;
|
|
14
14
|
export declare function isNone<A>(thing: Option<A>): thing is None;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lblod/ember-rdfa-editor-lblod-plugins",
|
|
3
|
-
"version": "37.2.
|
|
3
|
+
"version": "37.2.1-dev.34534679eaf5d030e66f8a99790dd2a7af28314c",
|
|
4
4
|
"description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"@rdfjs/data-model": "^2.0.2",
|
|
65
65
|
"@rdfjs/dataset": "^2.0.2",
|
|
66
66
|
"@rdfjs/parser-n3": "^2.0.2",
|
|
67
|
-
"@types/rdf-validate-shacl": "^0.4.7",
|
|
68
67
|
"@types/rdfjs__parser-n3": "^2.0.6",
|
|
69
68
|
"buffer": "^6.0.3",
|
|
70
69
|
"codemirror": "^6.0.1",
|
|
@@ -82,7 +81,7 @@
|
|
|
82
81
|
"process": "0.11.10",
|
|
83
82
|
"proj4": "^2.11.0",
|
|
84
83
|
"rdf-ext": "^2.5.2",
|
|
85
|
-
"rdf-validate-shacl": "^0.
|
|
84
|
+
"rdf-validate-shacl": "^0.6.5",
|
|
86
85
|
"rdfa-streaming-parser": "^3.0.2",
|
|
87
86
|
"reactiveweb": "^1.9.1",
|
|
88
87
|
"stream-browserify": "^3.0.0",
|
|
@@ -114,7 +113,7 @@
|
|
|
114
113
|
"@lblod/ember-rdfa-editor": "13.10.0",
|
|
115
114
|
"@glint/template": "^1.7.7",
|
|
116
115
|
"@rdfjs/to-ntriples": "^3.0.1",
|
|
117
|
-
"@rdfjs/types": "^
|
|
116
|
+
"@rdfjs/types": "^2.0.1",
|
|
118
117
|
"@release-it/keep-a-changelog": "^4.0.0",
|
|
119
118
|
"@tsconfig/ember": "^3.0.8",
|
|
120
119
|
"@types/debug": "^4.1.12",
|
package/app/models/template.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/models/template';
|