@alistigo/artifact-list 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +84 -0
- package/dist/index.umd.js +42 -0
- package/dist/index.umd.js.map +1 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mikael Labrut
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @alistigo/artifact-list
|
|
2
|
+
|
|
3
|
+
Self-contained UMD bundle for embedding the Alistigo list widget in Claude HTML artifacts or any web page. Bundles React, Lingui (English), and all Alistigo packages — no external dependencies required.
|
|
4
|
+
|
|
5
|
+
Auto-detects Claude artifact runtime and uses `window.storage` for persistence; falls back to `localStorage` elsewhere.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
### Auto-mount (default)
|
|
10
|
+
|
|
11
|
+
Include the script — the widget mounts itself at the end of `<body>`:
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<script src="https://cdn.jsdelivr.net/npm/@alistigo/artifact-list@0.1.0/dist/index.umd.js"></script>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Configure with a script tag
|
|
18
|
+
|
|
19
|
+
Place a JSON config tag **before** the bundle script to customise the widget:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<script type="application/json" id="alistigo-config">
|
|
23
|
+
{ "container": "#app", "document": { ... } }
|
|
24
|
+
</script>
|
|
25
|
+
<script src="https://cdn.jsdelivr.net/npm/@alistigo/artifact-list@0.1.0/dist/index.umd.js"></script>
|
|
26
|
+
|
|
27
|
+
<div id="app"></div>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
| Field | Type | Description |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `container` | CSS selector | Target element. A `<div>` is appended to `<body>` if omitted. |
|
|
33
|
+
| `document` | `AlistigoDocument` | Pre-seeded list document. Defaults to an empty list. |
|
|
34
|
+
|
|
35
|
+
### Explicit mount (advanced)
|
|
36
|
+
|
|
37
|
+
For programmatic control, call `Alistigo.mount()` directly. **Do not mix with auto-mount** — combining the two creates two widget instances.
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<div id="app"></div>
|
|
41
|
+
<script src="https://cdn.jsdelivr.net/npm/@alistigo/artifact-list@latest/dist/index.umd.js"></script>
|
|
42
|
+
<script>
|
|
43
|
+
Alistigo.mount('#app', { document: myAlistigoDocument });
|
|
44
|
+
</script>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
If `mount()` is called before the DOM is ready it will defer automatically — no manual `DOMContentLoaded` wrapping needed.
|
|
48
|
+
|
|
49
|
+
**Note:** Locale is baked at build time (English). The `locale` option has no effect at runtime.
|
|
50
|
+
|
|
51
|
+
## CSS bundling
|
|
52
|
+
|
|
53
|
+
The bundle includes all CSS — no separate stylesheet is needed.
|
|
54
|
+
|
|
55
|
+
**How it works:**
|
|
56
|
+
- Styling uses [Tailwind CSS v4](https://tailwindcss.com/) via `@tailwindcss/vite`.
|
|
57
|
+
- At build time, the Vite plugin scans every TypeScript/TSX source file reachable from the entry point, collects all Tailwind utility class names, and generates a CSS string containing only the classes actually used.
|
|
58
|
+
- Vite's `cssCodeSplit: false` option keeps that CSS inside the JS bundle instead of emitting a separate `.css` file. When the script executes, it injects a `<style>` tag into the page.
|
|
59
|
+
- Design tokens (Radix Colors scales, semantic colour variables) are defined in `@alistigo/list-components-react/src/styles/globals.css` and bundled the same way.
|
|
60
|
+
|
|
61
|
+
**Why not a separate CSS file?**
|
|
62
|
+
|
|
63
|
+
The primary target is Claude HTML artifacts, which run inside a sandboxed `<iframe>`. The iframe has no build pipeline and no way to load an external stylesheet that must stay version-locked to the script. A single `<script>` tag is the only reliable delivery mechanism. `cssCodeSplit: false` makes the bundle truly drop-in.
|
|
64
|
+
|
|
65
|
+
If you embed this bundle in a page that already uses Tailwind v4, there is no conflict — the injected styles are scope-independent utilities.
|
|
66
|
+
|
|
67
|
+
## Source structure
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
src/
|
|
71
|
+
components/
|
|
72
|
+
App.tsx — root React component; default export App
|
|
73
|
+
ListBody.tsx — presentational list body; default export ListBody
|
|
74
|
+
utils/
|
|
75
|
+
container.ts — resolveContainer, resolveAutoMountTarget (DOM helpers)
|
|
76
|
+
document.ts — makeDefaultDocument; default export; pure data factory
|
|
77
|
+
auto-mount.ts — autoMount; default export; AutoMountConfig type
|
|
78
|
+
i18n.ts — bootI18n; default export
|
|
79
|
+
mount.ts — mount; default export; MountOptions type
|
|
80
|
+
index.tsx — bundle entry; re-exports public API; fires DOMContentLoaded
|
|
81
|
+
vite-env.d.ts — Vite + Lingui virtual module type declarations
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Convention:** each non-entry file carries `export default` for its single primary export (the function or component that matches the file name). Files with two equally important public helpers (`container.ts`) use named exports only. The entry `index.tsx` does not follow this rule — it is a re-export barrel.
|