uniweb 0.26.2 → 0.26.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniweb",
3
- "version": "0.26.2",
3
+ "version": "0.26.4",
4
4
  "description": "Create structured Vite + React sites with content/code separation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,15 +41,15 @@
41
41
  "js-yaml": "^4.1.0",
42
42
  "prompts": "^2.4.2",
43
43
  "tar": "^7.0.0",
44
- "@uniweb/core": "^0.10.1",
44
+ "@uniweb/runtime": "^0.12.5",
45
+ "@uniweb/kit": "^0.13.0",
45
46
  "@uniweb/semantic-parser": "^1.2.3",
46
- "@uniweb/kit": "^0.12.3",
47
- "@uniweb/runtime": "^0.12.3"
47
+ "@uniweb/core": "^0.10.2"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@uniweb/build": "^0.24.5",
51
- "@uniweb/content-reader": "^1.2.3",
52
- "@uniweb/semantic-parser": "^1.2.3"
51
+ "@uniweb/semantic-parser": "^1.2.3",
52
+ "@uniweb/content-reader": "^1.2.3"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "@uniweb/build": {
@@ -1983,8 +1983,19 @@ runtime loads once, after consent when a gate is declared, and never in a frame
1983
1983
  or during prerender. That is a **separate path with no connection to the stream
1984
1984
  below** — the vendor measures its own way, and nothing you `track()` reaches it.
1985
1985
 
1986
- **The runtime reports `page_view` on every route change, including the first.**
1987
- That is the only thing it emits on its own — everything else is yours to report:
1986
+ **Some events you get for free.** These are reported for you, with no call from
1987
+ your foundation and regardless of how it renders:
1988
+
1989
+ | event | when |
1990
+ |---|---|
1991
+ | `page_view` | every route change, including the first |
1992
+ | `outbound_click` | a visitor follows a link off the site — the destination **host** only, never the full URL |
1993
+ | `section_view` | a section first becomes half-visible, on pages that ask for it (`trackSections`, below) |
1994
+
1995
+ ⛔ **So don't write your own link-click or scroll-into-view listener for these.**
1996
+ A second one double-counts against a collector that already has them.
1997
+
1998
+ Everything else is yours to report:
1988
1999
 
1989
2000
  ```jsx
1990
2001
  // In a section type, the block is already in your props.
@@ -2001,12 +2012,85 @@ const { track } = useTracker()
2001
2012
  <button onClick={() => track('brochure_download', { file: 'specs.pdf' })}>…</button>
2002
2013
  ```
2003
2014
 
2004
- The event name is yours — there is no list of permitted names. Three are already
2005
- in use, so reach for these rather than inventing a synonym: **`page_view`** (the
2006
- runtime), **`scroll_depth`** (kit's `useScrollDepth()`, with a `depth` of 25 /
2007
- 50 / 75 / 100) and **`video_milestone`** (kit's `<Media>`, with `milestone` and
2008
- `src`). Put the varying part in a **field**, never in the name — four names for
2009
- one event turn a collector's event dimension into a cardinality problem.
2015
+ The event name is yours — there is no list of permitted names. Five are already
2016
+ in use, so reach for these rather than inventing a synonym: the three automatic
2017
+ ones above **`page_view`**, **`outbound_click`**, **`section_view`** plus
2018
+ **`video_milestone`**, which kit's `<Media>` reports for any video you render
2019
+ through it, and **`read_depth`** from `useReadingDepth()` below. Put the
2020
+ varying part in a **field**, never in the name four names for one event turn a
2021
+ collector's event dimension into a cardinality problem.
2022
+
2023
+ ### Choosing what a site sends
2024
+
2025
+ By default a site sends `page_view`, `outbound_click` and `section_view`. Narrow
2026
+ or widen that with `emit`:
2027
+
2028
+ ```yaml
2029
+ # site.yml — your own collector
2030
+ tracking:
2031
+ endpoint: https://collector.example.com/events
2032
+ emit: standard # minimal | standard | all — or a list of event names
2033
+
2034
+ # site.yml — a host that supplies the collector: say what to send, not where
2035
+ tracking:
2036
+ emit: minimal
2037
+ ```
2038
+
2039
+ ⭐ **`emit` needs no endpoint of its own.** Where a host provides one, the site
2040
+ declares only what it wants sent and the address comes from the host. The two
2041
+ are read key by key, so naming `emit` alone overrides nothing else the host
2042
+ declared. And declaring your own `endpoint:` always wins, so a site pointing at
2043
+ its own collector keeps working on any host, including none.
2044
+
2045
+ `minimal` is `page_view` alone. `standard` is the default. `all` is a standing
2046
+ yes, so an event added in a later framework release is included without you
2047
+ changing anything — which is exactly why `standard` exists as well: it is a
2048
+ curated set that a release cannot grow behind your back.
2049
+
2050
+ ⚠️ **`emit` never limits what YOU send.** `block.track()` and `useTracker()` are
2051
+ not filtered by it — the registry is open, and your events are yours. It governs
2052
+ only the ones the framework emits on its own. A host may narrow the list further
2053
+ if it will not store an event, and it can never widen past what you asked for.
2054
+
2055
+ ### Reading depth in a long section
2056
+
2057
+ `section_view` tells you a reader *arrived* at a section. For a long-form one —
2058
+ an article, a report, a case study — the question is how far they got:
2059
+
2060
+ ```jsx
2061
+ import { useRef } from 'react'
2062
+ import { useReadingDepth } from '@uniweb/kit'
2063
+
2064
+ export default function Article({ content, block }) {
2065
+ const ref = useRef(null)
2066
+ useReadingDepth({ ref, block })
2067
+ return <article ref={ref}>{/* … */}</article>
2068
+ }
2069
+ ```
2070
+
2071
+ That reports `read_depth` at 25 / 50 / 75 / 100% **of that element**, once each.
2072
+ Measuring the element rather than the page is the point: two long sections on
2073
+ one page report independently, and adding a section above them changes neither.
2074
+
2075
+ ⭐ **This one is a hook rather than automatic because only you know a section is
2076
+ long-form reading.** The framework cannot tell an essay from a row of logos, so
2077
+ it does not guess — and a foundation that never calls this pays nothing for it.
2078
+
2079
+ **`trackSections`** is one page's answer on `section_view`, and it overrides the
2080
+ site in **both** directions — instrument one page of a site that sends `minimal`,
2081
+ or exempt a noisy page of a site that sends `standard`. Say nothing and the
2082
+ site's `emit` decides.
2083
+
2084
+ ⭐ **This is the only event with a per-page control, and the asymmetry is the
2085
+ point.** A page view is one event whatever the page and an outbound click is
2086
+ bounded by what a visitor does, but a section view is **one per section** — so a
2087
+ long page costs many times what a short one does. The control sits at the
2088
+ granularity the cost actually varies at.
2089
+
2090
+ ```yaml
2091
+ # page.yml
2092
+ trackSections: true # or false to exempt this page
2093
+ ```
2010
2094
 
2011
2095
  ⛔ **Never guard a `track()` call.** A site with **no** tracking destination is
2012
2096
  the default and the majority: the call returns having done nothing, opened no
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-08-19T12:16:02.893Z",
3
+ "generatedAt": "2026-08-19T17:26:33.370Z",
4
4
  "packages": {
5
5
  "@uniweb/build": {
6
6
  "version": "0.24.5",
@@ -29,7 +29,7 @@
29
29
  "deps": []
30
30
  },
31
31
  "@uniweb/core": {
32
- "version": "0.10.1",
32
+ "version": "0.10.2",
33
33
  "path": "framework/core",
34
34
  "deps": [
35
35
  "@uniweb/semantic-parser",
@@ -49,7 +49,7 @@
49
49
  ]
50
50
  },
51
51
  "@uniweb/kit": {
52
- "version": "0.12.3",
52
+ "version": "0.13.0",
53
53
  "path": "framework/kit",
54
54
  "deps": [
55
55
  "@uniweb/core",
@@ -76,7 +76,7 @@
76
76
  ]
77
77
  },
78
78
  "@uniweb/runtime": {
79
- "version": "0.12.3",
79
+ "version": "0.12.5",
80
80
  "path": "framework/runtime",
81
81
  "deps": [
82
82
  "@uniweb/core",