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

Deps update #149

Draft
wants to merge 55 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a63268b
chore: rename `typedoc.ts` to `typedoc-generator.ts`
adrianschmidt Sep 28, 2024
8d89205
fix(package.json): update values of `main` and `module` properties
adrianschmidt Sep 28, 2024
48978e5
chore(package): update typedoc from v0.17.8 to v0.18.0
adrianschmidt Sep 28, 2024
bb8a4c7
chore(package): downgrade typescript from v4.7.4 to v4.0.8 for compat…
adrianschmidt Sep 28, 2024
8f55b6d
chore(package): update typedoc from v0.18.0 to v0.19.2
adrianschmidt Sep 28, 2024
482b6bf
test(typedoc-generator): add smaller test cases
adrianschmidt Oct 4, 2024
08b22b6
chore(package): update typedoc from v0.19.2 to v0.20.0
adrianschmidt Sep 28, 2024
b398113
refactor(typedoc-generator): update typedoc-generator.ts for compatib…
adrianschmidt Sep 28, 2024
cfe9b9f
chore(package): update typescript from v4.0.8 to v4.1.6
adrianschmidt Oct 4, 2024
bfe7d5c
chore(package): update typedoc from v0.20.0 to v0.20.16
adrianschmidt Oct 4, 2024
997d041
tmp: add logging
adrianschmidt Oct 4, 2024
69c8a1b
style(typedoc-generator): move getDocs and getDocsTags functions for …
adrianschmidt Oct 5, 2024
9dd80b9
chore(package): update typedoc from v0.20.16 to v0.20.17
adrianschmidt Oct 4, 2024
dc1cda2
chore(package): update typedoc to v0.23.20 and typescript to v4.8.4
adrianschmidt Oct 6, 2024
85b913c
chore(package): update @stencil/core to v2.22.3 and @stencil/sass to …
adrianschmidt Oct 6, 2024
623680a
refactor(scss): replace "slash as division" with `math.div()`
adrianschmidt Oct 6, 2024
04a74f4
test(fixtures): correct capitalization of `@inheritDoc`
adrianschmidt Oct 6, 2024
b9e73df
fix broken build
adrianschmidt Oct 6, 2024
2c803ad
improve logging
adrianschmidt Oct 6, 2024
501ab27
enum test working
adrianschmidt Oct 6, 2024
0b3d504
partway on simple class test
adrianschmidt Oct 6, 2024
14232de
test(typedoc-generator): change value of `@foobar` blockTag to avoid …
adrianschmidt Oct 7, 2024
b4187d6
test(typedoc-generator): consecutive line breaks are now conserved
adrianschmidt Oct 7, 2024
4d9bc4f
test(typedoc-generator): typedoc no longer supports decorators
adrianschmidt Oct 7, 2024
d4161f5
refactor(typedoc-generator): update typedoc-generator.ts for compatib…
adrianschmidt Oct 8, 2024
f8a1bbd
just some logging changes
adrianschmidt Oct 8, 2024
4bd5eb6
chore(package): update typedoc from v0.23.20 to v0.23.28
adrianschmidt Oct 8, 2024
ede5b29
chore(package): update typedoc from v0.23.28 to v0.24.8
adrianschmidt Oct 8, 2024
5ccb51f
chore(package): update typedoc from v0.24.8 to v0.25.13
adrianschmidt Oct 9, 2024
c489c7b
fixup! chore(package): update typedoc from v0.23.28 to v0.24.8
adrianschmidt Oct 9, 2024
e771610
make stuff async as required by typedoc v0.25.13
adrianschmidt Oct 9, 2024
11fc73e
chore(package): update typescript from v4.8.4 to v5.4.5
adrianschmidt Oct 9, 2024
1b2523b
just logging changes
adrianschmidt Oct 9, 2024
d82baff
some refactoring to fit typedoc v0.25.13
adrianschmidt Oct 9, 2024
5997a4a
chore(package): update typedoc from v0.25.13 to v0.26.8
adrianschmidt Oct 9, 2024
b331a5e
chore(package): update typescript from v5.4.5 to v5.6.3
adrianschmidt Oct 9, 2024
f3b6c61
chore(package): update @stencil/core from v2.22.3 to v4.22.1
adrianschmidt Oct 9, 2024
2ed6baa
chore(package): update @stencil/sass from v1.5.2 to v3.0.12
adrianschmidt Oct 9, 2024
c887e8d
fixup! chore(package): update @stencil/core from v2.22.3 to v4.22.1
adrianschmidt Oct 9, 2024
d76fc04
chore(package): update dependencies on jest, jest-cli, and puppeteer
adrianschmidt Oct 9, 2024
e1a19c4
chore(package): get tests to run with updated dependencies
adrianschmidt Oct 9, 2024
1673e09
chore(typedoc-generator): allow `@sourceFile` block tags
adrianschmidt Oct 12, 2024
0be3538
fix getReturns
adrianschmidt Oct 12, 2024
7a4e7bd
almost there
adrianschmidt Oct 12, 2024
f64dcf4
version that correctly gets param and return tags for methods using i…
adrianschmidt Oct 12, 2024
07d44c9
fixup! refactor(scss): replace "slash as division" with `math.div()`
adrianschmidt Oct 13, 2024
e7eb57b
a bunch of refactoring
adrianschmidt Oct 13, 2024
fba585f
increase logging
adrianschmidt Oct 13, 2024
ecac99a
all test are PASSING!!!
adrianschmidt Oct 13, 2024
66c3d7d
chore(package): update @stencil/core from v4.22.1 to v4.22.2
adrianschmidt Nov 11, 2024
5bb45f1
chore(package): update typedoc from v0.26.8 to v0.26.11
adrianschmidt Nov 11, 2024
ad2e8fa
WIP
jgroth Nov 11, 2024
7a03d39
routing works
adrianschmidt Dec 22, 2024
3666493
docs(code): add descriptions to the code component and its example
adrianschmidt Dec 23, 2024
40aef1d
add some console logging for debugging purposes
adrianschmidt Dec 23, 2024
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
13 changes: 12 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,18 @@ export default [

semi: ['error', 'always'],
'prettier/prettier': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],

