Liking cljdoc? Tell your friends :D

baredom.components.x-drop-zone.model


accepts?cljs

(accepts? {:keys [disabled? accept-kinds capacity child-count kind]})

True when a zone in state m would accept a panel of kind.

child-count is the zone's current panel count, read from the DOM rather than accumulated, so capacity stays a function of what is actually there. A pending reservation is deliberately not counted: the panel has not arrived, and counting it would reject a second drop the server may well accept.

Input keys: :disabled? boolean :accept-kinds set | nil :capacity number | nil :child-count number :kind string

True when a zone in state `m` would accept a panel of `kind`.

`child-count` is the zone's current panel count, read from the DOM rather than
accumulated, so capacity stays a function of what is actually there. A pending
reservation is deliberately not counted: the panel has not arrived, and
counting it would reject a second drop the server may well accept.

Input keys:
  :disabled?    boolean
  :accept-kinds set | nil
  :capacity     number | nil
  :child-count  number
  :kind         string
sourceraw docstring

attr-acceptscljs

source

attr-animate-movescljs

source

attr-disabledcljs

source

attr-drag-statecljs

source

attr-labelcljs

source

attr-maxcljs

source

attr-pendingcljs

source

attr-pending-indexcljs

source

attr-valuecljs

source

boundary-offsetscljs

(boundary-offsets spans content-start content-end)

Caret offsets for every insertion index, given child spans and the zone's content bounds. Always one longer than spans.

An empty zone yields a single centred offset, so the caret reads as here rather than as a stray line pinned to the top edge.

Caret offsets for every insertion index, given child spans and the zone's
content bounds. Always one longer than `spans`.

An empty zone yields a single centred offset, so the caret reads as *here*
rather than as a stray line pinned to the top edge.
sourceraw docstring

caret-offsetcljs

(caret-offset boundaries index)

Offset for the caret at index, clamped into the available boundaries.

Returns nil when there is no index to render. Clamping rather than erroring matters because pending-index is author-set and may outlive the child list it was computed against — a stale index should park the caret at the end, not throw during a render.

Offset for the caret at `index`, clamped into the available boundaries.

Returns nil when there is no index to render. Clamping rather than erroring
matters because `pending-index` is author-set and may outlive the child list
it was computed against — a stale index should park the caret at the end, not
throw during a render.
sourceraw docstring

default-labelcljs

source

drag-statecljs

(drag-state {:keys [hovering? accepted?]})

The data-drag-state value for a hovering panel, or nil when none hovers.

The `data-drag-state` value for a hovering panel, or nil when none hovers.
sourceraw docstring

drop-detailcljs

(drop-detail kind value from to index panel)

Build the x-drop-zone-drop CustomEvent detail.

Both endpoints are opaque strings rather than element references: a confirmation re-render can replace the panel and its source zone, so an app that held elements across the round trip would be writing to detached nodes. panel stays because the synchronous path needs a node to move and it cannot be derived; from is nil when the panel was dragged from outside any zone, which is distinct from a source zone that simply has no value.

Build the x-drop-zone-drop CustomEvent detail.

Both endpoints are opaque strings rather than element references: a
confirmation re-render can replace the panel and its source zone, so an app
that held elements across the round trip would be writing to detached nodes.
`panel` stays because the synchronous path needs a node to move and it cannot
be derived; `from` is nil when the panel was dragged from outside any zone,
which is distinct from a source zone that simply has no `value`.
sourceraw docstring

event-dropcljs

source

event-entercljs

source

event-leavecljs

source

event-schemacljs

source

hover-detailcljs

(hover-detail kind value)

Build the x-drop-zone-enter / x-drop-zone-leave CustomEvent detail.

Build the x-drop-zone-enter / x-drop-zone-leave CustomEvent detail.
sourceraw docstring

insert-indexcljs

(insert-index midpoints pointer)

Index a panel would occupy if dropped at pointer along the flow axis.

