hyper-undo 0.6.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # hyper-undo changelog
2
2
 
3
+ ## [0.6.2] - 2026-10-03
4
+
5
+ ### Fixed
6
+ - Cloning now preserves the values of file, checkbox, radio, and option elements
7
+
8
+
9
+
10
+ ## [0.6.1] - 2026-09-30
11
+
12
+ ### Changed
13
+ - The packed contract now loads hyper-undo
14
+ - The packed contract is excluded from the published npm package
15
+
16
+ ### Fixed
17
+ - A descendant's own region marker is now checked on the element itself (content-dom.js synced from ClayJS)
18
+
19
+
20
+
3
21
  ## [0.6.0] - 2026-09-11
4
22
 
5
23
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyper-undo",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "DOM-state undo/redo via MutationObserver inverse-op replay. Standalone or paired with hyperclayjs.",
5
5
  "keywords": [
6
6
  "undo",
@@ -7,9 +7,9 @@ const UNSUPPORTED_SELECTOR = /:(?:focus(?:-within|-visible)?|hover|active|visite
7
7
  function copyControlState(source, copy) {
8
8
  if (!/^(INPUT|TEXTAREA|SELECT|OPTION)$/.test(source.tagName || '')) return
9
9
  const type = (source.getAttribute?.('type') || '').toLowerCase()
10
- if ('value' in source && 'value' in copy && source.tagName !== 'OPTION' && type !== 'checkbox' && type !== 'radio') copy.value = source.value
11
- if ('checked' in source && 'checked' in copy) copy.checked = source.checked
12
- if ('selected' in source && 'selected' in copy) copy.selected = source.selected
10
+ if ('value' in source && 'value' in copy && source.tagName !== 'OPTION' && type !== 'checkbox' && type !== 'radio' && type !== 'file') copy.value = source.value
11
+ if (source.tagName === 'INPUT' && (type === 'checkbox' || type === 'radio')) copy.checked = source.checked
12
+ if (source.tagName === 'OPTION') copy.selected = source.selected
13
13
  if (source.tagName === 'SELECT') {
14
14
  for (let i = 0; i < source.options.length; i++) copy.options[i].selected = source.options[i].selected
15
15
  }
@@ -29,8 +29,10 @@ function matchesWithin(node, selector, boundary, inherit) {
29
29
 
30
30
  function importTree(source, targetDocument, capability, capabilityMatch, exclude, boundary, inherit, maps) {
31
31
  if (source.nodeType === 1 && (
32
- (inherit ? hasCapability(source, capability) : matchesWithin(source, capabilityMatch, boundary, false)) ||
33
- (exclude && matchesWithin(source, exclude, boundary, inherit))
32
+ (inherit
33
+ ? hasCapability(source, capability)
34
+ : matchesWithin(source, capabilityMatch, boundary, false)) ||
35
+ (exclude && (inherit && source !== boundary ? source.matches(exclude) : matchesWithin(source, exclude, boundary, inherit)))
34
36
  )) return null
35
37
  const copy = targetDocument.importNode(source, false)
36
38
  maps.cloneToLive.set(copy, source)