Skip to content

Commit

Permalink
chore: fix ci (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianGonz97 authored May 1, 2024
1 parent 667d6a8 commit 55888c8
Show file tree
Hide file tree
Showing 37 changed files with 215 additions and 271 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ on:
push:
branches:
- main
paths-ignore:
- '.changeset/**'
pull_request:
paths-ignore:
- '.changeset/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package-lock.json
yarn.lock
**/.changeset/
.prettierrc
package.json
.vercel
.contentlayer
**/dist
Expand Down
2 changes: 0 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"useTabs": true,
"tabWidth": 4,
"singleQuote": false,
"trailingComma": "es5",
"semi": true,
Expand All @@ -19,7 +18,6 @@
"parser": "markdown",
"printWidth": 100,
"proseWrap": "always",
"tabWidth": 2,
"useTabs": true,
"trailingComma": "none",
"bracketSameLine": true
Expand Down
118 changes: 59 additions & 59 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
{
"name": "root",
"description": "Monorepo for Runed.",
"private": true,
"version": "0.0.0",
"homepage": "https://runed.dev",
"contributors": [
{
"name": "Thomas G. Lopes",
"url": "https://thomasglopes.com"
},
{
"name": "Hunter Johnston",
"url": "https://x.com/huntabyte"
}
],
"funding": [
"https://github.com/sponsors/huntabyte",
"https://github.com/sponsors/tglide"
],
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/svecosystem/runed"
},
"scripts": {
"dev": "pnpm sync && pnpm --parallel dev",
"test": "pnpm -r test",
"test:package": "pnpm -F \"./packages/**\" test",
"test:package:watch": "pnpm -F \"./packages/**\" test:watch",
"build": "pnpm -r build",
"build:packages": "pnpm -F \"./packages/**\" --parallel build",
"build:content": "pnpm -F \"./sites/**\" --parallel build:content",
"ci:publish": "pnpm build:packages && changeset publish",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"check": "pnpm -r check",
"sync": "pnpm -r sync",
"postinstall": "pnpm -r sync"
},
"license": "MIT",
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@huntabyte/eslint-config": "^0.3.1",
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
"eslint": "^9.1.1",
"eslint-plugin-svelte": "2.38.0",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.3",
"prettier-plugin-tailwindcss": "^0.5.14",
"svelte-eslint-parser": "^0.35.0",
"wrangler": "^3.52.0"
},
"type": "module",
"pnpm": {
"overrides": {
"[email protected]": "^0.21.5"
}
}
}
"name": "root",
"description": "Monorepo for Runed.",
"private": true,
"version": "0.0.0",
"homepage": "https://runed.dev",
"contributors": [
{
"name": "Thomas G. Lopes",
"url": "https://thomasglopes.com"
},
{
"name": "Hunter Johnston",
"url": "https://x.com/huntabyte"
}
],
"funding": [
"https://github.com/sponsors/huntabyte",
"https://github.com/sponsors/tglide"
],
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/svecosystem/runed"
},
"scripts": {
"dev": "pnpm sync && pnpm --parallel dev",
"test": "pnpm -r test",
"test:package": "pnpm -F \"./packages/**\" test",
"test:package:watch": "pnpm -F \"./packages/**\" test:watch",
"build": "pnpm -r build",
"build:packages": "pnpm -F \"./packages/**\" --parallel build",
"build:content": "pnpm -F \"./sites/**\" --parallel build:content",
"ci:publish": "pnpm build:packages && changeset publish",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"check": "pnpm -r check",
"sync": "pnpm -r sync",
"postinstall": "pnpm -r sync"
},
"license": "MIT",
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@huntabyte/eslint-config": "^0.3.1",
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
"eslint": "^9.1.1",
"eslint-plugin-svelte": "2.38.0",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.3",
"prettier-plugin-tailwindcss": "^0.5.14",
"svelte-eslint-parser": "^0.35.0",
"wrangler": "^3.52.0"
},
"type": "module",
"pnpm": {
"overrides": {
"[email protected]": "^0.21.5"
}
}
}
44 changes: 21 additions & 23 deletions packages/runed/src/lib/functions/box/box.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export interface WritableBox<T> extends ReadableBox<T> {

/**
* @returns Whether the value is a Box
*
*
* @see {@link https://runed.dev/docs/functions/box}
*/
function isBox(value: unknown): value is ReadableBox<unknown> {
return isObject(value) && BoxSymbol in value;
}
/**
* @returns Whether the value is a WritableBox
*
*
* @see {@link https://runed.dev/docs/functions/box}
*/
function isWritableBox(value: unknown): value is WritableBox<unknown> {
Expand All @@ -36,7 +36,7 @@ function isWritableBox(value: unknown): value is WritableBox<unknown> {
*
* @returns A box with a `value` property which can be set to a new value.
* Useful to pass state to other functions.
*
*
* @see {@link https://runed.dev/docs/functions/box}
*/
export function box<T>(): WritableBox<T | undefined>;
Expand All @@ -46,7 +46,7 @@ export function box<T>(): WritableBox<T | undefined>;
* @param initialValue The initial value of the box.
* @returns A box with a `value` property which can be set to a new value.
* Useful to pass state to other functions.
*
*
* @see {@link https://runed.dev/docs/functions/box}
*/
export function box<T>(initialValue: T): WritableBox<T>;
Expand All @@ -71,7 +71,7 @@ export function box(initialValue?: unknown) {
* @param getter Function to get the value of the box
* @returns A box with a `value` property whose value is the result of the getter.
* Useful to pass state to other functions.
*
*
* @see {@link https://runed.dev/docs/functions/box}
*/
function boxWith<T>(getter: () => T): ReadableBox<T>;
Expand All @@ -82,7 +82,7 @@ function boxWith<T>(getter: () => T): ReadableBox<T>;
* @param setter Function to set the value of the box
* @returns A box with a `value` property which can be set to a new value.
* Useful to pass state to other functions.
*
*
* @see {@link https://runed.dev/docs/functions/box}
*/
function boxWith<T>(getter: () => T, setter: (v: T) => void): WritableBox<T>;
Expand Down Expand Up @@ -110,25 +110,23 @@ function boxWith<T>(getter: () => T, setter?: (v: T) => void) {
};
}



/**
* Creates a box from either a static value, a box, or a getter function.
* Useful when you want to receive any of these types of values and generate a boxed version of it.
*
* @returns A box with a `value` property whose value.
*
*
* @see {@link https://runed.dev/docs/functions/box}
*/
function boxFrom<T>(value: T | WritableBox<T>): WritableBox<T>;
function boxFrom<T>(value: ReadableBox<T>): ReadableBox<T>;
function boxFrom<T>(value: Getter<T>): ReadableBox<T>;
function boxFrom<T>(value: MaybeBoxOrGetter<T>): ReadableBox<T>
function boxFrom<T>(value: MaybeBoxOrGetter<T>): ReadableBox<T>;
function boxFrom<T>(value: T): WritableBox<T>;
function boxFrom<T>(value: MaybeBoxOrGetter<T>) {
if (box.isBox(value)) return value;
if (isFunction(value)) return box.with(value);
return box(value)
return box(value);
}

type GetKeys<T, U> = {
Expand All @@ -143,16 +141,16 @@ type BoxFlatten<R extends Record<string, unknown>> = Expand<
},
never
> &
RemoveValues<
{
readonly [K in keyof R]: R[K] extends WritableBox<infer _>
? never
: R[K] extends ReadableBox<infer T>
? T
: never;
},
never
>
RemoveValues<
{
readonly [K in keyof R]: R[K] extends WritableBox<infer _>
? never
: R[K] extends ReadableBox<infer T>
? T
: never;
},
never
>
> &
RemoveValues<
{
Expand All @@ -168,7 +166,7 @@ type BoxFlatten<R extends Record<string, unknown>> = Expand<
* const count = box(0)
* const flat = box.flatten({ count, double: box.with(() => count.value) })
* // type of flat is { count: number, readonly double: number }
*
*
* @see {@link https://runed.dev/docs/functions/box}
*/
function boxFlatten<R extends Record<string, unknown>>(boxes: R): BoxFlatten<R> {
Expand Down Expand Up @@ -205,7 +203,7 @@ function boxFlatten<R extends Record<string, unknown>>(boxes: R): BoxFlatten<R>
* @example
* const count = box(0) // WritableBox<number>
* const countReadonly = box.readonly(count) // ReadableBox<number>
*
*
* @see {@link https://runed.dev/docs/functions/box}
*/
function toReadonlyBox<T>(b: ReadableBox<T>): ReadableBox<T> {
Expand Down
2 changes: 1 addition & 1 deletion packages/runed/src/lib/functions/box/box.test.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describe("box types", () => {
const count = 0 as MaybeBoxOrGetter<number>;
const count2 = box.from(count);
expectTypeOf(count2).toMatchTypeOf<ReadableBox<number>>();
})
});

test("box.isWritableBox = true should allow box to be settable", () => {
const count = box(0) as WritableBox<number> | ReadableBox<number>;
Expand Down
4 changes: 2 additions & 2 deletions packages/runed/src/lib/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export * from "./useEventListener/index.js";
export * from "./useMounted/index.js";
export * from "./useSupported/index.js";
export * from "./useStateHistory/index.js";
export * from './watch/index.js';
export * from './usePrevious/index.js';
export * from "./watch/index.js";
export * from "./usePrevious/index.js";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { isBrowser } from "$lib/internal/utils/browser.js";
*
* @returns an object with a reactive value `value` that is equal to `document.activeElement`,
* or `null` if there's no active element.
*
*
* @see {@link https://runed.dev/docs/functions/use-active-element}
*/
export function useActiveElement(): ReadableBox<Element | null> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ describe("useActiveElement", () => {
const activeElement = useActiveElement();
expect(activeElement.value).toBe(document.activeElement);
});
testWithEffect(
"updates accordingly when `document.activeElement` element changes",
async () => {
const input = document.createElement("input");
document.body.appendChild(input);
input.focus();
testWithEffect("updates accordingly when `document.activeElement` element changes", async () => {
const input = document.createElement("input");
document.body.appendChild(input);
input.focus();

const activeElement = useActiveElement();
await tick();
expect(document.activeElement).toBe(input);
expect(activeElement.value).toBe(input);
}
);
const activeElement = useActiveElement();
await tick();
expect(document.activeElement).toBe(input);
expect(activeElement.value).toBe(input);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { FunctionArgs, MaybeGetter } from "$lib/internal/types.js";
* The second parameter is the time to wait before calling the original callback.
* Alternatively, it can also be a getter function that returns the time to wait.
*
*
*
* @see {@link https://runed.dev/docs/functions/use-debounce}
*/
export function useDebounce<Callback extends FunctionArgs>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type UseElementSizeOptions = {
* - `box`: The box model to use. Can be either `"content-box"` or `"border-box"`. Defaults to `"border-box"`.
*
* @returns an object with `width` and `height` properties.
*
*
* @see {@link https://runed.dev/docs/functions/use-element-size}
*/
export function useElementSize(
Expand All @@ -37,8 +37,7 @@ export function useElementSize(

const observer = new ResizeObserver((entries) => {
for (const entry of entries) {
const boxSize =
options.box === "content-box" ? entry.contentBoxSize : entry.borderBoxSize;
const boxSize = options.box === "content-box" ? entry.contentBoxSize : entry.borderBoxSize;
const boxSizeArr = Array.isArray(boxSize) ? boxSize : [boxSize];
size.width = boxSizeArr.reduce((acc, size) => Math.max(acc, size.inlineSize), 0);
size.height = boxSizeArr.reduce((acc, size) => Math.max(acc, size.blockSize), 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { addEventListener } from "$lib/internal/utils/event.js";
* @param event The event(s) to listen for.
* @param handler The function to be called when the event is triggered.
* @param options An optional object that specifies characteristics about the event listener.
*
*
* @see {@link https://runed.dev/docs/functions/use-event-listener}
*/
export function useEventListener<TEvent extends keyof WindowEventMap>(
Expand All @@ -31,7 +31,7 @@ export function useEventListener<TEvent extends keyof DocumentEventMap>(
* @param event The event(s) to listen for.
* @param handler The function to be called when the event is triggered.
* @param options An optional object that specifies characteristics about the event listener.
*
*
* @see {@link https://runed.dev/docs/functions/use-event-listener}
*/
export function useEventListener<
Expand All @@ -50,7 +50,7 @@ export function useEventListener<
* @param event The event(s) to listen for.
* @param handler The function to be called when the event is triggered.
* @param options An optional object that specifies characteristics about the event listener.
*
*
* @see {@link https://runed.dev/docs/functions/use-event-listener}
*/
export function useEventListener(
Expand Down
Loading

0 comments on commit 55888c8

Please sign in to comment.