@pixerate/editor-react 0.110.0 → 0.111.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.
- package/dist/chart/index.cjs +24 -3
- package/dist/chart/index.js +1 -1
- package/dist/{chunk-MST2H6JB.js → chunk-VTLCQXIY.js} +24 -3
- package/dist/index.cjs +24 -3
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/chart/index.cjs
CHANGED
|
@@ -248,9 +248,10 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
248
248
|
valueDomain: frozen?.valueDomain,
|
|
249
249
|
valueDomain2: frozen?.valueDomain2,
|
|
250
250
|
xDomain: frozen?.xDomain,
|
|
251
|
-
readout: frozen?.readout
|
|
251
|
+
readout: frozen?.readout,
|
|
252
|
+
raceFrame: state.raceFrame
|
|
252
253
|
}),
|
|
253
|
-
[state.spec, state.selection, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
|
|
254
|
+
[state.spec, state.selection, state.raceFrame, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
|
|
254
255
|
);
|
|
255
256
|
if (sceneRef) sceneRef.current = scene;
|
|
256
257
|
const byKey = (0, import_react2.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
|
|
@@ -708,7 +709,7 @@ function ErrorBarFields({ controller, series, which, idBase }) {
|
|
|
708
709
|
] });
|
|
709
710
|
}
|
|
710
711
|
function ChartInspector({ controller, sections, className }) {
|
|
711
|
-
const { spec, selectedSeries, selection } = useChartState(controller);
|
|
712
|
+
const { spec, selectedSeries, selection, raceFrame, racePlaying } = useChartState(controller);
|
|
712
713
|
const idBase = (0, import_react4.useId)();
|
|
713
714
|
const show = (section) => !sections || sections.includes(section);
|
|
714
715
|
const cartesian = (0, import_chart4.isCartesianChart)(spec.type);
|
|
@@ -779,6 +780,26 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
779
780
|
onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
|
|
780
781
|
}
|
|
781
782
|
) }),
|
|
783
|
+
spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-race-top`, value: String(spec.raceTopN), inputMode: "numeric", "data-option": "raceTopN", className: chartInputClass, onCommit: (text) => controller.update({ raceTopN: Number(text) }).ok }) }),
|
|
784
|
+
spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
785
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "race-play", "aria-label": racePlaying ? "Pause the race" : "Play the race", onClick: () => racePlaying ? controller.pauseRace() : controller.playRace(), children: racePlaying ? "Pause" : "Play" }),
|
|
786
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
787
|
+
"input",
|
|
788
|
+
{
|
|
789
|
+
id: `${idBase}-race-frame`,
|
|
790
|
+
type: "range",
|
|
791
|
+
min: 0,
|
|
792
|
+
max: spec.categories.length - 1,
|
|
793
|
+
step: 0.01,
|
|
794
|
+
value: raceFrame ?? spec.categories.length - 1,
|
|
795
|
+
"data-option": "raceFrame",
|
|
796
|
+
"aria-valuetext": spec.categories[Math.round(raceFrame ?? spec.categories.length - 1)],
|
|
797
|
+
className: "min-w-0 flex-1 accent-primary",
|
|
798
|
+
onChange: (e) => controller.setRaceFrame(Number(e.currentTarget.value))
|
|
799
|
+
}
|
|
800
|
+
),
|
|
801
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "w-12 shrink-0 truncate text-right tabular-nums text-muted-foreground", "data-race-time": "", children: spec.categories[Math.round(raceFrame ?? spec.categories.length - 1)] })
|
|
802
|
+
] }) }),
|
|
782
803
|
spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Select, { id: `${idBase}-sankey-color`, name: "sankeyLinkColor", value: spec.sankeyLinkColor, options: import_chart4.CHART_SANKEY_LINK_COLORS, labels: { source: "Coloured by source", target: "Coloured by target", gray: "Grey" }, onChange: (sankeyLinkColor) => controller.update({ sankeyLinkColor }) }) }),
|
|
783
804
|
spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
|
|
784
805
|
spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Select, { id: `${idBase}-likert-neutral`, name: "likertNeutral", value: spec.likertNeutral, options: import_chart4.CHART_LIKERT_NEUTRALS, labels: { split: "Across the centre", separate: "In its own column" }, onChange: (likertNeutral) => controller.update({ likertNeutral }) }) }),
|
package/dist/chart/index.js
CHANGED
|
@@ -197,9 +197,10 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
197
197
|
valueDomain: frozen?.valueDomain,
|
|
198
198
|
valueDomain2: frozen?.valueDomain2,
|
|
199
199
|
xDomain: frozen?.xDomain,
|
|
200
|
-
readout: frozen?.readout
|
|
200
|
+
readout: frozen?.readout,
|
|
201
|
+
raceFrame: state.raceFrame
|
|
201
202
|
}),
|
|
202
|
-
[state.spec, state.selection, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
|
|
203
|
+
[state.spec, state.selection, state.raceFrame, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
|
|
203
204
|
);
|
|
204
205
|
if (sceneRef) sceneRef.current = scene;
|
|
205
206
|
const byKey = useMemo2(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
|
|
@@ -713,7 +714,7 @@ function ErrorBarFields({ controller, series, which, idBase }) {
|
|
|
713
714
|
] });
|
|
714
715
|
}
|
|
715
716
|
function ChartInspector({ controller, sections, className }) {
|
|
716
|
-
const { spec, selectedSeries, selection } = useChartState(controller);
|
|
717
|
+
const { spec, selectedSeries, selection, raceFrame, racePlaying } = useChartState(controller);
|
|
717
718
|
const idBase = useId();
|
|
718
719
|
const show = (section) => !sections || sections.includes(section);
|
|
719
720
|
const cartesian = isCartesianChart(spec.type);
|
|
@@ -784,6 +785,26 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
784
785
|
onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
|
|
785
786
|
}
|
|
786
787
|
) }),
|
|
788
|
+
spec.type === "barrace" && /* @__PURE__ */ jsx3(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ jsx3(ChartCommitInput, { id: `${idBase}-race-top`, value: String(spec.raceTopN), inputMode: "numeric", "data-option": "raceTopN", className: chartInputClass, onCommit: (text) => controller.update({ raceTopN: Number(text) }).ok }) }),
|
|
789
|
+
spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ jsx3(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1", children: [
|
|
790
|
+
/* @__PURE__ */ jsx3("button", { type: "button", className: chartButtonClass, "data-action": "race-play", "aria-label": racePlaying ? "Pause the race" : "Play the race", onClick: () => racePlaying ? controller.pauseRace() : controller.playRace(), children: racePlaying ? "Pause" : "Play" }),
|
|
791
|
+
/* @__PURE__ */ jsx3(
|
|
792
|
+
"input",
|
|
793
|
+
{
|
|
794
|
+
id: `${idBase}-race-frame`,
|
|
795
|
+
type: "range",
|
|
796
|
+
min: 0,
|
|
797
|
+
max: spec.categories.length - 1,
|
|
798
|
+
step: 0.01,
|
|
799
|
+
value: raceFrame ?? spec.categories.length - 1,
|
|
800
|
+
"data-option": "raceFrame",
|
|
801
|
+
"aria-valuetext": spec.categories[Math.round(raceFrame ?? spec.categories.length - 1)],
|
|
802
|
+
className: "min-w-0 flex-1 accent-primary",
|
|
803
|
+
onChange: (e) => controller.setRaceFrame(Number(e.currentTarget.value))
|
|
804
|
+
}
|
|
805
|
+
),
|
|
806
|
+
/* @__PURE__ */ jsx3("span", { className: "w-12 shrink-0 truncate text-right tabular-nums text-muted-foreground", "data-race-time": "", children: spec.categories[Math.round(raceFrame ?? spec.categories.length - 1)] })
|
|
807
|
+
] }) }),
|
|
787
808
|
spec.type === "sankey" && /* @__PURE__ */ jsx3(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ jsx3(Select, { id: `${idBase}-sankey-color`, name: "sankeyLinkColor", value: spec.sankeyLinkColor, options: CHART_SANKEY_LINK_COLORS, labels: { source: "Coloured by source", target: "Coloured by target", gray: "Grey" }, onChange: (sankeyLinkColor) => controller.update({ sankeyLinkColor }) }) }),
|
|
788
809
|
spec.type === "sunburst" && /* @__PURE__ */ jsx3(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ jsx3(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
|
|
789
810
|
spec.type === "likert" && /* @__PURE__ */ jsx3(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ jsx3(Select, { id: `${idBase}-likert-neutral`, name: "likertNeutral", value: spec.likertNeutral, options: CHART_LIKERT_NEUTRALS, labels: { split: "Across the centre", separate: "In its own column" }, onChange: (likertNeutral) => controller.update({ likertNeutral }) }) }),
|
package/dist/index.cjs
CHANGED
|
@@ -11349,9 +11349,10 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
11349
11349
|
valueDomain: frozen?.valueDomain,
|
|
11350
11350
|
valueDomain2: frozen?.valueDomain2,
|
|
11351
11351
|
xDomain: frozen?.xDomain,
|
|
11352
|
-
readout: frozen?.readout
|
|
11352
|
+
readout: frozen?.readout,
|
|
11353
|
+
raceFrame: state.raceFrame
|
|
11353
11354
|
}),
|
|
11354
|
-
[state.spec, state.selection, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
|
|
11355
|
+
[state.spec, state.selection, state.raceFrame, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
|
|
11355
11356
|
);
|
|
11356
11357
|
if (sceneRef) sceneRef.current = scene;
|
|
11357
11358
|
const byKey = (0, import_react83.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
|
|
@@ -11820,7 +11821,7 @@ function ErrorBarFields({ controller, series, which, idBase }) {
|
|
|
11820
11821
|
] });
|
|
11821
11822
|
}
|
|
11822
11823
|
function ChartInspector({ controller, sections, className }) {
|
|
11823
|
-
const { spec, selectedSeries, selection } = useChartState(controller);
|
|
11824
|
+
const { spec, selectedSeries, selection, raceFrame, racePlaying } = useChartState(controller);
|
|
11824
11825
|
const idBase = (0, import_react85.useId)();
|
|
11825
11826
|
const show = (section) => !sections || sections.includes(section);
|
|
11826
11827
|
const cartesian = (0, import_chart4.isCartesianChart)(spec.type);
|
|
@@ -11891,6 +11892,26 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
11891
11892
|
onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
|
|
11892
11893
|
}
|
|
11893
11894
|
) }),
|
|
11895
|
+
spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ChartCommitInput, { id: `${idBase}-race-top`, value: String(spec.raceTopN), inputMode: "numeric", "data-option": "raceTopN", className: chartInputClass, onCommit: (text) => controller.update({ raceTopN: Number(text) }).ok }) }),
|
|
11896
|
+
spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
11897
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "race-play", "aria-label": racePlaying ? "Pause the race" : "Play the race", onClick: () => racePlaying ? controller.pauseRace() : controller.playRace(), children: racePlaying ? "Pause" : "Play" }),
|
|
11898
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
11899
|
+
"input",
|
|
11900
|
+
{
|
|
11901
|
+
id: `${idBase}-race-frame`,
|
|
11902
|
+
type: "range",
|
|
11903
|
+
min: 0,
|
|
11904
|
+
max: spec.categories.length - 1,
|
|
11905
|
+
step: 0.01,
|
|
11906
|
+
value: raceFrame ?? spec.categories.length - 1,
|
|
11907
|
+
"data-option": "raceFrame",
|
|
11908
|
+
"aria-valuetext": spec.categories[Math.round(raceFrame ?? spec.categories.length - 1)],
|
|
11909
|
+
className: "min-w-0 flex-1 accent-primary",
|
|
11910
|
+
onChange: (e) => controller.setRaceFrame(Number(e.currentTarget.value))
|
|
11911
|
+
}
|
|
11912
|
+
),
|
|
11913
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "w-12 shrink-0 truncate text-right tabular-nums text-muted-foreground", "data-race-time": "", children: spec.categories[Math.round(raceFrame ?? spec.categories.length - 1)] })
|
|
11914
|
+
] }) }),
|
|
11894
11915
|
spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Select, { id: `${idBase}-sankey-color`, name: "sankeyLinkColor", value: spec.sankeyLinkColor, options: import_chart4.CHART_SANKEY_LINK_COLORS, labels: { source: "Coloured by source", target: "Coloured by target", gray: "Grey" }, onChange: (sankeyLinkColor) => controller.update({ sankeyLinkColor }) }) }),
|
|
11895
11916
|
spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
|
|
11896
11917
|
spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Select, { id: `${idBase}-likert-neutral`, name: "likertNeutral", value: spec.likertNeutral, options: import_chart4.CHART_LIKERT_NEUTRALS, labels: { split: "Across the centre", separate: "In its own column" }, onChange: (likertNeutral) => controller.update({ likertNeutral }) }) }),
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.111.0",
|
|
4
4
|
"description": "React bindings and prompt/rich-text components for @pixerate/editor",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
},
|
|
259
259
|
"peerDependencies": {
|
|
260
260
|
"@dagrejs/dagre": "^1.1.8",
|
|
261
|
-
"@pixerate/editor": ">=0.
|
|
261
|
+
"@pixerate/editor": ">=0.166.0 <1.0.0-0",
|
|
262
262
|
"@tiptap/core": "^2.27.3",
|
|
263
263
|
"@tiptap/pm": "^2.27.3",
|
|
264
264
|
"@tiptap/react": "^2.27.3",
|
|
@@ -285,7 +285,7 @@
|
|
|
285
285
|
"tsup": "^9.0.0",
|
|
286
286
|
"typescript": "^5.7.3",
|
|
287
287
|
"vitest": "^5.0.5",
|
|
288
|
-
"@pixerate/editor": "0.
|
|
288
|
+
"@pixerate/editor": "0.166.0"
|
|
289
289
|
},
|
|
290
290
|
"scripts": {
|
|
291
291
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|