@pie-lib/plot 4.0.4-next.0 → 4.0.4-next.102

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.
Files changed (57) hide show
  1. package/CHANGELOG.json +17 -0
  2. package/CHANGELOG.md +838 -0
  3. package/LICENSE.md +5 -0
  4. package/lib/draggable.js +44 -0
  5. package/lib/draggable.js.map +1 -0
  6. package/lib/graph-props.js +46 -0
  7. package/lib/graph-props.js.map +1 -0
  8. package/lib/grid-draggable.js +361 -0
  9. package/lib/grid-draggable.js.map +1 -0
  10. package/lib/index.js +44 -0
  11. package/lib/index.js.map +1 -0
  12. package/lib/label.js +173 -0
  13. package/lib/label.js.map +1 -0
  14. package/lib/root.js +474 -0
  15. package/lib/root.js.map +1 -0
  16. package/lib/trig.js +149 -0
  17. package/lib/trig.js.map +1 -0
  18. package/lib/types.js +40 -0
  19. package/lib/types.js.map +1 -0
  20. package/lib/utils.js +165 -0
  21. package/lib/utils.js.map +1 -0
  22. package/package.json +21 -28
  23. package/src/__tests__/draggable.test.jsx +41 -0
  24. package/src/__tests__/grid-draggable.test.jsx +487 -0
  25. package/src/__tests__/root.test.jsx +277 -0
  26. package/src/__tests__/trig.test.js +163 -0
  27. package/src/__tests__/utils.test.js +229 -0
  28. package/src/draggable.jsx +11 -0
  29. package/src/graph-props.js +34 -0
  30. package/src/grid-draggable.jsx +332 -0
  31. package/src/index.js +9 -0
  32. package/src/label.jsx +199 -0
  33. package/src/root.jsx +485 -0
  34. package/src/trig.js +151 -0
  35. package/src/types.js +41 -0
  36. package/src/utils.js +167 -0
  37. package/dist/_virtual/_rolldown/runtime.js +0 -23
  38. package/dist/draggable.d.ts +0 -13
  39. package/dist/draggable.js +0 -13
  40. package/dist/graph-props.d.ts +0 -22
  41. package/dist/graph-props.js +0 -29
  42. package/dist/grid-draggable.d.ts +0 -91
  43. package/dist/grid-draggable.js +0 -168
  44. package/dist/index.d.ts +0 -16
  45. package/dist/index.js +0 -8
  46. package/dist/label.d.ts +0 -30
  47. package/dist/label.js +0 -132
  48. package/dist/node_modules/.bun/invariant@2.2.4/node_modules/invariant/browser.js +0 -28
  49. package/dist/node_modules/.bun/react-draggable@3.3.2/node_modules/react-draggable/dist/react-draggable.js +0 -914
  50. package/dist/root.d.ts +0 -68
  51. package/dist/root.js +0 -302
  52. package/dist/trig.d.ts +0 -41
  53. package/dist/trig.js +0 -47
  54. package/dist/types.d.ts +0 -125
  55. package/dist/types.js +0 -46
  56. package/dist/utils.d.ts +0 -40
  57. package/dist/utils.js +0 -82
