@pie-element/number-line 13.1.2-next.1 → 13.1.2
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/CHANGELOG.json +1247 -0
- package/CHANGELOG.md +2441 -0
- package/LICENSE.md +5 -0
- package/README.md +28 -0
- package/configure/CHANGELOG.json +827 -0
- package/configure/CHANGELOG.md +2088 -0
- package/configure/lib/arrows.js +89 -0
- package/configure/lib/arrows.js.map +1 -0
- package/configure/lib/card-bar.js +57 -0
- package/configure/lib/card-bar.js.map +1 -0
- package/configure/lib/defaults.js +177 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/domain.js +87 -0
- package/configure/lib/domain.js.map +1 -0
- package/configure/lib/index.js +176 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +815 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/number-text-field.js +26 -0
- package/configure/lib/number-text-field.js.map +1 -0
- package/configure/lib/point-config.js +84 -0
- package/configure/lib/point-config.js.map +1 -0
- package/configure/lib/size.js +66 -0
- package/configure/lib/size.js.map +1 -0
- package/configure/lib/ticks.js +234 -0
- package/configure/lib/ticks.js.map +1 -0
- package/configure/lib/utils.js +12 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +20 -0
- package/controller/CHANGELOG.json +332 -0
- package/controller/CHANGELOG.md +1360 -0
- package/controller/lib/defaults.js +56 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +430 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/tickUtils.js +294 -0
- package/controller/lib/tickUtils.js.map +1 -0
- package/controller/lib/utils.js +168 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +20 -0
- package/demo.gif +0 -0
- package/docs/config-schema.json +2532 -0
- package/docs/config-schema.json.md +1844 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +39 -0
- package/docs/demo/index.html +1 -0
- package/docs/pie-schema.json +2461 -0
- package/docs/pie-schema.json.md +1228 -0
- package/docs/schemas/config.json +256 -0
- package/lib/data-converter.js +96 -0
- package/lib/data-converter.js.map +1 -0
- package/lib/draggable/index.js +114 -0
- package/lib/draggable/index.js.map +1 -0
- package/lib/index.js +196 -0
- package/lib/index.js.map +1 -0
- package/lib/number-line/colors.js +11 -0
- package/lib/number-line/colors.js.map +1 -0
- package/lib/number-line/feedback.js +92 -0
- package/lib/number-line/feedback.js.map +1 -0
- package/lib/number-line/graph/arrow.js +44 -0
- package/lib/number-line/graph/arrow.js.map +1 -0
- package/lib/number-line/graph/elements/base.js +20 -0
- package/lib/number-line/graph/elements/base.js.map +1 -0
- package/lib/number-line/graph/elements/builder.js +37 -0
- package/lib/number-line/graph/elements/builder.js.map +1 -0
- package/lib/number-line/graph/elements/line.js +259 -0
- package/lib/number-line/graph/elements/line.js.map +1 -0
- package/lib/number-line/graph/elements/point.js +204 -0
- package/lib/number-line/graph/elements/point.js.map +1 -0
- package/lib/number-line/graph/elements/ray.js +190 -0
- package/lib/number-line/graph/elements/ray.js.map +1 -0
- package/lib/number-line/graph/index.js +262 -0
- package/lib/number-line/graph/index.js.map +1 -0
- package/lib/number-line/graph/line.js +38 -0
- package/lib/number-line/graph/line.js.map +1 -0
- package/lib/number-line/graph/stacks.js +78 -0
- package/lib/number-line/graph/stacks.js.map +1 -0
- package/lib/number-line/graph/tick-utils.js +347 -0
- package/lib/number-line/graph/tick-utils.js.map +1 -0
- package/lib/number-line/graph/ticks.js +188 -0
- package/lib/number-line/graph/ticks.js.map +1 -0
- package/lib/number-line/index.js +384 -0
- package/lib/number-line/index.js.map +1 -0
- package/lib/number-line/point-chooser/button.js +49 -0
- package/lib/number-line/point-chooser/button.js.map +1 -0
- package/lib/number-line/point-chooser/img.js +8 -0
- package/lib/number-line/point-chooser/img.js.map +1 -0
- package/lib/number-line/point-chooser/index.js +197 -0
- package/lib/number-line/point-chooser/index.js.map +1 -0
- package/lib/number-line/point-chooser/styles.js +77 -0
- package/lib/number-line/point-chooser/styles.js.map +1 -0
- package/lib/number-line/transitions/fade.js +88 -0
- package/lib/number-line/transitions/fade.js.map +1 -0
- package/lib/number-line/transitions/index.js +14 -0
- package/lib/number-line/transitions/index.js.map +1 -0
- package/package.json +21 -87
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/_virtual/_rolldown/runtime.js +0 -11
- package/dist/author/arrows.d.ts +0 -28
- package/dist/author/arrows.js +0 -69
- package/dist/author/card-bar.d.ts +0 -20
- package/dist/author/card-bar.js +0 -41
- package/dist/author/defaults.d.ts +0 -178
- package/dist/author/defaults.js +0 -144
- package/dist/author/domain.d.ts +0 -15
- package/dist/author/domain.js +0 -54
- package/dist/author/index.d.ts +0 -23
- package/dist/author/index.js +0 -89
- package/dist/author/main.d.ts +0 -44
- package/dist/author/main.js +0 -485
- package/dist/author/number-text-field.d.ts +0 -13
- package/dist/author/number-text-field.js +0 -13
- package/dist/author/point-config.d.ts +0 -25
- package/dist/author/point-config.js +0 -69
- package/dist/author/size.d.ts +0 -24
- package/dist/author/size.js +0 -48
- package/dist/author/ticks.d.ts +0 -22
- package/dist/author/ticks.js +0 -115
- package/dist/author/utils.d.ts +0 -9
- package/dist/author/utils.js +0 -4
- package/dist/browser/author/index.js +0 -40259
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/controller/index.js +0 -569
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -2
- package/dist/browser/delivery-Ci_kZyOM.js +0 -17903
- package/dist/browser/delivery-Ci_kZyOM.js.map +0 -1
- package/dist/browser/dist-D5T-OaLo.js +0 -19038
- package/dist/browser/dist-D5T-OaLo.js.map +0 -1
- package/dist/browser/impureFunctionsAny.generated-Bqfato71.js +0 -10162
- package/dist/browser/impureFunctionsAny.generated-Bqfato71.js.map +0 -1
- package/dist/browser/number-line.css +0 -2
- package/dist/controller/defaults.d.ts +0 -58
- package/dist/controller/defaults.js +0 -50
- package/dist/controller/index.d.ts +0 -47
- package/dist/controller/index.js +0 -165
- package/dist/controller/tickUtils.d.ts +0 -21
- package/dist/controller/tickUtils.js +0 -252
- package/dist/controller/utils.d.ts +0 -9
- package/dist/controller/utils.js +0 -68
- package/dist/delivery/data-converter.d.ts +0 -64
- package/dist/delivery/data-converter.js +0 -70
- package/dist/delivery/draggable/index.d.ts +0 -33
- package/dist/delivery/draggable/index.js +0 -39
- package/dist/delivery/index.d.ts +0 -35
- package/dist/delivery/index.js +0 -109
- package/dist/delivery/number-line/colors.d.ts +0 -11
- package/dist/delivery/number-line/colors.js +0 -5
- package/dist/delivery/number-line/feedback.d.ts +0 -19
- package/dist/delivery/number-line/feedback.js +0 -57
- package/dist/delivery/number-line/graph/arrow.d.ts +0 -30
- package/dist/delivery/number-line/graph/arrow.js +0 -27
- package/dist/delivery/number-line/graph/elements/base.d.ts +0 -16
- package/dist/delivery/number-line/graph/elements/base.js +0 -11
- package/dist/delivery/number-line/graph/elements/builder.d.ts +0 -33
- package/dist/delivery/number-line/graph/elements/builder.js +0 -30
- package/dist/delivery/number-line/graph/elements/line.d.ts +0 -51
- package/dist/delivery/number-line/graph/elements/line.js +0 -188
- package/dist/delivery/number-line/graph/elements/point.d.ts +0 -43
- package/dist/delivery/number-line/graph/elements/point.js +0 -127
- package/dist/delivery/number-line/graph/elements/ray.d.ts +0 -43
- package/dist/delivery/number-line/graph/elements/ray.js +0 -130
- package/dist/delivery/number-line/graph/index.d.ts +0 -59
- package/dist/delivery/number-line/graph/index.js +0 -196
- package/dist/delivery/number-line/graph/line.d.ts +0 -46
- package/dist/delivery/number-line/graph/line.js +0 -27
- package/dist/delivery/number-line/graph/stacks.d.ts +0 -10
- package/dist/delivery/number-line/graph/stacks.js +0 -40
- package/dist/delivery/number-line/graph/tick-utils.d.ts +0 -80
- package/dist/delivery/number-line/graph/tick-utils.js +0 -295
- package/dist/delivery/number-line/graph/ticks.d.ts +0 -46
- package/dist/delivery/number-line/graph/ticks.js +0 -115
- package/dist/delivery/number-line/index.d.ts +0 -35
- package/dist/delivery/number-line/index.js +0 -215
- package/dist/delivery/number-line/point-chooser/button.d.ts +0 -31
- package/dist/delivery/number-line/point-chooser/button.js +0 -36
- package/dist/delivery/number-line/point-chooser/img.d.ts +0 -10
- package/dist/delivery/number-line/point-chooser/img.js +0 -4
- package/dist/delivery/number-line/point-chooser/index.d.ts +0 -37
- package/dist/delivery/number-line/point-chooser/index.js +0 -154
- package/dist/delivery/number-line/point-chooser/styles.d.ts +0 -192
- package/dist/delivery/number-line/transitions/fade.d.ts +0 -34
- package/dist/delivery/number-line/transitions/fade.js +0 -75
- package/dist/delivery/number-line/transitions/index.d.ts +0 -10
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -197
- package/dist/index.js +0 -2
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/number-line/src/data-converter.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
export declare const lineIsSwitched: (line: any) => boolean;
|
|
10
|
-
export declare const switchGraphLine: (line: any) => any;
|
|
11
|
-
export declare const switchPosition: (p: any) => {
|
|
12
|
-
left: any;
|
|
13
|
-
right: any;
|
|
14
|
-
};
|
|
15
|
-
export declare const toSessionFormat: (gf: any) => {
|
|
16
|
-
type: string;
|
|
17
|
-
pointType: any;
|
|
18
|
-
domainPosition: any;
|
|
19
|
-
size?: undefined;
|
|
20
|
-
leftPoint?: undefined;
|
|
21
|
-
rightPoint?: undefined;
|
|
22
|
-
direction?: undefined;
|
|
23
|
-
} | {
|
|
24
|
-
type: string;
|
|
25
|
-
size: number;
|
|
26
|
-
domainPosition: any;
|
|
27
|
-
leftPoint: any;
|
|
28
|
-
rightPoint: any;
|
|
29
|
-
pointType?: undefined;
|
|
30
|
-
direction?: undefined;
|
|
31
|
-
} | {
|
|
32
|
-
type: string;
|
|
33
|
-
domainPosition: any;
|
|
34
|
-
pointType: any;
|
|
35
|
-
direction: any;
|
|
36
|
-
size?: undefined;
|
|
37
|
-
leftPoint?: undefined;
|
|
38
|
-
rightPoint?: undefined;
|
|
39
|
-
} | undefined;
|
|
40
|
-
export declare const toGraphFormat: (sf: any) => {
|
|
41
|
-
type: string;
|
|
42
|
-
pointType: any;
|
|
43
|
-
position: any;
|
|
44
|
-
leftPoint?: undefined;
|
|
45
|
-
rightPoint?: undefined;
|
|
46
|
-
direction?: undefined;
|
|
47
|
-
} | {
|
|
48
|
-
type: string;
|
|
49
|
-
position: {
|
|
50
|
-
left: any;
|
|
51
|
-
right: any;
|
|
52
|
-
};
|
|
53
|
-
leftPoint: any;
|
|
54
|
-
rightPoint: any;
|
|
55
|
-
pointType?: undefined;
|
|
56
|
-
direction?: undefined;
|
|
57
|
-
} | {
|
|
58
|
-
type: string;
|
|
59
|
-
position: any;
|
|
60
|
-
pointType: any;
|
|
61
|
-
direction: any;
|
|
62
|
-
leftPoint?: undefined;
|
|
63
|
-
rightPoint?: undefined;
|
|
64
|
-
} | undefined;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { __exportAll as e } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
//#region src/delivery/data-converter.ts
|
|
3
|
-
var t = /* @__PURE__ */ e({
|
|
4
|
-
lineIsSwitched: () => n,
|
|
5
|
-
switchGraphLine: () => r,
|
|
6
|
-
switchPosition: () => i,
|
|
7
|
-
toGraphFormat: () => o,
|
|
8
|
-
toSessionFormat: () => a
|
|
9
|
-
}), n = (e) => {
|
|
10
|
-
let { position: t } = e;
|
|
11
|
-
return t.left > t.right;
|
|
12
|
-
}, r = (e) => {
|
|
13
|
-
let { position: t } = e;
|
|
14
|
-
if (t.left < t.right) return e;
|
|
15
|
-
let { leftPoint: n, rightPoint: r } = e;
|
|
16
|
-
return {
|
|
17
|
-
leftPoint: r,
|
|
18
|
-
rightPoint: n,
|
|
19
|
-
position: i(t),
|
|
20
|
-
type: "line"
|
|
21
|
-
};
|
|
22
|
-
}, i = (e) => {
|
|
23
|
-
let { left: t, right: n } = e;
|
|
24
|
-
return {
|
|
25
|
-
left: n,
|
|
26
|
-
right: t
|
|
27
|
-
};
|
|
28
|
-
}, a = (e) => {
|
|
29
|
-
if (e.type === "point") return {
|
|
30
|
-
type: "point",
|
|
31
|
-
pointType: e.pointType,
|
|
32
|
-
domainPosition: e.position
|
|
33
|
-
};
|
|
34
|
-
if (e.type === "line") return {
|
|
35
|
-
type: "line",
|
|
36
|
-
size: e.position.right - e.position.left,
|
|
37
|
-
domainPosition: e.position.left,
|
|
38
|
-
leftPoint: e.leftPoint,
|
|
39
|
-
rightPoint: e.rightPoint
|
|
40
|
-
};
|
|
41
|
-
if (e.type === "ray") return {
|
|
42
|
-
type: "ray",
|
|
43
|
-
domainPosition: e.position,
|
|
44
|
-
pointType: e.pointType,
|
|
45
|
-
direction: e.direction
|
|
46
|
-
};
|
|
47
|
-
}, o = (e) => {
|
|
48
|
-
if (e.type === "point") return {
|
|
49
|
-
type: "point",
|
|
50
|
-
pointType: e.pointType,
|
|
51
|
-
position: e.domainPosition
|
|
52
|
-
};
|
|
53
|
-
if (e.type === "line") return {
|
|
54
|
-
type: "line",
|
|
55
|
-
position: {
|
|
56
|
-
left: e.domainPosition,
|
|
57
|
-
right: e.domainPosition + e.size
|
|
58
|
-
},
|
|
59
|
-
leftPoint: e.leftPoint,
|
|
60
|
-
rightPoint: e.rightPoint
|
|
61
|
-
};
|
|
62
|
-
if (e.type === "ray") return {
|
|
63
|
-
type: "ray",
|
|
64
|
-
position: e.domainPosition,
|
|
65
|
-
pointType: e.pointType,
|
|
66
|
-
direction: e.direction
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
//#endregion
|
|
70
|
-
export { t as data_converter_exports, n as lineIsSwitched, r as switchGraphLine, o as toGraphFormat, a as toSessionFormat };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/number-line/src/draggable/index.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Shared dnd-kit wrapper for Line + Point.
|
|
11
|
-
*
|
|
12
|
-
* Props:
|
|
13
|
-
* - id: string (unique)
|
|
14
|
-
* - disabled: boolean
|
|
15
|
-
* - grid: [stepX] (like grid={[is]})
|
|
16
|
-
* - bounds: { left: number, right: number } in px (like scaledLineBounds)
|
|
17
|
-
* - onMouseDown: (event) => void
|
|
18
|
-
* - onDragStart?: () => void
|
|
19
|
-
* - onDragMove?: (deltaX: number) => void // snapped + clamped
|
|
20
|
-
* - onDragEnd?: (deltaX: number) => void // snapped + clamped
|
|
21
|
-
* - children: ({ setNodeRef, attributes, listeners, translateX, isDragging, onMouseDown }) => ReactNode
|
|
22
|
-
*/
|
|
23
|
-
export declare function Draggable({ id, disabled, grid, bounds, onMouseDown, onDragStart, onDragMove, onDragEnd, children, }: {
|
|
24
|
-
id: any;
|
|
25
|
-
disabled: any;
|
|
26
|
-
grid: any;
|
|
27
|
-
bounds: any;
|
|
28
|
-
onMouseDown: any;
|
|
29
|
-
onDragStart: any;
|
|
30
|
-
onDragMove: any;
|
|
31
|
-
onDragEnd: any;
|
|
32
|
-
children: any;
|
|
33
|
-
}): any;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useDndMonitor as e, useDraggable as t } from "@dnd-kit/core";
|
|
2
|
-
//#region src/delivery/draggable/index.ts
|
|
3
|
-
function n({ id: n, disabled: r, grid: i, bounds: a, onMouseDown: o, onDragStart: s, onDragMove: c, onDragEnd: l, children: u }) {
|
|
4
|
-
let { attributes: d, listeners: f, setNodeRef: p, transform: m } = t({
|
|
5
|
-
id: n,
|
|
6
|
-
disabled: r
|
|
7
|
-
}), h = i && i[0] ? i[0] : null, g = m?.x ?? 0;
|
|
8
|
-
h && (g = Math.round(g / h) * h), a && (typeof a.left == "number" && (g = Math.max(a.left, g)), typeof a.right == "number" && (g = Math.min(a.right, g)));
|
|
9
|
-
let _ = g, v = !!m, y = (e) => {
|
|
10
|
-
let t = e;
|
|
11
|
-
return h && (t = Math.round(t / h) * h), a && (typeof a.left == "number" && (t = Math.max(a.left, t)), typeof a.right == "number" && (t = Math.min(a.right, t))), t;
|
|
12
|
-
};
|
|
13
|
-
return e({
|
|
14
|
-
onDragStart(e) {
|
|
15
|
-
e.active.id !== n || r || s?.();
|
|
16
|
-
},
|
|
17
|
-
onDragMove(e) {
|
|
18
|
-
if (e.active.id !== n || r) return;
|
|
19
|
-
let t = e.delta.x || 0;
|
|
20
|
-
c?.(y(t));
|
|
21
|
-
},
|
|
22
|
-
onDragEnd(e) {
|
|
23
|
-
if (e.active.id !== n || r) return;
|
|
24
|
-
let t = e.delta.x || 0;
|
|
25
|
-
l?.(y(t));
|
|
26
|
-
}
|
|
27
|
-
}), u({
|
|
28
|
-
setNodeRef: p,
|
|
29
|
-
attributes: d,
|
|
30
|
-
listeners: f,
|
|
31
|
-
translateX: _,
|
|
32
|
-
isDragging: v,
|
|
33
|
-
onMouseDown: (e) => {
|
|
34
|
-
e.nativeEvent.preventDefault(), o?.(e);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
export { n as Draggable };
|
package/dist/delivery/index.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/number-line/src/index.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import * as dataConverter from './data-converter.js';
|
|
10
|
-
import * as pointChooser from './number-line/point-chooser/index.js';
|
|
11
|
-
import * as tickUtils from './number-line/graph/tick-utils.js';
|
|
12
|
-
import Graph from './number-line/graph/index.js';
|
|
13
|
-
import NumberLineComponent from './number-line/index.js';
|
|
14
|
-
export { Graph, NumberLineComponent, tickUtils, dataConverter, pointChooser };
|
|
15
|
-
export default class NumberLine extends HTMLElement {
|
|
16
|
-
constructor();
|
|
17
|
-
_scheduleMathRender: any;
|
|
18
|
-
_initMathObserver(): void;
|
|
19
|
-
_disconnectMathObserver(): void;
|
|
20
|
-
set model(m: any);
|
|
21
|
-
set session(s: any);
|
|
22
|
-
get session(): any;
|
|
23
|
-
connectedCallback(): void;
|
|
24
|
-
isComplete(): boolean;
|
|
25
|
-
dispatch(type: any): void;
|
|
26
|
-
dispatchSessionChanged(): void;
|
|
27
|
-
addElement(data: any): void;
|
|
28
|
-
moveElement(index: any, el: any, position: any): void;
|
|
29
|
-
deleteElements(indices: any): void;
|
|
30
|
-
undoElement(): void;
|
|
31
|
-
clearElements(): void;
|
|
32
|
-
_applyInitialElements(): void;
|
|
33
|
-
_render(): void;
|
|
34
|
-
disconnectedCallback(): void;
|
|
35
|
-
}
|
package/dist/delivery/index.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { data_converter_exports as e, lineIsSwitched as t, switchGraphLine as n, toGraphFormat as r, toSessionFormat as i } from "./data-converter.js";
|
|
2
|
-
import { point_chooser_exports as a } from "./number-line/point-chooser/index.js";
|
|
3
|
-
import { tick_utils_exports as o } from "./number-line/graph/tick-utils.js";
|
|
4
|
-
import s from "./number-line/graph/index.js";
|
|
5
|
-
import c from "./number-line/index.js";
|
|
6
|
-
import l from "react";
|
|
7
|
-
import { cloneDeep as u } from "@pie-element/shared-lodash";
|
|
8
|
-
import { createRoot as d } from "react-dom/client";
|
|
9
|
-
import { renderMath as f } from "@pie-element/shared-math-rendering-mathjax";
|
|
10
|
-
//#region src/delivery/index.ts
|
|
11
|
-
var p = class extends HTMLElement {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(), this._root = null, this._mathObserver = null, this._mathRenderPending = !1;
|
|
14
|
-
}
|
|
15
|
-
_scheduleMathRender = () => {
|
|
16
|
-
this._mathRenderPending || (this._mathRenderPending = !0, requestAnimationFrame(() => {
|
|
17
|
-
this._mathObserver && this._mathObserver.disconnect(), f(this), this._mathRenderPending = !1, setTimeout(() => {
|
|
18
|
-
this._mathObserver && this._mathObserver.observe(this, {
|
|
19
|
-
childList: !0,
|
|
20
|
-
subtree: !0,
|
|
21
|
-
characterData: !1
|
|
22
|
-
});
|
|
23
|
-
}, 50);
|
|
24
|
-
}));
|
|
25
|
-
};
|
|
26
|
-
_initMathObserver() {
|
|
27
|
-
this._mathObserver || (this._mathObserver = new MutationObserver(() => {
|
|
28
|
-
this._scheduleMathRender();
|
|
29
|
-
}), this._mathObserver.observe(this, {
|
|
30
|
-
childList: !0,
|
|
31
|
-
subtree: !0,
|
|
32
|
-
characterData: !1
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
_disconnectMathObserver() {
|
|
36
|
-
this._mathObserver &&= (this._mathObserver.disconnect(), null);
|
|
37
|
-
}
|
|
38
|
-
set model(e) {
|
|
39
|
-
this._model = e, this._applyInitialElements(), this._render(), this.dispatch("model-set");
|
|
40
|
-
}
|
|
41
|
-
set session(e) {
|
|
42
|
-
this._session = e, this._applyInitialElements(), this._render();
|
|
43
|
-
}
|
|
44
|
-
get session() {
|
|
45
|
-
return this._session;
|
|
46
|
-
}
|
|
47
|
-
connectedCallback() {
|
|
48
|
-
this._initMathObserver(), this._render();
|
|
49
|
-
}
|
|
50
|
-
isComplete() {
|
|
51
|
-
return this._session ? (this._session.answer || []).length > 0 : !1;
|
|
52
|
-
}
|
|
53
|
-
dispatch(e) {
|
|
54
|
-
this.dispatchEvent(new CustomEvent(e, {
|
|
55
|
-
bubbles: !0,
|
|
56
|
-
detail: { complete: this.isComplete() }
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
dispatchSessionChanged() {
|
|
60
|
-
this.dispatch("session-changed");
|
|
61
|
-
}
|
|
62
|
-
addElement(e) {
|
|
63
|
-
this._session && (this._session.answer = this._session.answer || [], this._session.answer.push(i(e)), this.dispatchSessionChanged(), this._render());
|
|
64
|
-
}
|
|
65
|
-
moveElement(e, r, a) {
|
|
66
|
-
if (!this._session.answer[e]) throw Error("cant find element at index: ", e);
|
|
67
|
-
if (r.type === "line" && a.left === a.right) {
|
|
68
|
-
this._render();
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
r.position = a;
|
|
72
|
-
let o = r.type === "line" && t(r) ? n(r) : r;
|
|
73
|
-
this._session.answer.splice(e, 1, i(o)), this.dispatchSessionChanged(), this._render();
|
|
74
|
-
}
|
|
75
|
-
deleteElements(e) {
|
|
76
|
-
this._session.answer = this._session.answer.filter((t, n) => !e.some((e) => e === n)), this.dispatchSessionChanged(), this._render();
|
|
77
|
-
}
|
|
78
|
-
undoElement() {
|
|
79
|
-
this._session.answer.pop(), this.dispatchSessionChanged(), this._render();
|
|
80
|
-
}
|
|
81
|
-
clearElements() {
|
|
82
|
-
this._session.answer = [], this.dispatchSessionChanged(), this._render();
|
|
83
|
-
}
|
|
84
|
-
_applyInitialElements() {
|
|
85
|
-
this._model && this._model.graph && this._model.graph.initialElements && this._session && (!this._session.answer || !this._session.answer.length) && (this._session.answer = u(this._model.graph.initialElements));
|
|
86
|
-
}
|
|
87
|
-
_render() {
|
|
88
|
-
if (this._model && this._session) {
|
|
89
|
-
this._session.answer || this._applyInitialElements();
|
|
90
|
-
let e = (this._session.answer || []).map(r), t = u(this._model);
|
|
91
|
-
t.correctResponse = t.correctResponse && t.correctResponse.map(r);
|
|
92
|
-
let n = {
|
|
93
|
-
model: t,
|
|
94
|
-
answer: e,
|
|
95
|
-
onAddElement: this.addElement.bind(this),
|
|
96
|
-
onMoveElement: this.moveElement.bind(this),
|
|
97
|
-
onDeleteElements: this.deleteElements.bind(this),
|
|
98
|
-
onUndoElement: this.undoElement.bind(this),
|
|
99
|
-
onClearElements: this.clearElements.bind(this)
|
|
100
|
-
}, i = l.createElement(c, n);
|
|
101
|
-
this._root ||= d(this), this._root.render(i), this._scheduleMathRender();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
disconnectedCallback() {
|
|
105
|
-
this._disconnectMathObserver(), this._root && this._root.unmount();
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
//#endregion
|
|
109
|
-
export { s as Graph, c as NumberLineComponent, e as dataConverter, p as default, a as pointChooser, o as tickUtils };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/number-line/src/number-line/colors.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
export declare const selected: any;
|
|
10
|
-
export declare const correct: any;
|
|
11
|
-
export declare const incorrect: any;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/number-line/src/number-line/feedback.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
import React from 'react';
|
|
11
|
-
declare const Feedback: {
|
|
12
|
-
(props: any): React.JSX.Element;
|
|
13
|
-
propTypes: {
|
|
14
|
-
width: PropTypes.Requireable<number>;
|
|
15
|
-
message: PropTypes.Requireable<string>;
|
|
16
|
-
type: PropTypes.Requireable<string>;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export default Feedback;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { useRef as e } from "react";
|
|
2
|
-
import { styled as t } from "@mui/material/styles";
|
|
3
|
-
import n from "prop-types";
|
|
4
|
-
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
-
import { color as a } from "@pie-lib/render-ui";
|
|
6
|
-
import { CSSTransition as o, TransitionGroup as s } from "react-transition-group";
|
|
7
|
-
import { Correct as c, Incorrect as l, NothingSubmitted as u, PartiallyCorrect as d, ShowRationale as f } from "@pie-lib/icons";
|
|
8
|
-
//#region src/delivery/number-line/feedback.tsx
|
|
9
|
-
var p = (e) => {
|
|
10
|
-
switch (e) {
|
|
11
|
-
case "unanswered": return u;
|
|
12
|
-
case "correct": return c;
|
|
13
|
-
case "incorrect": return l;
|
|
14
|
-
case "partial": return d;
|
|
15
|
-
case "info": return f;
|
|
16
|
-
default: return;
|
|
17
|
-
}
|
|
18
|
-
}, m = t("div")(({ $type: e }) => ({
|
|
19
|
-
marginTop: "10px",
|
|
20
|
-
backgroundColor: "#dddddd",
|
|
21
|
-
padding: "10px",
|
|
22
|
-
display: "flex",
|
|
23
|
-
alignItems: "center",
|
|
24
|
-
...e === "correct" && { backgroundColor: a.correct() },
|
|
25
|
-
...e === "incorrect" && { backgroundColor: a.incorrect() },
|
|
26
|
-
"& svg": { height: "30px" },
|
|
27
|
-
"& h1": {
|
|
28
|
-
padding: "0px",
|
|
29
|
-
margin: "0px"
|
|
30
|
-
}
|
|
31
|
-
})), h = t("span")({
|
|
32
|
-
paddingLeft: "5px",
|
|
33
|
-
userSelect: "none"
|
|
34
|
-
}), g = (t) => {
|
|
35
|
-
let { type: n, width: a, message: c } = t, l = p(n), u = e(null);
|
|
36
|
-
return /* @__PURE__ */ r(s, { children: /* @__PURE__ */ r(o, {
|
|
37
|
-
classNames: "fb",
|
|
38
|
-
timeout: 300,
|
|
39
|
-
nodeRef: u,
|
|
40
|
-
children: /* @__PURE__ */ i(m, {
|
|
41
|
-
ref: u,
|
|
42
|
-
$type: n,
|
|
43
|
-
style: { width: a },
|
|
44
|
-
children: [/* @__PURE__ */ r(l, {
|
|
45
|
-
iconSet: "emoji",
|
|
46
|
-
shape: "square"
|
|
47
|
-
}), /* @__PURE__ */ r(h, { dangerouslySetInnerHTML: { __html: c } })]
|
|
48
|
-
}, "panel")
|
|
49
|
-
}, "fb") });
|
|
50
|
-
};
|
|
51
|
-
g.propTypes = {
|
|
52
|
-
width: n.number,
|
|
53
|
-
message: n.string,
|
|
54
|
-
type: n.string
|
|
55
|
-
};
|
|
56
|
-
//#endregion
|
|
57
|
-
export { g as default };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/number-line/src/number-line/graph/arrow.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare function Arrow({ x, y, direction, className }: {
|
|
12
|
-
x: any;
|
|
13
|
-
y: any;
|
|
14
|
-
direction: any;
|
|
15
|
-
className: any;
|
|
16
|
-
}): React.JSX.Element;
|
|
17
|
-
export declare namespace Arrow {
|
|
18
|
-
var propTypes: {
|
|
19
|
-
y: PropTypes.Requireable<number>;
|
|
20
|
-
x: PropTypes.Requireable<number>;
|
|
21
|
-
direction: PropTypes.Requireable<string>;
|
|
22
|
-
className: PropTypes.Requireable<string>;
|
|
23
|
-
};
|
|
24
|
-
var defaultProps: {
|
|
25
|
-
y: number;
|
|
26
|
-
x: number;
|
|
27
|
-
direction: string;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export default Arrow;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import "react";
|
|
2
|
-
import { styled as e } from "@mui/material/styles";
|
|
3
|
-
import t from "prop-types";
|
|
4
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
-
import { color as r } from "@pie-lib/render-ui";
|
|
6
|
-
//#region src/delivery/number-line/graph/arrow.tsx
|
|
7
|
-
var i = e("path")({ fill: r.primary() });
|
|
8
|
-
function a({ x: e, y: t, direction: r, className: a }) {
|
|
9
|
-
let o = `translate(${e || 0},${t})`;
|
|
10
|
-
return r && r === "right" && (o += " rotate(180)"), /* @__PURE__ */ n(i, {
|
|
11
|
-
d: "m 0,0 8,-5 0,10 -8,-5",
|
|
12
|
-
transform: o,
|
|
13
|
-
className: a
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
a.propTypes = {
|
|
17
|
-
y: t.number,
|
|
18
|
-
x: t.number,
|
|
19
|
-
direction: t.oneOf(["left", "right"]),
|
|
20
|
-
className: t.string
|
|
21
|
-
}, a.defaultProps = {
|
|
22
|
-
y: 0,
|
|
23
|
-
x: 0,
|
|
24
|
-
direction: "left"
|
|
25
|
-
};
|
|
26
|
-
//#endregion
|
|
27
|
-
export { a as default };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/number-line/src/number-line/graph/elements/base.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
export declare const basePropTypes: () => {
|
|
11
|
-
interval: PropTypes.Validator<number>;
|
|
12
|
-
domain: PropTypes.Requireable<PropTypes.InferProps<{
|
|
13
|
-
min: PropTypes.Validator<number>;
|
|
14
|
-
max: PropTypes.Validator<number>;
|
|
15
|
-
}>>;
|
|
16
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import e from "prop-types";
|
|
2
|
-
//#region src/delivery/number-line/graph/elements/base.ts
|
|
3
|
-
var t = () => ({
|
|
4
|
-
interval: e.number.isRequired,
|
|
5
|
-
domain: e.shape({
|
|
6
|
-
min: e.number.isRequired,
|
|
7
|
-
max: e.number.isRequired
|
|
8
|
-
})
|
|
9
|
-
});
|
|
10
|
-
//#endregion
|
|
11
|
-
export { t as basePropTypes };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/number-line/src/number-line/graph/elements/builder.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
export declare function buildElementModel(position: any, elementType: any, domain: any, interval: any): {
|
|
10
|
-
position: any;
|
|
11
|
-
type: string;
|
|
12
|
-
pointType: string;
|
|
13
|
-
leftPoint?: undefined;
|
|
14
|
-
rightPoint?: undefined;
|
|
15
|
-
direction?: undefined;
|
|
16
|
-
} | {
|
|
17
|
-
type: string;
|
|
18
|
-
leftPoint: string;
|
|
19
|
-
rightPoint: string;
|
|
20
|
-
position: {
|
|
21
|
-
left: any;
|
|
22
|
-
right: any;
|
|
23
|
-
};
|
|
24
|
-
pointType?: undefined;
|
|
25
|
-
direction?: undefined;
|
|
26
|
-
} | {
|
|
27
|
-
type: string;
|
|
28
|
-
direction: string;
|
|
29
|
-
pointType: string;
|
|
30
|
-
position: any;
|
|
31
|
-
leftPoint?: undefined;
|
|
32
|
-
rightPoint?: undefined;
|
|
33
|
-
} | undefined;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//#region src/delivery/number-line/graph/elements/builder.ts
|
|
2
|
-
function e(e, t, n, r) {
|
|
3
|
-
if (t.startsWith("p")) return {
|
|
4
|
-
position: e,
|
|
5
|
-
type: "point",
|
|
6
|
-
pointType: t.endsWith("e") ? "empty" : "full"
|
|
7
|
-
};
|
|
8
|
-
if (t.startsWith("l")) {
|
|
9
|
-
let i = e + r <= n.max ? e : e - r, a = i + r;
|
|
10
|
-
return {
|
|
11
|
-
type: "line",
|
|
12
|
-
leftPoint: t.charAt(1) === "e" ? "empty" : "full",
|
|
13
|
-
rightPoint: t.charAt(2) === "e" ? "empty" : "full",
|
|
14
|
-
position: {
|
|
15
|
-
left: i,
|
|
16
|
-
right: a
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
} else if (t.startsWith("r")) {
|
|
20
|
-
let n = t.charAt(1) === "f";
|
|
21
|
-
return {
|
|
22
|
-
type: "ray",
|
|
23
|
-
direction: t.charAt(2) === "p" ? "positive" : "negative",
|
|
24
|
-
pointType: n ? "full" : "empty",
|
|
25
|
-
position: e
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
|
-
export { e as buildElementModel };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/number-line/src/number-line/graph/elements/line.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class Line extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
empty: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
14
|
-
left: PropTypes.Validator<boolean>;
|
|
15
|
-
right: PropTypes.Validator<boolean>;
|
|
16
|
-
}>>>;
|
|
17
|
-
position: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
18
|
-
left: PropTypes.Validator<number>;
|
|
19
|
-
right: PropTypes.Validator<number>;
|
|
20
|
-
}>>>;
|
|
21
|
-
y: PropTypes.Requireable<number>;
|
|
22
|
-
selected: PropTypes.Requireable<boolean>;
|
|
23
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
24
|
-
correct: PropTypes.Requireable<boolean>;
|
|
25
|
-
onMoveLine: PropTypes.Validator<(...args: any[]) => any>;
|
|
26
|
-
onToggleSelect: PropTypes.Validator<(...args: any[]) => any>;
|
|
27
|
-
onDragStart: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
-
onDragStop: PropTypes.Requireable<(...args: any[]) => any>;
|
|
29
|
-
interval: PropTypes.Validator<number>;
|
|
30
|
-
domain: PropTypes.Requireable<PropTypes.InferProps<{
|
|
31
|
-
min: PropTypes.Validator<number>;
|
|
32
|
-
max: PropTypes.Validator<number>;
|
|
33
|
-
}>>;
|
|
34
|
-
};
|
|
35
|
-
static defaultProps: {
|
|
36
|
-
selected: boolean;
|
|
37
|
-
y: number;
|
|
38
|
-
disabled: boolean;
|
|
39
|
-
correct: undefined;
|
|
40
|
-
};
|
|
41
|
-
static contextTypes: {
|
|
42
|
-
xScale: PropTypes.Validator<(...args: any[]) => any>;
|
|
43
|
-
snapValue: PropTypes.Validator<(...args: any[]) => any>;
|
|
44
|
-
};
|
|
45
|
-
constructor(props: any);
|
|
46
|
-
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
47
|
-
onDrag(side: any, p: any): void;
|
|
48
|
-
onMove(side: any, d: any): void;
|
|
49
|
-
render(): React.JSX.Element;
|
|
50
|
-
}
|
|
51
|
-
export default Line;
|