Skip to content

Commit

Permalink
use spaces instead of tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
jsulpis committed Dec 7, 2024
1 parent 92183d4 commit 1959dc7
Show file tree
Hide file tree
Showing 33 changed files with 954 additions and 956 deletions.
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"printWidth": 100
"printWidth": 100,
"useTabs": false
}
6 changes: 3 additions & 3 deletions docs/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineCollection } from 'astro:content';
import { docsSchema } from '@astrojs/starlight/schema';
import { defineCollection } from "astro:content";
import { docsSchema } from "@astrojs/starlight/schema";

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
docs: defineCollection({ schema: docsSchema() }),
};
22 changes: 11 additions & 11 deletions docs/src/content/docs/introduction/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ A proper documentation will come soon !

<PackageManagers pkg="usegl" frame="false" pkgManagers={["pnpm", "npm", "yarn", "bun"]} />


## Usage

<Code lang="js" code={`
import { useWebGLCanvas } from "usegl";
useWebGLCanvas({
canvas: document.querySelector("canvas"),
fragment: /* glsl */ \`
varying vec2 vUv;
uniform float uTime;
void main() {
gl_FragColor = vec4(vUv, sin(uTime) / 2. + .5, 1.);
}
\`
canvas: document.querySelector("canvas"),
fragment: /_ glsl _/ \`
varying vec2 vUv;
uniform float uTime;
void main() {
gl_FragColor = vec4(vUv, sin(uTime) / 2. + .5, 1.);
}
\`
});
`} />
`} />
2 changes: 1 addition & 1 deletion docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"jsx": "react-jsx",
"jsxImportSource": "react"
}
}
}
12 changes: 6 additions & 6 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import unjs from "eslint-config-unjs";

export default unjs({
rules: {
"unicorn/filename-case": "off",
"unicorn/no-null": "off",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/triple-slash-reference": "off",
},
rules: {
"unicorn/filename-case": "off",
"unicorn/no-null": "off",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/triple-slash-reference": "off",
},
});
11 changes: 4 additions & 7 deletions lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Changelog


## v0.2.0

[compare changes](https://github.com/jsulpis/usegl/compare/v0.1.0...v0.2.0)
Expand All @@ -11,7 +10,7 @@
- Allow to provide the canvas as a CSS selector ([a7f8d0f](https://github.com/jsulpis/usegl/commit/a7f8d0f))
- Add useLoop hook with play/pause controls ([f3e2cf3](https://github.com/jsulpis/usegl/commit/f3e2cf3))
- Add useBoundingRect hook ([8d1851e](https://github.com/jsulpis/usegl/commit/8d1851e))
- ⚠️ Change onPointerEvents to usePointerEvents and add more events ([ddeabd9](https://github.com/jsulpis/usegl/commit/ddeabd9))
- ⚠️ Change onPointerEvents to usePointerEvents and add more events ([ddeabd9](https://github.com/jsulpis/usegl/commit/ddeabd9))

### 🩹 Fixes

Expand All @@ -20,7 +19,7 @@

### 💅 Refactors

- ⚠️ Change `onCanvasResize` to `useResizeObserver` and provide controls on the observer ([31e38ff](https://github.com/jsulpis/usegl/commit/31e38ff))
- ⚠️ Change `onCanvasResize` to `useResizeObserver` and provide controls on the observer ([31e38ff](https://github.com/jsulpis/usegl/commit/31e38ff))

### 🏡 Chore

Expand All @@ -39,12 +38,11 @@

#### ⚠️ Breaking Changes

- ⚠️ Change onPointerEvents to usePointerEvents and add more events ([ddeabd9](https://github.com/jsulpis/usegl/commit/ddeabd9))
- ⚠️ Change `onCanvasResize` to `useResizeObserver` and provide controls on the observer ([31e38ff](https://github.com/jsulpis/usegl/commit/31e38ff))
- ⚠️ Change onPointerEvents to usePointerEvents and add more events ([ddeabd9](https://github.com/jsulpis/usegl/commit/ddeabd9))
- ⚠️ Change `onCanvasResize` to `useResizeObserver` and provide controls on the observer ([31e38ff](https://github.com/jsulpis/usegl/commit/31e38ff))

## v0.1.0


### 🚀 Enhancements

- Add a first version of useWebGLCanvas, onCanvasResize, and add a gradient demo ([f464f08](https://github.com/jsulpis/usegl/commit/f464f08))
Expand Down Expand Up @@ -79,4 +77,3 @@
- Separate packages for docs and lib ([1857c1c](https://github.com/jsulpis/usegl/commit/1857c1c))
- Add license ([e0801ca](https://github.com/jsulpis/usegl/commit/e0801ca))
- Setup unjs package template ([0dc0d0c](https://github.com/jsulpis/usegl/commit/0dc0d0c))

24 changes: 12 additions & 12 deletions lib/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ const __dirname = dirname(fileURLToPath(import.meta.url));

// https://astro.build/config
export default defineConfig({
srcDir: "./playground/src",
publicDir: "./playground/public",
vite: {
resolve: {
alias: {
usegl: resolve(__dirname, "./src/index.ts"),
},
},
},
devToolbar: {
enabled: false,
},
srcDir: "./playground/src",
publicDir: "./playground/public",
vite: {
resolve: {
alias: {
usegl: resolve(__dirname, "./src/index.ts"),
},
},
},
devToolbar: {
enabled: false,
},
});
104 changes: 52 additions & 52 deletions lib/package.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
{
"name": "usegl",
"version": "0.2.0",
"description": "Lightweight hooks library for WebGL",
"repository": "jsulpis/usegl",
"license": "MIT",
"author": "Julien SULPIS",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs"
}
},
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "unbuild",
"dev": "astro dev",
"format": "prettier src --check",
"format:fix": "prettier src --write",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"prepack": "pnpm build",
"release": "changelogen --release --clean",
"test": "playwright test",
"test:local": "docker build -t usegl . && docker run --rm -v $(pwd)/test-results:/app/test-results usegl /bin/sh -c 'xvfb-run pnpm run test'",
"test:ui": "playwright test --ui",
"test:update": "docker build -t usegl . && docker run --rm -v $(pwd)/test-results:/app/test-results -v $(pwd)/tests/__screenshots__:/app/tests/__screenshots__ usegl",
"typecheck": "tsc --noEmit && astro check"
},
"devDependencies": {
"@astrojs/check": "0.9.4",
"@playwright/test": "1.48.1",
"@types/node": "22.1.0",
"astro": "4.16.7",
"changelogen": "0.5.5",
"eslint": "9.8.0",
"eslint-config-unjs": "0.3.2",
"prettier": "3.3.3",
"typescript": "5.5.4",
"unbuild": "3.0.0-rc.7"
},
"changelog": {
"excludeAuthors": [
""
]
}
"name": "usegl",
"version": "0.2.0",
"description": "Lightweight hooks library for WebGL",
"repository": "jsulpis/usegl",
"license": "MIT",
"author": "Julien SULPIS",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs"
}
},
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "unbuild",
"dev": "astro dev",
"format": "prettier src --check",
"format:fix": "prettier src --write",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"prepack": "pnpm build",
"release": "changelogen --release --clean",
"test": "playwright test",
"test:local": "docker build -t usegl . && docker run --rm -v $(pwd)/test-results:/app/test-results usegl /bin/sh -c 'xvfb-run pnpm run test'",
"test:ui": "playwright test --ui",
"test:update": "docker build -t usegl . && docker run --rm -v $(pwd)/test-results:/app/test-results -v $(pwd)/tests/__screenshots__:/app/tests/__screenshots__ usegl",
"typecheck": "tsc --noEmit && astro check"
},
"devDependencies": {
"@astrojs/check": "0.9.4",
"@playwright/test": "1.48.1",
"@types/node": "22.1.0",
"astro": "4.16.7",
"changelogen": "0.5.5",
"eslint": "9.8.0",
"eslint-config-unjs": "0.3.2",
"prettier": "3.3.3",
"typescript": "5.5.4",
"unbuild": "3.0.0-rc.7"
},
"changelog": {
"excludeAuthors": [
""
]
}
}
4 changes: 2 additions & 2 deletions lib/playground/src/components/renderCount.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function incrementRenderCount() {
const renderCountElement = document.querySelector("#renderCount");
renderCountElement.textContent = `${Number(renderCountElement.textContent) + 1}`;
const renderCountElement = document.querySelector("#renderCount");
renderCountElement.textContent = `${Number(renderCountElement.textContent) + 1}`;
}
14 changes: 7 additions & 7 deletions lib/playground/src/components/routes.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { readdirSync } from "node:fs";

export const sections = readdirSync("playground/src/pages", { withFileTypes: true })
.filter((file) => file.isDirectory())
.map((folder) => folder.name);
.filter((file) => file.isDirectory())
.map((folder) => folder.name);

export const routes = sections.flatMap((section) => {
const files = readdirSync(`playground/src/pages/${section}`);
const files = readdirSync(`playground/src/pages/${section}`);

return files.map((file) => {
const route = file.replace(".astro", "");
return { section, route };
});
return files.map((file) => {
const route = file.replace(".astro", "");
return { section, route };
});
});
2 changes: 1 addition & 1 deletion lib/playground/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/// <reference path="../../.astro/types.d.ts" />
/// <reference path="../../.astro/types.d.ts" />
14 changes: 7 additions & 7 deletions lib/playground/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "astro/tsconfigs/base",
"include": ["../src", "src"],
"compilerOptions": {
"paths": {
"usegl": ["../src/index.ts"]
}
}
"extends": "astro/tsconfigs/base",
"include": ["../src", "src"],
"compilerOptions": {
"paths": {
"usegl": ["../src/index.ts"]
}
}
}
Loading

0 comments on commit 1959dc7

Please sign in to comment.