@staging-apiplus/essentials
v0.0.6
Published
First-party QuickPage code package. It is the source of the **System library** snapshot.
Readme
@staging-apiplus/essentials
First-party QuickPage code package. It is the source of the System library snapshot.
| Module | Kind | What it does |
| --- | --- | --- |
| gallery | Code component | A Swiper-based gallery. |
| slider | Logic | Moves slides along a track. |
| tab | Logic | Shows one tab content at a time. |
Neither logic writes layout styles at runtime, except the display: none that a variable bound to a switch asks for (Slider pagination and dots, Tab items). tab has a settings dialog like slider.
Commands
pnpm run dev # apps dev: playground + HMR (+ QuickPage Link dev for editor and preview)
pnpm run build # apps build, writes dist/ (also via make build-code-packages)
pnpm run validate # apps validate
pnpm run test:unit # schema and DOM helper testsGallery
A code component built on Swiper. The slides are the content of its slide slot. The number of slides is the number of items in that slot. A gallery with no slide renders nothing.
Use the gallery
- Add the package. Settings → Apps → Browse → Essentials. The package then lists its components in the Insert panel.
- Insert it. Insert panel → Components → Gallery. It is inserted at the size of an Embed (16:9) and starts as the Slide template.
- Fill the slide slot. Pick one of these:
- By hand. Add frames under the Slides slot on the canvas. Each frame is one slide.
- From a source. Select the gallery or its slide slot. In the Content source section, bind a list variable or a component. One slide is made per item. The slot panel shows the kind: Manual, Asset folder or Master variants.
- Pick a template. Design panel → Template. See Templates.
- Set the slides. The panel fields are in Design panel. Default picks the slide shown first. Its list shows "Slide 1", "Slide 2" and so on, or the title of each variant for a component source.
- Check it in Preview. The editor canvas shows the gallery but does not run it. See Canvas, preview and published pages.
The reset button in the panel header clears every prop and every binding except the Template. The gallery goes back to the defaults of its current template, not to the first one.
Templates
The Template prop picks the look. Each template runs one Swiper effect and starts from its own layout (props/template_bundles.ts).
| Template | Look | Starts with |
| --- | --- | --- |
| Slide | The plain slider. It can lay slides out in a grid of rows. | Horizontal. Autoplay on (3000 ms), loop on, arrows and pagination on. |
| Cards | A deck of cards. Style stack peeks the next cards below and flies the swiped card out. Style wallet fans cards on both sides of the front card: left and right for a horizontal swipe, above and below for a vertical one. | Vertical. Centered, loop on, no arrows, no pagination. |
| Carousel | Slides on a ring seen from outside. | Horizontal. Three slides in view, centered, loop off, arrows and pagination on. |
| Expo | A scale and parallax effect. The leaving slide shrinks and, with Parallax on, drifts slower than the swipe. | Vertical. One slide in view, loop on, pagination on, no arrows, Parallax off. |
| Material You | The Material 3 multi-browse row: a large, a medium and a small slide. With Centered slide, the active slide is the largest and sits in the middle. | Horizontal. Two slides in view, loop on, arrows and pagination on. |
| Panorama | A curved wall seen from inside. | Horizontal. Three slides in view, centered, loop on, pagination on. |
| Paper | Full-bleed slides revealed by a growing arc, like onboarding screens. The dots grade by distance from the active one. | Vertical. Loop on, pagination on, arrows off. |
| Spring | A row that follows the swipe like a chain on a spring. | Horizontal. One slide in view, loop on, arrows and pagination on. |
| Thumbs | The slider with a thumbnail strip that follows it. The strip runs along the same axis and shows a scaled copy of each slide. | Horizontal. Autoplay on (3000 ms), loop on, arrows on, no pagination. |
Picking a template writes its whole layout. Every prop that any template manages goes back to its own default first, so a value left over from another template does not stay. A prop that no template manages keeps the user's value. A prop the user has never set takes the value of the current template.
Navigation starts on for Slide, Carousel, Material You, Spring and Thumbs, and off for Panorama and Paper, which have the toggle. Expo and Cards have no arrows: the Navigation toggle is hidden and the view draws none, even for a value stored under another template. Cards and Paper hide the Pagination toggle. Paper always draws its pagination, and Cards draws none.
Design panel
- The panel starts with the Template and the slide settings, with no heading. Style (Stack or Wallet) shows under the Template for Cards.
- Autoplay and Control are collapsible sections. Grid is a third one, for the Slide template only. It has Grid row and Grid direction, and it shows for a horizontal swipe only.
- The fields of each section depend on the template:
| Template | Slide settings (no heading) | Autoplay | Control | | --- | --- | --- | --- | | Slide | Default, Slide per view, Direction, Navigation, Pagination, Type pagination | Autoplay, Delay, Space between | Centered slide, Loop, Mouse wheel, Parallax | | Cards | Default, Direction | Autoplay, Delay | Loop, Mouse wheel | | Carousel | Default, Slide per view, Direction, Navigation, Pagination, Type pagination | Autoplay, Delay, Space between | Centered slide, Loop, Mouse wheel, Parallax | | Expo | Default, Direction, Pagination, Type pagination | Autoplay, Delay, Space between | Loop, Mouse wheel, Parallax | | Material You | Default, Slide per view, Direction, Navigation, Pagination, Type pagination | Autoplay, Delay, Space between | Centered slide, Loop, Parallax | | Panorama | Default, Slide per view, Direction, Navigation, Pagination, Type pagination | Autoplay, Delay, Space between | Loop, Mouse wheel | | Paper | Default, Direction, Navigation, Type pagination | Autoplay, Delay | Loop, Mouse wheel, Parallax | | Spring | Default, Slide per view, Direction, Navigation, Pagination, Type pagination | Autoplay, Delay, Space between | Centered slide, Loop, Parallax | | Thumbs | Default, Direction, Navigation | Autoplay, Display, Space between | Loop |
- Parallax changes the look in Expo and Carousel only. The other templates show the toggle but ignore it.
- The panel has no field for speed, rewind, slides per group, grab cursor, scrollbar, keyboard, the autoplay behavior on interaction, the Carousel rotation and depth, the Panorama angle or the Spring stagger. These props keep their defaults (for example speed is 300 ms and the Spring stagger is 0.35). A prop value stored on the node still applies.
- Booleans are switches. Direction and Grid direction are icon toggles. Space between is a length input with a unit picker limited to the units the gallery can lay out (
pxand%); it stores CSS text such as10px(prop.length({ units })), and a plain number stored earlier counts aspx. A prop that must stay in one unit usesprop.number({ unit })with any CSS unit, shown as a suffix. Delay is a duration input (prop.duration) with anms/sdropdown: type800,800msor1.5s. It stores the text with its unit (5s), so the unit you chose stays; a plain number stored earlier is milliseconds, and the component always reads milliseconds. Text that is no duration is dropped. A number input commits when you leave it or press Enter, and it keeps the value inside its bounds. - A field can take a variable, except the choice fields (Template, Style, Type pagination, Default). The link button hovers inside input fields. A bound field shows the variable name. Switches take a boolean variable. Delay and Space between take a number, string or CSS variable. The other number fields take a number variable.
Canvas, preview and published pages
- Autoplay runs in preview and on published pages. It does not run on the editor canvas.
- On the editor canvas the slides do not react to click, drag, keyboard or mouse wheel, and the grab cursor is off. This keeps a click on the slide content a selection. Preview and published pages react to all of them.
- The mouse wheel lets the page scroll on once the first or last slide is reached. Panorama with Loop on, and Carousel with Loop and Centered slide on, take the wheel themselves, one slide per notch.
Limits
- Slide per view is clamped to the number of slides (and to 12).
- Loop is off when the slide count does not exceed the slides in view, when Grid row is more than 1, and, for Cards, when the deck has too few slides for its ring. With Loop off, Rewind (if set) applies.
- Grid works for a horizontal Slide gallery only. With a vertical direction the grid is one row.
- Material You sizes its own slides, so Slide per view does not decide whether it can loop.
Tests
pnpm run test:unit covers the prop groups, the template layouts, the Swiper options, the effect math and the slide slot helpers.
Slider
Props
| Prop | Default | Behavior |
| --- | --- | --- |
| loop | true | Loops in preview and on published pages. See "Loop". |
| speed | 400 | Transition time in ms. |
| autoplay | false | Moves one slide per autoplayDelay. At the last slide it follows loop. |
| autoplayDelay | 3000 | Time between slides in ms. This is not the speed transition time. |
A missing loop counts as true. Attachments saved before the prop existed also loop.
Loop
- Next on the last slide moves to the first slide, in the same direction.
- Previous on the first slide moves back to the last slide.
- The runtime clones no slides. It moves each slide to the end of the track that is nearest to the active slide.
- The track needs at least two slides.
- Previous and next stay enabled at both ends.
- When
loopisfalse, the index clamps and previous and next are disabled at the ends. - The editor canvas shows the chosen slide with no wrap animation.
Settings panel
Designers set these in the slide settings panel.
- Loop writes
loopthroughlibraryLogic.updateProps. - Autoplay writes
autoplay. - Speed writes
autoplayDelay. The minimum is 500 ms. It is disabled while Autoplay is off.
Each of these, and the Pagination and Pagination dot switches, can take a variable, like the gallery fields. The link button shows beside the field (inside it for Speed). A bound field shows the variable name, and its unlink button writes the value the variable had back.
| Field | Variable type | What true and false do |
| --- | --- | --- |
| Autoplay, Loop | Boolean | The prop value |
| Speed | Number, string or CSS (800ms) | The delay in ms |
| Pagination | Boolean | true shows the pagination layer, false hides it |
| Pagination dot | Boolean | true shows one dot per slide, false shows the first dot only |
- The binding is stored on the slider's host at
props.logicAttaches.<attachmentId>.propsJson.<key>. The literal stays in the attachment props as the fallback. - On the preview and on published pages the slider runs again with the new value each time the variable changes. Autoplay restarts on each change.
- Pagination and Pagination dot are structural switches (a layer's visibility, a repeat). Their variable goes to the props
paginationandpaginationDot, which default totrueand change nothing while unset. Linking a variable turns the switch on, so the variable alone decides. Unlinking sets the switch to the value the variable had and clears the prop. - The runtime hides with an inline
display: noneand gives back the inlinedisplayit replaced. The editor canvas never hides, so you keep what you edit. - Default takes no variable. It edits the editor state.
Swipe
Swipe works in preview and on published pages.
- Dragging a slide along the slide axis follows the pointer. The axis is horizontal or vertical, from the
flexDirectionof the wrapper. - A release past about 40 px settles on the next or previous slide. For small slides the distance is a third of the slide.
- Swipe respects
loop, pauses autoplay while dragging, and swallows the click that ends a drag. - A drag that starts across the axis scrolls the page. The runtime sets
touch-actiontopan-yorpan-x. - Previous, next, and pagination controls are not swipe handles.
- The editor canvas has no swipe, so selection and layer drags are unaffected.
Slide settings modal
The slider header button on the slider host opens this modal. The slider declares it in slider/editor/editor.ts (editorPanel.dialog). QuickPage renders the generic logic editor dialog (interaction/logic/editor_dialog/). The button, the controls, and the slide list all come from that declaration.
| Part | Rule |
| --- | --- |
| Source | The top card shows the repeat source of the first slide (the repeated template). It shows Non-sourced when there is none. A click opens the Source picker (Variables and Components). The slide count follows the source. The card shows even with no slides, but it does nothing until a slide exists. |
| Slides | Add, rename, reorder, duplicate, set default, and delete run through the slider editor plugin actions. A click on a slide previews it on the canvas. The preview clears when the modal closes. |
| Direction | The setDirection action writes flexDirection on the wrapper role node. |
| Dragging | Drag the title bar. The modal stays inside the viewport. It returns to its anchored position when it reopens. |
| Closing | The close button closes it. A selection change closes it when the primary node is neither the slider host nor a descendant. Slides keep it open. Clearing the selection closes it. SelectionState.#dismissSelectionScopedUi wires this through logicEditorDialog. |
Tab
The tab logic has the structure of the slider (tab/editor/, tab/runtime/).
Roles and wires
| Name | Kind | Label |
| --- | --- | --- |
| tabList | Container, and a wire | "Tab list" |
| panelList | Container, and a wire | "Tab content wrapper" |
| tab | Repeatable role | |
| panel | Repeatable role | |
Runtime
- The runtime shows the active panel and hides the others with
hidden. - The runtime sets the ARIA roles and
aria-selected. - The runtime writes no layout styles, except hiding the tabs after the first while a variable bound to Tab items is
false. - The arrow keys, Home, and End move between tabs.
Settings panel
- Default lists the tab content titles. The first tab content is the default.
- Tab items repeats the tab once per tab content. Binding the tab list or the wrapper turns it on.
- It can take a boolean variable.
trueshows one tab per tab content,falseshows the first tab only. The variable goes to the proptabItems, which defaults totrueand changes nothing while unset. Linking a variable turns the switch on. Unlinking sets the switch to the value the variable had and clears the prop. See the Slider settings panel for the rules.
- It can take a boolean variable.
Tab settings dialog
The dialog has three parts:
- The panel source row.
- Direction, which applies to the tab list and the wrapper.
- The tab content list.
Add, remove, reorder, rename, and duplicate act on tab content only. The first tab content becomes the default. Later tab content never moves the default.
Canvas
- The canvas shows all tab content (
shiftToActive) and slides to the previewed one. - Preview and publish show only the active panel.
Tooling dependencies
| Context | @packages/qp-sdk and @packages/app-cli |
| --- | --- |
| Monorepo root pnpm install | workspace:@packages/qp-*@^0.0.1 links the in-tree packages. Verdaccio is not required. |
| Registry-shaped (same as external authors) | Run make publish-code-packages-dev with the mock registry up. Then run pnpm install in this folder. It resolves through .npmrc at ^0.0.1. |
There is no Node imports map to packages/qp_sdk/src. Builds use the published SDK layout, like third-party packages.
Author documentation
These guides apply to all code packages. They cover the lifecycle (editor, preview, published), the SDK APIs, and the logic tiers.
- Module author guide: code components and
designTimelogic. In QuickPage, attach tab or slider with Code → Logic → Apply on wired chrome. See also logic presets. - Dev flow (Tilt and isolate): consolidated dev flow. Use Link dev for HMR. Run
apps publishto the dev registry, then use Refresh in editor or reload staging. - Broader context: code packages hub, artifact scenarios (all envs), author quickstart.