package/dist/label.js DELETED
@@ -1,132 +0,0 @@
1
- import { extractTextFromHTML as e, isEmptyString as t } from "./utils.js";
2
- import { useState as n } from "react";
3
- import { styled as r } from "@mui/material/styles";
4
- import i from "prop-types";
5
- import * as a from "@pie-lib/render-ui";
6
- import { Readable as o } from "@pie-lib/render-ui";
7
- import { jsx as s } from "react/jsx-runtime";
8
- import c from "@pie-lib/editable-html-tip-tap";
9
- //#region src/label.tsx
10
- function l(e) {
11
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
12
- }
13
- function u(e, t) {
14
- return !e || l(e) ? e : l(e.default) ? e.default : t && l(e[t]) ? e[t] : t && l(e[t]?.default) ? e[t].default : e;
15
- }
16
- var d = u(o, "Readable") || u(m.Readable, "Readable"), f = a, p = f.default, m = p && typeof p == "object" ? p : f, h = {
17
- axisLabel: {
18
- fontSize: 12,
19
- textAlign: "center",
20
- margin: 4,
21
- padding: "4px 0"
22
- },
23
- chartLabel: {
24
- fontSize: 16,
25
- textAlign: "center",
26
- margin: 4,
27
- padding: "4px 0"
28
- },
29
- disabledLabel: {
30
- pointerEvents: "none",
31
- width: "100%"
32
- },
33
- editLabel: {
34
- position: "absolute",
35
- backgroundColor: "white",
36
- borderRadius: 4,
37
- boxShadow: "0px 5px 8px rgba(0,0,0,0.15)",
38
- zIndex: 10
39
- },
40
- rotateLeftLabel: {
41
- transform: "rotate(-90deg)",
42
- transformOrigin: "0 0",
43
- position: "absolute"
44
- },
45
- rotateRightLabel: {
46
- transform: "rotate(90deg)",
47
- transformOrigin: "0 0",
48
- position: "absolute"
49
- },
50
- customBottom: { position: "absolute" },
51
- displayNone: { display: "none" },
52
- centerPlaceholder: { "& .ProseMirror p.is-editor-empty::before, & .ProseMirror div.is-editor-empty::before": {
53
- left: 0,
54
- right: 0,
55
- width: "100%",
56
- textAlign: "center"
57
- } }
58
- }, g = r("div")({ ...h.centerPlaceholder }), _ = r("div")({
59
- ...h.disabledLabel,
60
- "& p": { margin: 0 }
61
- }), v = (r) => {
62
- let { disabledLabel: i, graphHeight: a, graphWidth: o, isChartBottomLabel: l, isDefineChartBottomLabel: u, isChartLeftLabel: f, isDefineChartLeftLabel: p, placeholder: m, text: v, side: y, onChange: b, mathMlOptions: x = {}, charactersLimit: S, titleHeight: C, preventNewLines: w } = r, [T, E] = n(!1), D = [
63
- "bold",
64
- "italic",
65
- "underline",
66
- "strikethrough",
67
- "math"
68
- ], O = l || f || u || p, k = y === "left" && p && a - 220, A = {
69
- width: k || (y === "left" || y === "right" ? a - 8 : o - 8),
70
- top: k || f && `${a - 70}px` || y === "left" && `${a - 8}px` || l && `${a - 60 + C}px` || y === "bottom" && `${a - 120 + C}px` || 0,
71
- left: y === "right" && `${o - 8}px` || (p || u) && "40px" || l && "-10px" || 0
72
- }, j = {
73
- width: o - 8,
74
- top: y === "right" ? `${a - 22}px` : 0,
75
- left: 0
76
- }, M = () => {
77
- !i && (y === "left" || y === "right") && E(!0);
78
- }, N = () => {
79
- E(!1), requestAnimationFrame(() => {
80
- document.activeElement?.blur?.();
81
- });
82
- }, P = (e) => !!(w && e.key === "Enter");
83
- return /* @__PURE__ */ s(d, {
84
- false: !0,
85
- children: /* @__PURE__ */ s(g, {
86
- onClick: M,
87
- style: {
88
- ...T ? j : A,
89
- ...O ? h.chartLabel : h.axisLabel,
90
- ...y === "left" && !T ? h.rotateLeftLabel : {},
91
- ...y === "right" && !T ? h.rotateRightLabel : {},
92
- ...T ? h.editLabel : {},
93
- ...l || u ? h.customBottom : {},
94
- ...i && !O && t(e(v)) && h.displayNone
95
- },
96
- children: i ? /* @__PURE__ */ s(_, { dangerouslySetInnerHTML: { __html: v || "" } }) : /* @__PURE__ */ s(c, {
97
- markup: v || "",
98
- onChange: b,
99
- placeholder: !i && m,
100
- toolbarOpts: {
101
- position: y === "bottom" ? "top" : "bottom",
102
- noPadding: !0,
103
- noBorder: !0
104
- },
105
- disableScrollbar: !0,
106
- activePlugins: D,
107
- onDone: N,
108
- onKeyDown: P,
109
- mathMlOptions: x,
110
- charactersLimit: S
111
- })
112
- })
113
- });
114
- };
115
- v.propTypes = {
116
- disabledLabel: i.bool,
117
- graphHeight: i.number,
118
- graphWidth: i.number,
119
- isChartBottomLabel: i.bool,
120
- isDefineChartBottomLabel: i.bool,
121
- isChartLeftLabel: i.bool,
122
- isDefineChartLeftLabel: i.bool,
123
- placeholder: i.string,
124
- text: i.string,
125
- side: i.string,
126
- onChange: i.func,
127
- mathMlOptions: i.object,
128
- charactersLimit: i.number,
129
- titleHeight: i.number
130
- };
131
- //#endregion
132
- export { v as default };
@@ -1,28 +0,0 @@
1
- import { __commonJSMin as e } from "../../../../../_virtual/_rolldown/runtime.js";
2
- //#region ../../../node_modules/.bun/invariant@2.2.4/node_modules/invariant/browser.js
3
- var t = /* @__PURE__ */ e(((e, t) => {
4
- t.exports = function(e, t, n, r, i, a, o, s) {
5
- if (process.env.NODE_ENV !== "production" && t === void 0) throw Error("invariant requires an error message argument");
6
- if (!e) {
7
- var c;
8
- if (t === void 0) c = /* @__PURE__ */ Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");
9
- else {
10
- var l = [
11
- n,
12
- r,
13
- i,
14
- a,
15
- o,
16
- s
17
- ], u = 0;
18
- c = Error(t.replace(/%s/g, function() {
19
- return l[u++];
20
- })), c.name = "Invariant Violation";
21
- }
22
- throw c.framesToPop = 1, c;
23
- }
24
- };
25
- }));
26
- //#endregion
27
- export default t();
28
- export { t as require_browser };