@pie-element/number-line 13.1.2-next.1 → 13.1.2-next.11
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/author/arrows.js +1 -1
- package/dist/author/domain.js +1 -1
- package/dist/author/index.d.ts +1 -0
- package/dist/author/index.js +5 -2
- package/dist/author/main.js +145 -145
- package/dist/author/ticks.js +1 -1
- package/dist/browser/author/index.js +17039 -21701
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +110 -110
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +1 -1
- package/dist/browser/{delivery-Ci_kZyOM.js → delivery-ZqHtCtAW.js} +3864 -3900
- package/dist/browser/delivery-ZqHtCtAW.js.map +1 -0
- package/dist/browser/{dist-D5T-OaLo.js → dist-clbS3pcd.js} +3739 -4335
- package/dist/browser/dist-clbS3pcd.js.map +1 -0
- package/dist/browser/{impureFunctionsAny.generated-Bqfato71.js → impureFunctionsAny.generated-DOBSXSdK.js} +1721 -2096
- package/dist/browser/impureFunctionsAny.generated-DOBSXSdK.js.map +1 -0
- package/dist/controller/tickUtils.d.ts +1 -1
- package/dist/controller/tickUtils.js +3 -3
- package/dist/delivery/data-converter.js +1 -1
- package/dist/delivery/index.js +3 -3
- package/dist/delivery/number-line/graph/arrow.js +1 -1
- package/dist/delivery/number-line/graph/elements/line.js +2 -2
- package/dist/delivery/number-line/graph/elements/point.js +5 -4
- package/dist/delivery/number-line/graph/elements/ray.js +3 -3
- package/dist/delivery/number-line/graph/index.js +6 -6
- package/dist/delivery/number-line/graph/line.js +1 -1
- package/dist/delivery/number-line/graph/stacks.js +1 -1
- package/dist/delivery/number-line/graph/tick-utils.d.ts +2 -2
- package/dist/delivery/number-line/graph/tick-utils.js +4 -4
- package/dist/delivery/number-line/graph/ticks.js +15 -15
- package/dist/delivery/number-line/index.js +3 -3
- package/dist/delivery/number-line/point-chooser/index.js +1 -1
- package/dist/index.iife.js +59 -59
- package/package.json +19 -20
- package/dist/browser/delivery-Ci_kZyOM.js.map +0 -1
- package/dist/browser/dist-D5T-OaLo.js.map +0 -1
- package/dist/browser/impureFunctionsAny.generated-Bqfato71.js.map +0 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import * as math from 'mathjs';
|
|
10
10
|
export declare const getMinorLimits: (domain: any, width: any) => {
|
|
11
|
-
min: number & (number | math.MathCollection
|
|
11
|
+
min: number & (number | math.MathCollection);
|
|
12
12
|
max: number;
|
|
13
13
|
};
|
|
14
14
|
export declare const generateMinorValues: (minorLimits: any) => {
|
|
@@ -195,7 +195,7 @@ var i = [
|
|
|
195
195
|
if (n(r)) return e.fraction(r.n * r.s, r.d);
|
|
196
196
|
if (t(r)) return e.fraction(r);
|
|
197
197
|
}, v = (t, n, r, i) => {
|
|
198
|
-
let a = i
|
|
198
|
+
let a = !i || i.limit !== !1, o = h(t, n), s = a ? m(_(r.minor), o.min, o.max) : _(r.minor), c = a ? m(_(r.major), s, e.multiply(s, 20)) : _(r.major);
|
|
199
199
|
if (!g(c, s)) {
|
|
200
200
|
let t = e.divide(c, s), n = t <= 2 ? 2 : Math.round(t);
|
|
201
201
|
return {
|
|
@@ -228,7 +228,7 @@ var i = [
|
|
|
228
228
|
let i = {
|
|
229
229
|
decimal: [],
|
|
230
230
|
fraction: []
|
|
231
|
-
}, a = e.fraction(e.number(e.number(t))), s = a.n, c = a.d;
|
|
231
|
+
}, a = e.fraction(e.number(e.number(t))), s = Number(a.n), c = Number(a.d);
|
|
232
232
|
if (s >= 1 && c === 1) for (let a = 1; a <= 10; a++) {
|
|
233
233
|
let o = e.number(e.multiply(s, a));
|
|
234
234
|
S(n, r, {
|
|
@@ -241,7 +241,7 @@ var i = [
|
|
|
241
241
|
S(n, r, {
|
|
242
242
|
minor: t,
|
|
243
243
|
major: e.number(l)
|
|
244
|
-
}, { fraction: void 0 }).filter((e) => e.type === "major").length > 1 && (l.d === 1 ? i.fraction.push(l.n.toString()) : i.fraction.push(l.n + "/" + l.d), i.decimal.push(e.number(l)));
|
|
244
|
+
}, { fraction: void 0 }).filter((e) => e.type === "major").length > 1 && (Number(l.d) === 1 ? i.fraction.push(Number(l.n).toString()) : i.fraction.push(Number(l.n) + "/" + Number(l.d)), i.decimal.push(e.number(l)));
|
|
245
245
|
}
|
|
246
246
|
return i;
|
|
247
247
|
}, S = (t, n, r, i) => y(t, n, r, i).map((t) => i.fraction ? t : {
|
|
@@ -67,4 +67,4 @@ var t = /* @__PURE__ */ e({
|
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
69
|
//#endregion
|
|
70
|
-
export { t as data_converter_exports, n as lineIsSwitched, r as switchGraphLine, o as toGraphFormat, a as toSessionFormat };
|
|
70
|
+
export { t as data_converter_exports, n as lineIsSwitched, r as switchGraphLine, i as switchPosition, o as toGraphFormat, a as toSessionFormat };
|
package/dist/delivery/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { data_converter_exports as e, lineIsSwitched as t, switchGraphLine as n, toGraphFormat as r, toSessionFormat as i } from "./data-converter.js";
|
|
2
2
|
import { point_chooser_exports as a } from "./number-line/point-chooser/index.js";
|
|
3
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";
|
|
4
|
+
import { NumberLineGraph as s } from "./number-line/graph/index.js";
|
|
5
|
+
import { NumberLine as c } from "./number-line/index.js";
|
|
6
6
|
import l from "react";
|
|
7
7
|
import { cloneDeep as u } from "@pie-element/shared-lodash";
|
|
8
8
|
import { createRoot as d } from "react-dom/client";
|
|
@@ -102,7 +102,7 @@ var p = class extends HTMLElement {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
disconnectedCallback() {
|
|
105
|
-
this._disconnectMathObserver(), this._root
|
|
105
|
+
this._disconnectMathObserver(), this._root &&= (this._root.unmount(), null);
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Draggable as e } from "../../../draggable/index.js";
|
|
2
|
-
import t from "./point.js";
|
|
2
|
+
import { Point as t } from "./point.js";
|
|
3
3
|
import { basePropTypes as n } from "./base.js";
|
|
4
4
|
import r from "react";
|
|
5
5
|
import { styled as i } from "@mui/material/styles";
|
|
@@ -185,4 +185,4 @@ var d = "150ms", f = i("g")(({ $disabled: e, $selected: t, $correct: n }) => ({
|
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
187
|
//#endregion
|
|
188
|
-
export { p as default };
|
|
188
|
+
export { p as Line, p as default };
|
|
@@ -66,8 +66,8 @@ var s = "150ms", c = n("circle")(({ $selected: e, $disabled: t, $correct: n, $em
|
|
|
66
66
|
};
|
|
67
67
|
render() {
|
|
68
68
|
let { onDragStop: t, onDragStart: n, onDrag: r, onClick: s, onMove: l, interval: u, y: d, bounds: f, selected: p, position: m, disabled: h, correct: g, empty: _ } = this.props, { snapValue: v, xScale: y } = this.context, b = y(u) - y(0), x = (e) => {
|
|
69
|
-
let t = e + y(0);
|
|
70
|
-
return v(m +
|
|
69
|
+
let t = e + y(0), n = y.invert(t);
|
|
70
|
+
return v(m + n);
|
|
71
71
|
}, S = f ? {
|
|
72
72
|
left: f.left / u * b,
|
|
73
73
|
right: f.right / u * b
|
|
@@ -90,7 +90,8 @@ var s = "150ms", c = n("circle")(({ $selected: e, $disabled: t, $correct: n, $em
|
|
|
90
90
|
s && s();
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
let n = x(e);
|
|
94
|
+
l(n);
|
|
94
95
|
},
|
|
95
96
|
children: ({ setNodeRef: e, attributes: t, listeners: n, translateX: r, isDragging: s, onMouseDown: l }) => /* @__PURE__ */ a("g", {
|
|
96
97
|
ref: e,
|
|
@@ -124,4 +125,4 @@ var s = "150ms", c = n("circle")(({ $selected: e, $disabled: t, $correct: n, $em
|
|
|
124
125
|
}
|
|
125
126
|
};
|
|
126
127
|
//#endregion
|
|
127
|
-
export { l as default };
|
|
128
|
+
export { l as Point, l as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import e from "./point.js";
|
|
1
|
+
import { Point as e } from "./point.js";
|
|
2
2
|
import { basePropTypes as t } from "./base.js";
|
|
3
3
|
import { correct as n, incorrect as r, selected as i } from "../../colors.js";
|
|
4
|
-
import a from "../arrow.js";
|
|
4
|
+
import { Arrow as a } from "../arrow.js";
|
|
5
5
|
import o from "react";
|
|
6
6
|
import { styled as s } from "@mui/material/styles";
|
|
7
7
|
import c from "prop-types";
|
|
@@ -127,4 +127,4 @@ var p = s("g")(({ $selected: e, $correct: t }) => ({
|
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
//#endregion
|
|
130
|
-
export { h as default };
|
|
130
|
+
export { h as Ray, h as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { snapTo as e } from "./tick-utils.js";
|
|
2
|
-
import t from "./elements/point.js";
|
|
3
|
-
import n from "./elements/line.js";
|
|
4
|
-
import r from "./arrow.js";
|
|
5
|
-
import i from "./elements/ray.js";
|
|
2
|
+
import { Point as t } from "./elements/point.js";
|
|
3
|
+
import { Line as n } from "./elements/line.js";
|
|
4
|
+
import { Arrow as r } from "./arrow.js";
|
|
5
|
+
import { Ray as i } from "./elements/ray.js";
|
|
6
6
|
import a from "./line.js";
|
|
7
|
-
import o from "./ticks.js";
|
|
7
|
+
import { Ticks as o } from "./ticks.js";
|
|
8
8
|
import s from "./stacks.js";
|
|
9
9
|
import c from "../transitions/fade.js";
|
|
10
10
|
import l, { createElement as u } from "react";
|
|
@@ -193,4 +193,4 @@ var b = (e, t, n, r) => {
|
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
195
|
//#endregion
|
|
196
|
-
export { x as default };
|
|
196
|
+
export { x as NumberLineGraph, x as default };
|
|
@@ -42,10 +42,10 @@ export declare const zeroBasedRange: (start: any, end: any, interval: any) => an
|
|
|
42
42
|
export declare const simpleRange: (start: any, end: any, interval: any) => (string | math.MathType)[];
|
|
43
43
|
export declare const closeTo: (a: any, b: any, precision: any) => boolean;
|
|
44
44
|
export declare const getMinorLimits: (domain: any, width: any) => {
|
|
45
|
-
min: number & (number | math.MathCollection
|
|
45
|
+
min: number & (number | math.MathCollection);
|
|
46
46
|
max: number;
|
|
47
47
|
};
|
|
48
|
-
export declare const isMultiple: (multiple: any, src: any) => boolean | math.MathCollection
|
|
48
|
+
export declare const isMultiple: (multiple: any, src: any) => boolean | math.MathCollection;
|
|
49
49
|
/**
|
|
50
50
|
* Accepts a fraction object {n,d,s} or number.
|
|
51
51
|
* @param {*} v
|
|
@@ -218,7 +218,7 @@ var a = /* @__PURE__ */ e({
|
|
|
218
218
|
if (r(e)) return t.fraction(e.n * e.s, e.d);
|
|
219
219
|
if (n(e)) return t.fraction(e);
|
|
220
220
|
}, b = (e, n, r, i) => {
|
|
221
|
-
let a = i
|
|
221
|
+
let a = !i || i.limit !== !1, o = _(e, n), s = a ? g(y(r.minor), o.min, o.max) : y(r.minor), c = a ? g(y(r.major), s, t.multiply(s, 20)) : y(r.major);
|
|
222
222
|
if (!v(c, s)) {
|
|
223
223
|
let e = t.divide(c, s), n = e <= 2 ? 2 : Math.round(e);
|
|
224
224
|
return {
|
|
@@ -251,7 +251,7 @@ var a = /* @__PURE__ */ e({
|
|
|
251
251
|
let i = {
|
|
252
252
|
decimal: [],
|
|
253
253
|
fraction: []
|
|
254
|
-
}, a = t.fraction(t.number(t.number(e))), o = a.n, s = a.d;
|
|
254
|
+
}, a = t.fraction(t.number(t.number(e))), o = Number(a.n), s = Number(a.d);
|
|
255
255
|
if (o >= 1 && s === 1) for (let a = 1; a <= 10; a++) {
|
|
256
256
|
let s = t.number(t.multiply(o, a));
|
|
257
257
|
w(n, r, {
|
|
@@ -264,7 +264,7 @@ var a = /* @__PURE__ */ e({
|
|
|
264
264
|
w(n, r, {
|
|
265
265
|
minor: e,
|
|
266
266
|
major: t.number(l)
|
|
267
|
-
}, { fraction: void 0 }).filter((e) => e.type === "major").length > 1 && (l.d === 1 ? i.fraction.push(l.n.toString()) : i.fraction.push(l.n + "/" + l.d), i.decimal.push(t.number(l)));
|
|
267
|
+
}, { fraction: void 0 }).filter((e) => e.type === "major").length > 1 && (Number(l.d) === 1 ? i.fraction.push(Number(l.n).toString()) : i.fraction.push(Number(l.n) + "/" + Number(l.d)), i.decimal.push(t.number(l)));
|
|
268
268
|
}
|
|
269
269
|
return i;
|
|
270
270
|
}, w = (e, n, r, i) => x(e, n, r, i).map((e) => i.fraction ? e : {
|
|
@@ -292,4 +292,4 @@ var a = /* @__PURE__ */ e({
|
|
|
292
292
|
return Number.isFinite(r) && (a.size = r), a;
|
|
293
293
|
});
|
|
294
294
|
//#endregion
|
|
295
|
-
export { w as buildTickData, C as generateMajorValuesForMinor, S as generateMinorValues, _ as getMinorLimits, D as snapElements, E as snapTo, a as tick_utils_exports };
|
|
295
|
+
export { w as buildTickData, x as buildTickDataAsFractions, h as closeTo, o as decimalTickValues, y as fraction, l as fractionRange, T as fractionSnapTo, s as fractionTickValues, C as generateMajorValuesForMinor, S as generateMinorValues, _ as getMinorLimits, v as isMultiple, c as labelMultiplier, b as normalizeTicks, m as simpleRange, D as snapElements, E as snapTo, a as tick_utils_exports, u as zbrErrorMessage, d as zeroBasedRange };
|
|
@@ -52,38 +52,38 @@ var s = n("text")({
|
|
|
52
52
|
this.resizeObserver && this.resizeObserver.disconnect();
|
|
53
53
|
}
|
|
54
54
|
render() {
|
|
55
|
-
let { x: e, y: n, type: r, xScale: o, fraction: l } = this.props, u = l
|
|
55
|
+
let { x: e, y: n, type: r, xScale: o, fraction: l } = this.props, u = l ? Number(e.n) : e.n, d = l ? Number(e.d) : e.d, f = l ? Number(e.s) : e.s, p = l && u !== d && u !== 0 && d !== 1, m = r === "major", h = m ? 20 : 10, { width: g = 0, height: _ = 0, x: v = 0, y = 0 } = this.state.textBox, b = l ? p ? /* @__PURE__ */ a(t.Fragment, { children: [/* @__PURE__ */ i("tspan", {
|
|
56
56
|
x: "0",
|
|
57
57
|
dy: "0.71em",
|
|
58
|
-
children:
|
|
58
|
+
children: u * f
|
|
59
59
|
}), /* @__PURE__ */ i("tspan", {
|
|
60
60
|
x: "0",
|
|
61
61
|
dy: "1.11em",
|
|
62
|
-
children:
|
|
63
|
-
})] }) :
|
|
62
|
+
children: d
|
|
63
|
+
})] }) : u * f : Number(e.toFixed(3));
|
|
64
64
|
return /* @__PURE__ */ a("g", {
|
|
65
65
|
opacity: "1",
|
|
66
66
|
transform: `translate(${o(e)}, ${n})`,
|
|
67
67
|
children: [
|
|
68
68
|
/* @__PURE__ */ i(c, {
|
|
69
|
-
y1:
|
|
70
|
-
y2:
|
|
69
|
+
y1: h / 2 * -1,
|
|
70
|
+
y2: h / 2,
|
|
71
71
|
x1: "0.5",
|
|
72
72
|
x2: "0.5"
|
|
73
73
|
}),
|
|
74
|
-
|
|
75
|
-
x1:
|
|
76
|
-
x2:
|
|
77
|
-
y1:
|
|
78
|
-
y2:
|
|
74
|
+
p && /* @__PURE__ */ i(c, {
|
|
75
|
+
x1: v,
|
|
76
|
+
x2: v + g,
|
|
77
|
+
y1: y + _ / 2,
|
|
78
|
+
y2: y + _ / 2
|
|
79
79
|
}),
|
|
80
|
-
|
|
80
|
+
m && /* @__PURE__ */ i(s, {
|
|
81
81
|
ref: (e) => this.text = e,
|
|
82
82
|
y: "14",
|
|
83
83
|
width: "10",
|
|
84
84
|
dy: "0.71em",
|
|
85
|
-
textAnchor:
|
|
86
|
-
children:
|
|
85
|
+
textAnchor: p && "middle",
|
|
86
|
+
children: b
|
|
87
87
|
})
|
|
88
88
|
]
|
|
89
89
|
});
|
|
@@ -112,4 +112,4 @@ var s = n("text")({
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
//#endregion
|
|
115
|
-
export { d as default };
|
|
115
|
+
export { u as Tick, l as TickValidator, d as Ticks, d as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import e from "./point-chooser/index.js";
|
|
2
|
-
import t from "./graph/index.js";
|
|
1
|
+
import { PointChooser as e } from "./point-chooser/index.js";
|
|
2
|
+
import { NumberLineGraph as t } from "./graph/index.js";
|
|
3
3
|
import n from "./feedback.js";
|
|
4
4
|
import { buildElementModel as r } from "./graph/elements/builder.js";
|
|
5
5
|
import i from "react";
|
|
@@ -212,4 +212,4 @@ var w = C(_, "UiLayout") || C(k.UiLayout, "UiLayout"), T = C(g, "PreviewPrompt")
|
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
//#endregion
|
|
215
|
-
export { I as default };
|
|
215
|
+
export { t as Graph, I as NumberLine, I as default };
|