{"version":3,"file":"web-DVsIyf-f.mjs","names":["cn","InTreeLayer","zLayerClass","React","Coord","Extent","start","size","minSize","shift","end","center","Axis","len","v","pct","fraction","AXIS_KEYS","x","y","const","Record","CSSProperties","resolveAxis","e","axis","style","k","undefined","placedStyle","rx","ry","translate","PlacedOptions","layer","decorative","placedClasses","opts","filter","Boolean","join","PlacedProps","HTMLAttributes","HTMLElement","as","ElementType","ref","Ref","Placed","t0","$","_c","children","className","rest","t1","As","t2","t3","t4","t5","_c","v","fraction","AXIS_KEYS","k","axis","style","rx","x","ry","y","opts","layer","zLayerClass","decorative","$","c","children","className","ref","rest","t1","t0","As","t2","cn","t3","t4","t5","web_default"],"sources":["../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/primitives/plugins/css/plugins/coords/web/internal/coords.tsx","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/primitives/plugins/css/plugins/coords/web/index.ts"],"sourcesContent":["import { cn } from \"@plugins/primitives/plugins/css/plugins/ui-kit/web\";\nimport {\n type InTreeLayer,\n zLayerClass,\n} from \"@plugins/primitives/plugins/css/plugins/z-layers/web\";\nimport type React from \"react\";\n\n/**\n * One coordinate: a number of CSS pixels, or any CSS length/percentage written\n * out (`\"50%\"`, `\"2rem\"`, `\"calc(100% - 4px)\"`).\n *\n * Numbers are px because every corpus site that hands this primitive a number\n * measured one — a `DOMRect`, a scroll offset, a virtualizer's `start`. There is\n * deliberately no unit prop: a site that wants a fraction says so with\n * {@link pct}, and a site that wants a ramp step is not a coordinate site at all\n * (that is ``).\n */\nexport type Coord = number | string;\n\n/**\n * How a box occupies ONE axis. `\"fill\"` spans the axis end to end; otherwise an\n * anchored arm.\n *\n * **The `?: never` keys are the point.** Over-specifying an axis\n * (`{ start, end, size }`, `{ center, start }`) is a real mistake with a silent\n * outcome — CSS resolves the conflict by dropping whichever property loses, and\n * the box lands somewhere plausible. Declaring the conflicting keys as optional\n * `never` on each arm turns it into a `tsc` error at the call site.\n *\n * Every arm declares EVERY key for a second reason: `in`-narrowing is defeated by\n * an optional `never` (`\"end\" in e` is true for `{ end: undefined }`), so\n * {@link placedStyle} resolves the arm **by value** instead. A future arm that\n * omits a key would silently opt out of that.\n */\nexport type Extent =\n | \"fill\"\n | {\n start: Coord;\n size?: Coord;\n minSize?: Coord;\n shift?: Coord;\n end?: never;\n center?: never;\n }\n | {\n end: Coord;\n size?: Coord;\n minSize?: Coord;\n shift?: Coord;\n start?: never;\n center?: never;\n }\n | {\n start: Coord;\n end: Coord;\n shift?: Coord;\n size?: never;\n minSize?: never;\n center?: never;\n }\n | {\n center: Coord;\n size?: Coord;\n minSize?: Coord;\n start?: never;\n end?: never;\n shift?: never;\n };\n\n/** Which axis an extent is being resolved on. */\ntype Axis = \"x\" | \"y\";\n\n/** A `Coord` as a CSS length. Bare numbers are px. */\nfunction len(v: Coord): string {\n return typeof v === \"number\" ? `${v}px` : v;\n}\n\n/**\n * A fraction as the percentage string 14 call sites hand-rolled as\n * `` `${f * 100}%` ``.\n *\n * **Unclamped and unrounded, on purpose.** Culling a tick that falls outside its\n * track is the caller's decision (`gantt-rows.tsx` filters on the fraction\n * before it ever gets here), and rounding would move pixels that are correct\n * today — sub-percent precision is exactly what a zoomed Gantt is made of.\n */\nexport function pct(fraction: number): string {\n return `${fraction * 100}%`;\n}\n\n/** The four CSS properties one axis writes. */\nconst AXIS_KEYS = {\n x: {\n start: \"left\",\n end: \"right\",\n size: \"width\",\n minSize: \"minWidth\",\n },\n y: {\n start: \"top\",\n end: \"bottom\",\n size: \"height\",\n minSize: \"minHeight\",\n },\n} as const satisfies Record>;\n\n/**\n * Resolve one axis into its style properties plus the shift this axis\n * contributes to the shared `translate`.\n *\n * The arm is read BY VALUE (`e.center !== undefined`), never by `in` — see\n * {@link Extent}. `center` is sugar: the anchor goes on the start edge and the\n * box pulls itself back by half its own size, which is one mechanic with two\n * names, not two mechanics.\n */\nfunction resolveAxis(\n e: Extent,\n axis: Axis,\n): { style: React.CSSProperties; shift: string | null } {\n const k = AXIS_KEYS[axis];\n const style: React.CSSProperties = {};\n if (e === \"fill\") {\n style[k.start] = 0;\n style[k.end] = 0;\n return { style, shift: null };\n }\n if (e.center !== undefined) {\n style[k.start] = len(e.center);\n if (e.size !== undefined) style[k.size] = len(e.size);\n if (e.minSize !== undefined) style[k.minSize] = len(e.minSize);\n return { style, shift: \"-50%\" };\n }\n if (e.start !== undefined) style[k.start] = len(e.start);\n if (e.end !== undefined) style[k.end] = len(e.end);\n if (e.size !== undefined) style[k.size] = len(e.size);\n if (e.minSize !== undefined) style[k.minSize] = len(e.minSize);\n return { style, shift: e.shift === undefined ? null : len(e.shift) };\n}\n\n/**\n * The pure coordinate style map — single source of truth, exported so the\n * component and the pure test share one definition.\n *\n * **Both axes are required**, and that is the API's one opinionated stance. An\n * absolutely-positioned box with nothing said about an axis keeps its CSS\n * *static position* — it lands wherever it would have been in flow, which is the\n * single genuinely surprising outcome in this corner of CSS and the reason the\n * corpus is full of `absolute top-0` boxes whose author meant \"the top\". Saying\n * `x=\"fill\"` costs one word and removes the whole question.\n *\n * **It writes the CSS `translate` property and NEVER `transform`.** Several\n * consumers (the Sonata progress bar, the piano roll, the notation cursor) drive\n * `el.style.transform` from a ref every frame. `translate` is applied before\n * `transform` by the spec, so the two compose: this primitive owns the placement,\n * the writer owns the per-frame motion, and there is no combination to avoid and\n * no rule to remember. (Tailwind v4 emits `-translate-x-1/2` as `translate` too,\n * which is why `` is already safe beside such a writer.)\n *\n * `shift` is per-AXIS rather than a whole-component mode because real sites mix\n * them: a windowed row is `left/right` inset with only its `y` composited, and a\n * loop region needs an inset base AND a shift on top.\n */\nexport function placedStyle(x: Extent, y: Extent): React.CSSProperties {\n const rx = resolveAxis(x, \"x\");\n const ry = resolveAxis(y, \"y\");\n const style: React.CSSProperties = { ...rx.style, ...ry.style };\n // No shift on either axis ⇒ no `translate` key at all, so a placed box never\n // silently declares a transform-adjacent property it does not use.\n if (rx.shift !== null || ry.shift !== null) {\n style.translate = `${rx.shift ?? \"0\"} ${ry.shift ?? \"0\"}`;\n }\n return style;\n}\n\n/** What a caller may say about a placed box beyond its two coordinates. Both\n * halves are optional — {@link placedClasses} owns the defaults. */\nexport interface PlacedOptions {\n /**\n * Stacking level among siblings, from the z-layer scale. **Defaults to no z\n * class at all** — deliberately unlike ``, which defaults to `raised`.\n *\n * Every bar, marker and overlay this primitive replaces paints by DOM order\n * today, and even `z-index: 0` would open a stacking context none of them\n * asked for. Say `layer` when the box genuinely has to jump its siblings.\n */\n layer?: InTreeLayer;\n /** Make the box click-through (`pointer-events-none`) — a ruler line, a\n * playhead, a highlight band that must never eat a click. Defaults to false. */\n decorative?: boolean;\n}\n\n/**\n * The pure coordinate class map — single source of truth, exported so the\n * component and the pure test share one definition.\n *\n * A placed box is `absolute` plus, optionally, a stacking level and\n * click-through. Everything geometric is inline style, because it is a runtime\n * number: there is no class for `left: 37.4%`.\n *\n * **The defaults live HERE, not in ``** — the `layer` precedent, and a\n * deliberate divergence from `pinClasses`/``, which declares each default\n * twice (once in the destructuring, once in the prop docs) and so can drift.\n */\nexport function placedClasses(opts: PlacedOptions = {}): string {\n const { layer, decorative = false } = opts;\n return [\n \"absolute\",\n layer === undefined ? null : zLayerClass(layer),\n decorative ? \"pointer-events-none\" : null,\n ]\n .filter(Boolean)\n .join(\" \");\n}\n\nexport interface PlacedProps\n extends PlacedOptions, React.HTMLAttributes {\n /** Horizontal extent. Required — see {@link placedStyle}. */\n x: Extent;\n /** Vertical extent. Required — see {@link placedStyle}. */\n y: Extent;\n /** Host element/component. Defaults to a `div`. */\n as?: React.ElementType;\n /** Forwarded to the rendered element (mirrors Layer/Clip/Fill/Pin). */\n ref?: React.Ref;\n}\n\n/**\n * The sanctioned **coordinate-space** primitive — a box placed by runtime\n * numbers inside a caller-owned positioned host: Gantt bars, piano-roll notes,\n * windowed-row offsets, drag ghosts, crop rectangles, `DOMRect` highlights,\n * editor decorations.\n *\n * Against `` the split is where the number comes from, not how big it is.\n * **Pin places by a semantic ramp step** (`to=\"top-right\" offset=\"sm\"`) — a\n * decision an author makes and a density preset can rescale. **Placed places by\n * a measurement** — a fraction of a track, a `DOMRect`, a virtualizer offset —\n * which no ramp can express and no preset may rescale. Pin's docs used to send\n * those sites to a per-file `eslint-disable`; the corpus says that call was\n * wrong, and this primitive is the answer instead.\n *\n * Against ``: a Layer is `inset-0` on both axes and carries no\n * coordinate. If your box has no number in it, you want Layer.\n *\n * **Reach for {@link placedStyle} + {@link placedClasses} rather than this\n * component whenever you do not own the element** — a raw ``/``\n * leaf that must ITSELF be placed, an element carrying `setPointerCapture` or\n * drag listeners (a wrapper would become the hit-test target and change\n * behaviour), or a third-party component exposing only `className`/`style`. Own\n * the element ⇒ ``; don't ⇒ the helpers.\n *\n * Caller `className` composes last, and caller `style` overrides the resolved\n * coordinates.\n */\nexport function Placed({\n x,\n y,\n layer,\n decorative,\n as: As = \"div\",\n ref,\n className,\n style,\n children,\n ...rest\n}: PlacedProps) {\n return (\n \n {children}\n \n );\n}\n","import type { PluginDefinition } from \"@plugins/framework/plugins/web-sdk/core\";\n\nexport {\n Placed,\n placedClasses,\n placedStyle,\n pct,\n type Coord,\n type Extent,\n type PlacedProps,\n type PlacedOptions,\n} from \"./internal/coords\";\n\nexport default {\n description:\n \"Coordinate-space positioning primitive: / placedStyle() places a box by runtime numbers on both axes, plus pct() for fractional coordinates.\",\n contributions: [],\n} satisfies PluginDefinition;\n"],"mappings":";;;;;AAyEA,SAASa,IAAIC,GAAkB;CAC7B,OAAO,OAAOA,KAAM,WAAW,GAAGA,EAAC,MAAOA;AAC5C;AAWA,SAAgBC,IAAIC,GAA0B;CAC5C,OAAO,GAAGA,IAAW,IAAG;AAC1B;AAGA,IAAMC,IAAY;CAChBC,GAAG;EACDZ,OAAO;EACPI,KAAK;EACLH,MAAM;EACNC,SAAS;CACX;CACAW,GAAG;EACDb,OAAO;EACPI,KAAK;EACLH,MAAM;EACNC,SAAS;CACX;AACF;AAWA,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