'@typescript-eslint/array-type': [
'error',
Expand Down
26,763 changes: 8,348 additions & 18,415 deletions package-lock.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
"name": "Kiarokh Moattar"
}
],
"main": "dist/index.ts",
"module": "dist/index.mjs",
"type": "module",
"main": "./dist/index.cjs.js",
"module": "./dist/index.js",
"es2015": "dist/esm/index.mjs",
"es2017": "dist/esm/index.mjs",
"types": "dist/types/index.d.ts",
Expand All @@ -41,8 +42,8 @@
"postbuild": "copyfiles -f src/kompendium/*.ts dist",
"start": "stencil build --dev --watch --serve --docs",
"dev": "stencil build --dev --docs",
"test": "stencil test --spec",
"test:watch": "stencil test --spec --watchAll",
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" stencil test --spec",
"test:watch": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" stencil test --spec --watchAll",
"generate": "stencil generate",
"semantic-release": "semantic-release",
"update-changelog": "node scripts/update-changelog",
Expand All @@ -59,12 +60,10 @@
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@stencil/core": "^2.6.0",
"@stencil/router": "^1.0.1",
"@stencil/sass": "^1.4.1",
"@types/jest": "25.2.3",
"@stencil/core": "^4.22.2",
"@stencil/sass": "^3.0.12",
"@types/jest": "^29.5.13",
"@types/prismjs": "^1.16.5",
"@types/puppeteer": "1.19.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"copyfiles": "^2.3.0",
Expand All @@ -76,13 +75,14 @@
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-sonarjs": "^0.25.1",
"globals": "^15.9.0",
"jest": "^27.0.3",
"jest-cli": "24.9.0",
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"prettier": "^3.3.3",
"prismjs": "^1.20.0",
"puppeteer": "1.19.0",
"puppeteer": "^23.5.1",
"rollup-plugin-node-polyfills": "^0.2.1",
"tmp": "^0.1.0",
"urlpattern-polyfill": "^10.0.0",
"yargs": "^15.4.0"
},
"dependencies": {
Expand All @@ -99,8 +99,8 @@
"remark-parse": "^8.0.2",
"remark-parse-yaml": "0.0.3",
"remark-rehype": "^7.0.0",
"typedoc": "^0.17.8",
"typescript": "^4.7.4",
"typedoc": "^0.26.11",
"typescript": "^5.6.3",
"unified": "^9.0.0",
"unist-util-flatmap": "^1.0.0",
"unist-util-map": "^2.0.1",
Expand Down
86 changes: 41 additions & 45 deletions src/components/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,46 @@ export class App {
);
}

