Skip to content

Commit b0fc049

Browse files
committed
Merge remote-tracking branch 'origin/master' into cam/7678/enable-typescript-type-checking
2 parents 737935c + 41bbed9 commit b0fc049

23 files changed

Lines changed: 1866 additions & 1115 deletions

.github/workflows/ci.yml

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -595,123 +595,6 @@ jobs:
595595
# ============================================================
596596
# Standalone jobs (no dependencies on install-and-cibuild)
597597
# ============================================================
598-
publish-dist:
599-
runs-on: ubuntu-latest
600-
steps:
601-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
602-
with:
603-
fetch-depth: 0
604-
fetch-tags: true
605-
606-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
607-
with:
608-
node-version: ${{ env.NODE_VERSION }}
609-
cache: 'npm'
610-
611-
- name: Set up build environment
612-
run: .github/scripts/env_build.sh
613-
614-
- name: Preview CHANGELOG for next release (only on master)
615-
if: github.ref == 'refs/heads/master'
616-
run: npm run use-draftlogs && git --no-pager diff --color-words CHANGELOG.md || true
617-
618-
- name: Set draft version in package.json
619-
run: |
620-
node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe)
621-
622-
- name: View package.json diff between previous and next releases
623-
run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true
624-
625-
- name: Build dist/
626-
run: npm run build
627-
628-
# Upload library uncompressed to allow for testing in REPLs
629-
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
630-
name: Upload uncompressed plotly.js built from PR, using Node 22
631-
with:
632-
retention-days: 30
633-
archive: false
634-
path: dist/plotly.js
635-
636-
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
637-
name: Upload Node 18 archive of plotly.js build folder
638-
with:
639-
name: dist-node18
640-
retention-days: 7
641-
path: dist/
642-
643-
- name: View dist/README.md diff between previous and next releases
644-
run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) dist/README.md || true
645-
646-
- name: Preview plot-schema diff (only on master)
647-
if: github.ref == 'refs/heads/master'
648-
run: git --no-pager diff tags/$(git describe --tags --abbrev=0) dist/plot-schema.json || true
649-
650-
- name: Test plot-schema.json diff
651-
run: diff --unified --color dist/plot-schema.json test/plot-schema.json
652-
653-
publish-dist-node-v22:
654-
runs-on: ubuntu-latest
655-
steps:
656-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
657-
with:
658-
fetch-depth: 0
659-
fetch-tags: true
660-
661-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
662-
with:
663-
node-version: '22.14.0'
664-
cache: 'npm'
665-
666-
- name: Set up build environment
667-
run: .github/scripts/env_build.sh
668-
669-
- name: Preview CHANGELOG for next release (only on master)
670-
if: github.ref == 'refs/heads/master'
671-
run: npm run use-draftlogs && git --no-pager diff --color-words CHANGELOG.md || true
672-
673-
- name: Set draft version in package.json
674-
run: |
675-
node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe)
676-
677-
- name: View package.json diff between previous and next releases
678-
run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true
679-
680-
- name: Build dist/
681-
run: npm run build
682-
683-
# This is necessary to avoid a naming collision with the upload from the Node 18 build
684-
- name: Copy library for upload
685-
run: cp dist/plotly.js dist/plotly.node22.js
686-
687-
# Upload library uncompressed to allow for testing in REPLs
688-
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
689-
name: Upload uncompressed plotly.js built from PR, using Node 22
690-
with:
691-
retention-days: 30
692-
archive: false
693-
path: dist/plotly.node22.js
694-
695-
- name: Remove copy of library
696-
run: rm dist/plotly.node22.js
697-
698-
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
699-
name: Upload Node 22 archive of plotly.js build folder
700-
with:
701-
name: dist-node22
702-
retention-days: 7
703-
path: dist/
704-
705-
- name: View dist/README.md diff between previous and next releases
706-
run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) dist/README.md || true
707-
708-
- name: Preview plot-schema diff (only on master)
709-
if: github.ref == 'refs/heads/master'
710-
run: git --no-pager diff tags/$(git describe --tags --abbrev=0) dist/plot-schema.json || true
711-
712-
- name: Test plot-schema.json diff
713-
run: diff --unified --color dist/plot-schema.json test/plot-schema.json
714-
715598
test-stackgl-bundle:
716599
needs: detect-changes
717600
if: >-

