Skip to content

Commit bf3bb85

Browse files
INT-3311: Support Svelte 5 (#92)
* INT-3311: Upgrade to support Svelte 5 * Update storybook * Replace run() with $effect as it does not concern about SSR * Resolve rollup warnings * Add changelog entries and readme * Update readme * Reduce the number of reactive variables * Update dependencies * Resolve type checks * Change how events are handled * Add a story for event bindings * Fix linting errors * Move eslint parser to dev dependencies * Improve type checking
1 parent 4a89a8e commit bf3bb85

13 files changed

Lines changed: 1011 additions & 1841 deletions

File tree

.storybook/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ const config: StorybookConfig = {
44
core: {
55
disableTelemetry: true,
66
},
7+
78
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx|svelte)'],
9+
810
framework: {
911
name: '@storybook/svelte-vite',
1012
options: {},
1113
},
12-
addons: ['@storybook/addon-essentials', '@storybook/addon-svelte-csf'],
13-
docs: {
14-
autodocs: 'tag',
15-
},
14+
15+
addons: ['@storybook/addon-svelte-csf', '@storybook/addon-docs']
1616
};
1717

1818
export default config;

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
### Added
11+
12+
- `svelte` to peer dependency. #INT-3311
13+
14+
#### Changed
15+
- Upgraded to support Svelte 5. #INT-3311
16+
1017
## 3.2.0 - 2025-07-31
1118

