skandha-facets 0.8.1 → 0.9.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/Addition.js +4 -4
- package/Editing.js +2 -2
- package/Filtering.d.ts +0 -2
- package/Filtering.js +1 -2
- package/Highlight.d.ts +0 -2
- package/Highlight.js +3 -10
- package/Insertion.d.ts +0 -2
- package/Insertion.js +1 -2
- package/Labelling.d.ts +0 -2
- package/Labelling.js +1 -9
- package/Selection.d.ts +0 -3
- package/Selection.js +2 -10
- package/index.d.ts +1 -4
- package/index.js +1 -4
- package/package.json +3 -3
- package/policies/insertionPreviewUsesDragSources.d.ts +2 -2
- package/policies/insertionPreviewUsesDragSources.js +5 -10
package/Addition.js
CHANGED
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { host
|
|
7
|
+
import { host } from 'aspiration';
|
|
8
8
|
import { data, operation } from 'skandha';
|
|
9
9
|
export class Addition {
|
|
10
10
|
constructor() {
|
|
@@ -23,9 +23,9 @@ export class Addition {
|
|
|
23
23
|
}
|
|
24
24
|
add(values) {
|
|
25
25
|
return (cbs) => {
|
|
26
|
-
|
|
26
|
+
cbs.storeLocation && cbs.storeLocation();
|
|
27
27
|
this.item = cbs.createItem();
|
|
28
|
-
|
|
28
|
+
cbs.highlightNewItem && cbs.highlightNewItem();
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
confirm() {
|
|
@@ -37,7 +37,7 @@ export class Addition {
|
|
|
37
37
|
cancel() {
|
|
38
38
|
return (cbs) => {
|
|
39
39
|
this._reset();
|
|
40
|
-
|
|
40
|
+
cbs.restoreLocation && cbs.restoreLocation();
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
_reset() {
|
package/Editing.js
CHANGED
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { host
|
|
7
|
+
import { host } from 'aspiration';
|
|
8
8
|
import { data, operation } from 'skandha';
|
|
9
9
|
export class Editing {
|
|
10
10
|
constructor() {
|
|
@@ -19,7 +19,7 @@ export class Editing {
|
|
|
19
19
|
return (cbs) => {
|
|
20
20
|
cbs.saveItem();
|
|
21
21
|
this.isEditing = false;
|
|
22
|
-
|
|
22
|
+
cbs.refreshView && cbs.refreshView();
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
cancel() {
|
package/Filtering.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GetterT } from 'skandha';
|
|
2
1
|
import { FilteringCbs, FilterT } from './FilteringCbs';
|
|
3
2
|
export type { FilteringCbs } from './FilteringCbs';
|
|
4
3
|
export declare class Filtering<ValueT = any> {
|
|
@@ -10,4 +9,3 @@ export declare class Filtering<ValueT = any> {
|
|
|
10
9
|
apply(filter: FilterT): (cbs: FilteringCbs['apply']) => void;
|
|
11
10
|
setEnabled(flag: boolean): (cbs: FilteringCbs['setEnabled']) => void;
|
|
12
11
|
}
|
|
13
|
-
export declare const filteringUsesInputItems: (getItems: GetterT, transform?: Function) => (ctr: any) => void;
|
package/Filtering.js
CHANGED
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { host, stub } from 'aspiration';
|
|
8
|
-
import { data,
|
|
8
|
+
import { data, operation } from 'skandha';
|
|
9
9
|
export class Filtering {
|
|
10
10
|
constructor() {
|
|
11
11
|
Object.defineProperty(this, "isEnabled", {
|
|
@@ -68,4 +68,3 @@ __decorate([
|
|
|
68
68
|
operation,
|
|
69
69
|
host(['flag'])
|
|
70
70
|
], Filtering.prototype, "setEnabled", null);
|
|
71
|
-
export const filteringUsesInputItems = (getItems, transform) => mapDataToFacet([Filtering, 'inputItems'], getItems, transform);
|
package/Highlight.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GetterT } from 'skandha';
|
|
2
1
|
import { HighlightCbs } from './HighlightCbs';
|
|
3
2
|
export type { HighlightCbs } from './HighlightCbs';
|
|
4
3
|
export declare class Highlight<ValueT = any> {
|
|
@@ -7,4 +6,3 @@ export declare class Highlight<ValueT = any> {
|
|
|
7
6
|
item?: ValueT;
|
|
8
7
|
highlightItem(id: string): (cbs: HighlightCbs['highlightItem']) => void;
|
|
9
8
|
}
|
|
10
|
-
export declare const highlightUsesItemLookUpTable: (getItemById: GetterT) => (ctr: any) => void;
|
package/Highlight.js
CHANGED
|
@@ -4,8 +4,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { host
|
|
8
|
-
import { data,
|
|
7
|
+
import { host } from 'aspiration';
|
|
8
|
+
import { data, operation, output } from 'skandha';
|
|
9
9
|
export class Highlight {
|
|
10
10
|
constructor() {
|
|
11
11
|
Object.defineProperty(this, "id", {
|
|
@@ -24,7 +24,7 @@ export class Highlight {
|
|
|
24
24
|
highlightItem(id) {
|
|
25
25
|
return (cbs) => {
|
|
26
26
|
this.id = id;
|
|
27
|
-
|
|
27
|
+
cbs.scrollItemIntoView && cbs.scrollItemIntoView();
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -44,10 +44,3 @@ __decorate([
|
|
|
44
44
|
operation,
|
|
45
45
|
host(['id'])
|
|
46
46
|
], Highlight.prototype, "highlightItem", null);
|
|
47
|
-
export const highlightUsesItemLookUpTable = (getItemById) => mapDatasToFacet([Highlight, 'item'], [
|
|
48
|
-
//
|
|
49
|
-
getItemById,
|
|
50
|
-
getm([Highlight, 'id']),
|
|
51
|
-
], (itemById, id) => {
|
|
52
|
-
return itemById[id];
|
|
53
|
-
});
|
package/Insertion.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GetterT } from 'skandha';
|
|
2
1
|
import { DragT, InsertionCbs } from './InsertionCbs';
|
|
3
2
|
export type { DragT, DropPositionT, InsertionCbs } from './InsertionCbs';
|
|
4
3
|
export declare type DragSourceT = (ctr: any) => DragT | undefined;
|
|
@@ -8,4 +7,3 @@ export declare class Insertion<ValueT = any> {
|
|
|
8
7
|
preview: Array<ValueT>;
|
|
9
8
|
insertItems(drag: DragT): (cbs: InsertionCbs['insertItems']) => void;
|
|
10
9
|
}
|
|
11
|
-
export declare const insertionUsesInputItems: (getItems: GetterT, transform?: Function) => (ctr: any) => void;
|
package/Insertion.js
CHANGED
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { host, stub } from 'aspiration';
|
|
8
|
-
import { input,
|
|
8
|
+
import { input, operation, output } from 'skandha';
|
|
9
9
|
import { getPreview } from './lib/getPreview';
|
|
10
10
|
export class Insertion {
|
|
11
11
|
constructor() {
|
|
@@ -47,4 +47,3 @@ __decorate([
|
|
|
47
47
|
operation,
|
|
48
48
|
host(['drag'])
|
|
49
49
|
], Insertion.prototype, "insertItems", null);
|
|
50
|
-
export const insertionUsesInputItems = (getItems, transform) => mapDataToFacet([Insertion, 'inputItems'], getItems, transform);
|
package/Labelling.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GetterT } from 'skandha';
|
|
2
1
|
import { IdsByLabelT, ItemsByLabelT, LabellingCbs, LabelValueT } from './LabellingCbs';
|
|
3
2
|
export type { LabellingCbs } from './LabellingCbs';
|
|
4
3
|
export declare class Labelling {
|
|
@@ -8,4 +7,3 @@ export declare class Labelling {
|
|
|
8
7
|
itemsByLabel: ItemsByLabelT;
|
|
9
8
|
setLabel(labelValue: LabelValueT): (cbs: LabellingCbs['setLabel']) => void;
|
|
10
9
|
}
|
|
11
|
-
export declare const labellingActsOnItems: (getItemById: GetterT) => (ctr: any) => void;
|
package/Labelling.js
CHANGED
|
@@ -5,8 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { host, stub } from 'aspiration';
|
|
8
|
-
import { data,
|
|
9
|
-
import { lookUp } from './internal/utils';
|
|
8
|
+
import { data, input, operation } from 'skandha';
|
|
10
9
|
export class Labelling {
|
|
11
10
|
constructor() {
|
|
12
11
|
Object.defineProperty(this, "idsByLabel", {
|
|
@@ -59,10 +58,3 @@ __decorate([
|
|
|
59
58
|
operation,
|
|
60
59
|
host(['labelValue'])
|
|
61
60
|
], Labelling.prototype, "setLabel", null);
|
|
62
|
-
export const labellingActsOnItems = (getItemById) => {
|
|
63
|
-
return mapDatasToFacet([Labelling, 'itemsByLabel'], [
|
|
64
|
-
//
|
|
65
|
-
getItemById,
|
|
66
|
-
getm([Labelling, 'idsByLabel']),
|
|
67
|
-
], (itemById, idsByLabel) => Object.fromEntries(Object.entries(idsByLabel).map(([label, ids]) => lookUp(ids, itemById))));
|
|
68
|
-
};
|
package/Selection.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GetterT } from 'skandha';
|
|
2
1
|
import { SelectionCbs, SelectionParamsT } from './SelectionCbs';
|
|
3
2
|
export type { SelectionCbs, SelectionParamsT } from './SelectionCbs';
|
|
4
3
|
export declare class Selection<ValueT = any> {
|
|
@@ -10,5 +9,3 @@ export declare class Selection<ValueT = any> {
|
|
|
10
9
|
selectItem(selectionParams: SelectionParamsT): (cbs: SelectionCbs['selectItem']) => void;
|
|
11
10
|
}
|
|
12
11
|
export declare function handleSelectItem(facet: Selection, { itemId, isShift, isCtrl }: SelectionParamsT): void;
|
|
13
|
-
export declare const selectionUsesItemLookUpTable: (getItemById: GetterT) => (ctr: any) => void;
|
|
14
|
-
export declare const selectionUsesSelectableIds: (getIds: GetterT, transform?: ((x: any) => string[]) | undefined) => (ctr: any) => void;
|
package/Selection.js
CHANGED
|
@@ -5,8 +5,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { host, stub } from 'aspiration';
|
|
8
|
-
import { data,
|
|
9
|
-
import {
|
|
8
|
+
import { data, input, operation, output } from 'skandha';
|
|
9
|
+
import { range } from './internal/utils';
|
|
10
10
|
const selectItemDefaultCbs = (selection) => ({
|
|
11
11
|
selectItem: function () {
|
|
12
12
|
handleSelectItem(selection, this.selectionParams);
|
|
@@ -98,11 +98,3 @@ export function handleSelectItem(facet, { itemId, isShift, isCtrl }) {
|
|
|
98
98
|
facet.anchorId = itemId;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
export const selectionUsesItemLookUpTable = (getItemById) => mapDatasToFacet([Selection, 'items'], [
|
|
102
|
-
//
|
|
103
|
-
getItemById,
|
|
104
|
-
getm([Selection, 'ids']),
|
|
105
|
-
], (itemById, ids) => {
|
|
106
|
-
return lookUp(ids, itemById);
|
|
107
|
-
});
|
|
108
|
-
export const selectionUsesSelectableIds = (getIds, transform) => mapDataToFacet([Selection, 'selectableIds'], getIds, transform);
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { highlightUsesItemLookUpTable } from "./Highlight";
|
|
3
|
-
export { filteringUsesInputItems } from "./Filtering";
|
|
4
|
-
export { insertionUsesInputItems } from "./Insertion";
|
|
1
|
+
export {};
|
package/index.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { highlightUsesItemLookUpTable } from "./Highlight";
|
|
3
|
-
export { filteringUsesInputItems } from "./Filtering";
|
|
4
|
-
export { insertionUsesInputItems } from "./Insertion";
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skandha-facets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Facets for use with the skandha library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "https://github.com/mnieber/skandha-facets.git",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"types": "index.d.ts",
|
|
10
10
|
"prepublish": "tsc",
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"skandha": ">=0.
|
|
13
|
-
"aspiration": ">=0.3.
|
|
12
|
+
"skandha": ">=0.9.0",
|
|
13
|
+
"aspiration": ">=0.3.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"typescript": "^4.0.3"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DragSourceT } from
|
|
2
|
-
export declare const insertionPreviewUsesDragSources: (dragSources: DragSourceT[]) => (
|
|
1
|
+
import { DragSourceT } from '../Insertion';
|
|
2
|
+
export declare const insertionPreviewUsesDragSources: (dragSources: DragSourceT[], ctr: any) => (inputItems: any[]) => any[];
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { mapDataToFacet, getf, getc } from "skandha";
|
|
5
|
-
export const insertionPreviewUsesDragSources = (dragSources) => mapDataToFacet([Insertion, "preview"], getf(Insertion), (insertion) => {
|
|
6
|
-
const ctr = getc(insertion);
|
|
1
|
+
import { findMap } from '../internal/utils';
|
|
2
|
+
import { getPreview } from '../lib/getPreview';
|
|
3
|
+
export const insertionPreviewUsesDragSources = (dragSources, ctr) => (inputItems) => {
|
|
7
4
|
const drag = findMap((dragSource) => dragSource(ctr), dragSources);
|
|
8
|
-
|
|
9
|
-
const preview = drag
|
|
5
|
+
return drag
|
|
10
6
|
? getPreview(inputItems !== null && inputItems !== void 0 ? inputItems : [], drag.targetItemId, drag.isBefore, drag.payload)
|
|
11
7
|
: inputItems !== null && inputItems !== void 0 ? inputItems : [];
|
|
12
|
-
|
|
13
|
-
});
|
|
8
|
+
};
|