const routes = [
{
path: '/',
name: 'kompendium-markdown',
props: { text: this.data.readme },
},
{
path: '/component/:name/:section?',
name: 'kompendium-component',
props: {
docs: this.data.docs,
schemas: this.data.schemas,
examplePropsFactory: this.examplePropsFactory,
},
},
{
path: '/type/:name',
name: 'kompendium-type',
props: {
types: this.data.types,
},
},
{
path: '/debug/:name',
name: 'kompendium-debug',
props: {
docs: this.data.docs,
schemas: this.data.schemas,
examplePropsFactory: this.examplePropsFactory,
},
},
{
path: '',
name: 'kompendium-guide',
props: {
data: this.data,
},
},
];

return (
<div class="kompendium-body">
<kompendium-navigation
Expand All @@ -104,51 +144,7 @@ export class App {
index={this.index}
/>
<main role="main">
<stencil-router historyType="hash">
<stencil-route-switch scrollTopOffset={0}>
<stencil-route
url="/"
component="kompendium-markdown"
componentProps={{
text: this.data.readme,
}}
exact={true}
/>
<stencil-route
url="/component/:name/:section?"
component="kompendium-component"
componentProps={{
docs: this.data.docs,
schemas: this.data.schemas,
examplePropsFactory:
this.examplePropsFactory,
}}
/>
<stencil-route
url="/type/:name"
component="kompendium-type"
componentProps={{
types: this.data.types,
}}
/>
<stencil-route
url="/debug/:name"
component="kompendium-debug"
componentProps={{
docs: this.data.docs,
schemas: this.data.schemas,
examplePropsFactory:
this.examplePropsFactory,
}}
/>
<stencil-route
component="kompendium-guide"
componentProps={{
data: this.data,
}}
/>
</stencil-route-switch>
</stencil-router>
<kompendium-router routes={routes} />
</main>
</div>
);
Expand Down
106 changes: 106 additions & 0 deletions src/components/app/router.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import { Component, FunctionalComponent, h, Prop, State } from '@stencil/core';
import { URLPattern } from 'urlpattern-polyfill';

type MatchedComponent = {
name: string;
props?: Record<string, string | number>;
};

type RoutedComponent = {
path: string;
name: string;
props?: Record<string, string | number>;
};

const ComponentTemplate: FunctionalComponent<MatchedComponent> = (
props,
children,
) => {
const Name = props.name;

return <Name {...props.props}>{children}</Name>;
};

@Component({
tag: 'kompendium-router',
shadow: true,
})
export class Router {
@Prop()
public routes: RoutedComponent[];

@State()
private matchedComponent: MatchedComponent | undefined;

private hashChangeHandler = () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got the routing to work, but I'm currently stuck at the code in markdown.ts not working correctly. It just returns undefined. I've added some logging, to help with debugging the problem, but not gotten any further.

this.setMatchedComponent(window.location);
};

public componentWillLoad() {
// Set it once now
this.setMatchedComponent(window.location);
}

public componentDidLoad() {
// Listen for subsequent changes
window.addEventListener('hashchange', this.hashChangeHandler);
}

public disconnectedCallback() {
// Clean up
window.removeEventListener('hashchange', this.hashChangeHandler);
}

public render() {
if (!this.matchedComponent) {
return '404';
}

return <ComponentTemplate {...this.matchedComponent} />;
}

private setMatchedComponent(location: Location) {
const component = this.findComponent(location);

if (component !== this.matchedComponent) {
this.matchedComponent = component;
}
}

private findComponent(location: Location): MatchedComponent | undefined {
const matchedRoute = this.routes.find(this.isMatched(location));
if (!matchedRoute) {
return;
}

const path = matchedRoute.path;
const pattern = new URLPattern({ hash: path });
const match = pattern.exec(location.href);
const props = this.parseProps(match?.hash.groups);

return {
name: matchedRoute.name,
props: {
...props,
...matchedRoute.props,
},
};
}

private isMatched = (location: Location) => (route: RoutedComponent) => {
const pattern = new URLPattern({ hash: route.path });

return pattern.test(location.href);
};

private parseProps(
groups: Record<string, string | undefined> = {},
): Record<string, string | number | undefined> {
return Object.fromEntries(
Object.entries(groups).map(([key, value]) => [
key,
isNaN(Number(value)) ? value : Number(value),
]),
);
}
}
2 changes: 2 additions & 0 deletions src/components/code/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard.js';

