class

Sni

@Js
const class Sni : Obj

Sni models a Subject Navigation Identifier formatted as:

/provider/tail?params#frag

constructors fromStr

Parse from string formatted as "/provider/tail?params#frag"

fields frag

Fragment identifier for location within the subject

home

Home root "/"

params

Query parameters parsed as key-value map

provider

Provider is the first path segment identifying the subject provider

spills

Spilled values keyed by spill key "a", "b", "c"..

tail

Tail as list of path segments after the provider

methods decode

Decode the full view state from a Dict produced by encode

defVal

Default is same as home

encode

Encode the full view state -- string plus spilled values -- to a Dict for history state, server requests, and favorites

equals

Equality based on string and spills

equalsIgnoreFrag

Equality ignoring fragment

fromId

Construct Sni from a Ref identity (reverse of id)

fromIds

Create "/db?sel=id1,id2,..." sni from multiple refs

get

Get a single param value by name, or null if not present

hash

Hash code based on string

id

Get Ref identity for this Sni

loc

Parse fragment as start location, or null if no fragment

locEnd

Parse fragment as end location for a range, or null if no range

name

Last named part in path of tail or provider

/files/lib/doc.xeto/Specs.md => "Specs.md"

noFrag

Return Sni with fragment stripped

plusName

Append a name to the tail path, dropping any params

plusSlash

Append a trailing slash, dropping any params

/dev/a/b?view=xxx plusSlash => /dev/a/b/

sel

Selection ids parsed from the "sel" param, or null if not present

set

Return new Sni with the given param set

setFrag

Return new Sni with given fragment, or remove if null

setParams

Return new Sni with given params

setSel

Return new Sni with the "sel" param set to the given selection ids, or removed if null

setTail

Return new Sni with given tail

setView

Set view name

tailStr

Tail as the full string after the provider

toItem

To item

toStr

Full string representation

toUri

Convert to a URI

view

Get the "view" parameter

decode static Sni decode(Dict d)

Decode the full view state from a Dict produced by encode.

defVal static Sni defVal()

Default is same as home

encode Dict encode()

Encode the full view state -- string plus spilled values -- to a Dict for history state, server requests, and favorites. The sni tag holds the string (with "$key" placeholders); the spills tag holds the spilled values when present. Reverse with decode.

equals virtual Bool equals(Obj? that)

Equality based on string and spills. Spill keys must match exactly. For string-only comparison use a.toStr == b.toStr.

equalsIgnoreFrag Bool equalsIgnoreFrag(Sni that)

Equality ignoring fragment

frag const Str? : frag

Fragment identifier for location within the subject. Null if no fragment.

/files/lib.xeto#L10 => "L10"
/files/lib.xeto#L10,5-L20,3 => "L10,5-L20,3"

fromId static Sni fromId(Ref id, Bool norm := true)

Construct Sni from a Ref identity (reverse of id). If norm is true, relativize the ref via UiSpace if available.

fromIds static Sni fromIds(Ref[] ids, Bool norm := true)

Create "/db?sel=id1,id2,..." sni from multiple refs. If norm is true, relativize ids via UiSpace if available. More than 8 ids will spill to the $a key (e.g. "?sel=$a").

fromStr static new fromStr(Str s, Bool checked := true)

Parse from string formatted as "/provider/tail?params#frag"

get @Operator
Str? get(Str name)

Get a single param value by name, or null if not present.

hash virtual Int hash()

Hash code based on string

home const static Sni : home

Home root "/"

id Ref id()

Get Ref identity for this Sni. For /db/{id} where id is a valid bare Ref, returns Ref(id). For all others returns sni:{provider}:{tail-encoded}. Params and fragment are never part of identity.

loc FileLoc? loc()

Parse fragment as start location, or null if no fragment. Returns FileLoc with line and optional column.

#L10 => FileLoc("", 10)
#L10,5 => FileLoc("", 10, 5)
#L10,5-L20,3 => FileLoc("", 10, 5)

locEnd FileLoc? locEnd()

Parse fragment as end location for a range, or null if no range. Returns FileLoc with line and optional column.

#L10 => null
#L10-L20 => FileLoc("", 20)
#L10,5-L20,3 => FileLoc("", 20, 3)

name Str name()

Last named part in path of tail or provider

/files/lib/doc.xeto/Specs.md => "Specs.md"

noFrag Sni noFrag()

Return Sni with fragment stripped. Returns this if no fragment.

params const Str:Str : params

Query parameters parsed as key-value map. Returns empty map if no params.

plusName Sni plusName(Str name)

Append a name to the tail path, dropping any params.

/dev/a/b?view=xxx plusName("c.txt") => /dev/a/b/c.txt

plusSlash Sni plusSlash()

Append a trailing slash, dropping any params

/dev/a/b?view=xxx plusSlash => /dev/a/b/

provider const Str : provider

Provider is the first path segment identifying the subject provider. Empty string only for root "/".

/db/ph::Equip/abc-123 => "db"
/files/lib/doc.xeto/Specs.md => "file"

sel Ref[]? sel()

Selection ids parsed from the "sel" param, or null if not present. A selection is a view of its base collection, never identity - see id. Returns null if the param was spilled and the spill values are not available (string-only reparse). See setSel.

set Sni set(Str name, Str? val)

Return new Sni with the given param set. If val is null, the param is removed. Returns this if unchanged.

setFrag Sni setFrag(Str? frag)

Return new Sni with given fragment, or remove if null.

setParams Sni setParams([Str:Str]? params)

Return new Sni with given params.

setSel Sni setSel(Ref[]? ids)

Return new Sni with the "sel" param set to the given selection ids, or removed if null. More than 8 ids spill to a "$key" placeholder carried by the spills Dict. See sel.

setTail Sni setTail(Str[] tail)

Return new Sni with given tail.

setView Sni setView(Str viewName)

Set view name

spills const Dict : spills

Spilled values keyed by spill key "a", "b", "c"... These are the typed values (e.g. Ref[]) referenced by "$key" placeholders in the string (so "$a" maps to spills->a). Keys are valid tag names. Empty Dict if no values spilled. See encode.

tail const Str[] : tail

Tail as list of path segments after the provider. Returns empty list if no tail.

/db/ph::Equip/abc-123 => ["ph::Equip", "abc-123"]
/files/lib/doc.xeto/Specs.md => ["lib", "doc.xeto", "Specs.md"]

tailStr Str tailStr()

Tail as the full string after the provider. Returns empty string if no tail.

/db/ph::Equip/abc-123 => "ph::Equip/abc-123"
/files/lib/doc.xeto/Specs.md => "lib/doc.xeto/Specs.md"

toItem Item toItem(Obj? text := null, Icon? icon := null, Dict? meta := null)

To item

toStr virtual Str toStr()

Full string representation. This is the URL form which carries spill placeholders such as "$0" but not the spilled values themselves. Use encode/decode to round-trip the full state including spills.

toUri Uri toUri()

Convert to a URI

view Str? view()

Get the "view" parameter

Haxall 4.0.7 ∙ 27-Oct-2026 09:10 EDT