Skip to content

Commit

Permalink
minor #468 Restricting chart.js to 3.8.2 (weaverryan)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 2.x branch.

Discussion
----------

Restricting chart.js to 3.8.2

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Tickets       | Fixes tests
| License       | MIT

In 3.9, they broke typescript with chart.js/auto - see chartjs/Chart.js#10599

It will be fixed in 4.0... that's the best we can do I think :).

I DID leave the peer dependencies alone, as I believe a user using 3.9 will still work.

Commits
-------

8809368 Restricting chart.js to 3.8.2
  • Loading branch information
weaverryan committed Sep 20, 2022
2 parents 464a143 + 8809368 commit 217f7eb
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
- run: yarn check-format

js-dist-current:
# always skip check for now - building is too inefficient and large for CI
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
Expand Down
2 changes: 1 addition & 1 deletion src/Chartjs/Resources/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"devDependencies": {
"@hotwired/stimulus": "^3.0.0",
"@types/chart.js": "^2.9.34",
"chart.js": "^3.4.1",
"chart.js": "^3.4.1 <3.9",
"jest-canvas-mock": "^2.3.0",
"resize-observer-polyfill": "^1.5.1"
}
Expand Down
19 changes: 19 additions & 0 deletions src/Typed/Resources/assets/src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ export default class extends Controller {
contentType: { type: String, default: 'html' },
};

readonly stringsValue!: string[];
readonly typeSpeedValue: number;
readonly smartBackspaceValue: boolean;
readonly startDelayValue?: number;
readonly backSpeedValue?: number;
readonly shuffleValue?: boolean;
readonly backDelayValue: number;
readonly fadeOutValue?: boolean;
readonly fadeOutClassValue: string;
readonly fadeOutDelayValue: number;
readonly loopValue?: boolean;
readonly loopCountValue: number;
readonly showCursorValue: boolean;
readonly cursorCharValue: string;
readonly autoInsertCssValue: boolean;
readonly attrValue?: string;
readonly bindInputFocusEventsValue?: boolean;
readonly contentTypeValue: string;

connect() {
const options = {
strings: this.stringsValue,
Expand Down
2 changes: 1 addition & 1 deletion src/Vue/Resources/assets/dist/register_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function registerVueControllerComponents(context) {
window.resolveVueComponent = (name) => {
const component = vueControllers[`./${name}.vue`];
if (typeof component === 'undefined') {
throw new Error('Vue controller "' + name + '" does not exist');
throw new Error(`Vue controller "${name}" does not exist`);
}
return component;
};
Expand Down
15 changes: 14 additions & 1 deletion src/Vue/Resources/assets/dist/render_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@ class default_1 extends Controller {
this._dispatchEvent('vue:connect', { componentName: this.componentValue, props: this.props });
const component = window.resolveVueComponent(this.componentValue);
this.app = createApp(component, this.props);
if (this.element.__vue_app__ !== undefined) {
this.element.__vue_app__.unmount();
}
this._dispatchEvent('vue:before-mount', {
componentName: this.componentValue,
component: component,
props: this.props,
app: this.app,
});
this.app.mount(this.element);
this._dispatchEvent('vue:mount', { componentName: this.componentValue, component: component, props: this.props });
this._dispatchEvent('vue:mount', {
componentName: this.componentValue,
component: component,
props: this.props,
});
}
disconnect() {
this.app.unmount();
Expand Down

0 comments on commit 217f7eb

Please sign in to comment.