.github/workflows/publish-dist.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Publish Dist
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
types:
8+
- opened
9+
- reopened
10+
- synchronize
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: publish-dist-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
publish-dist:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
22+
with:
23+
fetch-depth: 0
24+
fetch-tags: true
25+
26+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
27+
with:
28+
node-version: '18'
29+
cache: 'npm'
30+
31+
- name: Set up build environment
32+
run: .github/scripts/env_build.sh
33+
34+
- name: Set draft version in package.json
35+
run: |
36+
node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe)
37+
# View package.json diff from last release (should show that the version has been changed to the draft version)
38+
git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true
39+
40+
- name: Build dist/
41+
run: npm run build
42+
43+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
44+
name: Upload Node 18 archive of plotly.js build folder
45+
with:
46+
name: dist-node18
47+
retention-days: 7
48+
path: dist/
49+
50+
- name: Test plot-schema.json diff
51+
run: diff --unified --color dist/plot-schema.json test/plot-schema.json
52+
53+
publish-dist-node-v22:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
57+
with:
58+
fetch-depth: 0
59+
fetch-tags: true
60+
61+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
62+
with:
63+
node-version: '22.14.0'
64+
cache: 'npm'
65+
66+
- name: Set up build environment
67+
run: .github/scripts/env_build.sh
68+
69+
- name: Set draft version in package.json
70+
run: |
71+
node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe)
72+
# View package.json diff from last release (should show that the version has been changed to the draft version)
73+
git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true
74+
75+
- name: Build dist/
76+
run: npm run build
77+
78+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
79+
name: Upload Node 22 archive of plotly.js build folder
80+
with:
81+
name: dist-node22
82+
retention-days: 7
83+
path: dist/
84+
85+
- name: Test plot-schema.json diff
86+
run: diff --unified --color dist/plot-schema.json test/plot-schema.json
Lines changed: 107 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,118 @@
1-
name: Upload dev build from PR (placeholder, not yet implemented)
1+
name: Upload dev build from PR
22

33
on:
44
workflow_run:
5-
workflows: ["CI"] # ci.yml
5+
workflows: ["Publish Dist"] # publish-dist.yml
66
types:
77
- completed
88
workflow_dispatch:
9-
9+
inputs:
10+
pr_number:
11+
description: 'PR Number to deploy'
12+
required: true
13+
run_id:
14+
description: 'The Run ID of the CI workflow that has the artifact'
15+
required: true
1016

1117
jobs:
12-
hello:
18+
upload:
1319
runs-on: ubuntu-latest
20+
if: |
21+
github.event_name == 'workflow_dispatch' ||
22+
(
23+
github.event_name == 'workflow_run' &&
24+
github.event.workflow_run.event == 'pull_request' &&
25+
github.event.workflow_run.conclusion == 'success'
26+
)
1427
steps:
15-
- name: Hello World
28+
- name: Download build artifact
29+
id: download-artifact
30+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
31+
with:
32+
name: dist-node22 # uploaded by publish-dist.yml > publish-dist-node-v22
33+
run-id: ${{ github.event.workflow_run.id || inputs.run_id }}
34+
github-token: ${{ secrets.GITHUB_TOKEN }}
35+
path: temp-dist
36+
37+
- name: Setup metadata and prepare folders
38+
id: setup-metadata
39+
env:
40+
GH_TOKEN: ${{ github.token }}
41+
PR_NUM: ${{ github.event.workflow_run.pull_requests[0].number || inputs.pr_number }}
42+
run: |
43+
# Get SHA from triggering workflow, or from manual input
44+
if [ "${{ github.event_name }}" == "workflow_run" ]; then
45+
SHA="${{ github.event.workflow_run.head_sha }}"
46+
else
47+
echo "Fetching latest SHA for PR #$PR_NUM..."
48+
SHA=$(gh pr view "$PR_NUM" --repo ${{ github.repository }} --json headRefOid --template '{{.headRefOid}}')
49+
fi
50+
SHORT_SHA=${SHA::7}
51+
UPLOAD_DIR_NAME="upload"
52+
53+
echo "Using SHA: ${SHA}"
54+
echo "Short SHA: ${SHORT_SHA}"
55+
mkdir -p "${UPLOAD_DIR_NAME}/pr-${PR_NUM}/latest"
56+
mkdir -p "${UPLOAD_DIR_NAME}/pr-${PR_NUM}/${SHORT_SHA}"
57+
# Copy all 3 artifacts (plotly.js, plotly.min.js, plot-schema.json) to /latest/
58+
cp temp-dist/plotly.js "${UPLOAD_DIR_NAME}/pr-${PR_NUM}/latest/plotly.js"
59+
cp temp-dist/plotly.min.js "${UPLOAD_DIR_NAME}/pr-${PR_NUM}/latest/plotly.min.js"
60+
cp temp-dist/plot-schema.json "${UPLOAD_DIR_NAME}/pr-${PR_NUM}/latest/plot-schema.json"
61+
# Copy only plotly.min.js to /$SHORT_SHA/
62+
cp temp-dist/plotly.min.js "${UPLOAD_DIR_NAME}/pr-${PR_NUM}/${SHORT_SHA}/plotly.min.js"
63+
64+
UPLOAD_DIR_FULL_PATH=$(pwd)/${UPLOAD_DIR_NAME}/
65+
echo "Created directory ${UPLOAD_DIR_FULL_PATH} with the following contents:"
66+
echo "$(ls -lR ${UPLOAD_DIR_FULL_PATH})"
67+
68+
echo "PR_NUM=${PR_NUM}" >> $GITHUB_OUTPUT
69+
echo "SHA=${SHA}" >> $GITHUB_OUTPUT
70+
echo "SHORT_SHA=${SHORT_SHA}" >> $GITHUB_OUTPUT
71+
72+
- name: Generate GitHub App token
73+
id: generate-token
74+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 #v3.1.1
75+
with:
76+
client-id: ${{ vars.DEV_DEPLOY_APP_ID }}
77+
private-key: ${{ secrets.DEV_DEPLOY_APP_PRIVATE_KEY }}
78+
owner: plotly
79+
repositories: plotly.js-dev-builds
80+
81+
- name: Check out plotly.js-dev-builds repo
82+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
83+
with:
84+
repository: plotly/plotly.js-dev-builds
85+
token: ${{ steps.generate-token.outputs.token }} # token from previous step
86+
path: plotly.js-dev-builds
87+
88+
- name: Commit and push files
89+
id: commit-and-push
90+
run: |
91+
# 1. Move 'upload' directory into repo folder and cd into repo root
92+
mkdir -p plotly.js-dev-builds/upload/
93+
cp -r upload/ plotly.js-dev-builds/
94+
cd plotly.js-dev-builds
95+
96+
# 2. Configure git
97+
git config user.name "plotly.js-pr-upload"
98+
git config user.email "<>"
99+
100+
# 3. add, commit, and push
101+
git add upload/
102+
103+
# Only commit if there are changes
104+
if git diff --staged --quiet; then
105+
echo "No changes to commit"
106+
else
107+
git commit -m "Deploy build for PR #${{ steps.setup-metadata.outputs.PR_NUM }} (commit ${{ steps.setup-metadata.outputs.SHORT_SHA }})"
108+
git push origin main
109+
fi
110+
111+
- name: Generate summary
16112
run: |
17-
echo "Hello World"
113+
BASE="https://plotly.github.io/plotly.js-dev-builds/upload/pr-${{ steps.setup-metadata.outputs.PR_NUM }}"
114+
echo "### PR Build Uploaded" >> $GITHUB_STEP_SUMMARY
115+
echo "Builds for PR #${{ steps.setup-metadata.outputs.PR_NUM }} can be accessed at:" >> $GITHUB_STEP_SUMMARY
116+
echo "- Latest build for this PR: [$BASE/latest/plotly.min.js]($BASE/latest/plotly.min.js)" >> $GITHUB_STEP_SUMMARY
117+
echo "- Build for this commit: [$BASE/${{ steps.setup-metadata.outputs.SHA }}/plotly.min.js]($BASE/${{ steps.setup-metadata.outputs.SHA }}/plotly.min.js)" >> $GITHUB_STEP_SUMMARY
118+
echo "The above links should start working a minute or two after this job completes." >> $GITHUB_STEP_SUMMARY

