@inglorious/web 2.1.0 → 2.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/web",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
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",
@@ -38,13 +38,13 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "lit-html": "^3.3.1",
41
- "@inglorious/store": "7.1.0",
41
+ "@inglorious/store": "7.1.1",
42
42
  "@inglorious/utils": "3.7.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "prettier": "^3.6.2",
46
46
  "vite": "^7.1.3",
47
- "@inglorious/eslint-config": "1.0.1"
47
+ "@inglorious/eslint-config": "1.1.0"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">= 22"
package/src/index.js CHANGED
@@ -11,3 +11,4 @@ export { choose } from "lit-html/directives/choose.js"
11
11
  export { classMap } from "lit-html/directives/class-map.js"
12
12
  export { ref } from "lit-html/directives/ref.js"
13
13
  export { repeat } from "lit-html/directives/repeat.js"
14
+ export { styleMap } from "lit-html/directives/style-map.js"
package/src/list.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { html } from "lit-html"
2
2
  import { ref } from "lit-html/directives/ref.js"
3
+ import { styleMap } from "lit-html/directives/style-map.js"
3
4
 
4
5
  const LIST_START = 0
5
6
  const PRETTY_INDEX = 1
@@ -69,7 +70,7 @@ export const list = {
69
70
 
70
71
  return html`
71
72
  <div
72
- style="height: ${viewportHeight}px; overflow: auto"
73
+ style=${styleMap({ height: `${viewportHeight}px`, overflow: "auto" })}
73
74
  @scroll=${(e) => api.notify(`#${entity.id}:scroll`, e.target)}
74
75
  ${ref((el) => {
75
76
  if (el && !itemHeight) {
@@ -79,14 +80,23 @@ export const list = {
79
80
  }
80
81
  })}
81
82
  >
82
- <div style="height: ${totalHeight}px; position: relative">
83
+ <div
84
+ style=${styleMap({
85
+ height: `${totalHeight}px`,
86
+ position: "relative",
87
+ })}
88
+ >
83
89
  ${visibleItems.map((item, idx) => {
84
90
  const absoluteIndex = visibleRange.start + idx
85
91
  const top = absoluteIndex * height
86
92
 
87
93
  return html`
88
94
  <div
89
- style="position: absolute; top: ${top}px; width: 100%"
95
+ style=${styleMap({
96
+ position: "absolute",
97
+ top: `${top}px`,
98
+ width: "100%",
99
+ })}
90
100
  data-index=${absoluteIndex}
91
101
  >
92
102
  ${type.renderItem(item, absoluteIndex, api)}
@@ -4,8 +4,7 @@ export const rangeFilter = {
4
4
  render(entity, column, api) {
5
5
  const filter = entity.filters[column.id] ?? {}
6
6
 
7
- return html`<div class="row">
8
- <input
7
+ return html`<input
9
8
  name=${`${column.id}Min`}
10
9
  type="number"
11
10
  placeholder=${column.filter.placeholder ?? "≥"}
@@ -36,7 +35,6 @@ export const rangeFilter = {
36
35
  })
37
36
  }}
38
37
  class="iw-table-cell-number"
39
- />
40
- </div>`
38
+ />`
41
39
  },
42
40
  }
@@ -292,8 +292,8 @@ function getDefaultColumnFilter(type) {
292
292
  }
293
293
 
294
294
  function getDefaultColumnWidth(filterType) {
295
- if (filterType === "number") return 100
296
- if (filterType === "range") return 200
295
+ if (filterType === "number") return 70
296
+ if (filterType === "range") return 100
297
297
  if (filterType === "select") return 70
298
298
  if (filterType === "date") return 120
299
299
  if (filterType === "time") return 120
@@ -1,4 +1,5 @@
1
1
  import { html } from "lit-html"
2
+ import { classMap } from "lit-html/directives/class-map.js"
2
3
  import { ref } from "lit-html/directives/ref.js"
3
4
 
4
5
  import { filters } from "./filters"
@@ -99,11 +100,11 @@ export const rendering = {
99
100
 
100
101
  return html`<div
101
102
  @click=${() => api.notify(`#${entity.id}:rowToggle`, rowId)}
102
- class="iw-table-row ${index % DIVISOR
103
- ? "iw-table-row-even"
104
- : "iw-table-row-odd"} ${entity.selection.includes(rowId)
105
- ? "iw-table-row-selected"
106
- : ""}"
103
+ class=${classMap({
104
+ "iw-table-row": true,
105
+ "iw-table-row-even": index % DIVISOR,
106
+ "iw-table-row-selected": entity.selection.includes(rowId),
107
+ })}
107
108
  >
108
109
  ${Object.values(row).map((value, index) =>
109
110
  type.renderCell(entity, value, index, api),
@@ -116,7 +117,12 @@ export const rendering = {
116
117
  const column = entity.columns[index]
117
118
 
118
119
  return html`<div
119
- class=${`iw-table-cell ${column.type === "number" ? "iw-table-cell-number" : ""} ${column.type === "date" ? "iw-table-cell-date" : ""} ${column.type === "boolean" ? "iw-table-cell-boolean" : ""}`}
120
+ class=${classMap({
121
+ "iw-table-cell": true,
122
+ "iw-table-cell-number": column.type === "number",
123
+ "iw-table-cell-date": column.type === "date",
124
+ "iw-table-cell-boolean": column.type === "boolean",
125
+ })}
120
126
  style=${getColumnStyle(column)}
121
127
  >
122
128
  ${type.renderValue(cell, column, api)}
@@ -182,7 +188,7 @@ export const rendering = {
182
188
  min="1"
183
189
  max=${pagination.totalPages}
184
190
  value=${pagination.page + PRETTY_PAGE}
185
- class=${`iw-table-page-input`}
191
+ class="iw-table-page-input"
186
192
  @input=${(event) =>
187
193
  api.notify(
188
194
  `#${entity.id}:pageChange`,