@pie-lib/tools 2.0.2-next.1 → 2.0.3-next.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.
Files changed (126) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +11 -0
  2. package/dist/anchor-utils.d.ts +60 -0
  3. package/dist/anchor-utils.js +87 -0
  4. package/dist/anchor.d.ts +13 -0
  5. package/dist/anchor.js +17 -0
  6. package/dist/index.d.ts +13 -0
  7. package/dist/index.js +5 -0
  8. package/dist/node_modules/.bun/assert@1.5.1/node_modules/assert/assert.js +174 -0
  9. package/dist/node_modules/.bun/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js +13 -0
  10. package/dist/node_modules/.bun/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js +8 -0
  11. package/dist/node_modules/.bun/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js +8 -0
  12. package/dist/node_modules/.bun/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js +16 -0
  13. package/dist/node_modules/.bun/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js +8 -0
  14. package/dist/node_modules/.bun/call-bound@1.0.4/node_modules/call-bound/index.js +14 -0
  15. package/dist/node_modules/.bun/degrees-radians@1.0.3/node_modules/degrees-radians/index.js +12 -0
  16. package/dist/node_modules/.bun/dunder-proto@1.0.1/node_modules/dunder-proto/get.js +19 -0
  17. package/dist/node_modules/.bun/es-define-property@1.0.1/node_modules/es-define-property/index.js +14 -0
  18. package/dist/node_modules/.bun/es-errors@1.3.0/node_modules/es-errors/eval.js +8 -0
  19. package/dist/node_modules/.bun/es-errors@1.3.0/node_modules/es-errors/index.js +8 -0
  20. package/dist/node_modules/.bun/es-errors@1.3.0/node_modules/es-errors/range.js +8 -0
  21. package/dist/node_modules/.bun/es-errors@1.3.0/node_modules/es-errors/ref.js +8 -0
  22. package/dist/node_modules/.bun/es-errors@1.3.0/node_modules/es-errors/syntax.js +8 -0
  23. package/dist/node_modules/.bun/es-errors@1.3.0/node_modules/es-errors/type.js +8 -0
  24. package/dist/node_modules/.bun/es-errors@1.3.0/node_modules/es-errors/uri.js +8 -0
  25. package/dist/node_modules/.bun/es-object-atoms@1.1.2/node_modules/es-object-atoms/index.js +8 -0
  26. package/dist/node_modules/.bun/function-bind@1.1.2/node_modules/function-bind/implementation.js +34 -0
  27. package/dist/node_modules/.bun/function-bind@1.1.2/node_modules/function-bind/index.js +10 -0
  28. package/dist/node_modules/.bun/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js +283 -0
  29. package/dist/node_modules/.bun/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js +9 -0
  30. package/dist/node_modules/.bun/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js +8 -0
  31. package/dist/node_modules/.bun/get-proto@1.0.1/node_modules/get-proto/index.js +19 -0
  32. package/dist/node_modules/.bun/gopd@1.2.0/node_modules/gopd/gOPD.js +8 -0
  33. package/dist/node_modules/.bun/gopd@1.2.0/node_modules/gopd/index.js +15 -0
  34. package/dist/node_modules/.bun/has-symbols@1.1.0/node_modules/has-symbols/index.js +12 -0
  35. package/dist/node_modules/.bun/has-symbols@1.1.0/node_modules/has-symbols/shams.js +23 -0
  36. package/dist/node_modules/.bun/hasown@2.0.4/node_modules/hasown/index.js +10 -0
  37. package/dist/node_modules/.bun/inherits@2.0.3/node_modules/inherits/inherits_browser.js +19 -0
  38. package/dist/node_modules/.bun/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js +8 -0
  39. package/dist/node_modules/.bun/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js +8 -0
  40. package/dist/node_modules/.bun/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js +10 -0
  41. package/dist/node_modules/.bun/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js +8 -0
  42. package/dist/node_modules/.bun/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js +8 -0
  43. package/dist/node_modules/.bun/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js +8 -0
  44. package/dist/node_modules/.bun/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js +8 -0
  45. package/dist/node_modules/.bun/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js +12 -0
  46. package/dist/node_modules/.bun/object-keys@1.1.1/node_modules/object-keys/implementation.js +77 -0
  47. package/dist/node_modules/.bun/object-keys@1.1.1/node_modules/object-keys/index.js +20 -0
  48. package/dist/node_modules/.bun/object-keys@1.1.1/node_modules/object-keys/isArguments.js +12 -0
  49. package/dist/node_modules/.bun/object.assign@4.1.7/node_modules/object.assign/implementation.js +29 -0
  50. package/dist/node_modules/.bun/object.assign@4.1.7/node_modules/object.assign/polyfill.js +27 -0
  51. package/dist/node_modules/.bun/radians-degrees@1.0.0/node_modules/radians-degrees/index.js +11 -0
  52. package/dist/node_modules/.bun/react-portal@4.3.0_6dbf9a050bc9aadb/node_modules/react-portal/es/LegacyPortal.js +77 -0
  53. package/dist/node_modules/.bun/react-portal@4.3.0_6dbf9a050bc9aadb/node_modules/react-portal/es/Portal.js +55 -0
  54. package/dist/node_modules/.bun/react-portal@4.3.0_6dbf9a050bc9aadb/node_modules/react-portal/es/PortalCompat.js +9 -0
  55. package/dist/node_modules/.bun/react-portal@4.3.0_6dbf9a050bc9aadb/node_modules/react-portal/es/utils.js +4 -0
  56. package/dist/node_modules/.bun/trigonometry-calculator@2.0.0/node_modules/trigonometry-calculator/lib/index.js +53 -0
  57. package/dist/node_modules/.bun/trigonometry-equations@2.0.1/node_modules/trigonometry-equations/lib/index.js +129 -0
  58. package/dist/node_modules/.bun/util@0.10.4/node_modules/util/support/isBufferBrowser.js +10 -0
  59. package/dist/node_modules/.bun/util@0.10.4/node_modules/util/util.js +262 -0
  60. package/dist/protractor/graphic.d.ts +13 -0
  61. package/dist/protractor/graphic.js +85 -0
  62. package/dist/protractor/index.d.ts +29 -0
  63. package/dist/protractor/index.js +56 -0
  64. package/dist/rotatable.d.ts +56 -0
  65. package/dist/rotatable.js +210 -0
  66. package/dist/ruler/graphic.d.ts +20 -0
  67. package/dist/ruler/graphic.js +53 -0
  68. package/dist/ruler/index.d.ts +32 -0
  69. package/dist/ruler/index.js +77 -0
  70. package/dist/ruler/unit-type.d.ts +30 -0
  71. package/dist/ruler/unit-type.js +38 -0
  72. package/dist/ruler/unit.d.ts +21 -0
  73. package/dist/ruler/unit.js +69 -0
  74. package/dist/style-utils.d.ts +12 -0
  75. package/dist/style-utils.js +5 -0
  76. package/dist/transform-origin.d.ts +18 -0
  77. package/dist/transform-origin.js +21 -0
  78. package/package.json +31 -25
  79. package/CHANGELOG.json +0 -1
  80. package/CHANGELOG.md +0 -622
  81. package/LICENSE.md +0 -5
  82. package/lib/anchor-utils.js +0 -193
  83. package/lib/anchor-utils.js.map +0 -1
  84. package/lib/anchor.js +0 -33
  85. package/lib/anchor.js.map +0 -1
  86. package/lib/index.js +0 -33
  87. package/lib/index.js.map +0 -1
  88. package/lib/protractor/graphic.js +0 -147
  89. package/lib/protractor/graphic.js.map +0 -1
  90. package/lib/protractor/index.js +0 -90
  91. package/lib/protractor/index.js.map +0 -1
  92. package/lib/rotatable.js +0 -335
  93. package/lib/rotatable.js.map +0 -1
  94. package/lib/ruler/graphic.js +0 -89
  95. package/lib/ruler/graphic.js.map +0 -1
  96. package/lib/ruler/index.js +0 -114
  97. package/lib/ruler/index.js.map +0 -1
  98. package/lib/ruler/unit-type.js +0 -55
  99. package/lib/ruler/unit-type.js.map +0 -1
  100. package/lib/ruler/unit.js +0 -124
  101. package/lib/ruler/unit.js.map +0 -1
  102. package/lib/style-utils.js +0 -21
  103. package/lib/style-utils.js.map +0 -1
  104. package/lib/transform-origin.js +0 -71
  105. package/lib/transform-origin.js.map +0 -1
  106. package/src/__tests__/anchor-utils.test.js +0 -131
  107. package/src/__tests__/rotatable.test.jsx +0 -263
  108. package/src/__tests__/transform-origin.test.jsx +0 -24
  109. package/src/anchor-utils.js +0 -153
  110. package/src/anchor.jsx +0 -20
  111. package/src/index.js +0 -6
  112. package/src/protractor/__tests__/graphic.test.jsx +0 -64
  113. package/src/protractor/__tests__/index.test.jsx +0 -65
  114. package/src/protractor/graphic.jsx +0 -82
  115. package/src/protractor/index.jsx +0 -67
  116. package/src/rotatable.jsx +0 -290
  117. package/src/ruler/__tests__/graphic.test.jsx +0 -64
  118. package/src/ruler/__tests__/index.test.jsx +0 -85
  119. package/src/ruler/__tests__/unit-type.test.jsx +0 -66
  120. package/src/ruler/__tests__/unit.test.jsx +0 -68
  121. package/src/ruler/graphic.jsx +0 -48
  122. package/src/ruler/index.jsx +0 -78
  123. package/src/ruler/unit-type.jsx +0 -39
  124. package/src/ruler/unit.jsx +0 -83
  125. package/src/style-utils.js +0 -7
  126. package/src/transform-origin.jsx +0 -60
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/tools/src/ruler/unit.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 Unit extends React.Component {
12
+ static propTypes: {
13
+ index: PropTypes.Validator<number>;
14
+ width: PropTypes.Validator<number>;
15
+ height: PropTypes.Validator<number>;
16
+ last: PropTypes.Validator<boolean>;
17
+ config: PropTypes.Validator<object>;
18
+ };
19
+ render(): React.JSX.Element;
20
+ }
21
+ export default Unit;
@@ -0,0 +1,69 @@
1
+ import { noSelect as e, strokeColor as t } from "../style-utils.js";
2
+ import n from "react";
3
+ import { styled as r } from "@mui/material/styles";
4
+ import i from "prop-types";
5
+ import { range as a } from "@pie-element/shared-lodash";
6
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ //#region src/ruler/unit.tsx
8
+ var c = r("line")(({ theme: e }) => ({ stroke: t(e) })), l = ({ x: e, height: t, bottom: n, major: r, minor: i }) => /* @__PURE__ */ o(c, {
9
+ y1: r ? n - t * 2 : i ? n - t * 1.5 : n - t,
10
+ y2: n,
11
+ x1: e,
12
+ x2: e
13
+ }), u = ({ count: e, width: t, height: r }) => /* @__PURE__ */ o(n.Fragment, { children: a(1, e).map((n) => /* @__PURE__ */ o(l, {
14
+ value: n,
15
+ x: t / e * n,
16
+ major: n % (e / 2) == 0,
17
+ minor: n % (e / 4) == 0,
18
+ bottom: r,
19
+ height: 10
20
+ }, n)) });
21
+ u.propTypes = {
22
+ count: i.number.isRequired,
23
+ width: i.number.isRequired,
24
+ height: i.number.isRequired
25
+ };
26
+ var d = r("line")(({ theme: e }) => ({
27
+ stroke: t(e),
28
+ strokeWidth: 1
29
+ })), f = r("text")(({ theme: n }) => ({
30
+ textAnchor: "end",
31
+ fontSize: "12px",
32
+ fill: t(n),
33
+ ...e()
34
+ })), p = class extends n.Component {
35
+ static propTypes = {
36
+ index: i.number.isRequired,
37
+ width: i.number.isRequired,
38
+ height: i.number.isRequired,
39
+ last: i.bool.isRequired,
40
+ config: i.object.isRequired
41
+ };
42
+ render() {
43
+ let { index: e, width: t, height: n, last: r, config: i } = this.props;
44
+ return /* @__PURE__ */ s("g", {
45
+ style: { transform: `translate(${t * (e - 1)}px, 0px)` },
46
+ children: [
47
+ !r && /* @__PURE__ */ o(d, {
48
+ x1: t,
49
+ y1: 0,
50
+ x2: t,
51
+ y2: n
52
+ }),
53
+ /* @__PURE__ */ o(u, {
54
+ count: i.ticks,
55
+ width: t,
56
+ height: n
57
+ }),
58
+ /* @__PURE__ */ o(f, {
59
+ width: t,
60
+ x: t - 5,
61
+ y: 15,
62
+ children: e
63
+ })
64
+ ]
65
+ });
66
+ }
67
+ };
68
+ //#endregion
69
+ export { p as default };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/tools/src/style-utils.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 { noSelect } from '@pie-lib/style-utils';
10
+ export { noSelect };
11
+ export declare const strokeColor: (theme: any) => string;
12
+ export declare const fillColor: (theme: any) => string;
@@ -0,0 +1,5 @@
1
+ import { noSelect as e } from "@pie-lib/style-utils";
2
+ //#region src/style-utils.ts
3
+ var t = (e) => `var(--ruler-stroke, ${e.palette.primary.main})`, n = (e) => `var(--ruler-bg, ${e.palette.primary.contrastText})`;
4
+ //#endregion
5
+ export { n as fillColor, e as noSelect, t as strokeColor };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/tools/src/transform-origin.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
+ /**
10
+ * Parse a transform origin string to x/y values.
11
+ * @param {{width: number, height: number}} rect
12
+ * @param {string} value
13
+ * @returns {x:number, y:number}
14
+ */
15
+ export declare const parse: (rect: any, value: any) => {
16
+ x: number;
17
+ y: number;
18
+ } | undefined;
@@ -0,0 +1,21 @@
1
+ //#region src/transform-origin.tsx
2
+ var e = (e) => e === "left" || e === "top" ? 0 : e === "right" || e === "bottom" ? 100 : e === "center" ? 50 : e.endsWith("%") ? parseFloat(e) : e, t = (t, n) => t.endsWith("px") ? parseFloat(t) : (t = e(t), t / 100 * n), n = (e) => e[0] === "bottom" || e[0] === "top" || e[1] === "left" || e[1] === "right" ? [e[1], e[0]] : e, r = (e, r) => {
3
+ if (!r) return {
4
+ x: e.width / 2,
5
+ y: e.height / 2
6
+ };
7
+ let i = r.split(" ");
8
+ if (i.length === 1) return {
9
+ x: t(i[0], e.width),
10
+ y: t("50%", e.height)
11
+ };
12
+ if (i.length === 2) {
13
+ let r = n(i);
14
+ return {
15
+ x: t(r[0], e.width),
16
+ y: t(r[1], e.height)
17
+ };
18
+ } else if (i.length === 3) throw Error("transform-origin values with 3 fields not supported.");
19
+ };
20
+ //#endregion
21
+ export { r as parse };
package/package.json CHANGED
@@ -1,43 +1,49 @@
1
1
  {
2
2
  "name": "@pie-lib/tools",
3
- "publishConfig": {
4
- "access": "public"
5
- },
6
- "version": "2.0.2-next.1",
3
+ "version": "2.0.3-next.0",
7
4
  "description": "Some interactive tools",
8
- "keywords": [
9
- "react",
10
- "pie",
11
- "tools"
12
- ],
13
- "main": "lib/index.js",
14
- "module": "src/index.js",
15
- "scripts": {},
16
- "author": "",
17
- "license": "ISC",
18
- "repository": "pie-framework/pie-lib",
19
5
  "dependencies": {
20
6
  "@emotion/react": "^11.14.0",
21
7
  "@emotion/style": "^0.8.0",
22
8
  "@mapbox/point-geometry": "^1.1.0",
23
9
  "@mui/icons-material": "^7.3.4",
24
10
  "@mui/material": "^7.3.4",
25
- "@pie-lib/style-utils": "^2.0.2-next.1",
11
+ "@pie-lib/style-utils": "2.0.2",
26
12
  "assert": "^1.4.1",
27
13
  "debug": "^4.1.1",
28
- "lodash-es": "^4.17.23",
29
14
  "prop-types": "^15.7.2",
30
15
  "react-portal": "^4.2.0",
31
- "trigonometry-calculator": "^2.0.0"
16
+ "trigonometry-calculator": "^2.0.0",
17
+ "@pie-element/shared-lodash": "0.1.1-next.0",
18
+ "@emotion/core": "0.x.x"
19
+ },
20
+ "type": "module",
21
+ "main": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
27
+ }
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "sideEffects": false,
33
+ "scripts": {
34
+ "build": "bun x vite build && bun x tsc --emitDeclarationOnly",
35
+ "dev": "bun x vite",
36
+ "test": "bun x vitest run"
32
37
  },
33
38
  "devDependencies": {
34
- "@mui/material": "^7.3.4",
35
- "react": "^18.2.0",
36
- "react-dom": "^18.2.0"
39
+ "vite": "^8.0.1",
40
+ "typescript": "^5.9.3",
41
+ "@vitejs/plugin-react": "^6.0.1",
42
+ "@types/react": "^18.2.0",
43
+ "@types/react-dom": "^18.2.0"
37
44
  },
38
45
  "peerDependencies": {
39
- "@mui/material": "^7.3.4",
40
- "react": "^18.2.0"
41
- },
42
- "gitHead": "abac0350cad300ce7a38fd54141b281b48a1461a"
46
+ "react": "^18.0.0",
47
+ "react-dom": "^18.0.0"
48
+ }
43
49
  }
package/CHANGELOG.json DELETED
@@ -1 +0,0 @@
1
- []