/**
* This component is used to render source-code in a nicely formatted way.

Check warning on line 12 in src/components/code/code.tsx

View workflow job for this annotation

GitHub Actions / Lint

Expected only 0 line after block description
*
* @exampleComponent kompendium-example-code
*/
@Component({
Expand Down
3 changes: 3 additions & 0 deletions src/components/code/examples/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import foo from 'foo';
foo();
`;

/**
* Very simple example of a code snippet
*/
@Component({
tag: 'kompendium-example-code',
shadow: true,
Expand Down
15 changes: 9 additions & 6 deletions src/components/component/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
JsonDocsComponent,
JsonDocsTag,
} from '@stencil/core/internal';
import { MatchResults } from '@stencil/router';
import { PropertyList } from './templates/props';
import { EventList } from './templates/events';
import { MethodList } from './templates/methods';
Expand Down Expand Up @@ -32,11 +31,8 @@
@Prop()
public schemas: Array<Record<string, any>>;

/**
* Matched route parameters
*/
@Prop()
public match: MatchResults;
public name: string;

/**
* Factory for creating props for example components
Expand All @@ -62,6 +58,9 @@
}

protected componentDidLoad(): void {
console.log('KompendiumComponent -> componentDidLoad -> this.docs', this.docs);

Check failure on line 61 in src/components/component/component.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement

Check failure on line 61 in src/components/component/component.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `'KompendiumComponent·->·componentDidLoad·->·this.docs',·this.docs` with `⏎············'KompendiumComponent·->·componentDidLoad·->·this.docs',⏎············this.docs,⏎········`
console.log('KompendiumComponent -> componentDidLoad -> this.schemas', this.schemas);

Check failure on line 62 in src/components/component/component.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement

Check failure on line 62 in src/components/component/component.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `'KompendiumComponent·->·componentDidLoad·->·this.schemas',·this.schemas` with `⏎············'KompendiumComponent·->·componentDidLoad·->·this.schemas',⏎············this.schemas,⏎········`
console.log('KompendiumComponent -> componentDidLoad -> this.name', this.name);

Check failure on line 63 in src/components/component/component.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement

Check failure on line 63 in src/components/component/component.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `'KompendiumComponent·->·componentDidLoad·->·this.name',·this.name` with `⏎············'KompendiumComponent·->·componentDidLoad·->·this.name',⏎············this.name,⏎········`
const route = this.getRoute();
this.scrollToElement(route);
}
Expand All @@ -88,8 +87,10 @@
}

public render(): HTMLElement {
const tag = this.match.params.name;
const tag = this.name;
const component = findComponent(tag, this.docs);
console.log('KompendiumComponent -> render -> tag', tag);

Check failure on line 92 in src/components/component/component.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement
console.log('KompendiumComponent -> render -> component', component);

Check failure on line 93 in src/components/component/component.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement

return (
<article class="component">
Expand All @@ -109,6 +110,8 @@
.filter(negate(isTag('exampleComponent')));
const schema = this.schemas.find((s) => s.$id === tag);

console.log('KompendiumComponent -> renderDocs -> component.docs', component.docs);

Check failure on line 113 in src/components/component/component.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement

Check failure on line 113 in src/components/component/component.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `'KompendiumComponent·->·renderDocs·->·component.docs',·component.docs` with `⏎············'KompendiumComponent·->·renderDocs·->·component.docs',⏎············component.docs,⏎········`

return [
<h1 id={this.getId()}>{title}</h1>,
<kompendium-markdown text={component.docs} />,
Expand Down
8 changes: 2 additions & 6 deletions src/components/debug/debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
JsonDocsComponent,
JsonDocsTag,
} from '@stencil/core/internal';
import { MatchResults } from '@stencil/router';
import { PropsFactory } from '../playground/playground.types';

@Component({
Expand All @@ -24,11 +23,8 @@ export class KompendiumDebug {
@Prop()
public schemas: Array<Record<string, any>>;

/**
* Matched route parameters
*/
@Prop()
public match: MatchResults;
public name: string;

/**
* Factory for creating props for example components
Expand All @@ -38,7 +34,7 @@ export class KompendiumDebug {
public examplePropsFactory?: PropsFactory = () => ({});

public render(): HTMLElement {
const tag = this.match.params.name;
const tag = this.name;
const component = findComponent(tag, this.docs);

return (
Expand Down
Loading
Loading