Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Towards migration to Svelte 4 #18

Open
wants to merge 3 commits into
base: svelte4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
{
"name": "ag-grid-svelte",
"version": "0.3.0",
"version": "0.4.0",
"description": "An unofficial Svelte wrapper for AG Grid",
"type": "module",
"devDependencies": {
"@playwright/test": "^1.34.0",
"@sveltejs/adapter-static": "^2.0.2",
"@sveltejs/kit": "^1.22.1",
"@sveltejs/package": "^2.1.0",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"@playwright/test": "^1.40.1",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.27.1",
"@sveltejs/package": "^2.2.3",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"ag-grid-community": "^30.0.0",
"ag-grid-enterprise": "^30.0.0",
"commit-and-tag-version": "^11.2.1",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-svelte": "^2.32.2",
"highlight.js": "^11.8.0",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
"highlight.js": "^11.9.0",
"prettier": "^3.1.0",
"prettier-plugin-svelte": "^3.1.2",
"sass": "^1.62.1",
"svelte": "^3.55.0",
"svelte-check": "^3.4.5",
"svelte-preprocess": "^5.0.4",
"svelte2tsx": "^0.6.19",
"tslib": "^2.5.2",
"typescript": "^5.0.4",
"vite": "^4.3.8"
"svelte": "^4.2.8",
"svelte-check": "^3.6.2",
"svelte-preprocess": "^5.1.1",
"svelte2tsx": "^0.6.27",
"tslib": "^2.6.2",
"typescript": "^5.3.2",
"vite": "^4.4.12"
},
"peerDependencies": {
"ag-grid-community": "^28 || ^29 || ^30",
"svelte": "^3"
"svelte": "^4"
},
"scripts": {
"dev": "vite dev",
Expand All @@ -40,8 +40,8 @@
"test": "playwright test",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check --plugin-search-dir=. . && eslint .",
"format": "prettier --write --plugin-search-dir=. .",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"release": "commit-and-tag-version"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
8 changes: 4 additions & 4 deletions src/lib/SvelteFrameworkComponentWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
type IComponent,
type WrappableInterface
} from 'ag-grid-community';
import type { ComponentType as SvelteComponentType, SvelteComponentTyped } from 'svelte';
import { SvelteComponent } from 'svelte/internal';
import type { ComponentType as SvelteComponentType } from 'svelte';
import { SvelteComponent } from 'svelte';

// Called when a Svelte component is provided to override a default grid component
export class SvelteFrameworkComponentWrapper
Expand All @@ -20,7 +20,7 @@ export class SvelteFrameworkComponentWrapper

class NewSvelteComponent<P> implements IComponent<P>, WrappableInterface {
private eParentElement!: HTMLElement;
private componentInstance!: SvelteComponentTyped<{ params: P }>;
private componentInstance!: SvelteComponent<{ params: P }>;
private methods: { [name: string]: (...args: P[]) => void } = {
// Provide a default refresh method
refresh: (params: P) => {
Expand All @@ -29,7 +29,7 @@ class NewSvelteComponent<P> implements IComponent<P>, WrappableInterface {
}
};

constructor(private SvelteComponent: SvelteComponentType<SvelteComponentTyped<{ params: P }>>) {}
constructor(private SvelteComponent: SvelteComponentType<SvelteComponent<{ params: P }>>) {}

init(params: P): void {
// Guaranteed to be called
Expand Down
13 changes: 8 additions & 5 deletions src/routes/guide/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ const files = import.meta.glob<ComponentImport>('./*/*/index.svelte');
export const filedata = Object.entries(files).map(parseFile);

// Generate sidebar nav
const sections = filedata.reduce((acc, data) => {
acc[data.section] ??= [];
acc[data.section].push(data);
return acc;
}, {} as Record<string, FileData[]>);
const sections = filedata.reduce(
(acc, data) => {
acc[data.section] ??= [];
acc[data.section].push(data);
return acc;
},
{} as Record<string, FileData[]>
);

// Sort by prefix
const sectionTitles = Object.keys(sections).sort();
Expand Down
Loading