@appius-fr/apx 2.7.0 → 2.8.0

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/APX.mjs CHANGED
@@ -3,8 +3,7 @@ import augmentWithTristate from './modules/tristate/tristate.mjs';
3
3
  import augmentWithScrollableTable from './modules/scrollableTable/scrollableTable.mjs';
4
4
  import dialog from './modules/dialog/dialog.mjs';
5
5
  import toast from './modules/toast/toast.mjs';
6
- import { loadCss } from './modules/common.mjs';
7
- import { augmentWithPack, tools } from './modules/tools/exports.mjs';
6
+ import { augmentWithPack, tools, loadCss } from './modules/tools/exports.mjs';
8
7
 
9
8
  /**
10
9
  * Creates an APX object that wraps one or more HTML elements.
package/README.md CHANGED
@@ -102,12 +102,30 @@ APX.toast.use('admin').info('Admin ready');
102
102
  - `demo/index.html` (landing)
103
103
  - `demo/modules/toast/index.html` (basic and advanced examples with code viewer)
104
104
  - `demo/modules/tristate/index.html` (state preview and interactive cycle)
105
+ - `demo/modules/scrollableTable/index.html` (scrollable tbody with colspan/rowspan)
106
+
107
+ ### `scrollableTable` (since 2.7.0)
108
+
109
+ Makes the **tbody** of a table scrollable while keeping thead and tfoot fixed. Uses CSS Grid with subgrid; column and row sizes can be preserved from the table’s natural layout or overridden (full or hybrid). **Dynamic body height** (2.7.1): `bodyHeightDynamic: { get, useAs, updateOn? }` re-resolves height on resize (and optionally scroll); default `updateOn` uses window resize + ResizeObserver on document (scrollbar appearance), `scroll: false`.
110
+
111
+ **Documentation:** [`modules/scrollableTable/README.md`](./modules/scrollableTable/README.md)
112
+
113
+ **Quick Start:**
114
+ ```javascript
115
+ APX('table.my-table').scrollableTable({ maxHeight: 300 });
116
+ APX('table.my-table').scrollableTable({ height: '50vh' });
117
+ // dynamic (viewport-based, updates on resize/scrollbar)
118
+ APX('table.my-table').scrollableTable({ bodyHeightDynamic: { get: (t) => window.innerHeight - t.getBoundingClientRect().top - 40, useAs: 'maxHeight' } });
119
+ APX('table.my-table').scrollableTable('refresh');
120
+ ```
121
+
122
+ **Demo page:** `demo/modules/scrollableTable/index.html`
105
123
 
106
124
  ### `tools` (since 2.6.0)
107
125
 
108
- The `tools` module provides utility functions for common web development tasks. Currently includes form handling utilities with more tools planned for future releases.
126
+ The `tools` module provides utility functions for common web development tasks: form handling (form-packer), dynamic CSS loading (`loadCss`), scrollbar measurement (`getScrollbarSize`), and more planned for future releases. Since 2.8.0, `loadCss` lives in tools (upgraded; idempotent, rejects on failure, optional options) and `getScrollbarSize` was added.
109
127
 
110
- **Documentation:** [`modules/tools/README.md`](./modules/tools/README.md)
128
+ **Documentation:** [`modules/tools/README.md`](./modules/tools/README.md) · **Changelog:** [`modules/tools/CHANGELOG.md`](./modules/tools/CHANGELOG.md)
111
129
 
112
130
  **Quick Start:**
113
131
  ```javascript
@@ -115,20 +133,26 @@ The `tools` module provides utility functions for common web development tasks.
115
133
  const data = APX('form#myForm').pack();
116
134
  // or
117
135
  const data = APX.tools.packFormToJSON(document.querySelector('#myForm'));
136
+
137
+ // Load CSS (idempotent; since 2.8.0 also APX.tools.loadCss)
138
+ await APX.loadCss('/path/to/styles.css');
139
+
140
+ // Scrollbar size in pixels (cached; since 2.8.0)
141
+ const scrollbarWidth = APX.tools.getScrollbarSize();
118
142
  ```
119
143
 
120
- **Sub-modules:**
144
+ **Sub-modules / utilities:**
121
145
  - **`form-packer`**: Convert HTML forms to JSON with support for nested objects, arrays, and complex structures.
122
146
  - Documentation: [`modules/tools/form-packer/README.md`](./modules/tools/form-packer/README.md)
147
+ - **`loadCss`** (since 2.8.0 in tools): Dynamic CSS loading; also available as `APX.loadCss`. See [`modules/tools/README.md`](./modules/tools/README.md).
148
+ - **`getScrollbarSize`** (since 2.8.0): Scrollbar size in pixels; `APX.tools.getScrollbarSize()`.
123
149
 
124
150
  **Demo page:**
125
151
  - `demo/modules/tools/index.html` (interactive form examples and validation)
126
152
 
127
153
  ### Utilities
128
154
 
129
- - **`loadCss`**: Dynamically load CSS files into your document.
130
-
131
- Documentation: [`modules/common.mjs`](./modules/common.mjs)
155
+ - **`loadCss`**: Dynamically load CSS files (since 2.8.0: idempotent, rejects on failure, optional `options`). Use `APX.loadCss(url)` or `APX.tools.loadCss(url, options?)`. See [`modules/tools/README.md`](./modules/tools/README.md).
132
156
 
133
157
  ## Usage
134
158
 
@@ -180,9 +204,10 @@ const apx7 = APX(() => APX('.example'));
180
204
 
181
205
  ### Utilities
182
206
 
183
- - **`APX.loadCss()`**: Dynamically load CSS files.
207
+ - **`APX.loadCss(url, options?)`**: Dynamically load CSS files (since 2.8.0: idempotent, rejects on failure; optional `options`: `id`, `media`, `before`). Also `APX.tools.loadCss()`.
184
208
  - **`APX.dialog()`**: Manage and display dialogs. See [`modules/dialog/README.md`](./modules/dialog/README.md)
185
209
  - **`APX.toast`**: Toast notification system. See [`modules/toast/README.md`](./modules/toast/README.md)
210
+ - **`APX('table').scrollableTable(options)`**: Scrollable tbody with fixed thead/tfoot. See [`modules/scrollableTable/README.md`](./modules/scrollableTable/README.md)
186
211
  - **`APX.tools`**: Utility functions. See [`modules/tools/README.md`](./modules/tools/README.md)
187
212
  - **`APX.isAPXObject(obj)`**: Check if an object is an APX object.
188
213
  - **`APX.is_numeric(n)`**: Check if a value is numeric.