@inglorious/web 4.0.2 → 4.0.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/README.md CHANGED
@@ -312,6 +312,37 @@ The `mount` function subscribes to the store and automatically re-renders your t
312
312
 
313
313
  ---
314
314
 
315
+ ## JSX Support
316
+
317
+ If you prefer JSX syntax over template literals, you can use **[`@inglorious/vite-plugin-jsx`](https://www.npmjs.com/package/@inglorious/vite-plugin-jsx)**.
318
+
319
+ This Vite plugin transforms standard JSX/TSX into optimized `lit-html` templates at compile time. You get the familiar developer experience of JSX without React's runtime, hooks, or VDOM overhead.
320
+
321
+ To use it:
322
+
323
+ 1. Install the plugin: `npm install -D @inglorious/vite-plugin-jsx`
324
+ 2. Add it to your `vite.config.js`
325
+ 3. Write your render functions using JSX
326
+
327
+ ```jsx
328
+ export const counter = {
329
+ render(entity, api) {
330
+ return (
331
+ <div className="counter">
332
+ <span>Count: {entity.value}</span>
333
+ <button onClick={() => api.notify(`#${entity.id}:increment`)}>
334
+ +1
335
+ </button>
336
+ </div>
337
+ )
338
+ },
339
+ }
340
+ ```
341
+
342
+ See the plugin documentation for full details on control flow, attributes, and engine components.
343
+
344
+ ---
345
+
315
346
  ## Redux DevTools Integration
316
347
 
317
348
  `@inglorious/web` ships with first-class support for the **Redux DevTools Extension**, allowing you to:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/web",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
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",
@@ -1,52 +1,52 @@
1
- .iw-select {
2
- position: relative;
3
- display: inline-block;
4
- width: 100%;
5
-
6
- .iw-select-control {
7
- display: flex;
8
- align-items: center;
9
-
10
- cursor: pointer;
11
- user-select: none;
12
-
13
- .iw-select-value,
14
- .iw-select-placeholder,
15
- .iw-select-multi-value {
16
- flex: 1;
17
- }
18
-
19
- .iw-select-multi-value {
20
- display: flex;
21
- flex-wrap: wrap;
22
-
23
- .iw-select-multi-value-tag {
24
- display: flex;
25
- align-items: center;
26
- }
27
- }
28
- }
29
-
30
- .iw-select-dropdown {
31
- position: absolute;
32
- top: 100%;
33
- left: 0;
34
- right: 0;
35
- z-index: 1000;
36
- display: flex;
37
- flex-direction: column;
38
-
39
- .iw-select-dropdown-search {
40
- width: 100%;
41
- }
42
-
43
- .iw-select-dropdown-options {
44
- .iw-select-dropdown-options-option {
45
- display: flex;
46
- align-items: center;
47
- cursor: pointer;
48
- user-select: none;
49
- }
50
- }
51
- }
52
- }
1
+ .iw-select {
2
+ position: relative;
3
+ display: inline-block;
4
+ width: 100%;
5
+
6
+ .iw-select-control {
7
+ display: flex;
8
+ align-items: center;
9
+
10
+ cursor: pointer;
11
+ user-select: none;
12
+
13
+ .iw-select-value,
14
+ .iw-select-placeholder,
15
+ .iw-select-multi-value {
16
+ flex: 1;
17
+ }
18
+
19
+ .iw-select-multi-value {
20
+ display: flex;
21
+ flex-wrap: wrap;
22
+
23
+ .iw-select-multi-value-tag {
24
+ display: flex;
25
+ align-items: center;
26
+ }
27
+ }
28
+ }
29
+
30
+ .iw-select-dropdown {
31
+ position: absolute;
32
+ top: 100%;
33
+ left: 0;
34
+ right: 0;
35
+ z-index: 1000;
36
+ display: flex;
37
+ flex-direction: column;
38
+
39
+ .iw-select-dropdown-search {
40
+ width: 100%;
41
+ }
42
+
43
+ .iw-select-dropdown-options {
44
+ .iw-select-dropdown-options-option {
45
+ display: flex;
46
+ align-items: center;
47
+ cursor: pointer;
48
+ user-select: none;
49
+ }
50
+ }
51
+ }
52
+ }
@@ -1,83 +1,83 @@
1
- .iw-table {
2
- .iw-table-header {
3
- border-bottom: 1px solid grey;
4
- padding: 1em 0;
5
- row-gap: 1em;
6
- }
7
-
8
- .iw-table-header-row {
9
- align-items: flex-start;
10
- column-gap: 1em;
11
- }
12
-
13
- .iw-table-header-column {
14
- row-gap: 0.5em;
15
- }
16
-
17
- .iw-table-header-title {
18
- font-weight: bold;
19
- white-space: nowrap;
20
- }
21
-
22
- .iw-table-body {
23
- max-height: 35em;
24
- overflow: auto;
25
- border-bottom: 1px solid grey;
26
- }
27
-
28
- .iw-table-row {
29
- align-items: center;
30
- column-gap: 1em;
31
- }
32
-
33
- .iw-table-row-even {
34
- background-color: aliceblue;
35
- }
36
-
37
- .iw-table-row-selected {
38
- border-left: 1px solid cornflowerblue;
39
- border-right: 1px solid cornflowerblue;
40
- }
41
-
42
- :not(.iw-table-row-selected) + .iw-table-row-selected {
43
- border-top: 1px solid cornflowerblue;
44
- margin-top: -1px;
45
- }
46
-
47
- .iw-table-row-selected + :not(.iw-table-row-selected) {
48
- border-top: 1px solid cornflowerblue;
49
- margin-top: -1px;
50
- }
51
-
52
- .iw-table-cell {
53
- padding: 1em;
54
- }
55
-
56
- .iw-table-cell-number,
57
- .iw-table-cell-date {
58
- text-align: right;
59
- }
60
-
61
- .iw-table-cell-boolean {
62
- text-align: center;
63
- }
64
-
65
- .iw-table-footer {
66
- padding: 1em 0;
67
- }
68
-
69
- .iw-table-footer-row {
70
- justify-content: space-between;
71
- align-items: center;
72
- column-gap: 1em;
73
- }
74
-
75
- .iw-table-page-input {
76
- min-width: 4em;
77
- text-align: right;
78
- }
79
-
80
- .iw-table-pagination-button {
81
- white-space: nowrap;
82
- }
83
- }
1
+ .iw-table {
2
+ .iw-table-header {
3
+ border-bottom: 1px solid grey;
4
+ padding: 1em 0;
5
+ row-gap: 1em;
6
+ }
7
+
8
+ .iw-table-header-row {
9
+ align-items: flex-start;
10
+ column-gap: 1em;
11
+ }
12
+
13
+ .iw-table-header-column {
14
+ row-gap: 0.5em;
15
+ }
16
+
17
+ .iw-table-header-title {
18
+ font-weight: bold;
19
+ white-space: nowrap;
20
+ }
21
+
22
+ .iw-table-body {
23
+ max-height: 35em;
24
+ overflow: auto;
25
+ border-bottom: 1px solid grey;
26
+ }
27
+
28
+ .iw-table-row {
29
+ align-items: center;
30
+ column-gap: 1em;
31
+ }
32
+
33
+ .iw-table-row-even {
34
+ background-color: aliceblue;
35
+ }
36
+
37
+ .iw-table-row-selected {
38
+ border-left: 1px solid cornflowerblue;
39
+ border-right: 1px solid cornflowerblue;
40
+ }
41
+
42
+ :not(.iw-table-row-selected) + .iw-table-row-selected {
43
+ border-top: 1px solid cornflowerblue;
44
+ margin-top: -1px;
45
+ }
46
+
47
+ .iw-table-row-selected + :not(.iw-table-row-selected) {
48
+ border-top: 1px solid cornflowerblue;
49
+ margin-top: -1px;
50
+ }
51
+
52
+ .iw-table-cell {
53
+ padding: 1em;
54
+ }
55
+
56
+ .iw-table-cell-number,
57
+ .iw-table-cell-date {
58
+ text-align: right;
59
+ }
60
+
61
+ .iw-table-cell-boolean {
62
+ text-align: center;
63
+ }
64
+
65
+ .iw-table-footer {
66
+ padding: 1em 0;
67
+ }
68
+
69
+ .iw-table-footer-row {
70
+ justify-content: space-between;
71
+ align-items: center;
72
+ column-gap: 1em;
73
+ }
74
+
75
+ .iw-table-page-input {
76
+ min-width: 4em;
77
+ text-align: right;
78
+ }
79
+
80
+ .iw-table-pagination-button {
81
+ white-space: nowrap;
82
+ }
83
+ }
package/types/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export * from "./form"
2
2
  export * from "./list"
3
+ export * from "./lit-html"
3
4
  export * from "./mount"
4
5
  export * from "./router"
5
6
  export * from "./select"
7
+ export * from "./store"
6
8
  export * from "./table"
@@ -0,0 +1,9 @@
1
+ export { html, TemplateResult } from "lit-html"
2
+
3
+ export { choose } from "lit-html/directives/choose"
4
+ export { classMap } from "lit-html/directives/class-map"
5
+ export { ref } from "lit-html/directives/ref"
6
+ export { repeat } from "lit-html/directives/repeat"
7
+ export { styleMap } from "lit-html/directives/style-map"
8
+ export { unsafeHTML } from "lit-html/directives/unsafe-html"
9
+ export { when } from "lit-html/directives/when"
package/types/mount.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { TemplateResult } from "lit-html"
2
- import type { Store, Api as StoreApi } from "@inglorious/store"
2
+ import type { BaseEntity, Store, Api as StoreApi } from "@inglorious/store"
3
3
 
4
4
  export type Api = StoreApi & {
5
5
  /**
@@ -21,8 +21,8 @@ export type Api = StoreApi & {
21
21
  * @param element The DOM element to mount the template to.
22
22
  * @returns An unsubscribe function.
23
23
  */
24
- export function mount(
25
- store: Store,
24
+ export function mount<Entity = BaseEntity, State = BaseState>(
25
+ store: Store<Entity, State>,
26
26
  renderFn: (api: Api) => TemplateResult | null,
27
27
  element: HTMLElement | DocumentFragment,
28
28
  ): () => void
@@ -0,0 +1,14 @@
1
+ export {
2
+ BaseEntity,
3
+ EntitiesState,
4
+ Event,
5
+ Middleware,
6
+ createStore,
7
+ TypesConfig,
8
+ } from "@inglorious/store"
9
+
10
+ export { createSelector } from "@inglorious/store/select"
11
+ export { trigger } from "@inglorious/store/test"
12
+
13
+ export { createDevtools } from "@inglorious/store/client/devtools"
14
+ export { multiplayerMiddleware } from "@inglorious/store/client/multiplayer-middleware"