Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
solid pkg
  • Loading branch information
roginfarrer committed Jun 14, 2024
commit 6d5db956fe7865cf8457232a357de14c2f873d5d
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ dist
storybook-static
.turbo
.parcel-cache
.solid
.next
File renamed without changes.
4 changes: 1 addition & 3 deletions packages/core/src/Collapse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ export class Collapse {
let styles: Record<string, string> = {
height: `${this.#options.collapsedHeight}px`,
overflow: "hidden",
display: this.#options.collapsedHeight === 0 ? "none" : "block",
};
if (this.#options.collapsedHeight === 0) {
styles.display = "none";
}
return styles;
}

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/react/src/useCollapse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function useCollapse({
const theirRef: any = args?.[refKey || "ref"];

const props: any = {
"aria-controls": `react-collapsed-panel-${id}`,
"aria-controls": disclosureId,
"aria-expanded": isExpanded,
onClick(evt: any) {
if (disabled) return;
Expand Down
32 changes: 32 additions & 0 deletions packages/solid-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SolidStart

Everything you need to build a Solid project, powered by [`solid-start`](https://start.solidjs.com);

## Creating a project

```bash
# create a new project in the current directory
npm init solid@latest

# create a new project in my-app
npm init solid@latest my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

Solid apps are built with _presets_, which optimise your project for deployment to different environments.

By default, `npm run build` will generate a Node app that you can run with `npm start`. To use a different preset, add it to the `devDependencies` in `package.json` and specify in your `app.config.js`.

## This project was created with the [Solid CLI](https://solid-cli.netlify.app)
3 changes: 3 additions & 0 deletions packages/solid-app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineConfig } from "@solidjs/start/config";

export default defineConfig({});
17 changes: 17 additions & 0 deletions packages/solid-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "example-bare",
"type": "module",
"scripts": {
"dev": "vinxi dev",
"build": "vinxi build",
"start": "vinxi start"
},
"dependencies": {
"@solidjs/start": "^1.0.1",
"solid-js": "^1.8.17",
"vinxi": "^0.3.11"
},
"engines": {
"node": ">=18"
}
}
Binary file added packages/solid-app/public/favicon.ico
Binary file not shown.
60 changes: 60 additions & 0 deletions packages/solid-app/src/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
body {
font-family: Gordita, Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

a {
margin-right: 1rem;
}

main {
text-align: center;
padding: 1em;
margin: 0 auto;
}

h1 {
color: #335d92;
text-transform: uppercase;
font-size: 4rem;
font-weight: 100;
line-height: 1.1;
margin: 4rem auto;
max-width: 14rem;
}

p {
max-width: 14rem;
margin: 2rem auto;
line-height: 1.35;
}

@media (min-width: 480px) {
h1 {
max-width: none;
}

p {
max-width: none;
}
}

.increment {
font-family: inherit;
font-size: inherit;
padding: 1em 2em;
color: #335d92;
background-color: rgba(68, 107, 158, 0.1);
border-radius: 2em;
border: 2px solid rgba(68, 107, 158, 0);
outline: none;
width: 200px;
font-variant-numeric: tabular-nums;
}

.increment:focus {
border: 2px solid #335d92;
}

.increment:active {
background-color: rgba(68, 107, 158, 0.2);
}
38 changes: 38 additions & 0 deletions packages/solid-app/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { createSignal } from "solid-js";
import { createCollapse } from "../../solid/src";
import "./app.css";

export default function App() {
const [collapseHeight, setCollapseHeight] = createSignal(60);
const collapse = createCollapse({
get collapsedHeight() {
return Number.isNaN(collapseHeight()) ? 0 : collapseHeight();
},
});

return (
<main>
<h1>Hello world!</h1>
<input
type="number"
value={collapseHeight()}
oninput={(e) => setCollapseHeight(e.target.valueAsNumber || 0)}
/>
<button {...collapse.getToggleProps()}>Toggle</button>
<div {...collapse.getCollapseProps()}>
<p>Hello there</p>
<p>Hello there</p>
<p>Hello there</p>
<p>Hello there</p>
<p>Hello there</p>
<p>Hello there</p>
<p>Hello there</p>
<p>Hello there</p>
<p>Hello there</p>
<p>Hello there</p>
<p>Hello there</p>
<p>Hello there</p>
</div>
</main>
);
}
4 changes: 4 additions & 0 deletions packages/solid-app/src/entry-client.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @refresh reload
import { mount, StartClient } from "@solidjs/start/client";

mount(() => <StartClient />, document.getElementById("app")!);
21 changes: 21 additions & 0 deletions packages/solid-app/src/entry-server.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// @refresh reload
import { createHandler, StartServer } from "@solidjs/start/server";

export default createHandler(() => (
<StartServer
document={({ assets, children, scripts }) => (
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
{assets}
</head>
<body>
<div id="app">{children}</div>
{scripts}
</body>
</html>
)}
/>
));
1 change: 1 addition & 0 deletions packages/solid-app/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@solidjs/start/env" />
19 changes: 19 additions & 0 deletions packages/solid-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"allowJs": true,
"strict": true,
"noEmit": true,
"types": ["vinxi/types/client"],
"isolatedModules": true,
"paths": {
"~/*": ["../../solid-app/src/*"]
}
}
}
19 changes: 19 additions & 0 deletions packages/solid/app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"allowJs": true,
"strict": true,
"noEmit": true,
"types": ["vinxi/types/client"],
"isolatedModules": true,
"paths": {
"~/*": ["../../solid-app/src/*"]
}
}
}
38 changes: 38 additions & 0 deletions packages/solid/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "@collapsed/solid",
"version": "0.0.1",
"type": "module",
"license": "MIT",
"main": "./dist/collapsed-disclosure.cjs",
"module": "./dist/collapsed-disclosure.js",
"types": "./dist/collapsed-disclosure.d.ts",
"exports": {
".": {
"import": "./dist/collapsed-disclosure.js",
"require": "./dist/collapsed-disclosure.cjs",
"types": "./dist/collapsed-disclosure.d.ts"
}
},
"files": [
"src",
"dist"
],
"scripts": {
"build": "tsup",
"typecheck": "tsc --project tsconfig.json --noEmit"
},
"devDependencies": {
"@collapsed-internal/build": "workspace:*",
"@collapsed-internal/tsconfig": "workspace:*",
"lit-analyzer": "^1.2.1",
"parcel": "^2.8.2",
"ts-lit-plugin": "^2.0.2",
"tslib": "^2.4.1",
"tsup": "^8",
"typescript": "^5.4.5"
},
"dependencies": {
"@collapsed/core": "workspace:*",
"solid-js": "^1.8.17"
}
}
Loading