cotomy 1.0.4 → 2.0.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/README.md CHANGED
@@ -69,7 +69,7 @@ The View layer provides thin wrappers around DOM elements and window events.
69
69
  - `enabled: boolean` (get/set) — Toggles `disabled` attribute
70
70
  - `setFocus(): void`
71
71
  - Tree traversal & manipulation
72
- - `parent: CotomyElement`
72
+ - `parent: CotomyElement` — Returns `CotomyElement.empty()` when no parent element exists (mainly edge cases such as `html` or detached elements)
73
73
  - `parents: CotomyElement[]`
74
74
  - `children(selector = "*", type?): T[]` (direct children only)
75
75
  - `firstChild(selector = "*", type?)`
@@ -83,6 +83,8 @@ The View layer provides thin wrappers around DOM elements and window events.
83
83
  - `clone(type?): CotomyElement` - Returns a deep-cloned element, optionally typed, and reassigns a new `data-cotomy-instance` while preserving the `data-cotomy-scopeid` for scoped CSS sharing (strips `data-cotomy-moving`). Cloning an invalidated element (`data-cotomy-invalidated`) throws.
84
84
  - `clear(): this` — Removes all descendants and text
85
85
  - `remove(): void` — Explicitly non-chainable after removal
86
+
87
+ > Design note: `parent` intentionally returns `CotomyElement` (non-null) for chaining and simpler usage. In typical page structures, missing parent elements are rare (mainly `html` or detached elements), and those cases are represented by `CotomyElement.empty()`.
86
88
  - Geometry & visibility
87
89
  - `visible: boolean`
88
90
  - `width: number` (get/set px)
@@ -255,8 +257,15 @@ The Form layer builds on `CotomyElement` for common form flows.
255
257
  - `mail`, `tel`, `url` — Wrap the value in a corresponding anchor tag.
256
258
  - `number` — Uses `Intl.NumberFormat` with `data-cotomy-locale`/`data-cotomy-currency` inheritance.
257
259
  - `data-cotomy-fraction-digits="2"` — Forces fixed fraction digits (sets both `minimumFractionDigits` and `maximumFractionDigits`). Works with or without `data-cotomy-currency` (e.g. `0` → `0.00`).
258
- - `utc` — Treats the value as UTC (or appends `Z` when missing) and formats with `data-cotomy-format` (default `YYYY/MM/DD HH:mm`).
259
- - `date` — Renders local dates with `data-cotomy-format` (default `YYYY/MM/DD`) when the input is a valid `Date` value.
260
+ - `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
+ - `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
+
263
+ ### UTC Renderer
264
+
265
+ - Supports ISO 8601 offsets (`+09:00`, `-05:00`)
266
+ - Explicitly supports `Z` (UTC indicator)
267
+ - Offset-less timestamps are treated as UTC (internally appends "Z" before parsing)
268
+ - `data-cotomy-timezone` is optional. When omitted, output stays local; when set, output is converted to the specified IANA timezone (supports ancestor inheritance).
260
269
 
261
270
  Example:
262
271