spaday-collab 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,20 @@
1
+ from pathlib import Path
2
+
3
+ from spaday import ComponentPackage, Token
4
+
5
+ from .components import SpadayPointers
6
+
7
+ __version__ = "0.1.0"
8
+ Pointers = SpadayPointers
9
+ package = ComponentPackage(
10
+ name="collab",
11
+ assets_dir=Path(__file__).parent / "extension",
12
+ assets=(("css", "css/index.css"), ("js", "cdn/index.js")),
13
+ components=(SpadayPointers,),
14
+ )
15
+ TOKENS = {
16
+ "spa_collab_accent": Token("--spa-collab-accent", "default pointer color", fallback="--spa-accent"),
17
+ "spa_collab_label_text": Token("--spa-collab-label-text", "pointer label text", fallback="--spa-text"),
18
+ "spa_collab_z_index": Token("--spa-collab-z-index", "pointer overlay stacking order"),
19
+ }
20
+ __all__ = ["TOKENS", "Pointers", "SpadayPointers", "package"]
@@ -0,0 +1,35 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "modules": [
4
+ {
5
+ "path": "src/ts/index.ts",
6
+ "declarations": [
7
+ {
8
+ "kind": "class",
9
+ "name": "Pointers",
10
+ "customElement": true,
11
+ "tagName": "spaday-pointers",
12
+ "summary": "Optional shared pointers and hover outlines.",
13
+ "attributes": [
14
+ {
15
+ "name": "peers",
16
+ "type": {
17
+ "text": "unknown"
18
+ },
19
+ "description": "Array of {peer, pointer: {target, x, y} | null, label?, color?}. Coordinates are normalized to a target. Labels are plain text."
20
+ }
21
+ ],
22
+ "events": [
23
+ {
24
+ "name": "pointer-change",
25
+ "type": {
26
+ "text": "CustomEvent"
27
+ },
28
+ "description": "detail.pointer is {target, x, y} or null. Emitted for local mouse/pen movement or withdrawal."
29
+ }
30
+ ]
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ }
@@ -0,0 +1,47 @@
1
+ # Generated by spaday.cem from components.cem.json — do not edit by hand.
2
+ from __future__ import annotations
3
+
4
+ from typing import Any
5
+
6
+ from spaday.catalog import ComponentSchema, PropertySchema
7
+ from spaday.component import Child, Component
8
+
9
+ __all__ = ["SpadayPointers"]
10
+
11
+
12
+ class SpadayPointers(Component):
13
+ """Optional shared pointers and hover outlines."""
14
+
15
+ tag = "spaday-pointers"
16
+ schema = ComponentSchema(
17
+ tag="spaday-pointers",
18
+ class_name="SpadayPointers",
19
+ summary="Optional shared pointers and hover outlines.",
20
+ props=(
21
+ PropertySchema(
22
+ name="peers",
23
+ kind="json",
24
+ choices=(),
25
+ default=None,
26
+ description="Array of {peer, pointer: {target, x, y} | null, label?, color?}. Coordinates are normalized to a target. Labels are plain text.",
27
+ ),
28
+ ),
29
+ events=("pointer-change",),
30
+ slots=(),
31
+ )
32
+
33
+ def __init__(
34
+ self,
35
+ *children: Child,
36
+ key: str | None = None,
37
+ peers: Any = None,
38
+ **props: Any,
39
+ ) -> None:
40
+ super().__init__(
41
+ *children,
42
+ key=key,
43
+ props={
44
+ "peers": peers,
45
+ },
46
+ **props,
47
+ )
@@ -0,0 +1,94 @@
1
+ """Shared pointers and a shared note over one managed transports connection."""
2
+
3
+ import asyncio
4
+ from contextlib import asynccontextmanager, suppress
5
+
6
+ from pydantic import BaseModel
7
+ from spaday import Awareness, SetField, Wire, element, event_value, field, obj
8
+ from spaday.backends.starlette import PageSpec, build_site
9
+ from starlette.applications import Starlette
10
+ from starlette.routing import WebSocketRoute
11
+ from transports import WRITE, Hub, autosync, ws_endpoint
12
+
13
+ from spaday_collab import Pointers, package
14
+ from spaday_collab.gallery import STYLE
15
+
16
+
17
+ class Document(BaseModel):
18
+ note: str = "Edit this note from either browser."
19
+
20
+
21
+ def page(user):
22
+ return element(
23
+ "main",
24
+ element("h1", "Shared pointers"),
25
+ element("nav", element("a", "Alice", href="/"), element("a", "Bob", href="/bob")),
26
+ element("p", f"Signed in as {user}. Open the other link in another browser to see their pointer."),
27
+ element("p", "Names and colors are example settings. Both users can edit; URL names are not authentication."),
28
+ element(
29
+ "label",
30
+ "Shared note",
31
+ element("textarea", **{"data-collab-target": "note", "aria-label": "Shared note"}).bind("value", "document.note", mode="two-way"),
32
+ ),
33
+ element("section", element("h2", "Review"), element("p", "Hover here to point out this section."), **{"data-collab-target": "review"}),
34
+ element("p", "Connected: ", element("output").bind("textContent", "document.connected")),
35
+ Pointers()
36
+ .bind("peers", "pointers")
37
+ .on(
38
+ "pointer-change",
39
+ SetField(
40
+ "activity",
41
+ obj(
42
+ {
43
+ "pointer": event_value("pointer"),
44
+ "label": field("name"),
45
+ "color": field("color"),
46
+ }
47
+ ),
48
+ ),
49
+ ),
50
+ )
51
+
52
+
53
+ def create_app(*, codec="json"):
54
+ hub = Hub(key=lambda connection: connection.query_params.get("user", "alice"))
55
+ model = hub.share(Document())
56
+ for user in ("alice", "bob"):
57
+ hub.subscribe(user, model, WRITE)
58
+
59
+ @asynccontextmanager
60
+ async def lifespan(_app):
61
+ task = asyncio.create_task(autosync(hub))
62
+ try:
63
+ yield
64
+ finally:
65
+ task.cancel()
66
+ with suppress(asyncio.CancelledError):
67
+ await task
68
+
69
+ pages = {
70
+ path: PageSpec(
71
+ lambda user=user: page(user),
72
+ packages=[package],
73
+ title="Shared pointers",
74
+ styles=[STYLE],
75
+ store={"name": user.title(), "color": color, "pointers": []},
76
+ scripts=["/components/collab/cdn/example.js"],
77
+ wire=Wire(
78
+ f"/ws?user={user}",
79
+ model=model,
80
+ namespace="document",
81
+ codec=codec,
82
+ reconnect=True,
83
+ awareness={"pointers": Awareness(local="activity", peers="remote_activity")},
84
+ ),
85
+ )
86
+ for path, user, color in (("/", "alice", "#f4a261"), ("/bob", "bob", "#90c2ff"))
87
+ }
88
+ return Starlette(routes=build_site(pages, routes=[WebSocketRoute("/ws", ws_endpoint(hub))]).all(), lifespan=lifespan)
89
+
90
+
91
+ if __name__ == "__main__":
92
+ import uvicorn
93
+
94
+ uvicorn.run(create_app(), host="127.0.0.1", port=8044)
@@ -0,0 +1,2 @@
1
+ document.addEventListener("spaday:wire-client",({detail:{namespace:r,store:e}})=>{if(r!=="document")return;let n=()=>e.set("pointers",(e.get("remote_activity")??[]).map(({peer:i,state:t})=>({peer:i,pointer:t?.pointer,label:t?.label,color:t?.color}))),o=e.subscribe("remote_activity",n);n(),window.addEventListener("pagehide",i=>{i.persisted||o()})});
2
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../examples/example.js"],
4
+ "sourcesContent": ["// Application mapping from scoped awareness to the optional pointer UI.\ndocument.addEventListener(\n \"spaday:wire-client\",\n ({ detail: { namespace, store } }) => {\n if (namespace !== \"document\") return;\n const render = () =>\n store.set(\n \"pointers\",\n (store.get(\"remote_activity\") ?? []).map(({ peer, state }) => ({\n peer,\n pointer: state?.pointer,\n label: state?.label,\n color: state?.color,\n })),\n );\n const stop = store.subscribe(\"remote_activity\", render);\n render();\n window.addEventListener(\"pagehide\", (event) => {\n if (!event.persisted) stop();\n });\n },\n);\n"],
5
+ "mappings": "AACA,SAAS,iBACP,qBACA,CAAC,CAAE,OAAQ,CAAE,UAAAA,EAAW,MAAAC,CAAM,CAAE,IAAM,CACpC,GAAID,IAAc,WAAY,OAC9B,IAAME,EAAS,IACbD,EAAM,IACJ,YACCA,EAAM,IAAI,iBAAiB,GAAK,CAAC,GAAG,IAAI,CAAC,CAAE,KAAAE,EAAM,MAAAC,CAAM,KAAO,CAC7D,KAAAD,EACA,QAASC,GAAO,QAChB,MAAOA,GAAO,MACd,MAAOA,GAAO,KAChB,EAAE,CACJ,EACIC,EAAOJ,EAAM,UAAU,kBAAmBC,CAAM,EACtDA,EAAO,EACP,OAAO,iBAAiB,WAAaI,GAAU,CACxCA,EAAM,WAAWD,EAAK,CAC7B,CAAC,CACH,CACF",
6
+ "names": ["namespace", "store", "render", "peer", "state", "stop", "event"]
7
+ }
@@ -0,0 +1,11 @@
1
+ function _(r){if(!r||typeof r!="object")return!1;let e=r;return typeof e.target=="string"&&e.target.length>0&&typeof e.x=="number"&&Number.isFinite(e.x)&&e.x>=0&&e.x<=1&&typeof e.y=="number"&&Number.isFinite(e.y)&&e.y>=0&&e.y<=1}function O(r,e){let n=document.elementFromPoint(r,e);for(;n?.shadowRoot;){let o=n.shadowRoot.elementFromPoint(r,e);if(!o||o===n)break;n=o}return n}function L(r,e){for(;e;){if(r===e||r.contains(e))return!0;let n=e.getRootNode();e=n instanceof ShadowRoot?n.host:null}return!1}function z(r){let e=r.getBoundingClientRect(),n=Math.max(0,e.left),o=Math.max(0,e.top),c=Math.min(innerWidth,e.right),d=Math.min(innerHeight,e.bottom),i=r;for(;i;){let h=i.getRootNode();if(i=i.parentElement??(h instanceof ShadowRoot?h.host:null),!i)break;let l=getComputedStyle(i),a=i.getBoundingClientRect();l.overflowX!=="visible"&&(n=Math.max(n,a.left+i.clientLeft),c=Math.min(c,a.left+i.clientLeft+i.clientWidth)),l.overflowY!=="visible"&&(o=Math.max(o,a.top+i.clientTop),d=Math.min(d,a.top+i.clientTop+i.clientHeight))}let u=new DOMRect(n,o,Math.max(0,c-n),Math.max(0,d-o));return{bounds:e,visibleBounds:u,hit(h,l){let a=O(h,l);return L(r,a)}}}function S(r=document){let e=()=>Array.from(r.querySelectorAll("[data-collab-target]"));return{hitTest(n,o){let c=O(n,o);return e().reverse().find(d=>L(d,c))?.getAttribute("data-collab-target")??null},resolve(n){let o=e().find(c=>c.getAttribute("data-collab-target")===n);return o?z(o):void 0},roots:()=>[r instanceof Document?r.body:r]}}function C(r,e,n){let o=null,c,d=[],i="",u,h=0,l=!0,a=new Set,f=()=>{clearTimeout(u),u=void 0,o&&(o=null,e(null))},x=()=>{if(h=0,!l)return;T();let t=d.flatMap(({peer:m,pointer:p})=>{if(!_(p))return[];let w=r.resolve(p.target);if(!w)return[];let{bounds:g}=w,y=w.visibleBounds??g,E=g.left+g.width*p.x,P=g.top+g.height*p.y;return g.width<=0||g.height<=0||y.width<=0||y.height<=0||E<y.left||E>y.right||P<y.top||P>y.bottom||!w.hit(E,P)?[]:[{peer:m,x:E,y:P,bounds:y}]}),s=JSON.stringify(t);s!==i&&(i=s,n(t))},v=()=>{l&&!h&&(h=requestAnimationFrame(x))},b=()=>{if(o&&c){let t=r.resolve(o.target);(!t||!t.hit(c.x,c.y)||Math.abs(t.bounds.left+t.bounds.width*o.x-c.x)>.5||Math.abs(t.bounds.top+t.bounds.height*o.y-c.y)>.5)&&f()}v()},R=new MutationObserver(b),M=new ResizeObserver(b);function T(){let t=new Set(r.roots?.()??[document.body]);if(!(t.size===a.size&&[...t].every(s=>a.has(s)))){R.disconnect(),M.disconnect();for(let s of a)s.removeEventListener("scroll",b,!0);a.clear();for(let s of t)a.add(s),s.addEventListener("scroll",b,!0),R.observe(s,{childList:!0,subtree:!0,attributes:!0}),M.observe(s instanceof ShadowRoot?s.host:s)}}let N=t=>{if(t.pointerType==="touch")return;c={x:t.clientX,y:t.clientY};let s=r.hitTest(t.clientX,t.clientY),m=s===null?void 0:r.resolve(s);if(!s||!m||!m.bounds.width||!m.bounds.height||!m.hit(t.clientX,t.clientY)){f();return}let p=m.bounds;o={target:s,x:Math.max(0,Math.min(1,(t.clientX-p.left)/p.width)),y:Math.max(0,Math.min(1,(t.clientY-p.top)/p.height))},u||(u=setTimeout(()=>{u=void 0,l&&e(o)},40))},j=()=>{document.hidden?f():v()},A=[[document,"pointermove",N],[document.documentElement,"pointerleave",f],[document,"scroll",b,!0],[document,"viewport-change",b],[document,"visibilitychange",j],[window,"resize",b],[window,"blur",f],[window,"pagehide",f],[window,"pageshow",b]];return A.forEach(([t,s,m,p])=>t.addEventListener(s,m,p)),T(),{current:()=>o,render(t){l&&(d=t,i="",v())},refresh:b,disconnect(){if(l){l=!1,f(),cancelAnimationFrame(h),R.disconnect(),M.disconnect();for(let t of a)t.removeEventListener("scroll",b,!0);A.forEach(([t,s,m,p])=>t.removeEventListener(s,m,p)),n([])}}}}var k=class extends HTMLElement{_peers=[];_adapter=S();tracker;layer;constructor(){super();let e=this.attachShadow({mode:"open"});e.innerHTML=`<style>
2
+ :host { display:contents; }
3
+ .layer { position:fixed; inset:0; z-index:var(--spa-collab-z-index,1000); pointer-events:none; overflow:hidden; }
4
+ .cursor,.hover { position:absolute; pointer-events:none; }
5
+ .hover { box-sizing:border-box; border:2px solid var(--peer-color); border-radius:3px; opacity:.65; }
6
+ .cursor { color:var(--spa-collab-label-text,var(--spa-text,#101820)); font:12px system-ui; display:flex; align-items:flex-start; gap:2px; }
7
+ .arrow { width:14px; height:20px; background:var(--peer-color); clip-path:polygon(0 0,100% 65%,55% 68%,40% 100%); }
8
+ .label { margin-top:16px; padding:2px 6px; border-radius:3px; background:var(--peer-color); }
9
+ .label:empty { display:none; }
10
+ </style>`,this.layer=document.createElement("div"),this.layer.className="layer",this.layer.setAttribute("aria-hidden","true"),e.append(this.layer)}get peers(){return this._peers}set peers(e){this._peers=Array.isArray(e)?e.filter(n=>n&&typeof n.peer=="string"):[],this.tracker?.render(this._peers)}get adapter(){return this._adapter}set adapter(e){this.tracker?.disconnect(),this.tracker=void 0,this._adapter=e,this.isConnected&&this.start()}connectedCallback(){for(let e of["peers","adapter"])if(Object.prototype.hasOwnProperty.call(this,e)){let n=this[e];delete this[e],Object.assign(this,{[e]:n})}this.tracker||this.start()}disconnectedCallback(){this.tracker?.disconnect(),this.tracker=void 0}start(){this.tracker=C(this._adapter,e=>this.dispatchEvent(new CustomEvent("pointer-change",{detail:{pointer:e},bubbles:!0,composed:!0})),e=>this.draw(e)),this.tracker.render(this._peers)}draw(e){this.layer.replaceChildren(...e.map(({peer:n,x:o,y:c,bounds:d})=>{let i=this._peers.find(v=>v.peer===n),u=document.createElement("div");u.dataset.peer=n;let h=typeof i.color=="string"&&CSS.supports("color",i.color)?i.color:"var(--spa-collab-accent,var(--spa-accent,#90c2ff))";u.style.setProperty("--peer-color",h);let l=document.createElement("div");l.className="hover",l.part.add("hover"),Object.assign(l.style,{left:`${d.left}px`,top:`${d.top}px`,width:`${d.width}px`,height:`${d.height}px`});let a=document.createElement("div");a.className="cursor",a.part.add("cursor"),Object.assign(a.style,{left:`${o}px`,top:`${c}px`});let f=document.createElement("span");f.className="arrow";let x=document.createElement("span");return x.className="label",x.part.add("label"),x.textContent=typeof i.label=="string"?i.label:"",a.append(f,x),u.append(l,a),u}))}};customElements.get("spaday-pointers")||customElements.define("spaday-pointers",k);export{k as SpadayPointers,C as connectPointers,S as domTargets,z as elementGeometry,_ as isPointer};
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ts/pointers.ts", "../../src/ts/index.ts"],
4
+ "sourcesContent": ["export interface Pointer {\n target: string;\n x: number;\n y: number;\n}\nexport interface Geometry {\n bounds: DOMRectReadOnly;\n visibleBounds?: DOMRectReadOnly;\n hit: (x: number, y: number) => boolean;\n}\nexport interface PointerAdapter {\n hitTest(x: number, y: number): string | null;\n resolve(target: string): Geometry | undefined;\n roots?(): (Element | ShadowRoot)[];\n}\nexport interface RemotePointer {\n peer: string;\n pointer?: unknown;\n}\nexport interface ProjectedPointer {\n peer: string;\n x: number;\n y: number;\n bounds: DOMRectReadOnly;\n}\nexport function isPointer(value: unknown): value is Pointer {\n if (!value || typeof value !== \"object\") return false;\n const p = value as Pointer;\n return (\n typeof p.target === \"string\" &&\n p.target.length > 0 &&\n typeof p.x === \"number\" &&\n Number.isFinite(p.x) &&\n p.x >= 0 &&\n p.x <= 1 &&\n typeof p.y === \"number\" &&\n Number.isFinite(p.y) &&\n p.y >= 0 &&\n p.y <= 1\n );\n}\nfunction hitElement(x: number, y: number): Element | null {\n let hit = document.elementFromPoint(x, y);\n while (hit?.shadowRoot) {\n const inner = hit.shadowRoot.elementFromPoint(x, y);\n if (!inner || inner === hit) break;\n hit = inner;\n }\n return hit;\n}\nfunction containsComposed(element: Element, hit: Element | null): boolean {\n while (hit) {\n if (element === hit || element.contains(hit)) return true;\n const root = hit.getRootNode();\n hit = root instanceof ShadowRoot ? root.host : null;\n }\n return false;\n}\nexport function elementGeometry(element: Element): Geometry {\n const bounds = element.getBoundingClientRect();\n let left = Math.max(0, bounds.left),\n top = Math.max(0, bounds.top);\n let right = Math.min(innerWidth, bounds.right),\n bottom = Math.min(innerHeight, bounds.bottom);\n let ancestor: Element | null = element;\n while (ancestor) {\n const root = ancestor.getRootNode();\n ancestor =\n ancestor.parentElement ?? (root instanceof ShadowRoot ? root.host : null);\n if (!ancestor) break;\n const style = getComputedStyle(ancestor),\n clip = ancestor.getBoundingClientRect();\n if (style.overflowX !== \"visible\") {\n left = Math.max(left, clip.left + ancestor.clientLeft);\n right = Math.min(\n right,\n clip.left + ancestor.clientLeft + ancestor.clientWidth,\n );\n }\n if (style.overflowY !== \"visible\") {\n top = Math.max(top, clip.top + ancestor.clientTop);\n bottom = Math.min(\n bottom,\n clip.top + ancestor.clientTop + ancestor.clientHeight,\n );\n }\n }\n const visibleBounds = new DOMRect(\n left,\n top,\n Math.max(0, right - left),\n Math.max(0, bottom - top),\n );\n return {\n bounds,\n visibleBounds,\n hit(x, y) {\n const hit = hitElement(x, y);\n return containsComposed(element, hit);\n },\n };\n}\n/** Stable IDs for ordinary HTML. Use a custom adapter for virtualized targets. */\nexport function domTargets(root: ParentNode = document): PointerAdapter {\n const targets = () =>\n Array.from(root.querySelectorAll(\"[data-collab-target]\"));\n return {\n hitTest(x, y) {\n const hit = hitElement(x, y);\n return (\n targets()\n .reverse()\n .find((el) => containsComposed(el, hit))\n ?.getAttribute(\"data-collab-target\") ?? null\n );\n },\n resolve(id) {\n const element = targets().find(\n (el) => el.getAttribute(\"data-collab-target\") === id,\n );\n return element ? elementGeometry(element) : undefined;\n },\n roots: () => [\n root instanceof Document ? root.body : (root as Element | ShadowRoot),\n ],\n };\n}\n/** Track relative pointers without choosing a transport, user identity, or renderer. */\nexport function connectPointers(\n adapter: PointerAdapter,\n changed: (pointer: Pointer | null) => void,\n draw: (pointers: ProjectedPointer[]) => void,\n) {\n let pointer: Pointer | null = null;\n let position: { x: number; y: number } | undefined;\n let peers: RemotePointer[] = [];\n let last = \"\";\n let timer: ReturnType<typeof setTimeout> | undefined;\n let frame = 0,\n active = true;\n const roots = new Set<Element | ShadowRoot>();\n const clear = () => {\n clearTimeout(timer);\n timer = undefined;\n if (pointer) {\n pointer = null;\n changed(null);\n }\n };\n const render = () => {\n frame = 0;\n if (!active) return;\n observe();\n const projected = peers.flatMap(({ peer, pointer: p }) => {\n if (!isPointer(p)) return [];\n const target = adapter.resolve(p.target);\n if (!target) return [];\n const { bounds } = target,\n box = target.visibleBounds ?? bounds;\n const x = bounds.left + bounds.width * p.x,\n y = bounds.top + bounds.height * p.y;\n if (\n bounds.width <= 0 ||\n bounds.height <= 0 ||\n box.width <= 0 ||\n box.height <= 0 ||\n x < box.left ||\n x > box.right ||\n y < box.top ||\n y > box.bottom ||\n !target.hit(x, y)\n )\n return [];\n return [{ peer, x, y, bounds: box }];\n });\n const encoded = JSON.stringify(projected);\n if (encoded !== last) {\n last = encoded;\n draw(projected);\n }\n };\n const schedule = () => {\n if (active && !frame) frame = requestAnimationFrame(render);\n };\n const refresh = () => {\n if (pointer && position) {\n const target = adapter.resolve(pointer.target);\n if (\n !target ||\n !target.hit(position.x, position.y) ||\n Math.abs(\n target.bounds.left + target.bounds.width * pointer.x - position.x,\n ) > 0.5 ||\n Math.abs(\n target.bounds.top + target.bounds.height * pointer.y - position.y,\n ) > 0.5\n )\n clear();\n }\n schedule();\n };\n const observer = new MutationObserver(refresh);\n const resize = new ResizeObserver(refresh);\n function observe() {\n const next = new Set(adapter.roots?.() ?? [document.body]);\n if (next.size === roots.size && [...next].every((root) => roots.has(root)))\n return;\n observer.disconnect();\n resize.disconnect();\n for (const root of roots) root.removeEventListener(\"scroll\", refresh, true);\n roots.clear();\n for (const root of next) {\n roots.add(root);\n root.addEventListener(\"scroll\", refresh, true);\n observer.observe(root, {\n childList: true,\n subtree: true,\n attributes: true,\n });\n resize.observe(root instanceof ShadowRoot ? root.host : root);\n }\n }\n const move = (event: PointerEvent) => {\n if (event.pointerType === \"touch\") return;\n position = { x: event.clientX, y: event.clientY };\n const target = adapter.hitTest(event.clientX, event.clientY);\n const geometry = target === null ? undefined : adapter.resolve(target);\n if (\n !target ||\n !geometry ||\n !geometry.bounds.width ||\n !geometry.bounds.height ||\n !geometry.hit(event.clientX, event.clientY)\n ) {\n clear();\n return;\n }\n const rect = geometry.bounds;\n pointer = {\n target,\n x: Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width)),\n y: Math.max(0, Math.min(1, (event.clientY - rect.top) / rect.height)),\n };\n if (!timer)\n timer = setTimeout(() => {\n timer = undefined;\n if (active) changed(pointer);\n }, 40);\n };\n const visibility = () => {\n if (document.hidden) clear();\n else schedule();\n };\n const events: [EventTarget, string, EventListener, boolean?][] = [\n [document, \"pointermove\", move as EventListener],\n [document.documentElement, \"pointerleave\", clear],\n [document, \"scroll\", refresh, true],\n [document, \"viewport-change\", refresh],\n [document, \"visibilitychange\", visibility],\n [window, \"resize\", refresh],\n [window, \"blur\", clear],\n [window, \"pagehide\", clear],\n [window, \"pageshow\", refresh],\n ];\n events.forEach(([target, type, listener, capture]) =>\n target.addEventListener(type, listener, capture),\n );\n observe();\n return {\n current: () => pointer,\n render(values: RemotePointer[]) {\n if (active) {\n peers = values;\n last = \"\";\n schedule();\n }\n },\n refresh,\n disconnect() {\n if (!active) return;\n active = false;\n clear();\n cancelAnimationFrame(frame);\n observer.disconnect();\n resize.disconnect();\n for (const root of roots)\n root.removeEventListener(\"scroll\", refresh, true);\n events.forEach(([target, type, listener, capture]) =>\n target.removeEventListener(type, listener, capture),\n );\n draw([]);\n },\n };\n}\n", "import {\n connectPointers,\n domTargets,\n type PointerAdapter,\n type ProjectedPointer,\n} from \"./pointers.js\";\nexport * from \"./pointers.js\";\nexport interface Peer {\n peer: string;\n pointer?: unknown;\n label?: string;\n color?: string;\n}\n/** Optional pointer presentation. Names and colors are supplied by the application. */\nexport class SpadayPointers extends HTMLElement {\n private _peers: Peer[] = [];\n private _adapter: PointerAdapter = domTargets();\n private tracker?: ReturnType<typeof connectPointers>;\n private layer: HTMLDivElement;\n constructor() {\n super();\n const root = this.attachShadow({ mode: \"open\" });\n root.innerHTML = `<style>\n :host { display:contents; }\n .layer { position:fixed; inset:0; z-index:var(--spa-collab-z-index,1000); pointer-events:none; overflow:hidden; }\n .cursor,.hover { position:absolute; pointer-events:none; }\n .hover { box-sizing:border-box; border:2px solid var(--peer-color); border-radius:3px; opacity:.65; }\n .cursor { color:var(--spa-collab-label-text,var(--spa-text,#101820)); font:12px system-ui; display:flex; align-items:flex-start; gap:2px; }\n .arrow { width:14px; height:20px; background:var(--peer-color); clip-path:polygon(0 0,100% 65%,55% 68%,40% 100%); }\n .label { margin-top:16px; padding:2px 6px; border-radius:3px; background:var(--peer-color); }\n .label:empty { display:none; }\n </style>`;\n this.layer = document.createElement(\"div\");\n this.layer.className = \"layer\";\n this.layer.setAttribute(\"aria-hidden\", \"true\");\n root.append(this.layer);\n }\n get peers() {\n return this._peers;\n }\n set peers(value: Peer[]) {\n this._peers = Array.isArray(value)\n ? value.filter((p) => p && typeof p.peer === \"string\")\n : [];\n this.tracker?.render(this._peers);\n }\n get adapter() {\n return this._adapter;\n }\n set adapter(value: PointerAdapter) {\n this.tracker?.disconnect();\n this.tracker = undefined;\n this._adapter = value;\n if (this.isConnected) this.start();\n }\n connectedCallback() {\n for (const prop of [\"peers\", \"adapter\"] as const) {\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n const value = this[prop];\n delete (this as unknown as Record<string, unknown>)[prop];\n Object.assign(this, { [prop]: value });\n }\n }\n if (!this.tracker) this.start();\n }\n disconnectedCallback() {\n this.tracker?.disconnect();\n this.tracker = undefined;\n }\n private start() {\n this.tracker = connectPointers(\n this._adapter,\n (pointer) =>\n this.dispatchEvent(\n new CustomEvent(\"pointer-change\", {\n detail: { pointer },\n bubbles: true,\n composed: true,\n }),\n ),\n (pointers) => this.draw(pointers),\n );\n this.tracker.render(this._peers);\n }\n private draw(pointers: ProjectedPointer[]) {\n this.layer.replaceChildren(\n ...pointers.map(({ peer, x, y, bounds }) => {\n const entry = this._peers.find((p) => p.peer === peer)!;\n const group = document.createElement(\"div\");\n group.dataset.peer = peer;\n const color =\n typeof entry.color === \"string\" && CSS.supports(\"color\", entry.color)\n ? entry.color\n : \"var(--spa-collab-accent,var(--spa-accent,#90c2ff))\";\n group.style.setProperty(\"--peer-color\", color);\n const hover = document.createElement(\"div\");\n hover.className = \"hover\";\n hover.part.add(\"hover\");\n Object.assign(hover.style, {\n left: `${bounds.left}px`,\n top: `${bounds.top}px`,\n width: `${bounds.width}px`,\n height: `${bounds.height}px`,\n });\n const cursor = document.createElement(\"div\");\n cursor.className = \"cursor\";\n cursor.part.add(\"cursor\");\n Object.assign(cursor.style, { left: `${x}px`, top: `${y}px` });\n const arrow = document.createElement(\"span\");\n arrow.className = \"arrow\";\n const label = document.createElement(\"span\");\n label.className = \"label\";\n label.part.add(\"label\");\n label.textContent = typeof entry.label === \"string\" ? entry.label : \"\";\n cursor.append(arrow, label);\n group.append(hover, cursor);\n return group;\n }),\n );\n }\n}\nif (!customElements.get(\"spaday-pointers\"))\n customElements.define(\"spaday-pointers\", SpadayPointers);\n"],
5
+ "mappings": "AAyBO,SAASA,EAAUC,EAAkC,CAC1D,GAAI,CAACA,GAAS,OAAOA,GAAU,SAAU,MAAO,GAChD,IAAMC,EAAID,EACV,OACE,OAAOC,EAAE,QAAW,UACpBA,EAAE,OAAO,OAAS,GAClB,OAAOA,EAAE,GAAM,UACf,OAAO,SAASA,EAAE,CAAC,GACnBA,EAAE,GAAK,GACPA,EAAE,GAAK,GACP,OAAOA,EAAE,GAAM,UACf,OAAO,SAASA,EAAE,CAAC,GACnBA,EAAE,GAAK,GACPA,EAAE,GAAK,CAEX,CACA,SAASC,EAAWC,EAAWC,EAA2B,CACxD,IAAIC,EAAM,SAAS,iBAAiBF,EAAGC,CAAC,EACxC,KAAOC,GAAK,YAAY,CACtB,IAAMC,EAAQ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AAI,SAAS,QAASA,EAAM,KAAK,EAChEA,EAAM,MACN,qDACNC,EAAM,MAAM,YAAY,eAAgBC,CAAK,EAC7C,IAAMC,EAAQ,SAAS,cAAc,KAAK,EAC1CA,EAAM,UAAY,QAClBA,EAAM,KAAK,IAAI,OAAO,EACtB,OAAO,OAAOA,EAAM,MAAO,CACzB,KAAM,GAAGJ,EAAO,IAAI,KACpB,IAAK,GAAGA,EAAO,GAAG,KAClB,MAAO,GAAGA,EAAO,KAAK,KACtB,OAAQ,GAAGA,EAAO,MAAM,IAC1B,CAAC,EACD,IAAMK,EAAS,SAAS,cAAc,KAAK,EAC3CA,EAAO,UAAY,SACnBA,EAAO,KAAK,IAAI,QAAQ,EACxB,OAAO,OAAOA,EAAO,MAAO,CAAE,KAAM,GAAGP,CAAC,KAAM,IAAK,GAAGC,CAAC,IAAK,CAAC,EAC7D,IAAMO,EAAQ,SAAS,cAAc,MAAM,EAC3CA,EAAM,UAAY,QAClB,IAAMC,EAAQ,SAAS,cAAc,MAAM,EAC3C,OAAAA,EAAM,UAAY,QAClBA,EAAM,KAAK,IAAI,OAAO,EACtBA,EAAM,YAAc,OAAON,EAAM,OAAU,SAAWA,EAAM,MAAQ,GACpEI,EAAO,OAAOC,EAAOC,CAAK,EAC1BL,EAAM,OAAOE,EAAOC,CAAM,EACnBH,CACT,CAAC,CACH,CACF,CACF,EACK,eAAe,IAAI,iBAAiB,GACvC,eAAe,OAAO,kBAAmBd,CAAc",
6
+ "names": ["isPointer", "value", "p", "hitElement", "x", "y", "hit", "inner", "containsComposed", "element", "root", "elementGeometry", "bounds", "left", "top", "right", "bottom", "ancestor", "style", "clip", "visibleBounds", "domTargets", "targets", "el", "id", "connectPointers", "adapter", "changed", "draw", "pointer", "position", "peers", "last", "timer", "frame", "active", "roots", "clear", "render", "observe", "projected", "peer", "target", "box", "encoded", "schedule", "refresh", "observer", "resize", "next", "move", "event", "geometry", "rect", "visibility", "events", "type", "listener", "capture", "values", "SpadayPointers", "domTargets", "root", "value", "p", "prop", "connectPointers", "pointer", "pointers", "peer", "x", "y", "bounds", "entry", "group", "color", "hover", "cursor", "arrow", "label"]
7
+ }
@@ -0,0 +1 @@
1
+ :root{--spa-collab-accent:var(--spa-accent,#90c2ff)}
@@ -0,0 +1,4 @@
1
+ <!doctype html>
2
+ <html lang="en"><head><meta charset="utf-8"><title>Pointer tests</title></head>
3
+ <body><main><div data-collab-target="first" style="margin:40px;width:300px;height:200px;background:#aec">Target</div></main>
4
+ <spaday-pointers></spaday-pointers><script type="module" src="./cdn/index.js"></script></body></html>
@@ -0,0 +1,49 @@
1
+ """Single-browser component preview, including supplied sample pointers."""
2
+
3
+ from spaday import SetField, element, event_value
4
+
5
+ from spaday_collab import Pointers
6
+
7
+ STYLE = """
8
+ :root { color-scheme: dark; --spa-text: #101820; --spa-accent: #90c2ff; }
9
+ body { margin:0; background:#101820; color:#e4ebef; font:16px/1.5 system-ui; }
10
+ main { max-width:56rem; margin:auto; padding:2rem; }
11
+ a { color:#90c2ff; } nav { display:flex; gap:1rem; }
12
+ section { background:#192630; border:1px solid #344854; border-radius:.5rem; padding:1rem; margin:2rem 0; min-height:8rem; }
13
+ label { display:block; margin-top:2rem; }
14
+ textarea { box-sizing:border-box; display:block; width:100%; min-height:8rem; font:inherit; padding:1rem; margin-top:.5rem; }
15
+ pre { white-space:pre-wrap; }
16
+ """
17
+
18
+
19
+ def gallery():
20
+ return element(
21
+ "main",
22
+ element("h1", "Shared pointer gallery"),
23
+ element(
24
+ "p", "Sample remote pointers show labels, colors, and hover outlines. Move your pointer over either panel to inspect local coordinates."
25
+ ),
26
+ element(
27
+ "p",
28
+ "This preview runs Python in Pyodide. For two real users, run python -m spaday_collab.example and open Alice and Bob in separate browsers.",
29
+ ),
30
+ element(
31
+ "section",
32
+ element("h2", "First target"),
33
+ element("p", "Stable target IDs align pointers across different window sizes."),
34
+ **{"data-collab-target": "first"},
35
+ ),
36
+ element(
37
+ "section",
38
+ element("h2", "Second target"),
39
+ element("p", "Labels and colors belong to the application."),
40
+ **{"data-collab-target": "second"},
41
+ ),
42
+ element("pre", id="pointer").bind("textContent", "pointer", codec="json"),
43
+ Pointers(
44
+ peers=[
45
+ {"peer": "sample-a", "pointer": {"target": "first", "x": 0.7, "y": 0.5}, "label": "Alice (sample)", "color": "#f4a261"},
46
+ {"peer": "sample-b", "pointer": {"target": "second", "x": 0.6, "y": 0.6}, "label": "Bob (sample)", "color": "#90c2ff"},
47
+ ]
48
+ ).on("pointer-change", SetField("pointer", event_value("pointer"))),
49
+ )
@@ -0,0 +1,50 @@
1
+ import ast
2
+ from pathlib import Path
3
+
4
+ from spaday import SetField, event_value, generate
5
+ from spaday.bootstrap import bootstrap
6
+ from starlette.testclient import TestClient
7
+
8
+ from spaday_collab import TOKENS, Pointers, SpadayPointers, package
9
+ from spaday_collab.example import create_app
10
+ from spaday_collab.gallery import gallery
11
+
12
+ ROOT = Path(__file__).parents[1]
13
+
14
+
15
+ def test_pointer_state_serializes():
16
+ pointer = {"target": "note", "x": 0.25, "y": 0.5}
17
+ component = Pointers(peers=[{"peer": "a", "pointer": pointer, "label": "Alice"}])
18
+ component.on("pointer-change", SetField("pointer", event_value("pointer")))
19
+ node = component.to_node()
20
+ assert Pointers is SpadayPointers
21
+ assert node["tag"] == "spaday-pointers"
22
+ assert node["props"]["peers"]["List"][0]["Map"]["pointer"]["Map"]["target"] == {"Str": "note"}
23
+ assert "pointer-change" in str(node)
24
+
25
+
26
+ def test_generated_component_is_current():
27
+ assert ast.dump(ast.parse(generate(str(ROOT / "components.cem.json")))) == ast.dump(ast.parse((ROOT / "components.py").read_text()))
28
+
29
+
30
+ def test_assets_and_tokens():
31
+ html = bootstrap(packages=[package])
32
+ assert "/components/collab/cdn/index.js" in html
33
+ assert "/components/collab/css/index.css" in html
34
+ for _, path in package.assets:
35
+ assert (package.assets_dir / path).is_file()
36
+ source = (ROOT.parent / "js/src/ts/index.ts").read_text()
37
+ assert all(token.property in source for token in TOKENS.values())
38
+ assert package.catalog[0].tag == "spaday-pointers"
39
+
40
+
41
+ def test_real_components_in_gallery():
42
+ assert "spaday-pointers" in str(gallery().to_node())
43
+
44
+
45
+ def test_example_pages_and_assets():
46
+ with TestClient(create_app()) as client:
47
+ for path in ("/", "/bob", "/components/collab/cdn/index.js", "/components/collab/cdn/example.js"):
48
+ response = client.get(path)
49
+ assert response.status_code == 200
50
+ assert "remote_activity" in client.get("/").text
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.5
2
+ Name: spaday-collab
3
+ Version: 0.1.0
4
+ Summary: Shared pointers and presence for spaday
5
+ Project-URL: Repository, https://github.com/1kbgz/spaday-collab
6
+ Project-URL: Homepage, https://github.com/1kbgz/spaday-collab
7
+ Author-email: 1kbgz <dev@1kbgz.com>
8
+ License: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Programming Language :: Python :: Implementation :: CPython
18
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: spaday<1.0,>=0.14.2
21
+ Provides-Extra: develop
22
+ Requires-Dist: build; extra == 'develop'
23
+ Requires-Dist: bump-my-version; extra == 'develop'
24
+ Requires-Dist: check-dist; extra == 'develop'
25
+ Requires-Dist: codespell; extra == 'develop'
26
+ Requires-Dist: hatch-js; extra == 'develop'
27
+ Requires-Dist: hatchling; extra == 'develop'
28
+ Requires-Dist: httpx; extra == 'develop'
29
+ Requires-Dist: mdformat; extra == 'develop'
30
+ Requires-Dist: mdformat-myst; extra == 'develop'
31
+ Requires-Dist: mdformat-tables>=1; extra == 'develop'
32
+ Requires-Dist: pydantic>=2; extra == 'develop'
33
+ Requires-Dist: pytest; extra == 'develop'
34
+ Requires-Dist: pytest-cov; extra == 'develop'
35
+ Requires-Dist: ruff; extra == 'develop'
36
+ Requires-Dist: starlette; extra == 'develop'
37
+ Requires-Dist: transports<0.13,>=0.12.3; extra == 'develop'
38
+ Requires-Dist: twine; extra == 'develop'
39
+ Requires-Dist: ty; extra == 'develop'
40
+ Requires-Dist: uv; extra == 'develop'
41
+ Requires-Dist: uvicorn; extra == 'develop'
42
+ Requires-Dist: websockets; extra == 'develop'
43
+ Requires-Dist: wheel; extra == 'develop'
44
+ Provides-Extra: examples
45
+ Requires-Dist: pydantic>=2; extra == 'examples'
46
+ Requires-Dist: starlette; extra == 'examples'
47
+ Requires-Dist: transports<0.13,>=0.12.3; extra == 'examples'
48
+ Requires-Dist: uvicorn; extra == 'examples'
49
+ Requires-Dist: websockets; extra == 'examples'
50
+ Description-Content-Type: text/markdown
51
+
52
+ <a href="https://github.com/1kbgz/spaday-collab">
53
+ <picture>
54
+ <source media="(prefers-color-scheme: dark)" srcset="https://github.com/1kbgz/spaday-collab/raw/main/docs/img/logo-dark.webp?raw=true">
55
+ <img alt="spaday-collab logo, shared pointers inside a browser window" src="https://github.com/1kbgz/spaday-collab/raw/main/docs/img/logo-light.webp?raw=true" width="1200">
56
+ </picture>
57
+ </a>
58
+
59
+ [![Build Status](https://github.com/1kbgz/spaday-collab/actions/workflows/build.yaml/badge.svg)](https://github.com/1kbgz/spaday-collab/actions/workflows/build.yaml)
60
+ [![PyPI](https://img.shields.io/pypi/v/spaday-collab.svg)](https://pypi.org/project/spaday-collab/)
61
+ [![License](https://img.shields.io/github/license/1kbgz/spaday-collab)](LICENSE)
62
+
63
+ Optional shared pointers and hover outlines for [spaday](https://github.com/1kbgz/spaday). Use ordinary HTML targets or supply geometry from a virtualized component.
64
+
65
+ ## Install
66
+
67
+ ```bash
68
+ pip install "spaday-collab[examples]"
69
+ ```
70
+
71
+ ## Usage
72
+
73
+ ```python
74
+ from spaday import SetField, element, event_value
75
+ from spaday_collab import Pointers
76
+
77
+ page = element(
78
+ "main",
79
+ element("section", "Review this section", **{"data-collab-target": "review"}),
80
+ Pointers()
81
+ .bind("peers", "remote_pointers")
82
+ .on("pointer-change", SetField("local_pointer", event_value("pointer"))),
83
+ )
84
+ ```
85
+
86
+ A pointer is `{target, x, y}` with coordinates between zero and one. Remote entries are `{peer, pointer, label?, color?}`. The application maps scoped awareness into this list and chooses labels and colors. The included example uses Spaday's `Wire.awareness` and one transports connection for both shared data and pointers.
87
+
88
+ The browser module also exports `connectPointers`, `domTargets`, and `elementGeometry`. These work without the `Pointers` renderer or a transports connection.
89
+
90
+ ## Documentation
91
+
92
+ - [Tutorial](https://1kbgz.github.io/spaday-collab/docs/src/tutorial.html): run two users against a shared note.
93
+ - [How-to guides](https://1kbgz.github.io/spaday-collab/docs/src/how-to.html): connect awareness, adapt geometry, and replace the display.
94
+ - [Reference](https://1kbgz.github.io/spaday-collab/docs/src/reference.html): Python component, browser API, and tokens.
95
+ - [Explanation](https://1kbgz.github.io/spaday-collab/docs/src/explanation.html): ownership and lifecycle boundaries.
96
+
97
+ ## Browser Examples
98
+
99
+ [Open the Pyodide gallery](https://1kbgz.github.io/spaday-collab/lite/). Python creates real `Pointers` components with explicitly labeled sample peers. This single-browser preview has no shared server; use the local example for real collaboration.
100
+
101
+ ## Run the examples locally
102
+
103
+ ```bash
104
+ pip install "spaday-collab[examples]"
105
+ python -m spaday_collab.example
106
+ ```
107
+
108
+ Open http://127.0.0.1:8044/ and http://127.0.0.1:8044/bob in separate browsers. Move over the note or review section to see pointers, then edit the shared note. Demo identities are selected by URL; production applications must authenticate users and assign permissions on the server.
109
+
110
+ From a checkout, run `make develop`, `make build`, and `make test`. `make pyodide-example` builds `dist/lite`; `make test-pyodide-example` checks that preview in Chromium.
111
+
112
+ > [!NOTE]
113
+ > This library was generated using [copier](https://copier.readthedocs.io/en/stable/) from the [Base Python Project Template repository](https://github.com/python-project-templates/base).
@@ -0,0 +1,17 @@
1
+ spaday_collab/__init__.py,sha256=3c8Cr7yKzvl-D7uq5xKx-oyI752fSm1M3w_V1vLMxGk,735
2
+ spaday_collab/components.cem.json,sha256=UqNHxOj01VxBun9uG3iII5qvYey2uC4p7hly4-CkmCI,985
3
+ spaday_collab/components.py,sha256=Y5Ol3asOli0yAdmRkHMuGB0N9NwAQzyLVTivKNSNRzA,1281
4
+ spaday_collab/example.py,sha256=Qfrr3M8DS2an6iNXQelwZXn93fEm4qqfYg2wuSF-QBs,3356
5
+ spaday_collab/gallery.py,sha256=ojlzFtQ7v-VwQOuAYcSPnd8x8ERKTYoAo0gCNNswnSQ,2181
6
+ spaday_collab/extension/index.html,sha256=rHpTL13lx8jaeGRkSXYbuY_x_uqNJl-7DFzEeq0nvAk,323
7
+ spaday_collab/extension/cdn/example.js,sha256=BxJKDIVNEy7GmCZ3tUwhJQBYNXcGEMchzjDcgRvCl7Q,387
8
+ spaday_collab/extension/cdn/example.js.map,sha256=jJV3Z6pKJffzT-qjU6U_OwmMg_K9X1KTZ6gOPmBZD9Q,1282
9
+ spaday_collab/extension/cdn/index.js,sha256=1Zn4bUmdTjYRRhd-efH2bBMk40SG4eL1P4Y5ByJU_Ok,6460
10
+ spaday_collab/extension/cdn/index.js.map,sha256=PO7K3dJmqG57fK3xRwbsXJdEw97ReRDBWiT6ljI9p9I,22017
11
+ spaday_collab/extension/css/index.css,sha256=TXsYnutLGn07CarK4t98VZDbevl8zJFotGZSAs9dm-g,52
12
+ spaday_collab/tests/test_all.py,sha256=ke-IcEf1OJnjOE3v6-z6K5rDQQEL6TiyzLwW9vp6cCs,1943
13
+ spaday_collab-0.1.0.dist-info/METADATA,sha256=bRVWhHwR-WfD284-haDnotsVN8mSQE8UHcwbOq2KOvg,5537
14
+ spaday_collab-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
15
+ spaday_collab-0.1.0.dist-info/entry_points.txt,sha256=pWfLoVMeA0CV84f-in-5zERv4Y4_j5Ep13dY8CGgTsA,59
16
+ spaday_collab-0.1.0.dist-info/licenses/LICENSE,sha256=RcPqVYf2JyhlV4FlBQud0104R3fT1_-7XbT-vp4eLyE,11335
17
+ spaday_collab-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [spaday.component_packages]
2
+ collab = spaday_collab:package
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 1kbgz
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.