draftlogs/7734_add.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Add `hoversort` layout attribute to sort unified hover label items by value [[#7734](https://github.com/plotly/plotly.js/pull/7734)], with thanks to @kimsehwan96 for the contribution!
2+

draftlogs/7735_fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix unexpected `ticklabelindex` behavior when minor ticks are not shown. [[#7735](https://github.com/plotly/plotly.js/pull/7735)], with thanks to @my-tien for the contribution!

draftlogs/7790_fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Handle 'pixel' size mode for shape labels [[#7790](https://github.com/plotly/plotly.js/pull/7790)]

src/components/fx/hover.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,15 @@ function createHoverText(hoverData, opts) {
13411341
mockLegend.entries.push([pt]);
13421342
}
13431343
mockLegend.entries.sort(function (a, b) {
1344+
var hoversort = fullLayout.hoversort;
1345+
if (hoversort === 'value descending' || hoversort === 'value ascending') {
1346+
var valueLetter = hovermode.charAt(0) === 'x' ? 'y' : 'x';
1347+
var aVal = a[0][valueLetter + 'LabelVal'];
1348+
var bVal = b[0][valueLetter + 'LabelVal'];
1349+
if (aVal !== bVal) {
1350+
return hoversort === 'value descending' ? bVal - aVal : aVal - bVal;
1351+
}
1352+
}
13441353
return a[0].trace.index - b[0].trace.index;
13451354
});
13461355
mockLegend.layer = container;

src/components/fx/layout_attributes.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ module.exports = {
7878
'If false, hover interactions are disabled.'
7979
].join(' ')
8080
},
81+
hoversort: {
82+
valType: 'enumerated',
83+
values: ['trace', 'value descending', 'value ascending'],
84+
dflt: 'trace',
85+
editType: 'none',
86+
description: [
87+
'Determines the order of items shown in unified hover labels.',
88+
'If *trace*, items are sorted by trace index.',
89+
'If *value descending*, items are sorted by value from largest to smallest.',
90+
'If *value ascending*, items are sorted by value from smallest to largest.',
91+
'Only applies when `hovermode` is *x unified* or *y unified*.'
92+
].join(' ')
93+
},
8194
hoversubplots: {
8295
valType: 'enumerated',
8396
values: ['single', 'overlaying', 'axis'],

src/components/fx/layout_defaults.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {
1414
if(hoverMode) {
1515
coerce('hoverdistance');
1616
coerce('spikedistance');
17+
if(hoverMode.indexOf('unified') !== -1) {
18+
coerce('hoversort');
19+
}
1720
}
1821

1922
var dragMode = coerce('dragmode');

0 commit comments

Comments
 (0)