Skip to content

Commit 6994072

Browse files
committed
aligned component distribution for build and watch
1 parent ea946fa commit 6994072

5 files changed

Lines changed: 17905 additions & 17838 deletions

File tree

README.md

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ Solid-UI provides both **UMD** and **ESM** bundles for direct browser usage. Bot
6969

7070
### UMD Bundle (Global Variable)
7171

72+
If you use the legacy UMD bundle (`solid-ui.js` / `solid-ui.min.js`), `rdflib` must define `window.$rdf` before `solid-ui` loads. If `rdflib` is missing, `solid-ui` will throw `ReferenceError: $rdf is not defined`.
73+
7274
Load via `<script>` tags and access through global variables `window.$rdf`, `window.SolidLogic`, and `window.UI`.
7375

7476
```html
@@ -273,17 +275,58 @@ import { Header } from 'solid-ui/components/header'
273275
import type { HeaderMenuItem, HeaderAccountMenuItem, HeaderAuthState } from 'solid-ui/components/header'
274276
```
275277

276-
Importing this module automatically registers `<solid-ui-header>` as a custom element. See [src/v2/components/header/README.md](src/v2/components/header/README.md) for the full API reference and usage examples.
278+
```html
279+
<solid-ui-header theme="dark" layout="desktop" brand-link="/">
280+
<a slot="help-menu" href="/help">Help</a>
281+
</solid-ui-header>
282+
```
283+
284+
Importing this module automatically registers `<solid-ui-header>` as a custom element.
285+
286+
### solid-ui-login-button
287+
288+
A standalone login button that encapsulates the Solid OIDC login flow and emits `login-success` when authentication succeeds.
289+
290+
**Subpath export:** `solid-ui/components/login-button`
291+
292+
```typescript
293+
import { LoginButton } from 'solid-ui/components/login-button'
294+
```
295+
296+
```html
297+
<solid-ui-login-button label="Log in" issuer-url="https://solidcommunity.net"></solid-ui-login-button>
298+
```
299+
300+
```typescript
301+
const loginButton = document.querySelector('solid-ui-login-button') as LoginButton
302+
loginButton.addEventListener('login-success', (event: CustomEvent) => {
303+
console.log('Logged in as', event.detail.webId)
304+
})
305+
```
306+
307+
### solid-ui-signup-button
308+
309+
A standalone sign-up button that opens a signup URL in a new browser tab.
310+
311+
**Subpath export:** `solid-ui/components/signup-button`
312+
313+
```typescript
314+
import { SignupButton } from 'solid-ui/components/signup-button'
315+
```
316+
317+
```html
318+
<solid-ui-signup-button label="Get a Pod" signup-url="https://solidproject.org/get_a_pod"></solid-ui-signup-button>
319+
```
277320

278321
### Component build pipeline
279322

280-
Web components use a two-stage build to produce a clean public layout without exposing internal source paths:
323+
Web components use a two-stage build to produce a clean public runtime layout while keeping internal TypeScript artifacts separate:
281324

282325
1. **webpack** (`npm run build-dist`) bundles each component entrypoint and emits the runtime files to `dist/components/<name>/index.js` and `dist/components/<name>/index.esm.js`.
283-
2. **tsc** (`npm run build-js`) emits declaration files mirroring the source tree, so they land at `dist/v2/components/<name>/index.d.ts`.
284-
3. **`scripts/build-component-dts.mjs`** (runs automatically after tsc as part of `postbuild-js`) writes a thin re-export wrapper at `dist/components/<name>/index.d.ts`, bridging the tsc output to the public package location.
326+
2. **tsc** (`npm run build-js`) emits internal declaration and JS artifacts mirroring the source tree under `dist/v2/components/<name>/`.
327+
3. **`scripts/build-component-dts.mjs`** (runs automatically after tsc as part of `postbuild-js`) writes thin public declaration wrappers at `dist/components/<name>/index.d.ts`, re-exporting from the internal `dist/v2/components/<name>/` output.
285328

286-
This keeps the `package.json` subpath export fully aligned:
329+
This keeps the `package.json` subpath export fully aligned while exposing only the public `dist/components/...` layout:
287330

288331
```json
289332
"./components/header": {
@@ -293,7 +336,7 @@ This keeps the `package.json` subpath export fully aligned:
293336
}
294337
```
295338

296-
Consumers never see the internal `v2` path; it is an implementation detail of the source tree.
339+
Consumers never import from `dist/v2/components/...`; that path is an internal build artifact only.
297340

298341
## Development
299342

0 commit comments

Comments
 (0)