Skip to content

Commit 284600d

Browse files
authored
Merge pull request #739 from SolidOS/milestone3m
Milestone3m [WiP] v3.1.0
2 parents 0ea2510 + 22be2fa commit 284600d

67 files changed

Lines changed: 21578 additions & 17770 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ docs/api
99
examples/storybook
1010
.history/
1111
docs/form-examples/solid-ui.js
12+
.tsbuildinfo

README.md

Lines changed: 128 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ See [Forms introduction](./docs/FormsReadme.md) for UI vocabulary implementation
1717
- [Use Directly in Browser](#use-directly-in-a-browser)
1818
- [UMD Bundle](#umd-bundle-global-variable)
1919
- [ESM Bundle](#esm-bundle-import-as-module)
20-
- [Development](#development-new-components)
20+
- [Web Components](#web-components)
21+
- [solid-ui-header](#solid-ui-header)
22+
- [Development](#development)
2123
- [Testing](#adding-tests)
2224
- [Further Documentation](#further-documentation)
25+
- [Generative AI usage](#generative-ai-usage)
2326

2427

2528
## Getting started
@@ -66,6 +69,8 @@ Solid-UI provides both **UMD** and **ESM** bundles for direct browser usage. Bot
6669

6770
### UMD Bundle (Global Variable)
6871

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+
6974
Load via `<script>` tags and access through global variables `window.$rdf`, `window.SolidLogic`, and `window.UI`.
7075

7176
```html
@@ -253,7 +258,87 @@ Use import maps for cleaner module specifiers:
253258
</html>
254259
```
255260

256-
### Development new components
261+
## Web Components
262+
263+
solid-ui ships self-contained Lit-based custom elements as subpath exports. Each component is independently importable, registers its custom element on import, and ships its own styles encapsulated in a Shadow DOM.
264+
265+
> Component UMD bundles do not export a shared global like `window.UI`. They only register the custom element on import, while the legacy main bundle still provides the `UI` global.
266+
267+
### solid-ui-header
268+
269+
A header bar with branding, auth state (logged-out / logged-in), an account dropdown, an optional logout icon, and a desktop-only help menu.
270+
271+
**Subpath export:** `solid-ui/components/header`
272+
273+
```typescript
274+
import { Header } from 'solid-ui/components/header'
275+
import type { HeaderMenuItem, HeaderAccountMenuItem, HeaderAuthState } from 'solid-ui/components/header'
276+
```
277+
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" icon="https://example.com/login-icon.svg"></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" icon="https://example.com/icon.svg"></solid-ui-signup-button>
319+
```
320+
321+
### Component build pipeline
322+
323+
Web components use a two-stage build to produce a clean public runtime layout while keeping internal TypeScript artifacts separate:
324+
325+
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`.
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.
328+
329+
This keeps the `package.json` subpath export fully aligned while exposing only the public `dist/components/...` layout:
330+
331+
```json
332+
"./components/header": {
333+
"types": "./dist/components/header/index.d.ts",
334+
"import": "./dist/components/header/index.esm.js",
335+
"require": "./dist/components/header/index.js"
336+
}
337+
```
338+
339+
Consumers never import from `dist/v2/components/...`; that path is an internal build artifact only.
340+
341+
## Development
257342

258343
When developing a component in solid-ui you can test it in isolation using storybook
259344

@@ -286,3 +371,44 @@ The following document gives guidance on how to add and perform testing in solid
286371
## Further documentation
287372

288373
- [Some code know-how](https://github.com/SolidOS/solidos/wiki/2.-Solid-UI-know-how)
374+
375+
## Generative AI usage
376+
The SolidOS team is using GitHub Copilot integrated in Visual Studio Code.
377+
We have added comments in the code to make it explicit which parts are 100% written by AI.
378+
379+
### Prompt usage history:
380+
381+
* Raptor mini: If I want to make the header a web component with a self contained CSS which only consumes CSS variables from a theme, how would I do this?
382+
383+
* Raptor mini: Go ahead and create a header web component, for backward compatibility keep the current code too.
384+
In the new header component I need to be flexible and receive from consumer - the layout (mobile or desktop) and the theme (light or dark) and its according CSS variables for light to dark.
385+
386+
* Raptor mini: Propose code. how about webpack config for distribution?
387+
388+
* Raptor mini: pls add a readme in the component documenting it usage and test and all
389+
390+
* Raptor mini: the helpMenuList should be menu items inside the help icon drop down menu
391+
392+
* Raptor mini: When I am not logged in I want the header to display: Log in button and Sign Up button.
393+
When the user is logged in, there is only one button, a drop down button called Accounts. The icon of the button is the avatar of the profile and it displays a list of available accounts of the user.
394+
I want this all to be presented flexible in the component.
395+
396+
* Claude Sonnet 4.6: create a LitElement also for the signupButton in the SignupButton.ts based on the signup.js code and wire it into the header like you did the loginButton.
397+
398+
* Raptor mini: when we are on layout mobile we do not want to display the help menu at all.
399+
400+
* Raptor mini: Create for me a footer Lit Component in tsy style of the components I have and under v2. Take the code from this index.ts to start with.
401+
402+
* Raptor mini: Good. Now, I want the footer to be a rectangular with round corners, grey background and it should have an adjustable position.
403+
404+
* Raptor mini: The content of the footer should be different upon loggedin or not.
405+
If not logged in, it should say:
406+
Title Public View
407+
You are viewving this profile as a guest,
408+
And if logged in:
409+
Title: Logged in View
410+
You are logged in as nameOfLoggedIn user.
411+
412+
* Raptor mini: add a readme to the Footer component with example.
413+
414+
* Claude Sonnet 4.6: Make the dop down as a list under the input field and entlarge the pop up, make it higher, adjustable to fit the drop down. And make the drop down arrow area larger

__mocks__/styleMock.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Jest mock for CSS imports
2+
module.exports = {}

babel.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
browsers: ['> 1%', 'last 3 versions', 'not dead']
66
}
77
}],
8-
'@babel/preset-typescript',
8+
['@babel/preset-typescript', { allowDeclareFields: true }],
99
],
1010
plugins: [
1111
'@babel/plugin-transform-runtime'

jest.config.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ export default {
1111
'^.+\\.(mjs|[tj]sx?)$': ['babel-jest', { configFile: './babel.config.mjs' }],
1212
},
1313
transformIgnorePatterns: [
14-
'<rootDir>/node_modules/(?!(lit-html|@noble/curves|@noble/hashes|@exodus/bytes|uuid|jsdom|parse5|@asamuzakjp/css-color|@csstools)/)',
14+
'<rootDir>/node_modules/(?!(lit|lit-html|lit-element|@lit|@lit-labs|@lit-labs/ssr-dom-shim|@lit/reactive-element|@noble/curves|@noble/hashes|@exodus/bytes|uuid|jsdom|parse5|@asamuzakjp/css-color|@csstools)/)',
1515
],
1616
setupFilesAfterEnv: ['./test/helpers/setup.ts'],
17+
moduleNameMapper: {
18+
'^.+\\.css$': '<rootDir>/__mocks__/styleMock.js'
19+
},
1720
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],
1821
roots: ['<rootDir>/src', '<rootDir>/test', '<rootDir>/__mocks__'],
1922
}

0 commit comments

Comments
 (0)