@record-evolution/widget-image 1.1.15 → 1.1.17

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
@@ -1,6 +1,8 @@
1
1
  # \<widget-image>
2
2
 
3
- This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
3
+ A Lit 3.x web component for displaying images with single/multi-image modes, time-based filtering, and responsive grid layouts. Part of the IronFlock widget ecosystem.
4
+
5
+ ![screenshot](thumbnail.png)
4
6
 
5
7
  ## Installation
6
8
 
@@ -12,34 +14,116 @@ npm i @record-evolution/widget-image
12
14
 
13
15
  ```html
14
16
  <script type="module">
15
- import '@record-evolution/widget-image/widget-image.js'
17
+ import '@record-evolution/widget-image/dist/widget-image.js'
16
18
  </script>
17
19
 
18
- <widget-image-1.1.12></widget-image-1.1.12>
20
+ <widget-image-1.1.15></widget-image-1.1.15>
19
21
  ```
20
22
 
21
- ## Expected data format
23
+ > **Note:** The version number in the tag name must match the installed package version.
24
+
25
+ ## Configuration
22
26
 
23
- The widget supports both single image and multi-image modes:
27
+ Configure the widget by setting the `inputData` property:
28
+
29
+ ```javascript
30
+ const widget = document.querySelector('widget-image-1.1.15')
31
+ widget.inputData = {
32
+ title: 'My Image',
33
+ subTitle: 'Optional subtitle',
34
+ imageUrl: 'https://example.com/image.jpg',
35
+ stretchToFit: false
36
+ }
37
+ ```
24
38
 
25
39
  ### Single Image Mode
26
40
 
27
41
  Display a single image with optional title and subtitle.
28
42
 
43
+ | Option | Type | Description |
44
+ | -------------- | ------- | --------------------------------------------- |
45
+ | `title` | string | Widget title |
46
+ | `subTitle` | string | Widget subtitle |
47
+ | `imageUrl` | string | URL of the image to display |
48
+ | `useUpload` | boolean | Use uploaded image instead of URL |
49
+ | `stretchToFit` | boolean | Stretch image to fill container (vs. contain) |
50
+
29
51
  ### Multi Image Mode
30
52
 
31
- Display multiple images in an optimized grid layout with automatic sizing and aspect ratio calculation.
53
+ Display multiple images in an optimized grid layout with automatic sizing.
54
+
55
+ ```javascript
56
+ widget.inputData = {
57
+ multiImage: true,
58
+ gap: 12,
59
+ labelFontSize: 14,
60
+ data: [
61
+ { imageUrl: 'https://example.com/img1.jpg', label: 'Image 1', timestamp: 1737417600000 },
62
+ { imageUrl: 'https://example.com/img2.jpg', label: 'Image 2', timestamp: 1737504000000 }
63
+ ]
64
+ }
65
+ ```
66
+
67
+ | Option | Type | Description |
68
+ | --------------- | ------- | ---------------------------------- |
69
+ | `multiImage` | boolean | Enable multi-image grid mode |
70
+ | `gap` | number | Gap between images in pixels |
71
+ | `labelFontSize` | number | Font size for image labels |
72
+ | `data` | array | Array of image objects (see below) |
73
+
74
+ #### Data Item Properties
32
75
 
33
- ## Tooling configs
76
+ | Property | Type | Description |
77
+ | ----------- | ------ | -------------------------------------- |
78
+ | `imageUrl` | string | Image URL |
79
+ | `label` | string | Optional label text |
80
+ | `timestamp` | number | Unix timestamp (ms) for time filtering |
34
81
 
35
- For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
82
+ ## Time-Based Filtering
36
83
 
37
- If you customize the configuration a lot, you can consider moving them to individual files.
84
+ Filter images by time range (useful for IoT dashboards):
85
+
86
+ ```javascript
87
+ widget.timeRange = {
88
+ start: 1737417600000, // Start timestamp (Unix ms)
89
+ end: 1737590400000 // End timestamp (Unix ms)
90
+ }
91
+ ```
38
92
 
39
- ## Local Demo with Vite
93
+ Images without timestamps are always shown. Images with timestamps outside the range are hidden.
94
+
95
+ ## Theming
96
+
97
+ The widget supports theming via CSS custom properties or a theme object:
98
+
99
+ ```javascript
100
+ widget.theme = {
101
+ theme_name: 'dark',
102
+ theme_object: {
103
+ backgroundColor: '#1a1a1a',
104
+ textStyle: { color: '#ffffff' }
105
+ }
106
+ }
107
+ ```
108
+
109
+ ### CSS Custom Properties
110
+
111
+ ```css
112
+ widget-image-1.1.15 {
113
+ --re-text-color: #333;
114
+ --re-tile-background-color: #fff;
115
+ }
116
+ ```
117
+
118
+ ## Development
40
119
 
41
120
  ```bash
42
- npm start
121
+ npm start # Dev server at http://localhost:8000/demo/
122
+ npm run build # Production build to dist/
123
+ npm run types # Regenerate TypeScript types from schema
124
+ npm run release # Build, bump version, push, and tag
43
125
  ```
44
126
 
45
- To run a local development server that serves the basic demo at http://localhost:8000/demo/
127
+ ## License
128
+
129
+ MIT