Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

dist
node_modules
storybook-static
6 changes: 6 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type {StorybookConfig} from "storybook-solidjs-vite"

export default {
stories: ["../stories/**/*.stories.@(ts|tsx)"],
framework: "storybook-solidjs-vite",
} satisfies StorybookConfig
7 changes: 7 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type {Preview} from "storybook-solidjs-vite"

export default {
parameters: {
controls: {expanded: true},
},
} satisfies Preview
299 changes: 258 additions & 41 deletions README.md

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions jest/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const common_config = {
rootDir: "../",
globals: {"ts-jest": {useESM: true}},
transformIgnorePatterns: ["node_modules/(?!solid-js.*|.*(?<=.[tj]sx))$"],
/* handles @solid-primitives/* ESM-only next-tag resolution, see resolver.cjs */
resolver: resolver_path,
/*
to support NodeNext module imports
https://stackoverflow.com/questions/73735202/typescript-jest-imports-with-js-extension-cause-error-cannot-find-module
Expand All @@ -24,13 +26,16 @@ const client_config = {
testEnvironment: "jsdom",
testMatch: ["<rootDir>/test/**/*.test.(js|ts)?(x)"],
testPathIgnorePatterns: ["/node_modules/", "ssr"],
setupFilesAfterEnv: ["<rootDir>/test/waapi-polyfill.js"],
/* uses a webpack style resolver, the default one has many issues. */
resolver: resolver_path,
/* transform ts and tsx files */
setupFilesAfterEnv: ["<rootDir>/test/setup.js"],
/* picks the "browser" exports condition so @solidjs/web resolves its DOM build */
testEnvironmentOptions: {
customExportConditions: ["browser"],
},
/* transform ts, tsx, and esm .mjs files */
transform: {
"\\.[jt]sx$": transform_client_path,
"\\.[jt]s$": transform_client_path,
"\\.mjs$": transform_client_path,
},
}

Expand All @@ -40,10 +45,11 @@ const server_config = {
// avoid loading jsdom.
testEnvironment: "node",
testMatch: ["<rootDir>/test/ssr.test.(js|ts)?(x)"],
/* transform ts and tsx files */
/* transform ts, tsx, and esm .mjs files */
transform: {
"\\.[jt]sx$": transform_ssr_path,
"\\.[jt]s$": transform_ssr_path,
"\\.mjs$": transform_ssr_path,
},
}

Expand Down
39 changes: 32 additions & 7 deletions jest/resolver.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
const {create, getDefaultConfig} = require("enhanced-resolve-jest")
const fs = require("fs")
const path = require("path")

module.exports = create(jestConfig => {
const baseConfig = getDefaultConfig(jestConfig)
baseConfig.aliasFields = ["browser"]
baseConfig.mainFields = ["browser", "main"]
return baseConfig
})
/*
@solid-primitives/* next-tag prereleases only publish an ESM "import" export
condition (no "require"/"main" fallback), which our CJS-based babel-jest
pipeline can't require() through package.json exports resolution. Walk up
node_modules by hand (mirroring Node's own lookup algorithm) to find the
package directory without going through the exports gate, then point
straight at its "module" (or "main") entry.
*/
function findPackageDir(specifier, fromDir) {
let dir = fromDir
for (;;) {
const candidate = path.join(dir, "node_modules", specifier)
if (fs.existsSync(candidate)) return candidate
const parent = path.dirname(dir)
if (parent === dir) return null
dir = parent
}
}

module.exports = function resolver(request, options) {
if (request.startsWith("@solid-primitives/")) {
const pkg_dir = findPackageDir(request, options.basedir)
if (pkg_dir) {
const pkg_json = JSON.parse(fs.readFileSync(path.join(pkg_dir, "package.json"), "utf8"))
const entry = pkg_json.module || pkg_json.main
if (entry) return path.join(pkg_dir, entry)
}
}
return options.defaultResolver(request, options)
}
12 changes: 12 additions & 0 deletions motion.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 28 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "solid-motionone",
"version": "1.0.4",
"version": "2.0.0-next.0",
"description": "A tiny, performant animation library for SolidJS",
"license": "MIT",
"author": "Damian Tarnawski <gthetarnav@gmail.com>; David Di Biase <dave.dibiase@gmail.com>",
Expand All @@ -19,7 +19,9 @@
"format": "prettier --cache -w .",
"lint": "pnpm run lint:code & pnpm run lint:types",
"lint:code": "eslint --ignore-path .gitignore --max-warnings 0 src/**/*.{js,ts,tsx,jsx}",
"lint:types": "tsc --noEmit"
"lint:types": "tsc --noEmit",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"type": "module",
"files": [
Expand All @@ -42,38 +44,49 @@
},
"typesVersions": {},
"dependencies": {
"@motionone/dom": "^10.17.0",
"@motionone/utils": "^10.17.0",
"@solid-primitives/props": "^3.1.11",
"@solid-primitives/refs": "^1.0.8",
"@solid-primitives/transition-group": "^1.0.5",
"csstype": "^3.1.3"
"@solid-primitives/props": "4.0.0-next.3",
"@solid-primitives/refs": "3.0.0-next.2",
"@solid-primitives/transition-group": "2.0.0-next.2",
"@solid-primitives/utils": "7.0.0-next.4",
"csstype": "^3.1.3",
"framer-motion": "^13.1.1",
"motion-dom": "^13.1.1",
"motion-utils": "^13.0.0"
},
"devDependencies": {
"@babel/preset-env": "^7.23.7",
"@babel/preset-typescript": "^7.23.3",
"@jest/types": "^29.6.3",
"@solidjs/testing-library": "^0.8.5",
"@solidjs/testing-library": "1.0.0-beta.2",
"@solidjs/web": "2.0.0-rc.3",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.6",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"babel-jest": "^29.7.0",
"babel-preset-solid": "^1.8.6",
"enhanced-resolve-jest": "^1.1.0",
"babel-preset-solid": "2.0.0-rc.2",
"eslint": "^8.56.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.1.1",
"solid-js": "^1.8.17",
"solid-js": "2.0.0-rc.3",
"storybook": "10.5.10",
"storybook-solidjs-vite": "10.7.1",
"tsup": "^8.0.1",
"tsup-preset-solid": "^2.2.0",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"vite": "^8.2.2",
"vite-plugin-solid": "3.0.0-next.27"
},
"peerDependencies": {
"solid-js": "^1.8.0"
"solid-js": "^2.0.0-rc.0"
},
"packageManager": "pnpm@10.9.0"
"packageManager": "pnpm@10.9.0",
"pnpm": {
"overrides": {
"babel-preset-solid": "2.0.0-rc.2"
}
}
}
Loading
Loading