@johnmorrisdotca/kazoku-ui 0.2.0 → 0.2.1
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 +4 -0
- package/README.md +2 -0
- package/dist/view-controls/controller.js +14 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.1] - 2026-11-01
|
|
4
|
+
|
|
5
|
+
- `ignore` now sees through shadow DOM: it tests the elements on the event's `composedPath()`, from the innermost up to the view, so a button inside a web component's open shadow root is left alone. Before, only the event's target (the host) was tested. A closed shadow root stays a limit: mark its host with `data-kazoku-ignore`.
|
|
6
|
+
|
|
3
7
|
## [0.2.0] - 2026-11-01
|
|
4
8
|
|
|
5
9
|
- A button, link or form control inside the view still works: a pointer press on a child that matches the new `ignore` selector is not captured, so the click goes through and a drag from the empty view still turns it. Attribute `ignore` and `createViewController` option `ignore`; the default is `button, a, input, select, textarea, label, [data-kazoku-ignore]` (`DEFAULT_IGNORE`); `ignore=""` leaves nothing alone.
|
package/README.md
CHANGED
|
@@ -104,6 +104,8 @@ Options of `createViewController` that match: `zoom` (`"fit"` or a number), `fit
|
|
|
104
104
|
|
|
105
105
|
The hands capture the pointer on the `for` element, so a press on a button or link placed inside it would be taken for a drag and its click lost. A press on anything that matches `ignore` is left alone (no capture, no drag, no double-tap), and the click goes through. Mark any other child with `data-kazoku-ignore`. Dragging from the empty part of the view turns it as before.
|
|
106
106
|
|
|
107
|
+
`ignore` also sees through shadow DOM: it tests every element on the event's path from the innermost one up to the view, so a button inside a web component's open shadow root (a card's own Animate button, say) is left alone even though the event's target is the component. A closed shadow root hides its inside from the page, so only the component itself can be matched: mark the host with `data-kazoku-ignore`, or add its tag name to `ignore`.
|
|
108
|
+
|
|
107
109
|
### Opening at the scene's natural size
|
|
108
110
|
|
|
109
111
|
Zoom 1 is Fit, whatever size that is on the page. A page that draws its scene at `fitScale` (for example 0.4 of natural size when it fits the view) and wants to open at natural size sets `zoom="1"` and tells the controls the scale:
|
|
@@ -200,16 +200,26 @@ export function createViewController(options = {}) {
|
|
|
200
200
|
};
|
|
201
201
|
const canTurn = () => controller.turnable;
|
|
202
202
|
const ignored = (e) => {
|
|
203
|
-
|
|
204
|
-
if (controller.ignore === "" || typeof target?.closest !== "function")
|
|
203
|
+
if (controller.ignore === "")
|
|
205
204
|
return false;
|
|
205
|
+
const path = typeof e.composedPath === "function" ? e.composedPath() : [];
|
|
206
206
|
try {
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
if (path.length === 0) {
|
|
208
|
+
const target = e.target;
|
|
209
|
+
const hit = typeof target?.closest === "function" ? target.closest(controller.ignore) : null;
|
|
210
|
+
return hit !== null && hit !== view && view.contains(hit);
|
|
211
|
+
}
|
|
212
|
+
for (const node of path) {
|
|
213
|
+
if (node === view)
|
|
214
|
+
return false;
|
|
215
|
+
if (typeof node.matches === "function" && node.matches(controller.ignore))
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
209
218
|
}
|
|
210
219
|
catch {
|
|
211
220
|
return false;
|
|
212
221
|
}
|
|
222
|
+
return false;
|
|
213
223
|
};
|
|
214
224
|
const onDown = (e) => {
|
|
215
225
|
if (e.pointerType === "mouse" && e.button > 2)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/kazoku-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Kazoku UI 家族, the family's shared interface parts as their own versioned package. First part: view controls for any 3D or zoomable view (angle, tilt, auto-turn, zoom about the pointer, pan, touch, address state) as a framework-free custom element and a plain controller. Zero dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"view-controls",
|