#!/bin/bash

# omarchy:summary=Open the omarchy-shell dev gallery (qs.Ui kit preview)
# omarchy:args=[section]
# omarchy:examples=omarchy dev ui-preview | omarchy dev ui-preview button | omarchy dev ui-preview button-group | omarchy dev ui-preview slider
#
# Pass a section name to jump straight to that component instead of
# scrolling from the top. Section names match the cursor section ids in
# shell/plugins/dev-gallery/GalleryPanel.qml — `button`, `button-group`,
# `cursor-surface`, `slider`, `toggle`, `dropdown`, etc. Unknown names
# are ignored and the gallery opens at its normal default position.

if (( $# > 0 )) && [[ -n $1 ]]; then
  section="$1"
  payload=$(printf '{"section":"%s"}' "${section//\"/}")
else
  payload='{}'
fi

omarchy-shell shell summon omarchy.dev-gallery "$payload"
