Skip to content

Commit

Permalink
Update dependency versions
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarnav committed Sep 13, 2024
1 parent 6fe0964 commit 1ea2a09
Show file tree
Hide file tree
Showing 9 changed files with 701 additions and 886 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-emus-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solid-primitives/list": patch
---

Use isDev const from solid-js/web instead if a string
6 changes: 6 additions & 0 deletions .changeset/young-buckets-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@solid-primitives/map": patch
"@solid-primitives/set": patch
---

Use new Map/SetIterator types
42 changes: 20 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,37 @@
"release": "pnpm build && changeset publish"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@types/jsdom": "^21.1.6",
"@types/node": "^20.10.5",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"@changesets/cli": "^2.27.8",
"@types/jsdom": "^21.1.7",
"@types/node": "^22.5.4",
"@typescript-eslint/eslint-plugin": "^8.5.0",
"@typescript-eslint/parser": "^8.5.0",
"esbuild": "^0.19.11",
"eslint": "^8.56.0",
"eslint": "^9.10.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-no-only-tests": "^3.3.0",
"gzip-size": "^7.0.0",
"jsdom": "^22.1.0",
"jsdom": "^25.0.0",
"json-to-markdown-table": "^1.0.0",
"prettier": "^3.1.1",
"prettier-plugin-tailwindcss": "^0.5.9",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.6",
"rehype-autolink-headings": "^7.1.0",
"rehype-highlight": "^7.0.0",
"rehype-slug": "^6.0.0",
"remark-gfm": "^4.0.0",
"solid-js": "^1.8.16",
"@solidjs/start": "^0.7.7",
"tsup": "^8.0.2",
"solid-js": "^1.8.22",
"@solidjs/start": "^1.0.6",
"tsup": "^8.2.4",
"tsup-preset-solid": "^2.2.0",
"tsx": "^4.7.0",
"tsx": "^4.19.1",
"turbo": "^1.12.5",
"vinxi": "^0.3.10",
"vinxi": "^0.4.2",
"vite-plugin-solid": "^2.10.2",
"typescript": "~5.2.2",
"typescript": "~5.6.2",
"valibot": "^0.20.1",
"vite": "5.2.2",
"vitest": "^0.34.6"
"vite": "5.4.4",
"vitest": "^2.1.0"
},
"packageManager": "[email protected]+sha256.b35018fbfa8f583668b2649e407922a721355cd81f61beeb4ac1d4258e585559",
"engines": {
"node": ">=18.0.0"
}
"packageManager": "[email protected]",
"engines": {"node": ">=20.0.0"}
}
6 changes: 4 additions & 2 deletions packages/keyboard/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ type OldPressedKeys = [Accessor<string[]>, { event: Accessor<KeyboardEvent | nul
export const useKeyDownList = /*#__PURE__*/ createSingletonRoot<Accessor<string[]>>(() => {
if (isServer) {
const keys = () => [];
// this is for backwards compatibility
// TODO remove in the next major version
(keys as any as OldPressedKeys)[0] = keys;
(keys as any as OldPressedKeys)[1] = { event: () => null };
(keys as any as OldPressedKeys)[Symbol.iterator] = function* () {
yield (keys as any as OldPressedKeys)[0];
yield (keys as any as OldPressedKeys)[1];
};
} as any;
return keys;
}

Expand Down Expand Up @@ -148,7 +150,7 @@ export const useKeyDownList = /*#__PURE__*/ createSingletonRoot<Accessor<string[
(pressedKeys as any as OldPressedKeys)[Symbol.iterator] = function* () {
yield (pressedKeys as any as OldPressedKeys)[0];
yield (pressedKeys as any as OldPressedKeys)[1];
};
} as any;

return pressedKeys;
});
Expand Down
7 changes: 4 additions & 3 deletions packages/list/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
type JSX,
createMemo,
} from "solid-js";
import {isDev} from "solid-js/web"

