diff --git a/.github/ISSUE_TEMPLATE/BUGS.yml b/.github/ISSUE_TEMPLATE/BUGS.yml index 64dab21b7..18358ff12 100644 --- a/.github/ISSUE_TEMPLATE/BUGS.yml +++ b/.github/ISSUE_TEMPLATE/BUGS.yml @@ -1,13 +1,10 @@ name: "Bug Report πͺ²" description: Report an issue or possible bug with the functionality of the Solid docs website. (Not related to the content of the site.) title: "[Bug]: " -labels: [ - "bug", - "pending review" -] -assignees: -- danieljcafonso -- atilafassina +labels: ["bug", "pending review"] +assignees: + - danieljcafonso + - atilafassina body: - type: textarea @@ -25,13 +22,13 @@ body: description: Please indicate on which page(s) the issue occurs. placeholder: https://docs.solidjs.com/concepts/intro-to-reactivity validations: - required: true + required: true - type: textarea id: expected attributes: label: "π€ Expected Behavior" description: Please describe what the expected behavior should be. - placeholder: When on this page, I expected . . . + placeholder: When on this page, I expected . . . validations: required: true - type: textarea @@ -39,7 +36,7 @@ body: attributes: label: "π Current Behavior" description: Please describe what the current behavior is. - placeholder: But instead, on this page I'm noticing . . . + placeholder: But instead, on this page I'm noticing . . . validations: required: true - type: input diff --git a/.github/ISSUE_TEMPLATE/CONTENT.yml b/.github/ISSUE_TEMPLATE/CONTENT.yml index 477a961ee..1b1ebe748 100644 --- a/.github/ISSUE_TEMPLATE/CONTENT.yml +++ b/.github/ISSUE_TEMPLATE/CONTENT.yml @@ -1,11 +1,9 @@ name: "Content Report π" title: "[Content]:" description: Report an issue with existing content. -labels: [ - "improve documentation", "pending review" -] -assignees: -- ladybluenotes +labels: ["improve documentation", "pending review"] +assignees: + - ladybluenotes body: - type: markdown attributes: @@ -25,7 +23,7 @@ body: description: Please provide the URL of the page(s) affected. placeholder: https://docs.solidjs.com/concepts/intro-to-reactivity validations: - required: true + required: true - type: textarea id: generalDesc attributes: @@ -33,11 +31,11 @@ body: description: Let us know what's wrong! placeholder: "..." validations: - required: true + required: true - type: textarea id: incorrectContent attributes: label: "π₯οΈ Reproduction in StackBlitz (if reporting incorrect content or code samples)" description: If you are reporting incorrect content or code samples, you can also attach a reproduction in stackblitz. validations: - required: false + required: false diff --git a/.github/ISSUE_TEMPLATE/REQUEST.yml b/.github/ISSUE_TEMPLATE/REQUEST.yml index 55479fe1e..f1aef4ba5 100644 --- a/.github/ISSUE_TEMPLATE/REQUEST.yml +++ b/.github/ISSUE_TEMPLATE/REQUEST.yml @@ -1,11 +1,9 @@ name: "Request π‘" title: "[Request]:" description: Share an idea. -labels: [ - "request", "pending review" -] +labels: ["request", "pending review"] assignees: -- ladybluenotes + - ladybluenotes body: - type: markdown attributes: @@ -14,7 +12,7 @@ body: id: request-topic attributes: label: "What is this request related to?" - options: + options: - Request - Styling - Feature @@ -27,7 +25,7 @@ body: description: Please provide the URL of the page(s) or section this idea is related to. placeholder: https://docs.solidjs.com/concepts/intro-to-reactivity validations: - required: false + required: false - type: textarea id: generalDesc attributes: @@ -35,7 +33,7 @@ body: description: Please provide a general description or bullet points about what you would like to see added. placeholder: "..." validations: - required: true + required: true - type: textarea id: example attributes: @@ -43,4 +41,4 @@ body: description: If you would like to suggest code samples please attach a working reproduction. placeholder: "..." validations: - required: false + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index b10530443..06c228009 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,4 +2,4 @@ blank_issues_enabled: true contact_links: - name: Support & Community π url: https://discord.com/invite/solidjs - about: 'This issue tracker is not for support questions. Our Discord server hosts the community of Solid users. Come join us to discuss Solid or find assistance!' + about: "This issue tracker is not for support questions. Our Discord server hosts the community of Solid users. Come join us to discuss Solid or find assistance!" diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1a6d7de3a..b9f88f0cc 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,6 +4,7 @@ - [ ] This PR references an issue (except for typos, broken links, or other minor problems) ### Description(required) + ### Related issues & labels diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index d5f890a02..17ced68c1 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -7,13 +7,12 @@ runs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 9 - run_install: false + version: 10 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 20 + node-version: 24 cache: pnpm - name: Install dependencies diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..35b5a9c30 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + assignees: + - "ladybluenotes" + group: + minor-patch: + applies-to: + - + patterns: + - "*" + update-types: + - "minor" + - "patch" diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml new file mode 100644 index 000000000..d3a2f92fb --- /dev/null +++ b/.github/workflows/autofix.yml @@ -0,0 +1,31 @@ +name: autofix.ci + +on: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: write + +jobs: + autofix: + name: autofix + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v5.0.0 + with: + fetch-depth: 0 + - name: Setup Tools + uses: ./.github/actions/install + - name: Fix lint issues + run: pnpm lint:fix + - name: Fix formatting + run: pnpm format + - name: Apply fixes + uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27 + with: + commit-message: "ci: apply automated fixes" diff --git a/.github/workflows/orama_sync.yml b/.github/workflows/orama_sync.yml index 1da8d02f4..ab1e5df91 100644 --- a/.github/workflows/orama_sync.yml +++ b/.github/workflows/orama_sync.yml @@ -8,19 +8,23 @@ on: paths: - "**.mdx" +permissions: + contents: read + pull-requests: read + jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - - uses: pnpm/action-setup@v3 + - uses: pnpm/action-setup@v4 with: - version: 9 + version: 10 - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20.x + node-version: 24.x cache: pnpm - name: Install dependencies run: pnpm i @@ -28,4 +32,5 @@ jobs: run: pnpm sync:orama env: ORAMA_PRIVATE_API_KEY: ${{ secrets.ORAMA_PRIVATE_API_KEY }} - ORAMA_PRIVATE_INDEX_ID: ${{ secrets.ORAMA_PRIVATE_INDEX_ID }} + ORAMA_DATASOURCE_ID: ${{ secrets.ORAMA_DATASOURCE_ID }} + ORAMA_PROJECT_ID: ${{ secrets.ORAMA_PROJECT_ID }} diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index ed34e8af5..9c4e09ba8 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -4,17 +4,21 @@ on: push: branches: - main - pull_request: branches: - main +permissions: + contents: read + actions: read + security-events: read + jobs: typecheck: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install tools & dependencies uses: ./.github/actions/install @@ -29,10 +33,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install tools & dependencies uses: ./.github/actions/install - name: Lint code run: pnpm check:lint + + - name: Check formatting + run: pnpm exec prettier . --check diff --git a/.prettierignore b/.prettierignore index 97ea5f250..5ed1e7ad7 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,5 @@ .solid dist *.min.* -package-lock.json \ No newline at end of file +package-lock.json +.github/ISSUE_TEMPLATE/OTHER.yml diff --git a/.prettierrc b/.prettierrc index 1d91c6a99..bfe5b02fa 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,5 +4,5 @@ "semi": true, "singleQuote": false, "useTabs": true, - "plugins": ["prettier-plugin-tailwindcss"] + "plugins": ["prettier-plugin-tailwindcss"] } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 26b11b8c7..1e94e9a22 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -133,13 +133,13 @@ Though it is not a hard requirement, we'd deeply appreciate if you could recomme 1. Create a dictionary file in `src/i18n/dictionaries/{locale}/ui.ts`. The name should follow our locale convention. - - language (ISO 639-1 - set 1): https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes - - country code(optional) (ISO 3166-1 alpha-2): https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 - - E.g.: Canadian French would be: `fr-ca` +- language (ISO 639-1 - set 1): https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes +- country code(optional) (ISO 3166-1 alpha-2): https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 +- E.g.: Canadian French would be: `fr-ca` 2. Add the `import` and language information to the objects in the barrel file: `./src/i18n/dictionaries/index.ts`. So it will be identified by the routing system, and an entry its added to the language dropdown. 3. Add the language to the `array` in `./scripts/collections/index.mjs` so internal files are created. -4. Add the important UI translations to `./src/i18n/dictionaries/{locale}/ui.ts` +4. Add the important UI translations to `./src/i18n/dictionaries/{locale}/ui.ts` 5. Add at least the index page `./src/routes/{locale}/index.mdx`, so others and yourself could see things in action. #### Adding translations to a supported language diff --git a/README.md b/README.md index 3c48337e6..035aea0fd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# Solid Docs +
+
+
Outcome 1
-Outcome 2
-Outcome 1
+Outcome 2
+Outcome 2
My Element
+ const myElement =My Element
; - returnMy Element
{ - myElement = el // el is created but not yet added to the DOM - }}> +
{ + myElement = el; // el is created but not yet added to the DOM + }} +> My Element
``` @@ -69,6 +85,7 @@ confirm it. ```tsx let myElement!: HTMLDivElement; ``` + ::: ### Signals as refs @@ -114,21 +131,21 @@ To access the `ref` in the child component, it is passed as a prop: ```tsx // Parent component -import { Canvas } from "./Canvas.jsx" +import { Canvas } from "./Canvas.jsx"; function ParentComponent() { - let canvasRef + let canvasRef; const animateCanvas = () => { // Manipulate the canvas using canvasRef... - } + }; return (I have a {animal.breed} named {animal.name}!
- ) -} + ); +}; ``` This means JavaScript content can be rendered on web pages based on an application's state or logic. @@ -98,6 +112,7 @@ In JSX files, HTML attributes are used much like regular HTML, with a few key di Click me! ``` + ::: ### JSX properties (props) @@ -110,17 +125,17 @@ They connect the component with the data it requires, for seamless data flows an - **Static props**: In Solid's JSX, static props are integrated directly into the HTML by cloning the template and using them as attributes. - - **Dynamic props**: - Dynamic props rely on state, allowing the content or properties to be dynamic. - An example is changing the style of an element in response to interactions within an application. - This can be expressed in the form of signals (`value={value()}`). +- **Dynamic props**: + Dynamic props rely on state, allowing the content or properties to be dynamic. + An example is changing the style of an element in response to interactions within an application. + This can be expressed in the form of signals (`value={value()}`). - **Data transfer**: Props are also used to fill components with data that comes from resources, like [`createResource`](/reference/basic-reactivity/create-resource) calls. This results in components that react in real-time to data changes. :::note -Expressions, whether fixed or dynamic, get applied *in the order defined within the JSX*. +Expressions, whether fixed or dynamic, get applied _in the order defined within the JSX_. This works for a wide range of DOM elements, but will not work with elements that require attributes to be defined in a special order, such as input types with `type='range'`. When order influences an element's behavior, users must define the expressions in the order that the element is expected. diff --git a/src/routes/configuration/environment-variables.mdx b/src/routes/configuration/environment-variables.mdx index 292a9210a..6ccf8813f 100644 --- a/src/routes/configuration/environment-variables.mdx +++ b/src/routes/configuration/environment-variables.mdx @@ -1,5 +1,19 @@ --- title: Environment variables +use_cases: >- + api keys, configuration, secrets management, build-time config, + environment-specific settings +tags: + - environment + - variables + - config + - vite + - secrets + - deployment +version: "1.0" +description: >- + Configure public and private environment variables in Solid apps using Vite's + built-in support for secure configuration. --- Solid is built on top of [Vite](https://vitejs.dev/), which offers a convenient way to handle environment variables. @@ -62,8 +76,8 @@ function MyComponent() { These variables should only be accessed in your backend code, so it's best not to use the `VITE_` prefix for them. Instead, use `process.env` to access them. Depending on the [Nitro preset](https://nitro.build/deploy) chosen, they'll be made available automatically or they will require an external dependency such as [dotenv](https://www.npmjs.com/package/dotenv). ```jsx -DB_HOST="somedb://192.110.0" -DB_PASSWORD = super_secret_password_hash +DB_HOST = "somedb://192.110.0"; +DB_PASSWORD = super_secret_password_hash; ``` To access them, within your backend code, use `process.env`. @@ -82,11 +96,10 @@ For an example, check the pseudo-code below. It is also possible to make `process.env` type-safe via the same `env.d.ts` file. ```typescript - declare namespace NodeJS { interface ProcessEnv { - readonly DB_URL: string - readonly DB_PASSWORD: string + readonly DB_URL: string; + readonly DB_PASSWORD: string; } } ``` diff --git a/src/routes/configuration/typescript.mdx b/src/routes/configuration/typescript.mdx index 61b1a82af..6206710e7 100644 --- a/src/routes/configuration/typescript.mdx +++ b/src/routes/configuration/typescript.mdx @@ -1,5 +1,20 @@ --- title: TypeScript +use_cases: >- + type safety, code reliability, large projects, team collaboration, api + documentation, migrating from javascript +tags: + - typescript + - types + - migration + - configuration + - jsx + - development + - tooling +version: "1.0" +description: >- + Learn to configure TypeScript with SolidJS for enhanced type safety, better + IDE support, and reliable component development. --- [TypeScript](https://www.typescriptlang.org/) is a superset of JavaScript that enhances code reliability and predictability through the introduction of [static types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html). @@ -58,7 +73,6 @@ typescript 2. Run the following command to generate a `tsconfig.json` file. - ```package-exec tsc --init ``` @@ -645,6 +659,7 @@ declare module "solid-js" { ``` :::note + New in v1.9.0 ::: @@ -685,8 +700,10 @@ To include specific native events, you can choose certain events (e.g. `mousemov ```ts declare module "solid-js" { namespace JSX { - interface CustomEvents - extends PickLoading...
-Loading...
+This is a toast
This is a toast
+Count: {count()}
+{user()?.email}
- className was deprecated in Solid 1.4 in favor of {" "}
- class.
+Note that `className` was deprecated in Solid 1.4 in favor of {" "} `class`.
:::
Alternatively, the `classList` pseudo-attribute lets you specify an object, where each key is a class and the value is treated as a boolean representing whether to include that class. For example (matching the last example):
diff --git a/src/routes/reference/jsx-attributes/innerhtml.mdx b/src/routes/reference/jsx-attributes/innerhtml.mdx
index 9c8162a8c..54083560d 100644
--- a/src/routes/reference/jsx-attributes/innerhtml.mdx
+++ b/src/routes/reference/jsx-attributes/innerhtml.mdx
@@ -1,5 +1,18 @@
---
title: innerHTML
+use_cases: >-
+ rendering html strings, dynamic html content, third-party html, legacy content
+ migration, sanitized markup
+tags:
+ - html
+ - dom
+ - security
+ - content
+ - markup
+version: "1.0"
+description: >-
+ Set raw HTML content in SolidJS elements using innerHTML attribute and render
+ HTML strings dynamically.
---
The `innerHTML` attribute is equivalent to the [`innerHTML` DOM property](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML).
diff --git a/src/routes/reference/jsx-attributes/on.mdx b/src/routes/reference/jsx-attributes/on.mdx
index c7e8ee4ec..14c47100a 100644
--- a/src/routes/reference/jsx-attributes/on.mdx
+++ b/src/routes/reference/jsx-attributes/on.mdx
@@ -1,6 +1,20 @@
---
-title: on:*
+title: "on:*"
order: 4
+use_cases: >-
+ custom events, non-bubbling events, capture phase handling, passive listeners,
+ special event options
+tags:
+ - events
+ - listeners
+ - dom
+ - capture
+ - passive
+ - handlers
+version: "1.0"
+description: >-
+ Attach non-delegated event handlers with on:* in SolidJS. Control capture,
+ passive, and once options for advanced event handling requirements.
---
For events with capital letters, listener options, or if you need to attach event handlers directly to a DOM element instead of optimized delegating via the document, use `on:*` in place of `on*`.
@@ -12,6 +26,7 @@ For events with capital letters, listener options, or if you need to attach even
This directly attaches an event handler (via [`addEventListener`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)) to the `div`.
:::note
+
New in v1.9.0
:::
diff --git a/src/routes/reference/jsx-attributes/on_.mdx b/src/routes/reference/jsx-attributes/on_.mdx
index c274af477..9f8f314c8 100644
--- a/src/routes/reference/jsx-attributes/on_.mdx
+++ b/src/routes/reference/jsx-attributes/on_.mdx
@@ -1,6 +1,20 @@
---
title: on*
order: 3
+use_cases: >-
+ user interactions, click handlers, form events, keyboard input, mouse events,
+ touch handling
+tags:
+ - events
+ - handlers
+ - interactions
+ - click
+ - input
+ - delegation
+version: "1.0"
+description: >-
+ Handle user events efficiently in SolidJS with onClick and other event
+ handlers. Optimized delegation system for improved performance at scale.
---
Event handlers in Solid typically take the form of `onclick` or `onClick` depending on style.
diff --git a/src/routes/reference/jsx-attributes/once.mdx b/src/routes/reference/jsx-attributes/once.mdx
index bd8633755..15d2e71e5 100644
--- a/src/routes/reference/jsx-attributes/once.mdx
+++ b/src/routes/reference/jsx-attributes/once.mdx
@@ -1,6 +1,19 @@
---
title: "@once"
order: 5
+use_cases: >-
+ performance optimization, static props, non-reactive values, compile-time
+ optimization, reducing overhead
+tags:
+ - optimization
+ - performance
+ - static
+ - compiler
+ - jsx
+version: "1.0"
+description: >-
+ Optimize SolidJS components with @once decorator for static values. Prevent
+ unnecessary reactive wrapping and improve runtime performance.
---
Solid's compiler uses a heuristic for reactive wrapping and lazy evaluation of JSX expressions. Does it contain a function call, a property access, or JSX? If yes we wrap it in a getter when passed to components or in an effect if passed to native elements.
diff --git a/src/routes/reference/jsx-attributes/prop.mdx b/src/routes/reference/jsx-attributes/prop.mdx
index 3195a2275..8dbdded12 100644
--- a/src/routes/reference/jsx-attributes/prop.mdx
+++ b/src/routes/reference/jsx-attributes/prop.mdx
@@ -1,6 +1,19 @@
---
-title: prop:*
+title: "prop:*"
order: 6
+use_cases: >-
+ dom properties, scrolltop manipulation, custom properties, property vs
+ attribute, direct property access
+tags:
+ - properties
+ - dom
+ - attributes
+ - manipulation
+ - custom
+version: "1.0"
+description: >-
+ Force DOM property assignment with prop:* in SolidJS. Set properties directly
+ instead of attributes for specific DOM manipulation needs.
---
Forces the prop to be treated as a property instead of an attribute.
diff --git a/src/routes/reference/jsx-attributes/ref.mdx b/src/routes/reference/jsx-attributes/ref.mdx
index 630806570..0ef8edbae 100644
--- a/src/routes/reference/jsx-attributes/ref.mdx
+++ b/src/routes/reference/jsx-attributes/ref.mdx
@@ -1,6 +1,20 @@
---
title: ref
order: 7
+use_cases: >-
+ dom access, element manipulation, focus management, measurements, third-party
+ libraries, animations
+tags:
+ - refs
+ - dom
+ - elements
+ - access
+ - manipulation
+ - components
+version: "1.0"
+description: >-
+ Access DOM elements directly in SolidJS with refs. Get references to rendered
+ elements for imperative operations and third-party integrations.
---
Refs are a way of getting access to underlying DOM elements in our JSX. While it is true one could just assign an element to a variable, it is more optimal to leave components in the flow of JSX. Refs are assigned at render time but before the elements are connected to the DOM. They come in 2 flavors.
@@ -22,12 +36,12 @@ Refs can also be used on Components. They still need to be attached on the other
```tsx
function MyComp(props) {
- return
+ return ;
}
function App() {
- let myDiv
- onMount(() => console.log(myDiv.clientWidth))
- return Count: {count()}
+