1219
### Changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ This package is a thin wrapper around [TinyMCE](https://github.com/tinymce/tinym
1010
* For the TinyMCE Svelte Technical Reference, see: [TinyMCE Documentation - TinyMCE Svelte Technical Reference](https://www.tiny.cloud/docs/tinymce/8/svelte-ref/).
1111
* For our quick demos, check out the TinyMCE Svelte [Storybook](https://tinymce.github.io/tinymce-svelte/).
1212

13+
### Supported Versions
14+
15+
|`tinymce-svelte` |Svelte |
16+
|--- |--- |
17+
|4.x |>= 5.x |
18+
|<= 3.x |<= 5.x (*) |
19+
20+
- (*): Svelte 5 projects can use `tinymce-svelte` 3.x because Svelte 5 still supports the old Svelte 4 syntax.
21+
1322

1423
### Issues
1524

eslint.config.mjs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
2+
import storybook from "eslint-plugin-storybook";
3+
14
// eslint.config.js
25
import tinymceEslintPlugin from "@tinymce/eslint-plugin";
36
import tseslint from '@typescript-eslint/eslint-plugin';
@@ -6,47 +9,44 @@ import svelte from 'eslint-plugin-svelte';
69
import globals from 'globals';
710
import svelteParser from 'svelte-eslint-parser';
811

9-
export default [
10-
{
11-
files: ['**/*.svelte'],
12-
languageOptions: {
13-
ecmaVersion: 2020,
14-
sourceType: 'module',
15-
parser: svelteParser,
16-
globals: {
17-
...globals.browser,
18-
...globals.node,
19-
},
20-
parserOptions: {
21-
parser: tsparser,
22-
extraFileExtensions: ['.svelte'],
23-
},
24-
},
25-
plugins: {
26-
svelte,
27-
'@typescript-eslint': tseslint
28-
},
29-
rules: {
30-
...svelte.configs.recommended.rules,
31-
eqeqeq: 'error',
12+
export default [{
13+
files: ['**/*.svelte'],
14+
languageOptions: {
15+
ecmaVersion: 2022,
16+
sourceType: 'module',
17+
parser: svelteParser,
18+
globals: {
19+
...globals.browser,
20+
...globals.node
3221
},
33-
},
34-
{
35-
files: ['**/*.ts'],
36-
languageOptions: {
22+
parserOptions: {
3723
parser: tsparser,
38-
parserOptions: {
39-
project: './tsconfig.json',
40-
},
41-
},
42-
plugins: {
43-
'@typescript-eslint': tseslint,
44-
"@tinymce": tinymceEslintPlugin
45-
},
46-
rules: {
47-
'@tinymce/prefer-fun': 'off',
48-
'@typescript-eslint/no-duplicate-imports': 'off',
49-
'@typescript-eslint/no-parameter-properties': 'off',
24+
extraFileExtensions: ['.svelte']
25+
}
26+
},
27+
plugins: {
28+
svelte,
29+
'@typescript-eslint': tseslint
30+
},
31+
rules: {
32+
...svelte.configs.recommended.rules,
33+
eqeqeq: 'error'
34+
}
35+
}, {
36+
files: ['**/*.ts'],
37+
languageOptions: {
38+
parser: tsparser,
39+
parserOptions: {
40+
project: './tsconfig.json'
5041
},
5142
},
52-
];
43+
plugins: {
44+
'@typescript-eslint': tseslint,
45+
"@tinymce": tinymceEslintPlugin
46+
},
47+
rules: {
48+
'@tinymce/prefer-fun': 'off',
49+
'@typescript-eslint/no-duplicate-imports': 'off',
50+
'@typescript-eslint/no-parameter-properties': 'off'
51+
}
52+
}, ...storybook.configs["flat/recommended"]];

package.json

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tinymce/tinymce-svelte",
3-
"version": "3.2.1-rc",
3+
"version": "4.0.0-rc",
44
"description": "TinyMCE Svelte Component",
55
"private": false,
66
"publishConfig": {
@@ -46,6 +46,7 @@
4646
"LICENSE.txt"
4747
],
4848
"peerDependencies": {
49+
"svelte": "^5.0.0",
4950
"tinymce": "^8.0.0 || ^7.0.0 || ^6.0.0 || ^5.0.0"
5051
},
5152
"peerDependenciesMeta": {
@@ -54,42 +55,39 @@
5455
}
5556
},
5657
"devDependencies": {
57-
"@babel/core": "^7.28.4",
5858
"@rollup/plugin-commonjs": "^17.1.0",
5959
"@rollup/plugin-node-resolve": "^11.2.1",
6060
"@rollup/plugin-typescript": "^8.5.0",
61-
"@storybook/addon-essentials": "^8.6.14",
62-
"@storybook/addon-svelte-csf": "^4.2.0",
63-
"@storybook/svelte": "^8.6.14",
64-
"@storybook/svelte-vite": "^8.6.14",
65-
"@sveltejs/vite-plugin-svelte": "^3.1.2",
61+
"@storybook/addon-docs": "^10.2.17",
62+
"@storybook/addon-svelte-csf": "^5.0.11",
63+
"@storybook/svelte": "^10.2.17",
64+
"@storybook/svelte-vite": "^10.2.17",
65+
"@sveltejs/vite-plugin-svelte": "^4.0.0",
6666
"@tinymce/beehive-flow": "^0.19.0",
6767
"@tinymce/eslint-plugin": "3.0.0",
68-
"@tsconfig/svelte": "^5.0.5",
69-
"@typescript-eslint/eslint-plugin": "^8.46.2",
68+
"@tsconfig/svelte": "^5.0.8",
69+
"@typescript-eslint/eslint-plugin": "^8.57.0",
7070
"@typescript-eslint/parser": "^8.46.2",
71-
"babel-loader": "^8.4.1",
7271
"eslint": "^9.38.0",
73-
"eslint-plugin-svelte": "^3.12.5",
72+
"eslint-plugin-storybook": "10.2.17",
73+
"eslint-plugin-svelte": "^3.15.2",
7474
"gh-pages": "^6.3.0",
75-
"react": "^18",
76-
"react-dom": "^18",
7775
"rollup": "^2.79.2",
7876
"rollup-plugin-css-only": "^3.1.0",
7977
"rollup-plugin-execute": "^1.1.1",
8078
"rollup-plugin-livereload": "^2.0.5",
8179
"rollup-plugin-svelte": "^7.2.3",
8280
"rollup-plugin-terser": "^7.0.2",
83-
"storybook": "^8.6.14",
84-
"svelte": "^4.2.20",
85-
"svelte-check": "^3.8.6",
81+
"storybook": "^10.2.17",
82+
"svelte": "^5.0.0",
83+
"svelte-check": "^4.0.0",
84+
"svelte-eslint-parser": "^1.6.0",
8685
"svelte-loader": "^3.2.4",
87-
"svelte-preprocess": "^5.1.4",
86+
"svelte-preprocess": "^6.0.0",
8887
"tinymce": "^8.1.2",
8988
"tslib": "^2.8.1",
9089
"typescript": "^5.9.3",
91-
"vite": "^5.4.21",
92-
"webpack": "^5.102.1"
90+
"vite": "^5.4.21"
9391
},
9492
"resolutions": {
9593
"browserslist": "^4.16.5",

rollup.config.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import commonjs from '@rollup/plugin-commonjs';
33
import resolve from '@rollup/plugin-node-resolve';
44
import livereload from 'rollup-plugin-livereload';
55
import { terser } from 'rollup-plugin-terser';
6-
import sveltePreprocess from 'svelte-preprocess';
6+
import { sveltePreprocess } from 'svelte-preprocess';
77
import typescript from '@rollup/plugin-typescript';
88
import execute from "rollup-plugin-execute";
99
import pkg from './package.json';
@@ -37,20 +37,25 @@ export default {
3737
// input: 'src/main.ts',
3838
input: 'src/main/index.ts',
3939
output: [
40-
{ file: pkg.module, format: 'es', sourcemap: true },
40+
{ file: pkg.module, format: 'es', sourcemap: !production },
4141
{
4242
file: pkg.main,
4343
format: 'umd',
4444
name,
45-
sourcemap: true,
45+
sourcemap: !production,
4646
plugins: [
4747
execute([
4848
'tsc --outDir ./dist --declaration',
4949
'node scripts/preprocess.js'
5050
])
5151
]
5252
},
53-
{ file: pkg.main.replace('.js','.min.js'), format: 'iife', name, plugins: [terser()] }
53+
{
54+
file: pkg.main.replace('.js','.min.js'),
55+
format: 'iife',
56+
name,
57+
plugins: [terser()]
58+
}
5459
],
5560
// output: {
5661
// sourcemap: true,
@@ -89,8 +94,10 @@ export default {
8994

9095
// If we're building for production (npm run build
9196
// instead of npm run dev), minify
92-
// production && terser()
97+
// production && terser(),
9398
],
99+
// Mark node:async_hoooks as external because it is a server-side feature in the Node.js runtime
100+
external: ['node:async_hooks'],
94101
watch: {
95102
clearScreen: false
96103
}

scripts/preprocess.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const fs = require("fs-extra");
33
const glob = require("glob");
44
const path = require("path");
55
const svelte = require("svelte/compiler");
6-
const sveltePreprocess = require("svelte-preprocess");
6+
const { sveltePreprocess } = require("svelte-preprocess");
77

88
const basePath = path.resolve(__dirname, "../");
99
const srcPath = path.resolve(basePath, "src/main");

0 commit comments

Comments
 (0)