type ListItem<T> = {
value: T;
Expand Down Expand Up @@ -177,13 +178,13 @@ export function listArray<T, U>(
items.push(t);
// signal created when used
let sV: Accessor<T> = () => {
[sV, t.valueSetter] = "_SOLID_DEV_"
[sV, t.valueSetter] = isDev
? createSignal(scopedV, { name: "value" })
: createSignal(scopedV);
return sV();
},
sI: Accessor<number> = () => {
[sI, t.indexSetter] = "_SOLID_DEV_"
[sI, t.indexSetter] = isDev
? createSignal(scopedI, { name: "index" })
: createSignal(scopedI);
return sI();
Expand Down Expand Up @@ -213,7 +214,7 @@ export function List<T extends readonly any[], U extends JSX.Element>(props: {
children: (item: Accessor<T[number]>, index: Accessor<number>) => U;
}) {
const fallback = "fallback" in props && { fallback: () => props.fallback };
return ("_SOLID_DEV_"
return (isDev
? createMemo(
listArray(() => props.each, props.children, fallback || undefined),
undefined,
Expand Down
8 changes: 4 additions & 4 deletions packages/map/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ export class ReactiveMap<K, V> extends Map<K, V> {
return super.size;
}

*keys(): IterableIterator<K> {
*keys(): MapIterator<K> {
for (const key of super.keys()) {
this.#keyTriggers.track(key);
yield key;
}
this.#keyTriggers.track($KEYS);
}
*values(): IterableIterator<V> {
*values(): MapIterator<V> {
for (const [key, v] of super.entries()) {
this.#valueTriggers.track(key);
yield v;
}
this.#keyTriggers.track($KEYS);
}
*entries(): IterableIterator<[K, V]> {
*entries(): MapIterator<[K, V]> {
for (const entry of super.entries()) {
this.#valueTriggers.track(entry[0]);
yield entry;
Expand Down Expand Up @@ -112,7 +112,7 @@ export class ReactiveMap<K, V> extends Map<K, V> {
}
}

[Symbol.iterator](): IterableIterator<[K, V]> {
[Symbol.iterator](): MapIterator<[K, V]> {
return this.entries();
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/set/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ export class ReactiveSet<T> extends Set<T> {
return super.has(v);
}

*keys(): IterableIterator<T> {
*keys(): SetIterator<T> {
for (const key of super.keys()) {
this.#triggers.track(key);
yield key;
}
this.#triggers.track($KEYS);
}
values(): IterableIterator<T> {
values(): SetIterator<T> {
return this.keys();
}
*entries(): IterableIterator<[T, T]> {
*entries(): SetIterator<[T, T]> {
for (const key of super.keys()) {
this.#triggers.track(key);
yield [key, key];
}
this.#triggers.track($KEYS);
}

[Symbol.iterator](): IterableIterator<T> {
[Symbol.iterator](): SetIterator<T> {
return this.values();
}
forEach(callbackfn: (value: T, value2: T, set: this) => void) {
Expand Down
46 changes: 21 additions & 25 deletions packages/transition-group/test/list-transition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,32 +171,28 @@ describe("createListTransition", () => {

dispose();
});
});

it("keeps index if removed elements if enabled", () => {
createRoot(dispose => {
const [children, setChildren] = createSignal<Element[]>([el1, el2, el3]);
const fn = vi.fn();

const result = createListTransition(children, {
onChange: fn,
exitMethod: "keep-index",
});
expect(result()).toHaveLength(2);

setChildren([el1, el3]);
expect(result()).toHaveLength(3);
expect(fn).toHaveBeenCalledOnce();
expect(fn).toHaveBeenCalledWith({
list: [el1, el2, el3],
added: [el3],
removed: [el1],
unchanged: [el2],
finishRemoved: expect.any(Function),
} satisfies OnChangeParams);

dispose();
});
});
it("keeps index if removed elements if enabled", () => {
const [children, setChildren] = createSignal<Element[]>([el1, el2, el3]);
const fn = vi.fn();

const [result, dispose] = createRoot(dispose => [createListTransition(children, {onChange: fn, exitMethod: "keep-index"}), dispose]);

expect(result()).toHaveLength(3);

setChildren([el1, el3]);
expect(result()).toHaveLength(3);
expect(fn).toHaveBeenCalledOnce();
expect(fn).toHaveBeenCalledWith({
list: [el1, el2, el3],
added: [],
removed: [el2],
unchanged: [el1, el3],
finishRemoved: expect.any(Function),
} satisfies OnChangeParams);

dispose();
});

/*
Expand Down
Loading

0 comments on commit 1ea2a09

Please sign in to comment.