@dcg-overseas/number-line 0.1.13 → 0.1.15

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/index.cjs CHANGED
@@ -480,7 +480,7 @@ function NumberLineProvider({
480
480
  );
481
481
  }
482
482
  function buildArcPath({ x1, x2, y, rx, ry }) {
483
- return `M ${x1} ${y} A ${rx} ${ry} 0 0 1 ${x2} ${y}`;
483
+ return `M ${x1} ${y - 10} A ${rx} ${ry} 0 0 1 ${x2} ${y - 10}`;
484
484
  }
485
485
  function computeLabelStep(containerWidth, range) {
486
486
  const maxLabels = Math.floor(containerWidth / 40);
@@ -561,7 +561,8 @@ const AxisLayer = React.memo(function AxisLayer2({
561
561
  tickStep,
562
562
  showGroupTicks,
563
563
  showMajorTicks,
564
- showMinorTicks
564
+ showMinorTicks,
565
+ showLabelStep
565
566
  }) {
566
567
  const range = viewMax - viewMin;
567
568
  if (range <= 0) return null;
@@ -621,15 +622,16 @@ const AxisLayer = React.memo(function AxisLayer2({
621
622
  strokeWidth: strokeW
622
623
  }
623
624
  ),
624
- showLabel && /* @__PURE__ */ jsxRuntime.jsx(
625
+ (showLabel || showLabelStep) && /* @__PURE__ */ jsxRuntime.jsx(
625
626
  "text",
626
627
  {
627
628
  x,
628
629
  y: axisY + 32,
629
630
  textAnchor: edgeTextAnchor(),
630
- fontSize: 18,
631
+ fontSize: 20,
631
632
  fill: "#472E17",
632
633
  pointerEvents: "none",
634
+ "data-type": "2",
633
635
  style: { userSelect: "none", WebkitUserSelect: "none" },
634
636
  children: v
635
637
  }
@@ -742,7 +744,8 @@ function AnimatedArc({
742
744
  strokeDasharray: pathLen,
743
745
  strokeDashoffset: dashOffset,
744
746
  style: { transition: strokeTransition },
745
- pointerEvents: "none"
747
+ pointerEvents: "none",
748
+ "data-type": "1"
746
749
  }
747
750
  ),
748
751
  arcVisible && showHitArea && /* @__PURE__ */ jsxRuntime.jsx(
@@ -786,7 +789,7 @@ function AnimatedArc({
786
789
  x1: x2,
787
790
  y1: textY + 5,
788
791
  x2,
789
- y2: axisY - arrowHeadH,
792
+ y2: axisY - arrowHeadH - 10,
790
793
  stroke: strokeColor,
791
794
  strokeWidth: 1.5,
792
795
  pointerEvents: "none"
@@ -795,7 +798,7 @@ function AnimatedArc({
795
798
  /* @__PURE__ */ jsxRuntime.jsx(
796
799
  "polygon",
797
800
  {
798
- points: `${x2},${axisY} ${x2 - arrowHeadHW},${axisY - arrowHeadH} ${x2 + arrowHeadHW},${axisY - arrowHeadH}`,
801
+ points: `${x2},${axisY - 16} ${x2 - arrowHeadHW},${axisY - arrowHeadH - 16} ${x2 + arrowHeadHW},${axisY - arrowHeadH - 16}`,
799
802
  fill: strokeColor,
800
803
  pointerEvents: "none"
801
804
  }
@@ -838,7 +841,7 @@ const GroupArcsLayer = React.memo(function GroupArcsLayer2({
838
841
  const ry = Math.min(rx * ARC_RY_RATIO, arcMaxHeight);
839
842
  const color = arcColors[g % arcColors.length];
840
843
  const MIN_ARROW_SPAN = 24;
841
- const textY = Math.min(axisY - ry - 6, axisY - MIN_ARROW_SPAN);
844
+ const textY = Math.min(axisY - ry - 26, axisY - MIN_ARROW_SPAN);
842
845
  const arcPath = buildArcPath({ x1, x2, y: axisY, rx, ry });
843
846
  const isSelected = selectedArcIndices.has(g);
844
847
  const hitCursor = tool === "eraser" ? "cell" : tool === "none" ? "pointer" : "default";
@@ -956,6 +959,7 @@ function NumberLine({ className }) {
956
959
  showGroupTicks,
957
960
  showMajorTicks,
958
961
  showMinorTicks,
962
+ showLabelStep,
959
963
  viewMin,
960
964
  viewMax,
961
965
  enableZoom,
@@ -1165,7 +1169,8 @@ function NumberLine({ className }) {
1165
1169
  tickStep,
1166
1170
  showGroupTicks,
1167
1171
  showMajorTicks,
1168
- showMinorTicks
1172
+ showMinorTicks,
1173
+ showLabelStep
1169
1174
  }
1170
1175
  ),
1171
1176
  /* @__PURE__ */ jsxRuntime.jsx(
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export declare interface NumberLineContextValue {
19
19
  showGroupTicks: boolean;
20
20
  showMajorTicks: boolean;
21
21
  showMinorTicks: boolean;
22
+ showLabelStep: boolean;
22
23
  viewMin: number;
23
24
  viewMax: number;
24
25
  enableZoom: boolean;
package/dist/index.js CHANGED
@@ -478,7 +478,7 @@ function NumberLineProvider({
478
478
  );
479
479
  }
480
480
  function buildArcPath({ x1, x2, y, rx, ry }) {
481
- return `M ${x1} ${y} A ${rx} ${ry} 0 0 1 ${x2} ${y}`;
481
+ return `M ${x1} ${y - 10} A ${rx} ${ry} 0 0 1 ${x2} ${y - 10}`;
482
482
  }
483
483
  function computeLabelStep(containerWidth, range) {
484
484
  const maxLabels = Math.floor(containerWidth / 40);
@@ -559,7 +559,8 @@ const AxisLayer = React.memo(function AxisLayer2({
559
559
  tickStep,
560
560
  showGroupTicks,
561
561
  showMajorTicks,
562
- showMinorTicks
562
+ showMinorTicks,
563
+ showLabelStep
563
564
  }) {
564
565
  const range = viewMax - viewMin;
565
566
  if (range <= 0) return null;
@@ -619,15 +620,16 @@ const AxisLayer = React.memo(function AxisLayer2({
619
620
  strokeWidth: strokeW
620
621
  }
621
622
  ),
622
- showLabel && /* @__PURE__ */ jsx(
623
+ (showLabel || showLabelStep) && /* @__PURE__ */ jsx(
623
624
  "text",
624
625
  {
625
626
  x,
626
627
  y: axisY + 32,
627
628
  textAnchor: edgeTextAnchor(),
628
- fontSize: 18,
629
+ fontSize: 20,
629
630
  fill: "#472E17",
630
631
  pointerEvents: "none",
632
+ "data-type": "2",
631
633
  style: { userSelect: "none", WebkitUserSelect: "none" },
632
634
  children: v
633
635
  }
@@ -740,7 +742,8 @@ function AnimatedArc({
740
742
  strokeDasharray: pathLen,
741
743
  strokeDashoffset: dashOffset,
742
744
  style: { transition: strokeTransition },
743
- pointerEvents: "none"
745
+ pointerEvents: "none",
746
+ "data-type": "1"
744
747
  }
745
748
  ),
746
749
  arcVisible && showHitArea && /* @__PURE__ */ jsx(
@@ -784,7 +787,7 @@ function AnimatedArc({
784
787
  x1: x2,
785
788
  y1: textY + 5,
786
789
  x2,
787
- y2: axisY - arrowHeadH,
790
+ y2: axisY - arrowHeadH - 10,
788
791
  stroke: strokeColor,
789
792
  strokeWidth: 1.5,
790
793
  pointerEvents: "none"
@@ -793,7 +796,7 @@ function AnimatedArc({
793
796
  /* @__PURE__ */ jsx(
794
797
  "polygon",
795
798
  {
796
- points: `${x2},${axisY} ${x2 - arrowHeadHW},${axisY - arrowHeadH} ${x2 + arrowHeadHW},${axisY - arrowHeadH}`,
799
+ points: `${x2},${axisY - 16} ${x2 - arrowHeadHW},${axisY - arrowHeadH - 16} ${x2 + arrowHeadHW},${axisY - arrowHeadH - 16}`,
797
800
  fill: strokeColor,
798
801
  pointerEvents: "none"
799
802
  }
@@ -836,7 +839,7 @@ const GroupArcsLayer = memo(function GroupArcsLayer2({
836
839
  const ry = Math.min(rx * ARC_RY_RATIO, arcMaxHeight);
837
840
  const color = arcColors[g % arcColors.length];
838
841
  const MIN_ARROW_SPAN = 24;
839
- const textY = Math.min(axisY - ry - 6, axisY - MIN_ARROW_SPAN);
842
+ const textY = Math.min(axisY - ry - 26, axisY - MIN_ARROW_SPAN);
840
843
  const arcPath = buildArcPath({ x1, x2, y: axisY, rx, ry });
841
844
  const isSelected = selectedArcIndices.has(g);
842
845
  const hitCursor = tool === "eraser" ? "cell" : tool === "none" ? "pointer" : "default";
@@ -954,6 +957,7 @@ function NumberLine({ className }) {
954
957
  showGroupTicks,
955
958
  showMajorTicks,
956
959
  showMinorTicks,
960
+ showLabelStep,
957
961
  viewMin,
958
962
  viewMax,
959
963
  enableZoom,
@@ -1163,7 +1167,8 @@ function NumberLine({ className }) {
1163
1167
  tickStep,
1164
1168
  showGroupTicks,
1165
1169
  showMajorTicks,
1166
- showMinorTicks
1170
+ showMinorTicks,
1171
+ showLabelStep
1167
1172
  }
1168
1173
  ),
1169
1174
  /* @__PURE__ */ jsx(
package/package.json CHANGED
@@ -1,47 +1,47 @@
1
- {
2
- "name": "@dcg-overseas/number-line",
3
- "version": "0.1.13",
4
- "description": "Interactive number line component with group arcs and freehand drawing",
5
- "type": "module",
6
- "license": "MIT",
7
- "main": "./dist/index.cjs",
8
- "module": "./dist/index.js",
9
- "types": "./dist/index.d.ts",
10
- "exports": {
11
- ".": {
12
- "import": {
13
- "types": "./dist/index.d.ts",
14
- "default": "./dist/index.js"
15
- },
16
- "require": {
17
- "types": "./dist/index.d.cts",
18
- "default": "./dist/index.cjs"
19
- }
20
- }
21
- },
22
- "files": [
23
- "dist"
24
- ],
25
- "sideEffects": false,
26
- "scripts": {
27
- "build": "vite build",
28
- "build:watch": "vite build --watch",
29
- "typecheck": "tsc --noEmit",
30
- "clean": "rm -rf dist *.tsbuildinfo"
31
- },
32
- "peerDependencies": {
33
- "react": "^18.0.0",
34
- "react-dom": "^18.0.0"
35
- },
36
- "devDependencies": {
37
- "@types/react": "^18.3.3",
38
- "@types/react-dom": "^18.3.0",
39
- "@vitejs/plugin-react": "^4.3.1",
40
- "vite": "^5.3.1",
41
- "vite-plugin-dts": "^3.9.1"
42
- },
43
- "publishConfig": {
44
- "access": "public",
45
- "registry": "https://registry.npmjs.org/"
46
- }
47
- }
1
+ {
2
+ "name": "@dcg-overseas/number-line",
3
+ "version": "0.1.15",
4
+ "description": "Interactive number line component with group arcs and freehand drawing",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "default": "./dist/index.cjs"
19
+ }
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "sideEffects": false,
26
+ "peerDependencies": {
27
+ "react": "^18.0.0",
28
+ "react-dom": "^18.0.0"
29
+ },
30
+ "devDependencies": {
31
+ "@types/react": "^18.3.3",
32
+ "@types/react-dom": "^18.3.0",
33
+ "@vitejs/plugin-react": "^4.3.1",
34
+ "vite": "^5.3.1",
35
+ "vite-plugin-dts": "^3.9.1"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public",
39
+ "registry": "https://registry.npmjs.org/"
40
+ },
41
+ "scripts": {
42
+ "build": "vite build",
43
+ "build:watch": "vite build --watch",
44
+ "typecheck": "tsc --noEmit",
45
+ "clean": "rm -rf dist *.tsbuildinfo"
46
+ }
47
+ }