@plitzi/sdk-elements 0.38.3 → 0.38.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +202 -0
- package/dist/elements/basic/Button/Button.d.ts +6 -1
- package/dist/elements/basic/Button/Button.mjs +9 -8
- package/dist/elements/basic/Button/declaration.d.ts +1 -0
- package/dist/elements/basic/Button/index.d.ts +1 -0
- package/dist/elements/declarations/index.d.ts +6 -2
- package/dist/elements/form/FormControl/FormControl.d.ts +5 -1
- package/dist/elements/form/FormControl/FormControl.mjs +3 -0
- package/dist/elements/form/FormControl/Settings.d.ts +1 -1
- package/dist/elements/form/FormControl/Settings.mjs +16 -1
- package/dist/elements/form/FormControl/declaration.mjs +3 -0
- package/dist/elements/media/Image/Image.d.ts +7 -1
- package/dist/elements/media/Image/Image.mjs +10 -10
- package/dist/elements/media/Image/declaration.d.ts +2 -1
- package/dist/elements/media/Image/declaration.mjs +1 -1
- package/dist/elements/media/Image/index.d.ts +2 -1
- package/dist/elements/provider/ApiContainer/ApiContainer.d.ts +1 -1
- package/dist/elements/provider/ApiContainer/ApiContainer.mjs +123 -131
- package/dist/elements/provider/ApiContainer/helpers/serverMock.d.ts +10 -0
- package/dist/elements/provider/ApiContainer/helpers/serverMock.mjs +17 -0
- package/dist/elements/structure/Container/Container.d.ts +8 -2
- package/dist/elements/structure/Container/Container.mjs +6 -5
- package/dist/elements/structure/Container/declaration.d.ts +3 -1
- package/dist/elements/structure/Container/declaration.mjs +31 -23
- package/dist/elements/structure/Container/index.d.ts +3 -1
- package/dist/index.d.ts +6 -2
- package/package.json +12 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,207 @@
|
|
|
1
1
|
# @plitzi/sdk-elements
|
|
2
2
|
|
|
3
|
+
## 0.38.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6ae4161: ## `plitzi push`: a self-hosted project back on its space
|
|
8
|
+
|
|
9
|
+
`plitzi create --from` and `plitzi pull` took a space out as a project and kept it in step; nothing put the project's
|
|
10
|
+
own changes back but a command per part, and no command at all for its pages. `plitzi push` is the way back
|
|
11
|
+
(`docs/en/projects-from-spaces.md`):
|
|
12
|
+
|
|
13
|
+
- **What changed, or what is named.** `plitzi push` sends what changed since the project last had the space — at a
|
|
14
|
+
terminal, offered as a ticked list to choose from (`↑/↓`, space, Enter); `plitzi push space functions` sends only
|
|
15
|
+
those parts: `space`, `functions`, `runtime`, `plugins`.
|
|
16
|
+
- **In order:** each changed plugin packed and uploaded (`pack plugin` + `upload plugin`, `--cdn`/`--bucket`), the
|
|
17
|
+
functions, the runtime, then the space — `src/space.ts` authored, the actions `src/actions.ts` serves and the manifests
|
|
18
|
+
in `src/connectors/` — as the space's draft. Never a published environment.
|
|
19
|
+
- **Never over the builder's work unseen.** The export now carries which state the draft is in (`SpaceExport.draft`),
|
|
20
|
+
recorded in `.plitzi/space.json` by `create --from` and `pull`; a push names it, and a draft edited since is refused
|
|
21
|
+
until `--force`. A project that never had the space may take one nobody has worked on; one holding work takes
|
|
22
|
+
`--force`.
|
|
23
|
+
- **Then `pull` follows it.** `.plitzi/space.json` records what was sent — only that, so a builder's change to a part
|
|
24
|
+
not pushed is still the next pull's — and a project that started on its own works with `pull` from then on.
|
|
25
|
+
- `@plitzi/sdk-shared/source`: `SpaceImport` / `SpaceImportResult` (`SPACE_IMPORT_FORMAT`), the push's one shape for
|
|
26
|
+
both ends, beside `SpaceExport`, which gains `draft`.
|
|
27
|
+
- `functions push`, `runtime push` and `upload plugin` keep their behaviour; their cores are what `push` runs.
|
|
28
|
+
|
|
29
|
+
## A project's folders: `tmp/` for what it writes, `.plitzi/` committed, `public/` said to be public
|
|
30
|
+
- **`tmp/` is what a project writes for itself.** `@plitzi/sdk-server` keeps the plugins it builds in `tmp/.sdk-plugins`
|
|
31
|
+
and resized pictures in `tmp/images` by default (were `.sdk-plugins` and `.plitzi/images`). A project the CLI writes
|
|
32
|
+
puts the port it took (`tmp/dev-server.json`), the space as last authored while developing (`tmp/space.json`) and
|
|
33
|
+
Playwright's output (`tmp/visual`) there too, and its `.gitignore` ignores `tmp` — one line for all of it.
|
|
34
|
+
- **`.plitzi/` is committed.** The scaffold ignored it whole, so a clone lost `space.json`, `functions.json` and
|
|
35
|
+
`scaffold.json` — what `pull`, `push`, `functions push` and `upgrade` stand on. Now it holds only what the CLI records.
|
|
36
|
+
`npx plitzi upgrade --write` brings an existing project's `.gitignore` up.
|
|
37
|
+
- **No `space/offline-data.json`.** `npm run author` checks the space and writes nothing; the server asks it for the
|
|
38
|
+
documents with `--out tmp/space.json` while developing. The space is `src/space.ts`, and nothing beside it says
|
|
39
|
+
otherwise.
|
|
40
|
+
- **`public/` is on the internet.** The generated `README.md` and `AGENTS.md`, the CLI and authoring skills, the MCP
|
|
41
|
+
guide, `@plitzi/sdk-server`'s README and the docs now say so where data goes: never a secret, a key or data only
|
|
42
|
+
some visitors may read — in `public/`, or in a space's documents, which reach every visitor too.
|
|
43
|
+
|
|
44
|
+
## An agent leaves the project clean
|
|
45
|
+
|
|
46
|
+
`AGENTS.md` gains **Keep the project clean** — nothing unused left behind, scratch work in `tmp/`, one of everything,
|
|
47
|
+
files a reader can find, and `author`, `typecheck`, `lint`, `format` and `check` passing — and the authoring skill's
|
|
48
|
+
review checklist a **Nothing left behind** section.
|
|
49
|
+
|
|
50
|
+
## The dev tools' X-ray is the outlines too
|
|
51
|
+
|
|
52
|
+
The QA tab had **Outlines** (every element's box, its type and id when pointed at) and **X-ray** (the same boxes,
|
|
53
|
+
fainter, with what is wired to each). They are one tool now: the X-ray draws every box with its type and id, and marks
|
|
54
|
+
the wiring picked — all of it, one kind, or **Boxes only**.
|
|
55
|
+
|
|
56
|
+
## A new space that says where to go
|
|
57
|
+
|
|
58
|
+
The space a new account and `plitzi create` start from keeps its welcome, and gains the three ways to change it — the
|
|
59
|
+
builder, code (with the command to run) and an agent — before the guides, which are shorter. Header, navigation, main
|
|
60
|
+
and footer are landmarks; the grid behind the top fades out instead of ending at an edge; the footer's line spans the
|
|
61
|
+
content; the links say their words and icon themselves, with no suggestion left.
|
|
62
|
+
|
|
63
|
+
## Server data reads the same everywhere
|
|
64
|
+
- **One shape for a provider with a `query`.** A `runtime: 'server'` provider that only reads a JSON file the server
|
|
65
|
+
serves answered the body itself, while the same provider in the browser publishes `{ status, data }` — so moving it
|
|
66
|
+
to the server broke every binding. `publicFileResolver` and the builder's mock now answer `{ status, data }` too:
|
|
67
|
+
`<source>.data.<field>` whichever runtime.
|
|
68
|
+
- **Server data is on unless a space turns it off.** The page render read a missing `rsc` as on and the connector
|
|
69
|
+
resolver as off, so a server provider in a space the builder or the MCP made (neither writes `rsc`) resolved to
|
|
70
|
+
nothing, silently. Both read it as on now; only `rsc: { enabled: false }` turns it off (and is warned with a server
|
|
71
|
+
element). `authorSpace` writes `enabled: true` for a space that has one.
|
|
72
|
+
- **Never inside a component.** The page server resolves a page's tree and its layouts only, so a server provider in a
|
|
73
|
+
component rendered nothing, silently. Refused now (`server-provider-in-component`), with the fix: the provider on
|
|
74
|
+
the page, the rows handed in as a prop.
|
|
75
|
+
- **Bindings held to the data.** `authorSpace` takes `data` — what a provider's `query` answers — and
|
|
76
|
+
`publicData(folder)` (`@plitzi/sdk-authoring/node`) reads it from `public/`. A binding onto a path the file does not
|
|
77
|
+
have is warned (`path-not-in-data`) with the keys it does have. Generated projects pass it.
|
|
78
|
+
- **`plitzi check` reads the data too.** A binding that reads a path its provider's answer lacks, a provider that
|
|
79
|
+
failed (once, not as every element it left empty) and the rows each list rendered (`dataIssues`). `--ssr` names what
|
|
80
|
+
the server's HTML lacks that the hydrated page has. The dev tools' badge and panel (`data-plitzi-devtools`) are hidden
|
|
81
|
+
while `check` and `shot` look.
|
|
82
|
+
|
|
83
|
+
## Authoring, clearer where agents tripped
|
|
84
|
+
- **`controls` on a button** (`aria-controls`): named by the element's id; authoring gives that element the anchor and
|
|
85
|
+
refuses an id the space lacks (`controls-unknown`); a saved document naming no anchor is warned
|
|
86
|
+
(`controls-no-anchor`). The accordion recipe uses it.
|
|
87
|
+
- **`live` on a container** (`aria-live`, `polite` or `assertive`) for words that change while a visitor reads them.
|
|
88
|
+
- **`subType: 'p'`** for a paragraph made of parts; `span-holds-block` covers it.
|
|
89
|
+
- **`formControl` types `search`, `url` and `tel`.**
|
|
90
|
+
- **Images:** no `src` draws the SDK's own placeholder (the CDN one answered 404); `resize: false` keeps a picture as
|
|
91
|
+
written; an SVG is never resized — `/_plitzi/img` redirects to it (`307`) instead of refusing it.
|
|
92
|
+
- **Messages:** an id taken by another page or layout names it and the id to write; a hyphenated source in a template
|
|
93
|
+
(`list_study-plans`) is explained as valid; an unknown CSS property says to write it in `customCss`; an unknown
|
|
94
|
+
variant on `custom` says it is never a prop of the component it hosts.
|
|
95
|
+
- **`plitzi explain` knows the helpers** — `bindTemplate`, `visibleWhen`, `variantFrom`, `activeOn`, `activeWhen`,
|
|
96
|
+
`when`, `named`, `scope`, `source`, `twig` — and `motion`, from the presets the SDK plays (`MOTION_ENTERS`,
|
|
97
|
+
`MOTION_TRIGGERS`, `MOTION_LOOPS`, now exported). `--list helpers` lists them.
|
|
98
|
+
- **`plitzi shot`** writes to `tmp/shots/` by default, and a full page shows the arrivals tied to the scroll as they
|
|
99
|
+
end. `inspectPage` no longer reports an image a hidden ancestor hides.
|
|
100
|
+
- **Style inspector:** `container-type` in Size.
|
|
101
|
+
- **New recipes:** `server-data.ts`, `accordion.ts`.
|
|
102
|
+
|
|
103
|
+
## Matching a page to another, measured
|
|
104
|
+
- **A whole page is the whole page.** The SDK scrolls a pane of its own, so `shot`'s full-page picture was one
|
|
105
|
+
screen; the pane is unrolled now (`unrollPage`) — the viewport untouched, so a `100vh` hero stays one screen.
|
|
106
|
+
- **`plitzi shot --compare` says why, not only how much.** Every lazy picture on both pages is loaded before they are
|
|
107
|
+
taken (`loadImages`), so a section no longer swings between 23 % and 40 % on how many covers had arrived. Each section
|
|
108
|
+
is compared where it is on the other page (`alignPictures` over row profiles): a page 400 px longer is said once, with
|
|
109
|
+
the section the drift starts at, instead of a footer with the same styles reading 100 %. And the texts both pages
|
|
110
|
+
have are paired (`pageTexts`, `compareTexts`), each with what it does differently there —
|
|
111
|
+
`h1 "Learn CSS" — font-size 68px → 60px · y +19px` — position less the drift of its section. `comparePictures` takes
|
|
112
|
+
its options as an object now (`{ regions, tolerance, align }`).
|
|
113
|
+
- **`--scheme` is the space's theme.** A space whose default is dark painted dark under `--scheme light`, and the file
|
|
114
|
+
said light. `check` and `shot` now set the `theme` cookie a visitor's toggle writes; left out, the space's default is
|
|
115
|
+
pictured and the file is named by the theme actually painted.
|
|
116
|
+
|
|
117
|
+
## `motion: { on: 'view' }` arrives once
|
|
118
|
+
|
|
119
|
+
`view` was tied to the scroll both ways: cards faded out again as the reader scrolled back up. Now it plays once, the
|
|
120
|
+
first time the element comes into view, with its `duration`, and stays — `revealOnView` (`@plitzi/sdk-shared/schema/
|
|
121
|
+
motionReveal`), one observer under the SDK's root, marks it `data-motion-seen`. The scroll-driven arrival is
|
|
122
|
+
`on: 'scroll'`. A page read without scripts shows them as they end (`@media (scripting: none)`); the builder's previews
|
|
123
|
+
and the MCP's local screenshots hold motion at its end. The builder's Motion tab has the three.
|
|
124
|
+
|
|
125
|
+
The builder's preview plays motion as the published page does. It held everything at its end, and nothing marked
|
|
126
|
+
the canvas `data-hydrated`, so neither the loops nor a space's own `[data-hydrated]` animations ever started there.
|
|
127
|
+
Now an arrival plays as it comes into view, and the loops and keyframes run; **▶** on the canvas being edited runs the
|
|
128
|
+
space's own `[data-hydrated]` loops too. The motion guide adds the rule this needs from a space: `[data-hydrated]` is for
|
|
129
|
+
loops; an entrance of its own that plays once (`transform`/`opacity` only) plays from the first paint with
|
|
130
|
+
`backwards`, as the presets do — gated on hydration it jumps when the page goes live, and a canvas that never goes
|
|
131
|
+
live holds it on its first frame.
|
|
132
|
+
|
|
133
|
+
## Thirteen ways in, nine loops
|
|
134
|
+
|
|
135
|
+
`motion` grows from six arrivals and four loops to thirteen and nine, all still `opacity` and the transforms:
|
|
136
|
+
|
|
137
|
+
- **Bold arrivals:** `slide-up` (from well below), `zoom-in` (from 60%), `zoom-out` (settling from 125%), `tilt`
|
|
138
|
+
(rising as it turns straight), `spin-in` (half a turn as it grows).
|
|
139
|
+
- **Springy arrivals:** `pop` overshoots and settles; `bounce-in` falls into place and bounces.
|
|
140
|
+
- **Loops:** `bounce`, `wobble`, `orbit` (a slow circle round where it is), `heartbeat`, `drift`.
|
|
141
|
+
|
|
142
|
+
An arrival is now a list of frames (`MOTION_ENTER_FRAMES` in `@plitzi/sdk-shared/schema/motion`; `MOTION_ENTER_FROM`
|
|
143
|
+
is its first), and so is a loop (`MOTION_LOOP_FRAMES[name].frames`, replacing `transform`/`at`). Arrivals move the
|
|
144
|
+
individual `translate`, `scale` and `rotate`, so they still compose with an element's own `transform` and with a loop.
|
|
145
|
+
The builder's Motion tab previews every frame; authoring, the MCP, `explain motion` and GraphQL read the same lists.
|
|
146
|
+
|
|
147
|
+
An arrival from the side no longer scrolls the page sideways. `slide-left` starts 32px to the right of where it lands,
|
|
148
|
+
past a phone's 16px gutter, and until it had played the page could be dragged sideways. The SDK's root clips that way
|
|
149
|
+
now (`overflow-x: clip`, which keeps the window the scroller: sticky bars and scroll timelines are untouched), and the
|
|
150
|
+
builder's preview does the same. Content wider than the page is cut rather than scrolling the page — give it a box of
|
|
151
|
+
its own with `overflow-x: auto`.
|
|
152
|
+
|
|
153
|
+
**3D and the transform parts are style properties.** `transform-style`, `perspective-origin`, `backface-visibility`,
|
|
154
|
+
`translate`, `rotate` and `scale` join the vocabulary (they were refused as `css-property-unknown` and had to go in
|
|
155
|
+
`customCss`); `scale: 0.94` is a factor, not pixels.
|
|
156
|
+
|
|
157
|
+
**The builder's placeholder for an empty element is 24px** (was 50px), one size for every element that has one. It
|
|
158
|
+
is a minimum, so it also grew empty shapes with a size of their own — a dot, a planet — while editing; 24px is still
|
|
159
|
+
a box to see, pick and drop into.
|
|
160
|
+
|
|
161
|
+
The desktop app's window was blank: authoring, run in the renderer to build the rail, asked Vite's `process` shim for
|
|
162
|
+
a working directory it does not have. It reads one only where there is one now — and only when a class conflict is
|
|
163
|
+
reported, rather than for every element of every space it writes.
|
|
164
|
+
|
|
165
|
+
## Authoring advice that knows where and when
|
|
166
|
+
- **`class-conflict` says where both declarations are:** `styles('md-menu-button') at src/components/dropdown.ts:12,
|
|
167
|
+
used by button at …, and styles('md-menu-button') at src/site/layout.ts:8, used by …` — `styles()` records its line as
|
|
168
|
+
an element factory does.
|
|
169
|
+
- **`repeated-shape` leaves controls alone.** Siblings that read different sources or write different state keys — a
|
|
170
|
+
menu for the language, one for the level — are not offered as a list.
|
|
171
|
+
- **`quiet: ['repeated-shape']`** on an element says a suggestion was left on purpose, and it is not offered again.
|
|
172
|
+
Only suggestions' codes (`quiet-unknown`). It is saved on the element (`definition.quiet`), so the builder's problems
|
|
173
|
+
panel, the MCP's `upsertElement`/`patchElement` and a project pulled back with `plitzi pull` all leave it alone.
|
|
174
|
+
|
|
175
|
+
## What the docs say is what the code does
|
|
176
|
+
|
|
177
|
+
A pass across authoring's own messages, the skills, the MCP guide, `docs/en`, the CLI's README and the website, so an
|
|
178
|
+
agent reading two of them is never told two things:
|
|
179
|
+
|
|
180
|
+
- **A binding's `source` is the bound value, and only that.** With no value yet it fell back to the attribute's
|
|
181
|
+
current one — `sourceTo` — so `{{ source|default('…') }}` never took its default and `{{ source ? … }}` read an
|
|
182
|
+
element's placeholder ("Text") as an answer. It is `undefined` until the source has a value now; `sourceTo` is still
|
|
183
|
+
the value before.
|
|
184
|
+
- **`explain` writes a step the way its builder is called:** `delay(ms)`, `openModal('modal-id', data?)`,
|
|
185
|
+
`scrollBy('row-id', { x: '80%' })` — not `delay(…)` above the document's param names, which read as `delay({ time })`.
|
|
186
|
+
- **A page field nobody takes is told what it was probably for** — `seo` → `seoTitle` and `seoDescription` — instead of a
|
|
187
|
+
hint about keeping state appended to every one.
|
|
188
|
+
- Docs set straight: an element's id is `data-plitzi-el` in the page (`data-id` is the builder's, with debugging on);
|
|
189
|
+
a visibility condition writes nothing while its source has no value and is a yes or a no once it has one; `mobile`
|
|
190
|
+
is up to and including 48rem; `loadStrategy` defaults by type (`lazy` for a modal); the accessibility codes listed
|
|
191
|
+
in full everywhere (`embed-without-title`, `dropdown-without-control`, `controls-no-anchor`); the generated
|
|
192
|
+
`AGENTS.md` says a repeated block is a component and rows of data a list, as the skill does; `plitzi runtime` is
|
|
193
|
+
documented in the CLI's README, its skill and the website, which no longer says state across requests needs a
|
|
194
|
+
server of your own.
|
|
195
|
+
|
|
196
|
+
- Updated dependencies [6ae4161]
|
|
197
|
+
- @plitzi/sdk-auth@0.38.4
|
|
198
|
+
- @plitzi/sdk-dev-tools@0.38.4
|
|
199
|
+
- @plitzi/sdk-event-bridge@0.38.4
|
|
200
|
+
- @plitzi/sdk-interactions@0.38.4
|
|
201
|
+
- @plitzi/sdk-navigation@0.38.4
|
|
202
|
+
- @plitzi/sdk-schema@0.38.4
|
|
203
|
+
- @plitzi/sdk-shared@0.38.4
|
|
204
|
+
|
|
3
205
|
## 0.38.3
|
|
4
206
|
|
|
5
207
|
### Patch Changes
|
|
@@ -24,6 +24,11 @@ export type ButtonProps = {
|
|
|
24
24
|
ariaExpanded?: boolean;
|
|
25
25
|
/** For a button that stays on or off — a filter, a mode: `true` while it is on. Left out, it is a plain button. */
|
|
26
26
|
ariaPressed?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* What the button shows and hides — an accordion's panel, a menu — by its anchor (`aria-controls`), so a screen
|
|
29
|
+
* reader can go from one to the other. Authoring takes the element's id and gives that element the anchor.
|
|
30
|
+
*/
|
|
31
|
+
controls?: string;
|
|
27
32
|
/**
|
|
28
33
|
* What the button does, in words — shown as a tooltip on hover, and the button's accessible name when it has no text
|
|
29
34
|
* of its own. An icon-only button without one is announced as nothing at all.
|
|
@@ -40,7 +45,7 @@ export type ButtonProps = {
|
|
|
40
45
|
*/
|
|
41
46
|
label?: string;
|
|
42
47
|
};
|
|
43
|
-
declare const Button: ({ ref, className, children, contentPlacement, content, icon, iconPlacement, subType, disabled, ariaExpanded, ariaPressed, title, label }: ButtonProps) => import('react').JSX.Element;
|
|
48
|
+
declare const Button: ({ ref, className, children, contentPlacement, content, icon, iconPlacement, subType, disabled, ariaExpanded, ariaPressed, controls, title, label }: ButtonProps) => import('react').JSX.Element;
|
|
44
49
|
declare const _default: {
|
|
45
50
|
(props: import('../../../Element/hocs/withElement').WithElementProps<ButtonProps>): import('react').JSX.Element;
|
|
46
51
|
displayName: string;
|
|
@@ -6,31 +6,32 @@ import i from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
|
6
6
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
7
|
import s from "clsx";
|
|
8
8
|
//#region src/elements/basic/Button/Button.tsx
|
|
9
|
-
var c = ({ ref: e, className: c = "", children: l, contentPlacement: u = "after", content: d = "Button", icon: f = "", iconPlacement: p = "before", subType: m = "button", disabled: h = !1, ariaExpanded: g, ariaPressed: _,
|
|
10
|
-
let { settings: { previewMode:
|
|
9
|
+
var c = ({ ref: e, className: c = "", children: l, contentPlacement: u = "after", content: d = "Button", icon: f = "", iconPlacement: p = "before", subType: m = "button", disabled: h = !1, ariaExpanded: g, ariaPressed: _, controls: v, title: y, label: b }) => {
|
|
10
|
+
let { settings: { previewMode: x } } = i(), { definition: { styleSelectors: S } } = t();
|
|
11
11
|
return /* @__PURE__ */ o(n, {
|
|
12
12
|
ref: e,
|
|
13
13
|
tag: "button",
|
|
14
|
-
type:
|
|
15
|
-
className: s("plitzi-component__button", c, { "container--empty--skip": !
|
|
14
|
+
type: x ? m : "button",
|
|
15
|
+
className: s("plitzi-component__button", c, { "container--empty--skip": !x && !l && (d || f) }),
|
|
16
16
|
disabled: h,
|
|
17
|
-
title:
|
|
18
|
-
"aria-label":
|
|
17
|
+
title: y || void 0,
|
|
18
|
+
"aria-label": b || void 0,
|
|
19
19
|
"aria-expanded": g,
|
|
20
20
|
"aria-pressed": _,
|
|
21
|
+
"aria-controls": v || void 0,
|
|
21
22
|
children: [
|
|
22
23
|
u === "before" && /* @__PURE__ */ a(r, {
|
|
23
24
|
content: d,
|
|
24
25
|
icon: f,
|
|
25
26
|
iconPlacement: p,
|
|
26
|
-
iconClassName:
|
|
27
|
+
iconClassName: S.icon
|
|
27
28
|
}),
|
|
28
29
|
l,
|
|
29
30
|
u === "after" && /* @__PURE__ */ a(r, {
|
|
30
31
|
content: d,
|
|
31
32
|
icon: f,
|
|
32
33
|
iconPlacement: p,
|
|
33
|
-
iconClassName:
|
|
34
|
+
iconClassName: S.icon
|
|
34
35
|
})
|
|
35
36
|
]
|
|
36
37
|
});
|
|
@@ -131,6 +131,7 @@ declare const declaration: {
|
|
|
131
131
|
title?: string | undefined;
|
|
132
132
|
content?: string | undefined;
|
|
133
133
|
disabled?: boolean | undefined;
|
|
134
|
+
controls?: string | undefined;
|
|
134
135
|
icon?: string | undefined;
|
|
135
136
|
subType?: "button" | "submit" | "reset" | undefined;
|
|
136
137
|
iconPlacement?: import('../../../Element/ElementWords').IconPlacement | undefined;
|
|
@@ -130,6 +130,7 @@ declare const Button: {
|
|
|
130
130
|
title?: string | undefined;
|
|
131
131
|
content?: string | undefined;
|
|
132
132
|
disabled?: boolean | undefined;
|
|
133
|
+
controls?: string | undefined;
|
|
133
134
|
icon?: string | undefined;
|
|
134
135
|
subType?: "button" | "submit" | "reset" | undefined;
|
|
135
136
|
iconPlacement?: import('../../../Element/ElementWords').IconPlacement | undefined;
|
|
@@ -424,6 +424,7 @@ export declare const elementDeclarations: {
|
|
|
424
424
|
title?: string | undefined;
|
|
425
425
|
content?: string | undefined;
|
|
426
426
|
disabled?: boolean | undefined;
|
|
427
|
+
controls?: string | undefined;
|
|
427
428
|
icon?: string | undefined;
|
|
428
429
|
subType?: "button" | "submit" | "reset" | undefined;
|
|
429
430
|
iconPlacement?: import('../../Element/ElementWords').IconPlacement | undefined;
|
|
@@ -742,6 +743,7 @@ export declare const elementDeclarations: {
|
|
|
742
743
|
readonly type: "container";
|
|
743
744
|
readonly attributeValues: {
|
|
744
745
|
readonly subType: readonly string[];
|
|
746
|
+
readonly live: readonly string[];
|
|
745
747
|
};
|
|
746
748
|
readonly content: {
|
|
747
749
|
readonly attributes: {
|
|
@@ -792,7 +794,8 @@ export declare const elementDeclarations: {
|
|
|
792
794
|
};
|
|
793
795
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
794
796
|
label?: string | undefined;
|
|
795
|
-
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | undefined;
|
|
797
|
+
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | undefined;
|
|
798
|
+
live?: "polite" | "assertive" | "" | undefined;
|
|
796
799
|
decorative?: boolean | undefined;
|
|
797
800
|
}>>;
|
|
798
801
|
readonly Custom: {
|
|
@@ -2135,7 +2138,7 @@ export declare const elementDeclarations: {
|
|
|
2135
2138
|
};
|
|
2136
2139
|
readonly content: {
|
|
2137
2140
|
readonly attributes: {
|
|
2138
|
-
readonly src: "
|
|
2141
|
+
readonly src: "";
|
|
2139
2142
|
readonly alt: "";
|
|
2140
2143
|
readonly decorative: false;
|
|
2141
2144
|
readonly fetchPriority: "auto";
|
|
@@ -2187,6 +2190,7 @@ export declare const elementDeclarations: {
|
|
|
2187
2190
|
readonly settings: {};
|
|
2188
2191
|
};
|
|
2189
2192
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
2193
|
+
resize?: boolean | undefined;
|
|
2190
2194
|
height?: number | undefined;
|
|
2191
2195
|
width?: number | undefined;
|
|
2192
2196
|
fetchPriority?: "high" | "low" | "auto" | undefined;
|
|
@@ -2,7 +2,11 @@ import { ChangeEvent, RefObject } from 'react';
|
|
|
2
2
|
export type FormControlProps = {
|
|
3
3
|
ref: RefObject<HTMLElement>;
|
|
4
4
|
className: string;
|
|
5
|
-
subType: 'text' | 'number' | 'email' | 'password'
|
|
5
|
+
subType: 'text' | 'number' | 'email' | 'password'
|
|
6
|
+
/** A search box: the browser draws its clear button, and a phone shows its search key. */
|
|
7
|
+
| 'search' | 'url'
|
|
8
|
+
/** A phone number: a phone shows its dial pad. */
|
|
9
|
+
| 'tel' | 'date' | 'time' | 'checkbox' | 'switch' | 'select' | 'textarea' | 'hidden'
|
|
6
10
|
/** The browser's own colour picker: its value is `#rrggbb`. */
|
|
7
11
|
| 'color';
|
|
8
12
|
name: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type SettingsProps = {
|
|
2
|
-
subType?: 'text' | 'number' | 'date' | 'time' | 'email' | 'password' | 'select' | 'checkbox' | 'textarea' | 'hidden' | 'color' | 'switch';
|
|
2
|
+
subType?: 'text' | 'number' | 'date' | 'time' | 'email' | 'password' | 'search' | 'url' | 'tel' | 'select' | 'checkbox' | 'textarea' | 'hidden' | 'color' | 'switch';
|
|
3
3
|
name?: string;
|
|
4
4
|
label?: string;
|
|
5
5
|
hideLabel?: boolean;
|
|
@@ -15,7 +15,10 @@ var l = (e) => {
|
|
|
15
15
|
"textarea",
|
|
16
16
|
"number",
|
|
17
17
|
"email",
|
|
18
|
-
"password"
|
|
18
|
+
"password",
|
|
19
|
+
"search",
|
|
20
|
+
"url",
|
|
21
|
+
"tel"
|
|
19
22
|
].includes(u), F = t((e) => N?.("name", e), [N]), I = t((e) => N?.("label", e), [N]), L = t((e) => N?.("hideLabel", e.target.checked), [N]), ee = t((e) => N?.("placeholder", e), [N]), R = t((e) => {
|
|
20
23
|
N?.("subType", e), N?.("defaultValue", "");
|
|
21
24
|
}, [N]), z = t((e) => N?.("defaultValue", e), [N]), B = t((e) => N?.("autoFocus", e.target.checked), [N]), V = t((e) => N?.("autoComplete", e.target.checked), [N]), H = t((e) => N?.("required", e.target.checked), [N]), U = t((e) => N?.("requiredMessage", e), [N]), W = t((e) => N?.("minLength", l(e)), [N]), G = t((e) => N?.("minLengthMessage", e), [N]), K = t((e) => N?.("maxLength", l(e)), [N]), q = t((e) => N?.("maxLengthMessage", e), [N]), J = t((e) => N?.("formatMessage", e), [N]), Y = t((e) => N?.("pattern", e), [N]), X = t((e) => N?.("patternMessage", e), [N]), Z = t((e) => N?.("matches", e), [N]), Q = t((e) => N?.("matchesMessage", e), [N]), $ = t((e) => N?.("readOnly", e.target.checked), [N]), te = t((e) => N?.("disabled", e.target.checked), [N]), ne = t((e) => N?.("previewError", e.target.checked), [N]), re = t((e) => {
|
|
@@ -78,6 +81,18 @@ var l = (e) => {
|
|
|
78
81
|
value: "email",
|
|
79
82
|
children: "Email"
|
|
80
83
|
}),
|
|
84
|
+
/* @__PURE__ */ r("option", {
|
|
85
|
+
value: "search",
|
|
86
|
+
children: "Search"
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ r("option", {
|
|
89
|
+
value: "url",
|
|
90
|
+
children: "URL"
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ r("option", {
|
|
93
|
+
value: "tel",
|
|
94
|
+
children: "Phone"
|
|
95
|
+
}),
|
|
81
96
|
/* @__PURE__ */ r("option", {
|
|
82
97
|
value: "password",
|
|
83
98
|
children: "Password"
|
|
@@ -27,8 +27,14 @@ export type ImageProps = {
|
|
|
27
27
|
* so nothing jumps. */
|
|
28
28
|
width?: number;
|
|
29
29
|
height?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the page server may make sizes of the picture, when it does (`images` in its configuration). `false` keeps
|
|
32
|
+
* this one as it is — a picture already sized for where it sits, or one its host must serve itself. A vector (SVG) is
|
|
33
|
+
* never resized.
|
|
34
|
+
*/
|
|
35
|
+
resize?: boolean;
|
|
30
36
|
};
|
|
31
|
-
declare const Image: ({ ref, className, src: srcProp, alt: altProp, decorative, fetchPriority, loadMode, sizes, width, height }: ImageProps) => import('react').JSX.Element;
|
|
37
|
+
declare const Image: ({ ref, className, src: srcProp, alt: altProp, decorative, fetchPriority, loadMode, sizes, width, height, resize }: ImageProps) => import('react').JSX.Element;
|
|
32
38
|
declare const _default: {
|
|
33
39
|
(props: import('../../../Element/hocs/withElement').WithElementProps<ImageProps>): import('react').JSX.Element;
|
|
34
40
|
displayName: string;
|
|
@@ -6,16 +6,16 @@ import a from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
|
6
6
|
import { useCommonStore as o } from "@plitzi/sdk-shared/store";
|
|
7
7
|
import { jsx as s } from "react/jsx-runtime";
|
|
8
8
|
import c from "clsx";
|
|
9
|
-
import { imageSrcSet as l, imageUrl as u,
|
|
9
|
+
import { imageSrcSet as l, imageUrl as u, isResizableImage as d } from "@plitzi/sdk-shared/helpers/images";
|
|
10
10
|
//#region src/elements/media/Image/Image.tsx
|
|
11
|
-
var f = 1280, p = n(), m =
|
|
12
|
-
let { settings: { previewMode: C } } = a(), w =
|
|
11
|
+
var f = 1280, p = n(), m = ({ ref: e, className: n = "", src: m, alt: h = "", decorative: g = !1, fetchPriority: _ = "auto", loadMode: v, sizes: y = "100vw", width: b, height: x, resize: S = !0 }) => {
|
|
12
|
+
let { settings: { previewMode: C } } = a(), w = m || p, T = g ? "" : h, [E, D] = i(void 0), O = E === w, k = r(() => D(w), [w]), A = O ? p : w, j = O ? { "data-plitzi-failed": w } : {}, M = v === "auto" ? void 0 : v, [N] = o("images.endpoint"), P = C && N && S && !O && d(w) ? {
|
|
13
13
|
src: u(N, w, f),
|
|
14
14
|
srcSet: l(N, w),
|
|
15
|
-
sizes:
|
|
15
|
+
sizes: y
|
|
16
16
|
} : { src: A }, F = {
|
|
17
|
-
...
|
|
18
|
-
...
|
|
17
|
+
...b ? { width: b } : {},
|
|
18
|
+
...x ? { height: x } : {}
|
|
19
19
|
};
|
|
20
20
|
return C ? /* @__PURE__ */ s(t, {
|
|
21
21
|
tag: "img",
|
|
@@ -26,7 +26,7 @@ var f = 1280, p = n(), m = "https://cdn.plitzi.com/resources/img/placeholder-img
|
|
|
26
26
|
...F,
|
|
27
27
|
alt: T,
|
|
28
28
|
loading: M,
|
|
29
|
-
fetchPriority:
|
|
29
|
+
fetchPriority: _,
|
|
30
30
|
onError: O ? void 0 : k,
|
|
31
31
|
...j
|
|
32
32
|
}) : /* @__PURE__ */ s(t, {
|
|
@@ -37,11 +37,11 @@ var f = 1280, p = n(), m = "https://cdn.plitzi.com/resources/img/placeholder-img
|
|
|
37
37
|
src: A,
|
|
38
38
|
alt: T,
|
|
39
39
|
loading: M,
|
|
40
|
-
fetchPriority:
|
|
40
|
+
fetchPriority: _,
|
|
41
41
|
onError: O ? void 0 : k,
|
|
42
42
|
...j
|
|
43
43
|
})
|
|
44
44
|
});
|
|
45
|
-
},
|
|
45
|
+
}, h = e(m);
|
|
46
46
|
//#endregion
|
|
47
|
-
export {
|
|
47
|
+
export { m as Image, h as default };
|
|
@@ -10,7 +10,7 @@ declare const declaration: {
|
|
|
10
10
|
};
|
|
11
11
|
readonly content: {
|
|
12
12
|
readonly attributes: {
|
|
13
|
-
readonly src: "
|
|
13
|
+
readonly src: "";
|
|
14
14
|
readonly alt: "";
|
|
15
15
|
readonly decorative: false;
|
|
16
16
|
readonly fetchPriority: "auto";
|
|
@@ -62,6 +62,7 @@ declare const declaration: {
|
|
|
62
62
|
readonly settings: {};
|
|
63
63
|
};
|
|
64
64
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
65
|
+
resize?: boolean | undefined;
|
|
65
66
|
height?: number | undefined;
|
|
66
67
|
width?: number | undefined;
|
|
67
68
|
fetchPriority?: "high" | "low" | "auto" | undefined;
|
|
@@ -9,7 +9,7 @@ declare const Image: {
|
|
|
9
9
|
};
|
|
10
10
|
readonly content: {
|
|
11
11
|
readonly attributes: {
|
|
12
|
-
readonly src: "
|
|
12
|
+
readonly src: "";
|
|
13
13
|
readonly alt: "";
|
|
14
14
|
readonly decorative: false;
|
|
15
15
|
readonly fetchPriority: "auto";
|
|
@@ -61,6 +61,7 @@ declare const Image: {
|
|
|
61
61
|
readonly settings: {};
|
|
62
62
|
};
|
|
63
63
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
64
|
+
resize?: boolean | undefined;
|
|
64
65
|
height?: number | undefined;
|
|
65
66
|
width?: number | undefined;
|
|
66
67
|
fetchPriority?: "high" | "low" | "auto" | undefined;
|
|
@@ -75,7 +75,7 @@ export type ApiContainerProps = {
|
|
|
75
75
|
*/
|
|
76
76
|
refreshSeconds?: number | string;
|
|
77
77
|
};
|
|
78
|
-
declare const ApiContainer: ({ ref, className, children, query, method, accessToken, when, headers, mockData, subType, credentials, singleRecord, pagination, pageParam, renderWhileLoading, loadingSlot, cache, staleTime, gcTime, refreshSeconds }: ApiContainerProps) => import('react').JSX.Element;
|
|
78
|
+
declare const ApiContainer: ({ ref, className, children, query, method, accessToken, when, headers, mockData, subType, credentials, singleRecord, pagination, pageParam, renderWhileLoading, loadingSlot, cache, staleTime, gcTime, refreshSeconds, connector, action }: ApiContainerProps) => import('react').JSX.Element;
|
|
79
79
|
declare const _default: {
|
|
80
80
|
(props: import('../../../Element/hocs/withElement').WithElementProps<ApiContainerProps>): import('react').JSX.Element;
|
|
81
81
|
displayName: string;
|
|
@@ -7,132 +7,124 @@ import { isEmptyAnswer as ne } from "./helpers/isEmptyAnswer.mjs";
|
|
|
7
7
|
import { childrenWhile as re } from "./helpers/loadingSlot.mjs";
|
|
8
8
|
import ie from "./helpers/providerOutcome.mjs";
|
|
9
9
|
import { queryInputOf as ae } from "./helpers/queryInput.mjs";
|
|
10
|
+
import { serverMock as oe } from "./helpers/serverMock.mjs";
|
|
10
11
|
import r from "./hooks/useApi.mjs";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { use as
|
|
16
|
-
import
|
|
17
|
-
import { useSdkStore as
|
|
18
|
-
import { StoreProvider as
|
|
19
|
-
import { emptyObject as
|
|
20
|
-
import { jsx as
|
|
21
|
-
import { currentRscLocation as
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import { QueryBuilderEvaluator as
|
|
12
|
+
import se from "./hooks/useAutoRefresh.mjs";
|
|
13
|
+
import ce from "./hooks/useProviderPagination.mjs";
|
|
14
|
+
import le from "./hooks/useProviderWrite.mjs";
|
|
15
|
+
import ue from "../../../dataSource/pathFields.mjs";
|
|
16
|
+
import { use as de, useCallback as i, useEffect as fe, useMemo as a, useRef as pe } from "react";
|
|
17
|
+
import me from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
18
|
+
import { useSdkStore as he } from "@plitzi/sdk-shared/store";
|
|
19
|
+
import { StoreProvider as ge } from "@plitzi/nexus/react";
|
|
20
|
+
import { emptyObject as o } from "@plitzi/sdk-shared/helpers/utils";
|
|
21
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
22
|
+
import { currentRscLocation as _e } from "@plitzi/sdk-shared/server/rsc/refreshRsc";
|
|
23
|
+
import ve from "clsx";
|
|
24
|
+
import ye from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
|
|
25
|
+
import be from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
|
|
26
|
+
import { QueryBuilderEvaluator as xe } from "@plitzi/plitzi-ui/QueryBuilder";
|
|
26
27
|
//#region src/elements/provider/ApiContainer/ApiContainer.tsx
|
|
27
|
-
var
|
|
28
|
-
let { id:
|
|
28
|
+
var c = ({ ref: e, className: c = "", children: l, query: u = "", method: d = "get", accessToken: f = "", when: p = o, headers: m = o, mockData: h = "{}", subType: Se = "", credentials: Ce = "same-origin", singleRecord: g = !1, pagination: we = "none", pageParam: Te = "page", renderWhileLoading: Ee = !1, loadingSlot: _ = "", cache: De = !1, staleTime: Oe = 30, gcTime: ke = 300, refreshSeconds: Ae = 0, connector: je = "", action: Me = "" }) => {
|
|
29
|
+
let { id: v, visible: y, definition: { label: b = "Api Container", runtime: x, items: Ne } } = t(), S = x === "server", { loaded: C, stale: w, location: T, elementData: E, refresh: D } = ee(), O = ye(n.sourceType, v), { settings: { previewMode: k }, contexts: { InteractionsContext: Pe } } = me(), { interactionsManager: A } = de(Pe), [[j, M, Fe]] = he([
|
|
29
30
|
"navigation.routeParams",
|
|
30
31
|
"navigation.queryParams",
|
|
31
32
|
"navigation.navigate"
|
|
32
|
-
]),
|
|
33
|
-
...
|
|
34
|
-
Authorization: `Bearer ${
|
|
35
|
-
} :
|
|
36
|
-
...
|
|
37
|
-
...
|
|
38
|
-
})) || !
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
]), Ie = a(() => f ? {
|
|
34
|
+
...m,
|
|
35
|
+
Authorization: `Bearer ${f}`
|
|
36
|
+
} : m, [m, f]), N = a(() => S || !y ? !1 : !!(k && u && (p === o || xe(p, {
|
|
37
|
+
...j,
|
|
38
|
+
...M
|
|
39
|
+
})) || !k && (u || h && h !== "{}" && h !== o)), [
|
|
40
|
+
S,
|
|
41
|
+
y,
|
|
42
|
+
k,
|
|
43
|
+
u,
|
|
44
|
+
p,
|
|
45
|
+
j,
|
|
44
46
|
M,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (w) return c;
|
|
62
|
-
if (typeof _ != "string") return _;
|
|
63
|
-
try {
|
|
64
|
-
return JSON.parse(_ || "{}");
|
|
65
|
-
} catch {
|
|
66
|
-
return c;
|
|
67
|
-
}
|
|
68
|
-
}, [
|
|
47
|
+
h
|
|
48
|
+
]), Le = a(() => [v], [v]), { isLoading: Re, isFetching: ze, data: P, refetch: F, isSuccess: Be, isError: Ve } = r({
|
|
49
|
+
url: u,
|
|
50
|
+
method: d,
|
|
51
|
+
credentials: Ce,
|
|
52
|
+
mock: k ? void 0 : h,
|
|
53
|
+
customHeaders: Ie,
|
|
54
|
+
enabled: N,
|
|
55
|
+
cache: De,
|
|
56
|
+
staleTime: Oe,
|
|
57
|
+
gcTime: ke,
|
|
58
|
+
tags: Le
|
|
59
|
+
}), I = S && !!T && T !== _e(), L = S && C && !I && E === null, R = S && !je && !Me, z = a(() => S ? E || (C ? o : oe(h, R)) : P ?? o, [
|
|
60
|
+
S,
|
|
61
|
+
P,
|
|
62
|
+
E,
|
|
69
63
|
C,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
_
|
|
74
|
-
]), B = C ? L : Fe, V = C ? L : Pe, H = de({}), U = a((e, t) => O(e, {
|
|
64
|
+
h,
|
|
65
|
+
R
|
|
66
|
+
]), B = S ? I : ze, V = S ? I : Re, H = pe({}), U = i((e, t) => D(e, {
|
|
75
67
|
...H.current,
|
|
76
68
|
...t
|
|
77
|
-
}), [
|
|
78
|
-
if (!
|
|
79
|
-
|
|
69
|
+
}), [D]), W = i(async () => {
|
|
70
|
+
if (!S) {
|
|
71
|
+
F();
|
|
80
72
|
return;
|
|
81
73
|
}
|
|
82
|
-
await U([
|
|
74
|
+
await U([v]);
|
|
83
75
|
}, [
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
S,
|
|
77
|
+
F,
|
|
86
78
|
U,
|
|
87
|
-
|
|
88
|
-
]), G =
|
|
79
|
+
v
|
|
80
|
+
]), G = i(async ({ input: e } = {}) => {
|
|
89
81
|
let t = ae(e);
|
|
90
82
|
t && (H.current = t), await W();
|
|
91
83
|
}, [W]);
|
|
92
|
-
|
|
93
|
-
seconds:
|
|
94
|
-
enabled:
|
|
84
|
+
se({
|
|
85
|
+
seconds: Ae,
|
|
86
|
+
enabled: y && (S ? C && !I : N),
|
|
95
87
|
refresh: W
|
|
96
88
|
});
|
|
97
|
-
let K = z,
|
|
98
|
-
elementId:
|
|
99
|
-
mode:
|
|
100
|
-
pageParam:
|
|
101
|
-
records:
|
|
89
|
+
let K = z, He = a(() => Array.isArray(K.records) ? K.records : [], [K.records]), { records: q, isLoadingMore: J, goToPage: Y, loadMore: X } = ce({
|
|
90
|
+
elementId: v,
|
|
91
|
+
mode: we,
|
|
92
|
+
pageParam: Te,
|
|
93
|
+
records: He,
|
|
102
94
|
page: K.pageInfo?.page ?? 1,
|
|
103
95
|
refresh: U,
|
|
104
|
-
navigate:
|
|
96
|
+
navigate: Fe
|
|
105
97
|
}), Z = ie({
|
|
106
|
-
serverMode:
|
|
107
|
-
isSuccess:
|
|
108
|
-
isError:
|
|
109
|
-
rscResolved:
|
|
110
|
-
rscPending:
|
|
111
|
-
elementData:
|
|
98
|
+
serverMode: S,
|
|
99
|
+
isSuccess: Be,
|
|
100
|
+
isError: Ve,
|
|
101
|
+
rscResolved: C,
|
|
102
|
+
rscPending: I,
|
|
103
|
+
elementData: E
|
|
112
104
|
});
|
|
113
|
-
|
|
114
|
-
!B &&
|
|
115
|
-
url:
|
|
116
|
-
method:
|
|
105
|
+
fe(() => {
|
|
106
|
+
!B && v && Z && A.interactionTrigger(v, Z === "success" ? "onApiSuccess" : "onApiError", {
|
|
107
|
+
url: u,
|
|
108
|
+
method: d,
|
|
117
109
|
...z
|
|
118
110
|
});
|
|
119
111
|
}, [
|
|
120
112
|
z,
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
v,
|
|
114
|
+
A,
|
|
123
115
|
B,
|
|
124
|
-
|
|
116
|
+
d,
|
|
125
117
|
Z,
|
|
126
|
-
|
|
118
|
+
u
|
|
127
119
|
]);
|
|
128
|
-
let Q =
|
|
120
|
+
let Q = a(() => ({
|
|
129
121
|
...z,
|
|
130
|
-
...Array.isArray(K.records) ? { records: q } :
|
|
122
|
+
...Array.isArray(K.records) ? { records: q } : o,
|
|
131
123
|
isLoading: B || J,
|
|
132
|
-
isEmpty: ne(K, q,
|
|
133
|
-
hasError:
|
|
134
|
-
errorMessage:
|
|
135
|
-
isStale:
|
|
124
|
+
isEmpty: ne(K, q, g),
|
|
125
|
+
hasError: L,
|
|
126
|
+
errorMessage: L ? "The data provider could not be reached" : "",
|
|
127
|
+
isStale: S && w
|
|
136
128
|
}), [
|
|
137
129
|
z,
|
|
138
130
|
K.records,
|
|
@@ -140,70 +132,70 @@ var u = ({ ref: e, className: u = "", children: d, query: f = "", method: p = "g
|
|
|
140
132
|
q,
|
|
141
133
|
B,
|
|
142
134
|
J,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
]),
|
|
148
|
-
|
|
149
|
-
id:
|
|
150
|
-
source:
|
|
151
|
-
name:
|
|
152
|
-
fields:
|
|
135
|
+
g,
|
|
136
|
+
L,
|
|
137
|
+
S,
|
|
138
|
+
w
|
|
139
|
+
]), Ue = i(() => ue(Q), [Q]);
|
|
140
|
+
be({
|
|
141
|
+
id: v,
|
|
142
|
+
source: O,
|
|
143
|
+
name: b || `API - ${v}`,
|
|
144
|
+
fields: Ue
|
|
153
145
|
});
|
|
154
|
-
let { writeRecord: $ } =
|
|
155
|
-
elementId:
|
|
156
|
-
enabled:
|
|
146
|
+
let { writeRecord: $ } = le({
|
|
147
|
+
elementId: v,
|
|
148
|
+
enabled: S,
|
|
157
149
|
onDone: W
|
|
158
|
-
}),
|
|
150
|
+
}), We = a(() => {
|
|
159
151
|
let e = {
|
|
160
152
|
performQuery: {
|
|
161
153
|
...n.callbacks.performQuery,
|
|
162
|
-
title: `Perform Query ${
|
|
154
|
+
title: `Perform Query ${b}`,
|
|
163
155
|
callback: G
|
|
164
156
|
},
|
|
165
157
|
loadMore: {
|
|
166
158
|
...n.callbacks.loadMore,
|
|
167
|
-
title: `Load More ${
|
|
159
|
+
title: `Load More ${b}`,
|
|
168
160
|
callback: X
|
|
169
161
|
},
|
|
170
162
|
goToPage: {
|
|
171
163
|
...n.callbacks.goToPage,
|
|
172
|
-
title: `Go To Page ${
|
|
164
|
+
title: `Go To Page ${b}`,
|
|
173
165
|
callback: ({ page: e }) => Y(Number(e) || 1)
|
|
174
166
|
}
|
|
175
167
|
};
|
|
176
|
-
return
|
|
168
|
+
return S && (e.writeRecord = {
|
|
177
169
|
...n.callbacks.writeRecord,
|
|
178
|
-
title: `Write Record ${
|
|
170
|
+
title: `Write Record ${b}`,
|
|
179
171
|
callback: $
|
|
180
172
|
}), e;
|
|
181
173
|
}, [
|
|
182
|
-
|
|
174
|
+
b,
|
|
183
175
|
G,
|
|
184
176
|
X,
|
|
185
177
|
Y,
|
|
186
|
-
|
|
178
|
+
S,
|
|
187
179
|
$
|
|
188
|
-
]),
|
|
189
|
-
|
|
180
|
+
]), Ge = a(() => _ && k ? re(l, _, V) : l, [
|
|
181
|
+
l,
|
|
190
182
|
V,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
]),
|
|
194
|
-
return /* @__PURE__ */
|
|
183
|
+
_,
|
|
184
|
+
k
|
|
185
|
+
]), Ke = a(() => O ? { runtime: { sources: { [O]: Q } } } : o, [Q, O]);
|
|
186
|
+
return /* @__PURE__ */ s(te, {
|
|
195
187
|
ref: e,
|
|
196
|
-
tag: !
|
|
197
|
-
className:
|
|
188
|
+
tag: !k && !Ne?.length ? "div" : Se,
|
|
189
|
+
className: ve("plitzi-component__api-container", c),
|
|
198
190
|
interactionTriggers: n.triggers,
|
|
199
|
-
interactionCallbacks:
|
|
200
|
-
children: (!V ||
|
|
191
|
+
interactionCallbacks: We,
|
|
192
|
+
children: (!V || Ee || _) && /* @__PURE__ */ s(ge, {
|
|
201
193
|
inherit: "live",
|
|
202
|
-
name: `Api:${
|
|
203
|
-
value:
|
|
204
|
-
children:
|
|
194
|
+
name: `Api:${v}`,
|
|
195
|
+
value: Ke,
|
|
196
|
+
children: Ge
|
|
205
197
|
})
|
|
206
198
|
});
|
|
207
|
-
},
|
|
199
|
+
}, l = e(c);
|
|
208
200
|
//#endregion
|
|
209
|
-
export {
|
|
201
|
+
export { c as ApiContainer, l as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a server provider renders from in the builder, which has no `/_rsc` to ask: its mock data, in the shape the
|
|
3
|
+
* server answers it with.
|
|
4
|
+
*
|
|
5
|
+
* A provider that only has a `query` is answered as a browser request publishes — `{ status, data }`, the body under
|
|
6
|
+
* `data` — so its mock is that body under `data` too: `<source>.data.<field>` in the browser, on the server and in the
|
|
7
|
+
* builder alike. A connector's or an action's answer is its own slice (`records`, an action's output), and so is its
|
|
8
|
+
* mock. Mock data that is not JSON renders nothing, as an empty answer would.
|
|
9
|
+
*/
|
|
10
|
+
export declare const serverMock: (mockData: Record<string, unknown> | string, queryShaped: boolean) => Record<string, unknown>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { emptyObject as e } from "@plitzi/sdk-shared/helpers/utils";
|
|
2
|
+
//#region src/elements/provider/ApiContainer/helpers/serverMock.ts
|
|
3
|
+
var t = (t, n) => {
|
|
4
|
+
let r;
|
|
5
|
+
if (typeof t != "string") r = t;
|
|
6
|
+
else try {
|
|
7
|
+
r = JSON.parse(t || "{}");
|
|
8
|
+
} catch {
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
return n ? {
|
|
12
|
+
status: 200,
|
|
13
|
+
data: r
|
|
14
|
+
} : r;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { t as serverMock };
|
|
@@ -2,7 +2,7 @@ import { ReactNode, RefObject } from 'react';
|
|
|
2
2
|
export type ContainerProps = {
|
|
3
3
|
ref?: RefObject<HTMLElement>;
|
|
4
4
|
className?: string;
|
|
5
|
-
subType?: 'div' | 'header' | 'footer' | 'nav' | 'main' | 'section' | 'article' | 'aside' | 'address' | 'figure' | 'dl' | 'dt' | 'dd' | 'li' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span';
|
|
5
|
+
subType?: 'div' | 'header' | 'footer' | 'nav' | 'main' | 'section' | 'article' | 'aside' | 'address' | 'figure' | 'dl' | 'dt' | 'dd' | 'li' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span';
|
|
6
6
|
/**
|
|
7
7
|
* The name of the part of the page this is — "Main navigation", "Search results", "Your cart" — for screen readers
|
|
8
8
|
* and browser agents, which list the page by its landmarks and regions and jump between them.
|
|
@@ -17,9 +17,15 @@ export type ContainerProps = {
|
|
|
17
17
|
* control inside it can still be tabbed to, and is then announced as nothing.
|
|
18
18
|
*/
|
|
19
19
|
decorative?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* A part of the page whose words change while somebody is on it — a count, a total, a status — said aloud when they
|
|
22
|
+
* do (`aria-live`): `polite` once the reader is idle, `assertive` at once, for what cannot wait. Left out, a change is
|
|
23
|
+
* silent to a screen reader, which reads only what it is moved to.
|
|
24
|
+
*/
|
|
25
|
+
live?: 'polite' | 'assertive' | '';
|
|
20
26
|
children?: ReactNode;
|
|
21
27
|
};
|
|
22
|
-
declare const Container: ({ ref, className, subType, label, decorative, children }: ContainerProps) => import('react').JSX.Element;
|
|
28
|
+
declare const Container: ({ ref, className, subType, label, decorative, live, children }: ContainerProps) => import('react').JSX.Element;
|
|
23
29
|
declare const _default: {
|
|
24
30
|
(props: import('../../../Element/hocs/withElement').WithElementProps<ContainerProps>): import('react').JSX.Element;
|
|
25
31
|
displayName: string;
|
|
@@ -4,18 +4,19 @@ import { NAMEABLE_CONTAINER_TAGS as n } from "./declaration.mjs";
|
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
5
|
import i from "clsx";
|
|
6
6
|
//#region src/elements/structure/Container/Container.tsx
|
|
7
|
-
var a = ({ ref: e, className: a = "", subType: o = "div", label: s = "", decorative: c = !1,
|
|
8
|
-
let
|
|
7
|
+
var a = ({ ref: e, className: a = "", subType: o = "div", label: s = "", decorative: c = !1, live: l = "", children: u }) => {
|
|
8
|
+
let d = !c && s && n.includes(o) ? {
|
|
9
9
|
"aria-label": s,
|
|
10
10
|
...o === "div" ? { role: "group" } : {}
|
|
11
|
-
} : {},
|
|
11
|
+
} : {}, f = c ? { "aria-hidden": !0 } : {}, p = l ? { "aria-live": l } : {};
|
|
12
12
|
return /* @__PURE__ */ r(t, {
|
|
13
13
|
ref: e,
|
|
14
14
|
tag: o,
|
|
15
15
|
className: i(`plitzi-component__container plitzi-component__container-${o}`, a),
|
|
16
|
-
...u,
|
|
17
16
|
...d,
|
|
18
|
-
|
|
17
|
+
...f,
|
|
18
|
+
...p,
|
|
19
|
+
children: u
|
|
19
20
|
});
|
|
20
21
|
}, o = e(a);
|
|
21
22
|
//#endregion
|
|
@@ -12,6 +12,7 @@ declare const declaration: {
|
|
|
12
12
|
readonly type: "container";
|
|
13
13
|
readonly attributeValues: {
|
|
14
14
|
readonly subType: readonly string[];
|
|
15
|
+
readonly live: readonly string[];
|
|
15
16
|
};
|
|
16
17
|
readonly content: {
|
|
17
18
|
readonly attributes: {
|
|
@@ -62,7 +63,8 @@ declare const declaration: {
|
|
|
62
63
|
};
|
|
63
64
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
64
65
|
label?: string | undefined;
|
|
65
|
-
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | undefined;
|
|
66
|
+
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | undefined;
|
|
67
|
+
live?: "polite" | "assertive" | "" | undefined;
|
|
66
68
|
decorative?: boolean | undefined;
|
|
67
69
|
}>>;
|
|
68
70
|
export default declaration;
|
|
@@ -12,29 +12,37 @@ var n = [
|
|
|
12
12
|
"figure"
|
|
13
13
|
], r = e()({
|
|
14
14
|
type: "container",
|
|
15
|
-
attributeValues: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
15
|
+
attributeValues: {
|
|
16
|
+
subType: t()([
|
|
17
|
+
"div",
|
|
18
|
+
"header",
|
|
19
|
+
"footer",
|
|
20
|
+
"nav",
|
|
21
|
+
"main",
|
|
22
|
+
"section",
|
|
23
|
+
"article",
|
|
24
|
+
"aside",
|
|
25
|
+
"address",
|
|
26
|
+
"figure",
|
|
27
|
+
"dl",
|
|
28
|
+
"dt",
|
|
29
|
+
"dd",
|
|
30
|
+
"li",
|
|
31
|
+
"h1",
|
|
32
|
+
"h2",
|
|
33
|
+
"h3",
|
|
34
|
+
"h4",
|
|
35
|
+
"h5",
|
|
36
|
+
"h6",
|
|
37
|
+
"p",
|
|
38
|
+
"span"
|
|
39
|
+
]),
|
|
40
|
+
live: t()([
|
|
41
|
+
"",
|
|
42
|
+
"polite",
|
|
43
|
+
"assertive"
|
|
44
|
+
])
|
|
45
|
+
},
|
|
38
46
|
content: {
|
|
39
47
|
attributes: { subType: "div" },
|
|
40
48
|
definition: {
|
|
@@ -5,6 +5,7 @@ declare const Container: {
|
|
|
5
5
|
readonly type: "container";
|
|
6
6
|
readonly attributeValues: {
|
|
7
7
|
readonly subType: readonly string[];
|
|
8
|
+
readonly live: readonly string[];
|
|
8
9
|
};
|
|
9
10
|
readonly content: {
|
|
10
11
|
readonly attributes: {
|
|
@@ -55,7 +56,8 @@ declare const Container: {
|
|
|
55
56
|
};
|
|
56
57
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
57
58
|
label?: string | undefined;
|
|
58
|
-
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | undefined;
|
|
59
|
+
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | undefined;
|
|
60
|
+
live?: "polite" | "assertive" | "" | undefined;
|
|
59
61
|
decorative?: boolean | undefined;
|
|
60
62
|
}>>;
|
|
61
63
|
export default Container;
|
package/dist/index.d.ts
CHANGED
|
@@ -919,6 +919,7 @@ export declare const defaultElements: {
|
|
|
919
919
|
readonly type: "container";
|
|
920
920
|
readonly attributeValues: {
|
|
921
921
|
readonly subType: readonly string[];
|
|
922
|
+
readonly live: readonly string[];
|
|
922
923
|
};
|
|
923
924
|
readonly content: {
|
|
924
925
|
readonly attributes: {
|
|
@@ -969,7 +970,8 @@ export declare const defaultElements: {
|
|
|
969
970
|
};
|
|
970
971
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
971
972
|
label?: string | undefined;
|
|
972
|
-
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | undefined;
|
|
973
|
+
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | undefined;
|
|
974
|
+
live?: "polite" | "assertive" | "" | undefined;
|
|
973
975
|
decorative?: boolean | undefined;
|
|
974
976
|
}>>;
|
|
975
977
|
layoutContainer: {
|
|
@@ -2012,7 +2014,7 @@ export declare const defaultElements: {
|
|
|
2012
2014
|
};
|
|
2013
2015
|
readonly content: {
|
|
2014
2016
|
readonly attributes: {
|
|
2015
|
-
readonly src: "
|
|
2017
|
+
readonly src: "";
|
|
2016
2018
|
readonly alt: "";
|
|
2017
2019
|
readonly decorative: false;
|
|
2018
2020
|
readonly fetchPriority: "auto";
|
|
@@ -2064,6 +2066,7 @@ export declare const defaultElements: {
|
|
|
2064
2066
|
readonly settings: {};
|
|
2065
2067
|
};
|
|
2066
2068
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
2069
|
+
resize?: boolean | undefined;
|
|
2067
2070
|
height?: number | undefined;
|
|
2068
2071
|
width?: number | undefined;
|
|
2069
2072
|
fetchPriority?: "high" | "low" | "auto" | undefined;
|
|
@@ -2458,6 +2461,7 @@ export declare const defaultElements: {
|
|
|
2458
2461
|
title?: string | undefined;
|
|
2459
2462
|
content?: string | undefined;
|
|
2460
2463
|
disabled?: boolean | undefined;
|
|
2464
|
+
controls?: string | undefined;
|
|
2461
2465
|
icon?: string | undefined;
|
|
2462
2466
|
subType?: "button" | "submit" | "reset" | undefined;
|
|
2463
2467
|
iconPlacement?: import('./Element/ElementWords').IconPlacement | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-elements",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.4",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -898,6 +898,10 @@
|
|
|
898
898
|
"types": "./dist/elements/provider/ApiContainer/helpers/queryInput.d.ts",
|
|
899
899
|
"import": "./dist/elements/provider/ApiContainer/helpers/queryInput.mjs"
|
|
900
900
|
},
|
|
901
|
+
"./elements/provider/ApiContainer/helpers/serverMock": {
|
|
902
|
+
"types": "./dist/elements/provider/ApiContainer/helpers/serverMock.d.ts",
|
|
903
|
+
"import": "./dist/elements/provider/ApiContainer/helpers/serverMock.mjs"
|
|
904
|
+
},
|
|
901
905
|
"./elements/provider/ApiContainer/hooks/useApi": {
|
|
902
906
|
"types": "./dist/elements/provider/ApiContainer/hooks/useApi.d.ts",
|
|
903
907
|
"import": "./dist/elements/provider/ApiContainer/hooks/useApi.mjs"
|
|
@@ -1294,13 +1298,13 @@
|
|
|
1294
1298
|
"dependencies": {
|
|
1295
1299
|
"@plitzi/nexus": "^1.4.0",
|
|
1296
1300
|
"@plitzi/plitzi-ui": "^1.6.29",
|
|
1297
|
-
"@plitzi/sdk-auth": "0.38.
|
|
1298
|
-
"@plitzi/sdk-dev-tools": "0.38.
|
|
1299
|
-
"@plitzi/sdk-event-bridge": "0.38.
|
|
1300
|
-
"@plitzi/sdk-interactions": "0.38.
|
|
1301
|
-
"@plitzi/sdk-navigation": "0.38.
|
|
1302
|
-
"@plitzi/sdk-schema": "0.38.
|
|
1303
|
-
"@plitzi/sdk-shared": "0.38.
|
|
1301
|
+
"@plitzi/sdk-auth": "0.38.4",
|
|
1302
|
+
"@plitzi/sdk-dev-tools": "0.38.4",
|
|
1303
|
+
"@plitzi/sdk-event-bridge": "0.38.4",
|
|
1304
|
+
"@plitzi/sdk-interactions": "0.38.4",
|
|
1305
|
+
"@plitzi/sdk-navigation": "0.38.4",
|
|
1306
|
+
"@plitzi/sdk-schema": "0.38.4",
|
|
1307
|
+
"@plitzi/sdk-shared": "0.38.4",
|
|
1304
1308
|
"clsx": "^2.1.1",
|
|
1305
1309
|
"immer": "^11.1.21"
|
|
1306
1310
|
},
|