@manta-eu/horns-kit 0.1.1 → 0.1.3
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/dist/embed/view-powers.d.ts +5 -21
- package/dist/embed/view-powers.js +4 -17
- package/package.json +2 -2
|
@@ -6,10 +6,7 @@ export type ExplainedFact = {
|
|
|
6
6
|
subject: string;
|
|
7
7
|
predicate?: string;
|
|
8
8
|
object: string;
|
|
9
|
-
/**
|
|
10
|
-
* The explanation itself, opaque here: its shape is the design system's, and only the host reads it.
|
|
11
|
-
* Without it the host's explainer would have to fetch, which a written view cannot make it do.
|
|
12
|
-
*/
|
|
9
|
+
/** The explanation, opaque here: only the host reads it. Without it the host would have to fetch one. */
|
|
13
10
|
data?: unknown;
|
|
14
11
|
/** What to call the explanation when it opens. */
|
|
15
12
|
title?: string;
|
|
@@ -24,13 +21,7 @@ export type WhyThisProps = ExplainedFact & {
|
|
|
24
21
|
/** The value being claimed: a number, a badge, a word. Drawn as it is, with the mark beside it. */
|
|
25
22
|
children: ReactNode;
|
|
26
23
|
};
|
|
27
|
-
/**
|
|
28
|
-
* A value that can say why it is what it is.
|
|
29
|
-
*
|
|
30
|
-
* Draws the thing it wraps unchanged and puts a small mark beside it, so a reader can tell at a glance which
|
|
31
|
-
* numbers on a page were worked out rather than recorded. Where nothing can open an explanation — a server
|
|
32
|
-
* render, a captured picture — the mark is left off and the value draws alone.
|
|
33
|
-
*/
|
|
24
|
+
/** Draws its child with a mark beside it. No placement — a server render, a capture — draws it alone. */
|
|
34
25
|
export declare function WhyThis({ children, ...fact }: WhyThisProps): import("react").JSX.Element;
|
|
35
26
|
export type HornFilters = {
|
|
36
27
|
/** The Horn's variables as the snapshot was built with them. */
|
|
@@ -55,9 +46,8 @@ export type HornFilter = {
|
|
|
55
46
|
/**
|
|
56
47
|
* One of the Horn's variables, as a filter a view can set.
|
|
57
48
|
*
|
|
58
|
-
* Setting it re-runs every binding
|
|
59
|
-
*
|
|
60
|
-
* does not declare gets a dead filter rather than an error — the document is what says which exist.
|
|
49
|
+
* Setting it re-runs every binding taking it as a parameter: the tile and the list answer to the variable,
|
|
50
|
+
* not to each other. A variable the Horn does not declare gives a dead filter, not an error.
|
|
61
51
|
*/
|
|
62
52
|
export declare function useHornFilter(id: string): HornFilter;
|
|
63
53
|
export type NothingProps = {
|
|
@@ -66,11 +56,5 @@ export type NothingProps = {
|
|
|
66
56
|
/** What would put something here, or why there is nothing. */
|
|
67
57
|
hint?: string;
|
|
68
58
|
};
|
|
69
|
-
/**
|
|
70
|
-
* A view with no rows, said in words.
|
|
71
|
-
*
|
|
72
|
-
* The design system's `EmptyState` takes a required `icon` component, and a written view has no icon module
|
|
73
|
-
* to give it — it renders, then throws. This is the same state drawn the way the frame around it is drawn,
|
|
74
|
-
* out of palette and inline style, so it works wherever the frame does.
|
|
75
|
-
*/
|
|
59
|
+
/** A view with no rows. `EmptyState` needs an `icon` component a written view cannot supply. */
|
|
76
60
|
export declare function Nothing({ title, hint }: NothingProps): import("react").JSX.Element;
|
|
@@ -2,13 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
const ExplainPlacementContext = createContext(undefined);
|
|
4
4
|
export const ExplainPlacementProvider = ExplainPlacementContext.Provider;
|
|
5
|
-
/**
|
|
6
|
-
* A value that can say why it is what it is.
|
|
7
|
-
*
|
|
8
|
-
* Draws the thing it wraps unchanged and puts a small mark beside it, so a reader can tell at a glance which
|
|
9
|
-
* numbers on a page were worked out rather than recorded. Where nothing can open an explanation — a server
|
|
10
|
-
* render, a captured picture — the mark is left off and the value draws alone.
|
|
11
|
-
*/
|
|
5
|
+
/** Draws its child with a mark beside it. No placement — a server render, a capture — draws it alone. */
|
|
12
6
|
export function WhyThis({ children, ...fact }) {
|
|
13
7
|
const placement = useContext(ExplainPlacementContext);
|
|
14
8
|
if (placement?.open === undefined)
|
|
@@ -38,9 +32,8 @@ export const HornFiltersProvider = HornFiltersContext.Provider;
|
|
|
38
32
|
/**
|
|
39
33
|
* One of the Horn's variables, as a filter a view can set.
|
|
40
34
|
*
|
|
41
|
-
* Setting it re-runs every binding
|
|
42
|
-
*
|
|
43
|
-
* does not declare gets a dead filter rather than an error — the document is what says which exist.
|
|
35
|
+
* Setting it re-runs every binding taking it as a parameter: the tile and the list answer to the variable,
|
|
36
|
+
* not to each other. A variable the Horn does not declare gives a dead filter, not an error.
|
|
44
37
|
*/
|
|
45
38
|
export function useHornFilter(id) {
|
|
46
39
|
const filters = useContext(HornFiltersContext);
|
|
@@ -57,13 +50,7 @@ export function useHornFilter(id) {
|
|
|
57
50
|
toggle: (candidate) => onChange?.(id, is(candidate) ? undefined : candidate),
|
|
58
51
|
};
|
|
59
52
|
}
|
|
60
|
-
/**
|
|
61
|
-
* A view with no rows, said in words.
|
|
62
|
-
*
|
|
63
|
-
* The design system's `EmptyState` takes a required `icon` component, and a written view has no icon module
|
|
64
|
-
* to give it — it renders, then throws. This is the same state drawn the way the frame around it is drawn,
|
|
65
|
-
* out of palette and inline style, so it works wherever the frame does.
|
|
66
|
-
*/
|
|
53
|
+
/** A view with no rows. `EmptyState` needs an `icon` component a written view cannot supply. */
|
|
67
54
|
export function Nothing({ title, hint }) {
|
|
68
55
|
const placement = useContext(ExplainPlacementContext);
|
|
69
56
|
const palette = placement?.palette;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manta-eu/horns-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Manta Horns component kit: charts and snapshot views that render on a server and hydrate in any React host, and the components the HornView sandbox runs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"sucrase": "^3.35.1",
|
|
57
57
|
"ts-pattern": "^5.9.0",
|
|
58
|
-
"@manta-eu/horns": "0.1.
|
|
58
|
+
"@manta-eu/horns": "0.1.3"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"react": ">=18",
|