@inglorious/web 4.0.9 → 4.0.10

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.
Files changed (2) hide show
  1. package/README.md +99 -10
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -96,8 +96,15 @@ This framework is ideal for both small apps and large business UIs.
96
96
  ## When NOT to Use Inglorious Web
97
97
 
98
98
  - You're frequently mutating thousands of items without virtualization (though our `list` component handles this elegantly)
99
- - You're building a library that needs to be framework-agnostic
100
- - Your team is already deeply invested in React/Vue/Angular
99
+ - You need framework-agnostic components for users who might not use Inglorious (use Web Components instead)
100
+ - Your team is already deeply invested in React/Vue/Angular and migration costs outweigh benefits
101
+
102
+ ## When Inglorious Web EXCELS
103
+
104
+ - Building **internal component libraries** - Types are more customizable than React components
105
+ - Creating **design systems** - Spread, override, and compose behaviors freely
106
+ - Building **pattern libraries** - Ship pre-configured entity types that users can adapt
107
+ - Apps where **predictable state flow** matters more than ecosystem size
101
108
 
102
109
  ---
103
110
 
@@ -145,14 +152,16 @@ This makes it especially suitable for:
145
152
 
146
153
  ### TL;DR Quick Comparison
147
154
 
148
- | Framework | Reactivity | Compiler | Component State | Bundle Size | Learning Curve |
149
- | -------------- | -------------- | -------- | --------------- | ----------- | -------------- |
150
- | Inglorious Web | Event-based | None | No (store only) | Tiny | Very Low |
151
- | React | VDOM diffing | None | Yes | Large | Medium/High |
152
- | Vue | Proxy-based | Optional | Yes | Medium | Medium |
153
- | Svelte | Compiler magic | Required | Yes | Small | Medium |
154
- | SolidJS | Fine signals | None | No (runs once) | Tiny | Medium/High |
155
- | Qwik | Resumable | Required | Yes | Small | Very High |
155
+ | Framework | Reactivity | Build Transform | Runtime Compiler | Component State | Bundle Size | Learning Curve |
156
+ | -------------- | -------------- | ---------------- | ---------------- | --------------- | ----------- | -------------- |
157
+ | Inglorious Web | Event-based | None required | No | No (store only) | Tiny | Very Low |
158
+ | React | VDOM diffing | JSX + optional\* | No | Yes | Large | Medium/High |
159
+ | Vue | Proxy-based | SFC (optional) | Available | Yes | Medium | Medium |
160
+ | Svelte | Compiler magic | Required | No | Yes | Small | Medium |
161
+ | SolidJS | Fine signals | JSX only | No | No (runs once) | Tiny | Medium/High |
162
+ | Qwik | Resumable | Required | No | Yes | Small | Very High |
163
+
164
+ \*React Compiler (stable 2024+) provides automatic memoization
156
165
 
157
166
  <details>
158
167
  <summary><strong>Click to expand detailed framework comparisons</strong></summary>
@@ -1299,6 +1308,86 @@ See `src/list.js` in the package for the implementation details and the `example
1299
1308
 
1300
1309
  ---
1301
1310
 
1311
+ ## Building Component Libraries with Inglorious Web
1312
+
1313
+ **Inglorious types are uniquely suited for component libraries** because they're fully customizable through JavaScript's spread operator.
1314
+
1315
+ ### The Pattern
1316
+
1317
+ **Library publishes types:**
1318
+
1319
+ ```javascript
1320
+ // @acme/design-system/table.js
1321
+ export const table = {
1322
+ render(entity, api) {
1323
+ const type = api.getType(entity.type)
1324
+
1325
+ return html`
1326
+ <table>
1327
+ ${entity.data.map((row) => type.renderRow(entity, row, api))}
1328
+ </table>
1329
+ `
1330
+ },
1331
+
1332
+ renderRow(entity, row, api) {
1333
+ return html`<tr>
1334
+ ${row.name}
1335
+ </tr>`
1336
+ },
1337
+
1338
+ rowClick(entity, row) {
1339
+ entity.selectedRow = row
1340
+ },
1341
+ }
1342
+ ```
1343
+
1344
+ **Users customize freely:**
1345
+
1346
+ ```javascript
1347
+ import { table } from "@acme/design-system/table"
1348
+
1349
+ // Use as-is
1350
+ const simpleTable = { ...table }
1351
+
1352
+ // Override methods
1353
+ const customTable = {
1354
+ ...table,
1355
+ renderRow(entity, row, api) {
1356
+ return html`<tr class="custom">
1357
+ ${row.name} - ${row.email}
1358
+ </tr>`
1359
+ },
1360
+ }
1361
+
1362
+ // Compose with behaviors
1363
+ import { sortable, exportable } from "@acme/design-system/behaviors"
1364
+
1365
+ const advancedTable = [
1366
+ table,
1367
+ sortable,
1368
+ exportable,
1369
+ {
1370
+ rowClick(entity, row) {
1371
+ console.log("Custom click handler", row)
1372
+ },
1373
+ },
1374
+ ]
1375
+ ```
1376
+
1377
+ ### Why This Is Better Than React Components
1378
+
1379
+ | Feature | React Components | Inglorious Types |
1380
+ | -------------------------- | ------------------------------ | ----------------------------------------- |
1381
+ | Customize rendering | Only if `render` prop exposed | Override `render()` method directly |
1382
+ | Customize behavior | Only if callback props exposed | Override any method |
1383
+ | Compose multiple libraries | Wrapper hell / HOCs | Array composition `[type1, type2, {...}]` |
1384
+ | Access internals | Private - must fork | Public - spread and override |
1385
+ | Type safety | Props interface | Entity schema + method signatures |
1386
+
1387
+ **Users get complete control** without forking your library. They can override rendering, behavior, or both—down to individual methods.
1388
+
1389
+ ---
1390
+
1302
1391
  ## Using Third-Party Web Components
1303
1392
 
1304
1393
  Inglorious Web works seamlessly with any Web Component library, such as Shoelace, Material Web Components, or Lion. Thanks to lit-html's efficient diffing algorithm, Web Components maintain their internal state even when the full tree re-renders - the component only updates when its properties change.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/web",
3
- "version": "4.0.9",
3
+ "version": "4.0.10",
4
4
  "description": "A new web framework that leverages the power of the Inglorious Store combined with the performance and simplicity of lit-html.",
5
5
  "author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
6
6
  "license": "MIT",
@@ -68,8 +68,8 @@
68
68
  "dependencies": {
69
69
  "@lit-labs/ssr-client": "^1.1.8",
70
70
  "lit-html": "^3.3.1",
71
- "@inglorious/utils": "3.7.2",
72
- "@inglorious/store": "9.0.1"
71
+ "@inglorious/store": "9.0.1",
72
+ "@inglorious/utils": "3.7.2"
73
73
  },
74
74
  "devDependencies": {
75
75
  "prettier": "^3.6.2",