The count of children whose midpoint precedes the pointer. The dragged panel is excluded from midpoints by the caller when it already lives in this zone, so dropping a panel back where it started yields its original index and the app can cheaply no-op.

Index a panel would occupy if dropped at `pointer` along the flow axis.

The count of children whose midpoint precedes the pointer. The dragged panel
is excluded from `midpoints` by the caller when it already lives in this zone,
so dropping a panel back where it started yields its original index and the
app can cheaply no-op.
sourceraw docstring

method-apicljs

source

normalizecljs

(normalize {:keys [value-raw accepts-raw max-raw label-raw disabled-present?
                   pending-present? pending-index-raw animate-moves-present?]})

Normalise raw attribute inputs into a stable view-model map.

Input keys: :value-raw string | nil :accepts-raw string | nil :max-raw string | nil :label-raw string | nil :disabled-present? boolean :pending-present? boolean :pending-index-raw string | nil :animate-moves-present? boolean

Output keys: :value string :accept-kinds set | nil (nil → accepts anything) :capacity number | nil :label string :disabled? boolean :pending? boolean :pending-index number | nil :animate-moves? boolean

Normalise raw attribute inputs into a stable view-model map.

Input keys:
  :value-raw              string | nil
  :accepts-raw            string | nil
  :max-raw                string | nil
  :label-raw              string | nil
  :disabled-present?      boolean
  :pending-present?       boolean
  :pending-index-raw      string | nil
  :animate-moves-present? boolean

Output keys:
  :value          string
  :accept-kinds   set | nil  (nil → accepts anything)
  :capacity       number | nil
  :label          string
  :disabled?      boolean
  :pending?       boolean
  :pending-index  number | nil
  :animate-moves? boolean
sourceraw docstring

normalize-labelcljs

(normalize-label raw)

Normalize the raw label attribute. Falls back to default-label.

Normalize the raw label attribute. Falls back to default-label.
sourceraw docstring

normalize-valuecljs

(normalize-value raw)

Normalize the raw value attribute — the zone's opaque identity key.

Absent collapses to the empty string, matching the panel's value. Callers that need to distinguish this zone has no id from there was no zone at all do so at the boundary, where nil means the latter.

Normalize the raw `value` attribute — the zone's opaque identity key.

Absent collapses to the empty string, matching the panel's `value`. Callers
that need to distinguish *this zone has no id* from *there was no zone at all*
do so at the boundary, where nil means the latter.
sourceraw docstring

observed-attributescljs

source

parse-acceptscljs

(parse-accepts raw)

Parse the raw accepts attribute into a set of kinds, or nil.

nil means accept anything — deliberately distinct from the empty set, which would mean accept nothing. An author who writes accepts="" means they have not constrained the zone, not that they have closed it.

Parse the raw `accepts` attribute into a set of kinds, or nil.

nil means *accept anything* — deliberately distinct from the empty set, which
would mean accept nothing. An author who writes `accepts=""` means they have
not constrained the zone, not that they have closed it.
sourceraw docstring

parse-countcljs

(parse-count raw)

Parse a raw attribute into a non-negative integer, or nil.

Absent, blank, non-numeric and negative all collapse to nil: a capacity or an index that cannot be read is better treated as unset than coerced to zero, which would silently close a zone or pin a caret to the top.

Parse a raw attribute into a non-negative integer, or nil.

Absent, blank, non-numeric and negative all collapse to nil: a capacity or an
index that cannot be read is better treated as unset than coerced to zero,
which would silently close a zone or pin a caret to the top.
sourceraw docstring

part-caretcljs

source

part-emptycljs

source

part-zonecljs

source

property-apicljs

source

span-midpointscljs

(span-midpoints spans)

Midpoint of each child span along the flow axis.

Midpoint of each child span along the flow axis.
sourceraw docstring

state-overcljs

source

state-rejectcljs

source

tag-namecljs

source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close