@livx.cc/bare-v3 0.1.0-alpha.153 → 0.1.0-alpha.155
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 +1 -1
- package/dist/components/swipe.d.ts +36 -0
- package/dist/components/swipe.js +12 -0
- package/dist/manifest.json +2 -1
- package/dist/references/swipe.md +35 -0
- package/dist/third-party.json +1 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Install the published alpha with `bun add @livx.cc/bare-v3@alpha`; use `bun pm p
|
|
|
19
19
|
|
|
20
20
|
Live batches are explicit: save `bun lab plan config.json` output, then run `bun lab execute saved-plan.json artifacts/batches/name/runs --live --max-new-jobs 4` with `CURSOR_API_KEY` available in the environment (and the configured `CURSOR_REAL_NODE` where required). This can incur provider charges. The job cap limits new generations in that invocation, not dollars; provider cost is currently unavailable. Obtain the resource budget before execution. Resume with the exact saved plan, artifact directory and unchanged built source. Before starting, the CLI checks installed AgentX/AI package versions against the pinned versions and boots Node through the isolation launcher without a model request. Install the frozen lock and use a self-contained `CURSOR_REAL_NODE` if Homebrew dynamic libraries are blocked. Generation failure, timeout, cancellation or a request for input stops the batch for investigation. Terminal attempts are retained, including failures; they are not retried automatically. A remaining `.batch.lock` or nonterminal attempt requires checking the recorded process and child handles before any manual recovery. Completion of attempts is never quality qualification. Review that batch with `bun lab compare artifacts/batches/name`; replay one run with `bun lab replay <run-id> artifacts/batches/name/runs`. These explicit paths keep unrelated pilots out of the batch review.
|
|
21
21
|
|
|
22
|
-
`bun lab plan config.json` creates a seeded, capped development job plan. `bun lab prepare run.json` prepares one isolated workspace and manifest without invoking a model. The [visual playground](http://127.0.0.1:4313/fixtures/playground.html) demonstrates the current component contracts and shows the bare-v2 coverage audit. Composed apps include Signal (system performance), Elsewhere (local discovery/booking), Daylight (iOS/Android web studies), Relay, Gather setup and sign-in, Counter, Margin, Still, Fieldnotes, Interval, and the Forma project workspace. New components are an implemented subset, not full bare-v2 parity or a qualified release. Two public layers ship: `/css` (CSS only) and `/components` — light-DOM custom elements (`<b3-tabs>`, `<b3-reel>`, `<b3-dropdown>`, `<b3-dialog>`, `<b3-sheet>`, `<b3-command>`, `<b3-toast-region>`, `<b3-toc>`) that enhance native markup, plus the document-wide `data-b3-confirm` guard and the `motion`/`layout`/`sequence`/`settle` helpers. Loading the entry (ESM, or re-bundled as a classic script) registers everything; there is no setup call or cleanup, and loading twice is a no-op. Heavier components are opt-in subpaths: `/components/board` (`<b3-board>`), `/components/date-picker`, `/components/image-viewer` and `/components/
|
|
22
|
+
`bun lab plan config.json` creates a seeded, capped development job plan. `bun lab prepare run.json` prepares one isolated workspace and manifest without invoking a model. The [visual playground](http://127.0.0.1:4313/fixtures/playground.html) demonstrates the current component contracts and shows the bare-v2 coverage audit. Composed apps include Signal (system performance), Elsewhere (local discovery/booking), Daylight (iOS/Android web studies), Relay, Gather setup and sign-in, Counter, Margin, Still, Fieldnotes, Interval, and the Forma project workspace. New components are an implemented subset, not full bare-v2 parity or a qualified release. Two public layers ship: `/css` (CSS only) and `/components` — light-DOM custom elements (`<b3-tabs>`, `<b3-reel>`, `<b3-dropdown>`, `<b3-dialog>`, `<b3-sheet>`, `<b3-command>`, `<b3-toast-region>`, `<b3-toc>`) that enhance native markup, plus the document-wide `data-b3-confirm` guard and the `motion`/`layout`/`sequence`/`settle` helpers. Loading the entry (ESM, or re-bundled as a classic script) registers everything; there is no setup call or cleanup, and loading twice is a no-op. Heavier components are opt-in subpaths: `/components/board` (`<b3-board>`), `/components/date-picker`, `/components/image-viewer`, `/components/audio-player` and `/components/swipe` (`<b3-swipe>`, swipe-to-act list rows). They are separate files rather than one bundle because of weight: the core is ~20 KB minified (~7 KB gzip), the board alone ~117 KB (~36 KB gzip, it bundles a reactive template runtime privately — one that needs no `'unsafe-eval'` under a Content-Security-Policy and loads only when a board first renders), so a single bundle would multiply every page's always-loaded cost by ~5x for a component most pages never show. `/markdown-stream` is a plain module (`MarkdownStream`, a class, not a tag) for streaming LLM markdown into bare-v3 components. Every entry ships `.d.ts` typings. Read `recipes/board.md`, `recipes/image-viewer.md`, `recipes/date-picker.md`, `recipes/audio-player.md`, `recipes/swipe.md` or `recipes/markdown-stream.md` for markup and lifecycle; `fixtures/elements/markdown-stream.html` demos the stream; `bun run chat` serves it as a live chat against a real model (needs `OPENROUTER_API_KEY` or `OPENAI_API_KEY`; offline it replays canned replies). The plain/React/Vue demos in `fixtures/elements/` exercise the image viewer; run `bun scripts/verify-image-viewer.ts` through the authorized AgentX browser workflow to verify measured transforms. `bun scripts/verify-components.ts`, `verify-reel.ts` and `verify-confirm.ts` drive headless Chrome against `fixtures/checks/` and re-run every check against a control build without the code.
|
|
23
23
|
|
|
24
24
|
Playground previews accept shareable app/width links, for example [Signal at 390px](http://127.0.0.1:4313/fixtures/playground.html?demo=metrics&width=390#demos). The controls keep these query parameters in sync; unknown values fall back to the authored defaults. This is an iframe layout preview, not mobile-device qualification.
|
|
25
25
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <b3-swipe> — swipe-to-act on list rows (iOS Mail's archive / mark-read), delegated from one host.
|
|
3
|
+
*
|
|
4
|
+
* Light DOM, opt-in entry (`@livx.cc/bare-v3/components/swipe`). Rows opt in by naming an action:
|
|
5
|
+
* `data-b3-swipe-left="Archive"` (pulled leftwards) and/or `data-b3-swipe-right="Read"`. The host
|
|
6
|
+
* fires `b3-swipe` ({ side, item }) from the row when the pull commits, and `b3-swipe-hold`
|
|
7
|
+
* ({ item, x, y }) on a still long press; a bare `data-b3-swipe` row only has the long press. Rows can be re-rendered freely: nothing is kept on them.
|
|
8
|
+
*
|
|
9
|
+
* The gesture is decided, not guessed: nothing moves until the finger travels `SLOP`; then the
|
|
10
|
+
* axis locks. Vertical → we let go and the page scrolls. Horizontal → the pointer is captured and
|
|
11
|
+
* touchmove is cancelled so the browser can no longer claim the drag halfway (the "released by
|
|
12
|
+
* itself" failure of a bare touch-action: pan-y row). A pointercancel never acts. Release acts past
|
|
13
|
+
* the threshold, or on a flick in the pull's direction; the "go" state has hysteresis so it does not
|
|
14
|
+
* flicker at the line. The click a swipe or hold ends with is swallowed.
|
|
15
|
+
*/
|
|
16
|
+
import { Base } from './base';
|
|
17
|
+
export declare class B3Swipe extends Base {
|
|
18
|
+
#private;
|
|
19
|
+
static observedAttributes: string[];
|
|
20
|
+
/** Reserved screen edges in px (system back/forward gestures). Default 0. */
|
|
21
|
+
get edge(): number;
|
|
22
|
+
/** Commit distance: px, or a fraction of the row's width when ≤ 1. Default max(110px, 40%). */
|
|
23
|
+
get threshold(): number;
|
|
24
|
+
/** Still-press duration (ms) that fires b3-swipe-hold; 0 disables. Default 500. */
|
|
25
|
+
get hold(): number;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
attributeChangedCallback(): void;
|
|
29
|
+
/** Abort a gesture in progress: the row springs back, nothing fires. */
|
|
30
|
+
cancel(): void;
|
|
31
|
+
}
|
|
32
|
+
declare global {
|
|
33
|
+
interface HTMLElementTagNameMap {
|
|
34
|
+
'b3-swipe': B3Swipe;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var C=typeof HTMLElement==="function"?HTMLElement:class{};function L(e,t){if(typeof customElements>"u"||customElements.get?.(e))return;try{customElements.define(e,t)}catch(s){console.warn(`bare-v3: ${e} was not registered`,s)}}var O=Symbol.for("bare-v3.styles");function T(e,t,s){if(!e?.head||e.getElementById(t))return;let o=e[O]??=new Set;if(o.has(t))return;let l=e.defaultView;if(l&&"adoptedStyleSheets"in e&&"replaceSync"in l.CSSStyleSheet.prototype){let b=new l.CSSStyleSheet;b.replaceSync(s),e.adoptedStyleSheets=[...e.adoptedStyleSheets,b],o.add(t);return}let d=e.createElement("style");d.id=t,d.textContent=s,e.head.append(d)}var X=10,P=24,N=0.6,B=48,Y=400,M="[data-b3-swipe],[data-b3-swipe-left],[data-b3-swipe-right]",W="b3-swipe-style",_=`
|
|
2
|
+
b3-swipe{display:block;}
|
|
3
|
+
b3-swipe :is(${M}){touch-action:pan-y;}
|
|
4
|
+
b3-swipe [data-b3-swiping]{position:relative;z-index:1;transition:none!important;}
|
|
5
|
+
b3-swipe [data-b3-swipe-back]{transition:transform .18s ease-out;}
|
|
6
|
+
.b3-swipe-action{position:absolute;display:flex;align-items:center;padding-inline:20px;box-sizing:border-box;
|
|
7
|
+
overflow:hidden;white-space:nowrap;font-weight:600;color:#fff;pointer-events:none;
|
|
8
|
+
--b3-swipe-color:var(--b3-swipe-left-color,var(--b3-color-danger,#c0392b));
|
|
9
|
+
background:color-mix(in srgb,var(--b3-swipe-color) 55%,var(--b3-color-muted,#888));}
|
|
10
|
+
.b3-swipe-action[data-side=right]{justify-content:flex-end;--b3-swipe-color:var(--b3-swipe-right-color,var(--b3-color-accent,#276bdd));}
|
|
11
|
+
.b3-swipe-action[data-go]{background:var(--b3-swipe-color);}
|
|
12
|
+
`;class k extends C{static observedAttributes=["disabled"];#e=null;#t=null;get edge(){return Number(this.getAttribute("edge"))||0}get threshold(){return Number(this.getAttribute("threshold"))||0}get hold(){let e=this.getAttribute("hold");return e===null?500:Number(e)||0}connectedCallback(){T(this.ownerDocument,W,_),this.#e=new AbortController;let e=this.#e.signal;this.addEventListener("pointerdown",(t)=>this.#n(t),{signal:e}),this.addEventListener("touchmove",(t)=>{if(this.hasAttribute("data-b3-dragging")&&t.cancelable)t.preventDefault()},{signal:e,passive:!1})}disconnectedCallback(){this.#t?.(),this.#e?.abort(),this.#e=null}attributeChangedCallback(){if(this.hasAttribute("disabled"))this.#t?.()}cancel(){this.#t?.()}#n(e){if(e.pointerType==="mouse"||!e.isPrimary||this.hasAttribute("disabled")||this.#t)return;let t=e.target.closest?.(M);if(!t||!this.contains(t))return;let s=this.ownerDocument.defaultView;if(this.edge&&(e.clientX<this.edge||e.clientX>s.innerWidth-this.edge))return;let{pointerId:o,clientX:l,clientY:d}=e,b=t.offsetWidth,f=this.threshold,y=f?f<=1?f*b:f:Math.max(110,b*0.4),h=null,r=0,g=!1,a=null,p=[[e.timeStamp,l]],v=new AbortController,w={signal:v.signal},S=()=>{let n=(i)=>{i.stopPropagation(),i.preventDefault()};s.addEventListener("click",n,{capture:!0,once:!0}),s.setTimeout(()=>s.removeEventListener("click",n,!0),Y)},u=(n)=>{if(v.abort(),s.clearTimeout(E),this.#t=null,this.removeAttribute("data-b3-dragging"),h!=="x")return;S();try{t.releasePointerCapture(o)}catch{}t.removeAttribute("data-b3-swiping"),t.style.background="",t.setAttribute("data-b3-swipe-back",""),t.style.transform="",s.setTimeout(()=>t.removeAttribute("data-b3-swipe-back"),200),a?.remove();let i=r<0?"left":"right";if(n&&t.hasAttribute(`data-b3-swipe-${i}`))t.dispatchEvent(new CustomEvent("b3-swipe",{bubbles:!0,detail:{side:i,item:t}}))};this.#t=()=>u(!1);let E=this.hold?s.setTimeout(()=>{if(h)return;u(!1),S(),t.dispatchEvent(new CustomEvent("b3-swipe-hold",{bubbles:!0,detail:{item:t,x:l,y:d}}))},this.hold):0,I=()=>{let n=r<0?"left":"right",i=t.getAttribute(`data-b3-swipe-${n}`),c=Math.abs(r);if(g=!!i&&(g?c>=y-P:c>=y),t.style.transform=`translateX(${i?r:r/4}px)`,!a)a=this.ownerDocument.createElement("div"),a.className="b3-swipe-action",a.style.cssText=`top:${t.offsetTop}px;height:${t.offsetHeight}px`,t.before(a);let m=Math.abs(i?r:r/4);a.style.left=`${t.offsetLeft+(r<0?b-m:0)}px`,a.style.width=`${m}px`,a.dataset.side=n,a.textContent=i||"",a.toggleAttribute("data-go",g)};s.addEventListener("pointermove",(n)=>{if(n.pointerId!==o)return;r=n.clientX-l;let i=n.clientY-d;p.push([n.timeStamp,n.clientX]);while(p.length>2&&n.timeStamp-p[0][0]>100)p.shift();if(!h){if(Math.hypot(r,i)<X)return;if(s.clearTimeout(E),Math.abs(i)>=Math.abs(r))return h="y",u(!1);if(!t.hasAttribute("data-b3-swipe-left")&&!t.hasAttribute("data-b3-swipe-right"))return u(!1);h="x",this.setAttribute("data-b3-dragging",""),t.setAttribute("data-b3-swiping","");let c=s.getComputedStyle(t).backgroundColor;t.style.background=`linear-gradient(${c},${c}),var(--b3-swipe-surface,var(--b3-color-canvas,#fff))`;try{t.setPointerCapture(o)}catch{}}I()},w),s.addEventListener("pointerup",(n)=>{if(n.pointerId!==o)return;let i=p.filter(([H])=>n.timeStamp-H<=100),[c,m]=i[0]??[n.timeStamp,n.clientX],x=n.timeStamp-c,A=x>0?(n.clientX-m)/x:0,D=Math.abs(r)>=B&&Math.abs(A)>=N&&Math.sign(A)===Math.sign(r);u(g||D)},w),s.addEventListener("pointercancel",(n)=>{if(n.pointerId===o)u(!1)},w)}}L("b3-swipe",k);export{k as B3Swipe};
|
package/dist/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.0-alpha.
|
|
2
|
+
"version": "0.1.0-alpha.155",
|
|
3
3
|
"cssSha256": "e8a1cc0d967b07a320c429873198cae5522155a82e2acdf92bb760fa83749d8c",
|
|
4
4
|
"classes": [
|
|
5
5
|
"b3-accordion",
|
|
@@ -524,6 +524,7 @@
|
|
|
524
524
|
"motion.md",
|
|
525
525
|
"scroll-entry.md",
|
|
526
526
|
"start.md",
|
|
527
|
+
"swipe.md",
|
|
527
528
|
"markdown-stream-prompt.md"
|
|
528
529
|
]
|
|
529
530
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Swipe element
|
|
2
|
+
|
|
3
|
+
`<b3-swipe>` is an opt-in component for swipe-to-act list rows (iOS Mail's archive / mark read).
|
|
4
|
+
It wraps a list and delegates: rows opt in by naming their action, so a re-rendered list keeps working.
|
|
5
|
+
|
|
6
|
+
```html
|
|
7
|
+
<script type="module" src="@livx.cc/bare-v3/components/swipe"></script>
|
|
8
|
+
|
|
9
|
+
<b3-swipe edge="24" style="position:relative; --b3-swipe-left-color:#a550a7">
|
|
10
|
+
<div class="b3-row" data-b3-swipe-left="Archive" data-b3-swipe-right="Read">…</div>
|
|
11
|
+
<div class="b3-row">a row with no data-b3-swipe-* does not swipe</div>
|
|
12
|
+
</b3-swipe>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Touch and pen only; a mouse never swipes, so always offer the same actions as buttons or a menu.
|
|
16
|
+
|
|
17
|
+
| Attribute | Meaning |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `data-b3-swipe-left` / `-right` (on a row) | The label shown behind the row when pulled that way. Absent = that side does nothing. |
|
|
20
|
+
| `data-b3-swipe` (on a row) | No swipe, but the row still gets `b3-swipe-hold` (e.g. a draft with a menu). |
|
|
21
|
+
| `edge` | Px at each screen edge where a touch never starts a swipe (system back/forward). Default 0. |
|
|
22
|
+
| `threshold` | Commit distance: px, or a fraction of the row width when ≤ 1. Default max(110px, 40%). |
|
|
23
|
+
| `hold` | Still-press ms that fires `b3-swipe-hold`; `0` disables. Default 500. |
|
|
24
|
+
| `disabled` | No swipes (e.g. while the list is in select mode). |
|
|
25
|
+
|
|
26
|
+
Colours: `--b3-swipe-left-color`, `--b3-swipe-right-color` (strong once the pull will commit, muted before). The dragged row is painted opaque (its own background over `--b3-swipe-surface`, default the canvas), so a translucent selection tint never shows the action through it.
|
|
27
|
+
The action panel is positioned by the row's `offsetTop`, so give the rows' container `position: relative`.
|
|
28
|
+
|
|
29
|
+
Events (bubble from the row): `b3-swipe` `{ side: 'left'|'right', item }` when a pull commits;
|
|
30
|
+
`b3-swipe-hold` `{ item, x, y }` on a still long press. The click that ends a swipe or hold is swallowed.
|
|
31
|
+
Method: `cancel()` aborts a gesture in progress.
|
|
32
|
+
|
|
33
|
+
Behaviour: the axis locks after 10px — vertical lets the page scroll, horizontal owns the drag (the
|
|
34
|
+
browser can no longer cancel it). A release acts past the threshold or on a fast flick that way;
|
|
35
|
+
a cancelled touch never acts; anything else springs back.
|
package/dist/third-party.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livx.cc/bare-v3",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.155",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"thirdPartyNotices": "./dist/third-party.json",
|
|
6
6
|
"files": [
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
"types": "./dist/components/audio-player.d.ts",
|
|
32
32
|
"default": "./dist/components/audio-player.js"
|
|
33
33
|
},
|
|
34
|
+
"./components/swipe": {
|
|
35
|
+
"types": "./dist/components/swipe.d.ts",
|
|
36
|
+
"default": "./dist/components/swipe.js"
|
|
37
|
+
},
|
|
34
38
|
"./components/image-viewer": {
|
|
35
39
|
"types": "./dist/components/image-viewer.d.ts",
|
|
36
40
|
"default": "./dist/components/image-viewer.js"
|