cotomy 2.0.0 → 2.0.2
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 +13 -0
- package/dist/browser/cotomy.js +2 -2
- package/dist/browser/cotomy.js.map +1 -1
- package/dist/browser/cotomy.min.js +1 -1
- package/dist/browser/cotomy.min.js.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/api.js +2 -2
- package/dist/esm/api.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
**Cotomy** is a lightweight framework for managing form behavior and page controllers in web applications.
|
|
7
7
|
It is suitable for both SPAs (Single Page Applications) and traditional web apps requiring dynamic form operations.
|
|
8
8
|
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
- Node.js 20.19.0 or later
|
|
12
|
+
|
|
9
13
|
To install Cotomy in your project, run the following command:
|
|
10
14
|
|
|
11
15
|
```bash
|
|
@@ -18,6 +22,13 @@ Cotomy will continue to expand with more detailed usage instructions and code ex
|
|
|
18
22
|
For the latest updates, please check the official documentation or repository regularly.
|
|
19
23
|
Reference: https://cotomy.net/
|
|
20
24
|
|
|
25
|
+
## Version Notes
|
|
26
|
+
|
|
27
|
+
### v2
|
|
28
|
+
|
|
29
|
+
- Updated core development dependencies including TypeScript 6 and Vitest 4
|
|
30
|
+
- Internal ID generation was migrated from `cuid` to `@paralleldrive/cuid2`
|
|
31
|
+
|
|
21
32
|
## View Reference
|
|
22
33
|
|
|
23
34
|
The View layer provides thin wrappers around DOM elements and window events.
|
|
@@ -260,6 +271,8 @@ The Form layer builds on `CotomyElement` for common form flows.
|
|
|
260
271
|
- `utc` — Treats the value as UTC (or appends `Z` when missing) and formats with `data-cotomy-format` (default `YYYY/MM/DD HH:mm`). By default it renders in local time; set `data-cotomy-timezone` (element or ancestor) to render in a specific IANA timezone.
|
|
261
272
|
- `date` — Renders local dates with `data-cotomy-format` (default `YYYY/MM/DD`) when the input is a valid `Date` value. By default it renders in local time; set `data-cotomy-timezone` (element or ancestor) to render in a specific IANA timezone.
|
|
262
273
|
|
|
274
|
+
`data-cotomy-bindtype` values are matched case-insensitively and surrounding whitespace is ignored. Custom renderers registered through `renderer(type, callback)` are stored with lowercase keys. If you override the protected `renderers` map directly, return lowercase keys such as `date` or `customtype`.
|
|
275
|
+
|
|
263
276
|
### UTC Renderer
|
|
264
277
|
|
|
265
278
|
- Supports ISO 8601 offsets (`+09:00`, `-05:00`)
|
package/dist/browser/cotomy.js
CHANGED
|
@@ -3154,7 +3154,7 @@ class CotomyViewRenderer {
|
|
|
3154
3154
|
this._initialized = false;
|
|
3155
3155
|
}
|
|
3156
3156
|
renderer(type, callback) {
|
|
3157
|
-
this._renderers[type] = callback;
|
|
3157
|
+
this._renderers[type.trim().toLowerCase()] = callback;
|
|
3158
3158
|
return this;
|
|
3159
3159
|
}
|
|
3160
3160
|
get renderers() {
|
|
@@ -3239,7 +3239,7 @@ class CotomyViewRenderer {
|
|
|
3239
3239
|
if (CotomyDebugSettings.isEnabled(CotomyDebugFeature.Bind)) {
|
|
3240
3240
|
console.debug(`Binding data to element [data-cotomy-bind="${propertyName}"]:`, value);
|
|
3241
3241
|
}
|
|
3242
|
-
const type = element.attribute("data-cotomy-bindtype")?.toLowerCase();
|
|
3242
|
+
const type = element.attribute("data-cotomy-bindtype")?.trim().toLowerCase();
|
|
3243
3243
|
if (type && this.renderers[type]) {
|
|
3244
3244
|
this.renderers[type](element, value);
|
|
3245
3245
|
}
|