@plitzi/sdk-elements 0.38.19 → 0.38.21
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 +186 -0
- package/dist/elements/basic/Dropdown/DropdownPopup/DropdownPopup.mjs +1 -1
- package/dist/elements/basic/Dropdown/useDropdown.mjs +2 -2
- package/dist/elements/declarations/index.d.ts +2 -0
- package/dist/elements/internal/Page/Page.d.ts +12 -1
- package/dist/elements/internal/Page/Page.mjs +34 -32
- package/dist/elements/internal/Page/PageWithheld.d.ts +10 -0
- package/dist/elements/internal/Page/PageWithheld.mjs +43 -0
- package/dist/elements/internal/Page/Settings.d.ts +4 -2
- package/dist/elements/internal/Page/Settings.mjs +132 -109
- package/dist/elements/internal/Page/declaration.d.ts +2 -0
- package/dist/elements/internal/Page/index.d.ts +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +7 -6
- package/dist/realtime/useChannel.mjs +38 -38
- package/dist/realtime/useJob.d.ts +8 -0
- package/dist/realtime/useJob.mjs +10 -0
- package/package.json +7 -7
- package/dist/Element/element.bench.d.ts +0 -1
- package/dist/testUtils/elementTestUtils.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,191 @@
|
|
|
1
1
|
# @plitzi/sdk-elements
|
|
2
2
|
|
|
3
|
+
## 0.38.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 19fbc45: ## Server
|
|
8
|
+
|
|
9
|
+
- **Jobs: work longer than a request** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`, `@plitzi/sdk-elements`,
|
|
10
|
+
`@plitzi/plitzi-sdk`, `@plitzi/sdk-authoring`) — PZ-136. A space's code declares them in
|
|
11
|
+
`defineFunctions({ jobs: { train: { watch, maxSeconds, run(input, job, ctx) } } })` and starts them with
|
|
12
|
+
`ctx.jobs.start(name, input, { key })` (`get`, `pause`, `resume`, `cancel` beside it). They run in the actions' durable
|
|
13
|
+
queue — leased, taken over when a server dies, retried with backoff — slice by slice, in the sandbox, in a space's
|
|
14
|
+
runtime and natively alike: `job.save(state)` is the one checkpoint and the next slice starts with `job.state`;
|
|
15
|
+
`job.report(fraction, step)` says how far it is; on `job.signal` (`job.stopping`: `pause`, `cancel`, `limit`,
|
|
16
|
+
`shutdown`) the code has 5 s to save and return. A sandbox slice runs at most `sliceMs` and goes on in the next if it
|
|
17
|
+
saved since it began — one that saved nothing fails, so a job cannot loop forever; a runtime's runs until the job's
|
|
18
|
+
time is up. A real pause: `paused` keeps what it saved until resumed. Who may watch it is RBAC: whoever started it, and
|
|
19
|
+
whoever its `watch` (a channel's access) lets in, on `$job:<id>` — the platform's topic, retained — read with
|
|
20
|
+
`useJob(id)` or a `channel` element on `$job:{{ id }}`; the view never carries its input, its state, or an error other
|
|
21
|
+
than the code's own refusal. Limits per space (its plan) through `functions.jobs.limitsFor` —
|
|
22
|
+
`DEFAULT_FUNCTION_JOB_LIMITS` otherwise: 10 running across the account's spaces (`pool`, the oldest first), 1,000
|
|
23
|
+
waiting, 6 h, slices of 5 min / 30 s CPU / 10,000 calls, 1 MB of state.
|
|
24
|
+
- **The queue's types are the queue's** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`): `ActionJobQueue`, `ActionJob`,
|
|
25
|
+
`ActionJobInput`, `ActionJobStatus`, `ActionJobAttempt`, `ActionJobSettlement`, `ActionJobQuery` are `JobQueue`, `Job`,
|
|
26
|
+
`JobInput`, `JobStatus`, `JobAttempt`, `JobSettlement`, `JobQuery` (`ACTION_JOB_STATUSES` → `JOB_STATUSES`,
|
|
27
|
+
`isJobStatus`, `TERMINAL_JOB_STATUSES`) — the queue holds a schedule's fires, the runs set for later and the jobs of
|
|
28
|
+
the spaces' functions. **What a job runs is its `target`**: `{ kind: 'action', name, trigger }` or
|
|
29
|
+
`{ kind: 'function', name, user, watch, at }`, in place of `actionId`, `trigger` and `function`; `listJobs` filters
|
|
30
|
+
by `kind` and `name`. Also on the queue: `paused` with `pause`/`resume`, `write` for what a running job saves and
|
|
31
|
+
reports, `state`/`progress`/`result`/`activeMs`, `heartbeat` answering `{ jobId, stop: 'cancel' | 'pause' }[]`, a
|
|
32
|
+
settlement's explicit `refund`, `requeue(…, { input, fresh })`. The helpers bring a store a release before left up
|
|
33
|
+
to it by themselves: MySQL's `ensureJobTables` gives each job its target from `action_id`/`trigger_type` and drops
|
|
34
|
+
them (`mysqlJobSchemaUpgrades` lists the statements for a deployment's own migrations); Mongo's queue does the same
|
|
35
|
+
to the documents on first use and drops the `spaceId_1_actionId_1_updatedAt_-1` index. A deployment with a queue of
|
|
36
|
+
its own: the contract tests (`describeJobQueue`) say what it must now do.
|
|
37
|
+
- **A runtime's routes stream** (`@plitzi/sdk-server`): a route under `/fn/` answered by a space's runtime is passed on
|
|
38
|
+
as it is written — its head at once, its body as the code writes it, with the platform's `ctx` — over the functions
|
|
39
|
+
protocol's new `head`/`chunk` messages, with no time limit once it answered; the deployment's own routes stream too.
|
|
40
|
+
A runtime's `endpoints` are for addresses outside `/fn/` (an MCP server at `/mcp`); anything that can live under
|
|
41
|
+
`/fn/` is a route. A sandbox's routes are answered whole, as before.
|
|
42
|
+
- **`createJobControl({ queue, realtime: { pubsub, kv } })`** (`@plitzi/sdk-server/actions`): an operator's
|
|
43
|
+
`pause`/`resume`/`cancel`/`requeue` from a process that serves no pages — a Queue panel's API — each said on
|
|
44
|
+
`$job:<id>` through the page server's own pub/sub and retained store, so a watcher hears what an operator did.
|
|
45
|
+
- **A run's user carries no session** (`RunUser`): what a step, a function and a job see of who asked.
|
|
46
|
+
- **The builder shows the jobs** (`@plitzi/plitzi-builder`, `@plitzi/sdk-shared`): **Server → Functions** lists the
|
|
47
|
+
jobs the code declares as it is typed (how long each may run; one spread in or built by a call is counted, not
|
|
48
|
+
guessed), and the inspector of one says how it is started and who may watch it, with the space's runs of it — live
|
|
49
|
+
while one moves, progress and step as its code reported them — and **Pause**, **Resume**, **Cancel** and **Run
|
|
50
|
+
again**. Through two new builder operations, `SpaceJobs(kind, name, status, page, pageSize)` — a `SpaceJob` each:
|
|
51
|
+
what it runs, where it is and how far, never its input, state or result — and `SpaceControlJob(jobId, control)`
|
|
52
|
+
(`JobControlAction`). Beside them in `@plitzi/sdk-shared/actions`: `JOB_KINDS`/`isJobKind`, and `actionAccessOf`, the
|
|
53
|
+
one reading of a channel's access, which the functions' manifest now reads a job's `watch` with too.
|
|
54
|
+
|
|
55
|
+
- **`ctx.oauth.token` for an SDK in the page** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`): Spotify's Web Playback,
|
|
56
|
+
Google's Picker and their kind ask the page for the access token themselves, and `ctx.oauth` kept every token on the
|
|
57
|
+
server. A connection that declares `exposeToken: true` now answers `ctx.oauth.token(name, { owner })` —
|
|
58
|
+
`{ token, type, expiresAt, scopes }`, renewed first when about to lapse — for a route of the code to hand to the
|
|
59
|
+
connection's owner. The refresh token never leaves; a connection without `exposeToken` refuses `token`, naming the
|
|
60
|
+
field. Through the sandbox's protocol and natively alike.
|
|
61
|
+
|
|
62
|
+
- **A page for some permissions, kept by the server** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`,
|
|
63
|
+
`@plitzi/sdk-authoring`, `@plitzi/sdk-elements`, `@plitzi/plitzi-builder`): a page says
|
|
64
|
+
`access: { permissions: [...] }`, and a visitor without every one is answered 401 (or the page's sign-in redirect) or
|
|
65
|
+
403 with a refusal drawn in the page's layout. Its content is withheld from everything that visitor is sent — the
|
|
66
|
+
render, the hydration payload, the space document (and a document built for somebody with access is not handed to
|
|
67
|
+
somebody without it by its name) and the page's server data. The builder's page settings take the permissions;
|
|
68
|
+
authoring refuses an `access` the server could not keep (`page-access`). A space read back as code — `plitzi create
|
|
69
|
+
--from`, the Export — keeps each page's `access`, so a protected page is never exported open. A page's handle carries
|
|
70
|
+
its `access` too, and a project's `visual/home.spec.ts` leaves such a page to a test that signs in, as it does a page
|
|
71
|
+
behind a session (`plitzi upgrade` rewrites an untouched one).
|
|
72
|
+
- **A project's first plugin is picked up while it runs** (`@plitzi/sdk-server`): `start:dev` registers a plugin folder
|
|
73
|
+
added under `src/plugins/` and reloads the open pages — but only watched that folder when it existed at boot, so a
|
|
74
|
+
project with no plugin yet (one taken out of a space that had none) showed nothing of its first `plitzi plugin add`
|
|
75
|
+
until a restart. With no folder, the server waits for it to appear and takes what it holds then.
|
|
76
|
+
|
|
77
|
+
## Packaging
|
|
78
|
+
- **No package ships the declarations of its tests** (`@plitzi/sdk-server`, `@plitzi/sdk-mcp`, `@plitzi/plitzi-sdk`,
|
|
79
|
+
`@plitzi/plitzi-builder`, `@plitzi/sdk-elements`, `@plitzi/sdk-shared`): each app wrote its declarations with its own
|
|
80
|
+
`dts({ exclude })`, and the ones that left the tests out of it shipped a `.test.d.ts` beside their modules — 148 in
|
|
81
|
+
sdk-server alone — and the base config let a `.bench.d.ts` through. Every `dts()` now excludes
|
|
82
|
+
`'**/*.(test|bench).(ts|tsx)'`, and `yarn check:dist-exports` (CI, after `build:prod`) fails a build of any published
|
|
83
|
+
package that holds one.
|
|
84
|
+
- **`@plitzi/plitzi-builder` depends on `graphql` ^16** (was ^17): Apollo Server — the builder's API — supports only
|
|
85
|
+
16, so a host installing the builder beside it got two copies. The builder uses nothing of 17's.
|
|
86
|
+
|
|
87
|
+
## Elements
|
|
88
|
+
- **A dropdown closes when a link in it is chosen** (`@plitzi/sdk-elements`): a link stops its click from bubbling,
|
|
89
|
+
and the popup listened for clicks on the way up — so no menu of links ever closed, and a click that did reach it was
|
|
90
|
+
cancelled, which would have kept an external link from going anywhere. The popup now hears the click as it goes down
|
|
91
|
+
and lets it through.
|
|
92
|
+
|
|
93
|
+
## CLI
|
|
94
|
+
- **A refused push says why** (`@plitzi/cli`): `space push functions` and the data push read any 409 as "changed since
|
|
95
|
+
your pull" — and the platform also answers 409 when the space has no private bucket to keep its code or data in, so
|
|
96
|
+
a first push to a space with no storage sent its author to pull, which changed nothing. The CLI now names a conflict
|
|
97
|
+
only when the refusal says `version`, and prints the platform's own words otherwise (where to add the bucket).
|
|
98
|
+
- **`create` points at the Academy** (`@plitzi/cli`): its last lines name the docs' Academy,
|
|
99
|
+
`https://docs.plitzi.com/academy`, for whoever is new to Plitzi — and the README the docs themselves.
|
|
100
|
+
|
|
101
|
+
## Builder
|
|
102
|
+
- **A space served by Plitzi has a server, and the builder says so** (`@plitzi/plitzi-builder`, `@plitzi/sdk-shared`):
|
|
103
|
+
whether a space can run its actions and resolve its connectors was read off an SSR _credential_, which only a space
|
|
104
|
+
deployed to a page server of its own has — so every space served at `<space>.plitzi.app` showed "No server-rendered
|
|
105
|
+
deployment" over Server and counted its actions unavailable, while they ran. The deployments now carry what serves
|
|
106
|
+
them (`provider`), and a deployment served by SSR — Plitzi's or the space's — counts.
|
|
107
|
+
- **New Layout saves the layout** (`@plitzi/sdk-schema`): a layout is a root of the pages' tree, added with no anchor,
|
|
108
|
+
and `flatMapOf` found no tree for an empty anchor — so the server refused every new layout, saying it was "already
|
|
109
|
+
added". A root now goes into the pages' tree, and the refusal says which of the two it is.
|
|
110
|
+
- **Settings → Realtime: a space's channels, declared by hand** (`@plitzi/plitzi-builder`): `settings.channels` was
|
|
111
|
+
written only in code or by an agent over MCP, so a space made in the builder could not open a channel. The section
|
|
112
|
+
lists the channels with who may join (anyone, signed-in visitors, visitors with permissions), who may speak (pages, or
|
|
113
|
+
only the server's `Publish On Channel`), presence, a grant, keeping the last message and the two limits — saved only
|
|
114
|
+
when `channelProblems` passes, with what is wrong said under the channel otherwise.
|
|
115
|
+
|
|
116
|
+
- Updated dependencies [19fbc45]
|
|
117
|
+
- @plitzi/sdk-auth@0.38.21
|
|
118
|
+
- @plitzi/sdk-event-bridge@0.38.21
|
|
119
|
+
- @plitzi/sdk-interactions@0.38.21
|
|
120
|
+
- @plitzi/sdk-navigation@0.38.21
|
|
121
|
+
- @plitzi/sdk-schema@0.38.21
|
|
122
|
+
- @plitzi/sdk-shared@0.38.21
|
|
123
|
+
|
|
124
|
+
## 0.38.20
|
|
125
|
+
|
|
126
|
+
### Patch Changes
|
|
127
|
+
|
|
128
|
+
- c7c241a: ## Security
|
|
129
|
+
|
|
130
|
+
- **The `Origin` fallback reads the request's own authority before a forwarded one** (`@plitzi/sdk-server`): 0.38.19
|
|
131
|
+
took `X-Forwarded-Host` first, and with no proxy in front a client could send one naming this host on another port,
|
|
132
|
+
making that port's `Origin` this server's own. Now `:authority` or `Host` decide whenever they name the host the
|
|
133
|
+
request is answered as; `X-Forwarded-Host` only when they do not — a host that took its hostname from the header
|
|
134
|
+
(Express's `trust proxy`) trusts the proxy that wrote it. No option to set: what the host resolved says which one it
|
|
135
|
+
believes. The write guard (`crossSiteWrites`), the sign-in's login-CSRF check and `createOriginGuardMiddleware`
|
|
136
|
+
share it.
|
|
137
|
+
|
|
138
|
+
## Server
|
|
139
|
+
- **`ctx.oauth`: OAuth 2.0 for a space's code, any provider** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`): a
|
|
140
|
+
connection is data in `defineFunctions({ oauth: { calendar: { issuer | authorizeUrl + tokenUrl, credential, scopes,
|
|
141
|
+
authorizeParams, clientAuth } } })` — an OpenID provider by its `issuer` (endpoints discovered), any other by its
|
|
142
|
+
endpoints; none is known to the platform by name. `ctx.oauth.connect(name, { returnTo, owner? })` answers the
|
|
143
|
+
consent URL (authorization code with PKCE); the platform answers `/fn/oauth/callback` — the one address to register
|
|
144
|
+
with every provider — exchanges the code with the app's id and secret from the named credential, and sends the
|
|
145
|
+
visitor back to `returnTo` with `?oauth=<name>&oauth_result=connected` (or `&oauth_error=`). `ctx.oauth.fetch(name,
|
|
146
|
+
url)` writes the token in, renewed before it lapses and once more on a 401, only to `allow.hosts`; `status` and
|
|
147
|
+
`disconnect` (revoked where the provider says). A token is a signed-in visitor's own by default, `{ owner: 'space' }`
|
|
148
|
+
the space's, or a key of the code's own; it is kept in the space's `kv` sealed with a key of the space's that no
|
|
149
|
+
`ctx.sign` reaches, so the code never holds one. In the sandbox, natively and in a space's runtime alike; a plugin's
|
|
150
|
+
functions declare and reach none. Needs `signingSecret`. Runs also carry the `origin` of the request that started
|
|
151
|
+
them (`ctx.origin` of a task context), what the callback address is made of.
|
|
152
|
+
|
|
153
|
+
## Packages
|
|
154
|
+
- **No path a package does not export is written anywhere in the packages** (`@plitzi/plitzi-sdk`,
|
|
155
|
+
`@plitzi/sdk-shared`): two JSDoc comments sent readers to `@plitzi/sdk-authoring/testing`, which is not an entry —
|
|
156
|
+
`inspectRenders` is exported by `@plitzi/sdk-authoring`. `yarn check:specifiers` (in CI after the build) reads every
|
|
157
|
+
`@plitzi/<package>/<path>` the workspace writes — the code, its built declarations, JSDoc, skills and docs — against
|
|
158
|
+
what that package exports, so an import somebody would copy into a project and get `ERR_MODULE_NOT_FOUND` from cannot
|
|
159
|
+
be published again.
|
|
160
|
+
|
|
161
|
+
- **The packages that run in Node say which Node** (`@plitzi/sdk-server`, `@plitzi/cli`, `@plitzi/sdk-mcp`,
|
|
162
|
+
`@plitzi/sdk-authoring`): `"engines": { "node": ">=22.18" }`, the floor every project the CLI makes already declares —
|
|
163
|
+
installed on an older Node they now say so, instead of failing on the first API it lacks (`--env-file-if-exists`,
|
|
164
|
+
`--permission`, `Set#union`). The browser's packages declare none: a bundler reads them.
|
|
165
|
+
|
|
166
|
+
- **A short render guide, and each part of it alone** (`@plitzi/sdk-mcp`): `renderGuideText` stays the whole guide
|
|
167
|
+
(~30k characters); `renderGuideCore` is a third of it for an agent that counts its tokens — a voice assistant, a small
|
|
168
|
+
model — with the model of a render, the element types, the host's theme and what to do on a refusal, and the address
|
|
169
|
+
of every other section; `renderGuideTopics[topic]` and `renderGuideTopicUri(topic)` (`plitzi://render/guide/repeat`,
|
|
170
|
+
`…/data`…) serve each one, cut from the one text. The MCP server answers them as resources and through `plitzi_read`.
|
|
171
|
+
|
|
172
|
+
## CLI
|
|
173
|
+
- **What Plitzi decided reaches the agent writing a report** (`@plitzi/cli`): `plitzi feedback`'s brief lists what was
|
|
174
|
+
reported and kept as it is — with why, and what to do instead — so a report files it under `changed` as `decided`
|
|
175
|
+
rather than carrying it as open, and the page has that status.
|
|
176
|
+
|
|
177
|
+
- **The CLI skill says what `ERR_MODULE_NOT_FOUND` into a `@plitzi` package's `dist` is** (`@plitzi/cli`): an import of
|
|
178
|
+
a path the package does not export — a file rather than its folder — with `plitzi doctor` to name each one and
|
|
179
|
+
`plitzi upgrade migrations --write` to rewrite it.
|
|
180
|
+
|
|
181
|
+
- Updated dependencies [c7c241a]
|
|
182
|
+
- @plitzi/sdk-auth@0.38.20
|
|
183
|
+
- @plitzi/sdk-event-bridge@0.38.20
|
|
184
|
+
- @plitzi/sdk-interactions@0.38.20
|
|
185
|
+
- @plitzi/sdk-navigation@0.38.20
|
|
186
|
+
- @plitzi/sdk-schema@0.38.20
|
|
187
|
+
- @plitzi/sdk-shared@0.38.20
|
|
188
|
+
|
|
3
189
|
## 0.38.19
|
|
4
190
|
|
|
5
191
|
### Patch Changes
|
|
@@ -13,7 +13,7 @@ var c = ({ ref: e, className: c = "", children: l }) => {
|
|
|
13
13
|
ref: u,
|
|
14
14
|
className: o("plitzi-component__dropdown-popup", c, { "popup-container--no-visible": !d || !f }),
|
|
15
15
|
style: f,
|
|
16
|
-
|
|
16
|
+
onClickCapture: p,
|
|
17
17
|
children: l
|
|
18
18
|
});
|
|
19
19
|
return m ? s(h, m) : h;
|
|
@@ -3025,6 +3025,8 @@ export declare const elementDeclarations: {
|
|
|
3025
3025
|
seoPageTitle?: string | undefined;
|
|
3026
3026
|
seoPageDescription?: string | undefined;
|
|
3027
3027
|
documentScroll?: (import('.').DocumentScroll | "") | undefined;
|
|
3028
|
+
withheld?: import('@plitzi/sdk-shared/schema').PageWithheld | undefined;
|
|
3029
|
+
access?: import('@plitzi/sdk-shared/schema').PageAccess | undefined;
|
|
3028
3030
|
}>>;
|
|
3029
3031
|
readonly Pagination: import('@plitzi/sdk-shared/authoring').DeclaredElement<{
|
|
3030
3032
|
readonly type: "pagination";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DocumentScroll } from './declaration';
|
|
2
|
+
import { PageAccess, PageWithheld as WithheldReason } from '@plitzi/sdk-shared/schema';
|
|
2
3
|
import { ReactNode, RefObject } from 'react';
|
|
3
4
|
export type PageProps = {
|
|
4
5
|
ref?: RefObject<HTMLElement>;
|
|
@@ -20,12 +21,22 @@ export type PageProps = {
|
|
|
20
21
|
* inside another space is embedded in, nor the builder's.
|
|
21
22
|
*/
|
|
22
23
|
documentScroll?: DocumentScroll | '';
|
|
24
|
+
/**
|
|
25
|
+
* The permissions a visitor must hold to see this page — read by the server, which withholds the page from anybody
|
|
26
|
+
* without them. Nothing for the page itself to do with.
|
|
27
|
+
*/
|
|
28
|
+
access?: PageAccess;
|
|
29
|
+
/**
|
|
30
|
+
* Set by the server on a page it withheld from this visitor (`access` they do not meet): the content was not sent,
|
|
31
|
+
* and the page says why instead. Never authored.
|
|
32
|
+
*/
|
|
33
|
+
withheld?: WithheldReason;
|
|
23
34
|
className?: string;
|
|
24
35
|
layout?: string;
|
|
25
36
|
layoutContainer?: string;
|
|
26
37
|
children?: ReactNode;
|
|
27
38
|
};
|
|
28
|
-
declare const Page: ({ ref, seoEnabled, seoPageTitle, seoPageDescription, documentScroll, className, layout, layoutContainer, children }: PageProps) => import('react').JSX.Element;
|
|
39
|
+
declare const Page: ({ ref, seoEnabled, seoPageTitle, seoPageDescription, documentScroll, withheld, className, layout, layoutContainer, children }: PageProps) => import('react').JSX.Element;
|
|
29
40
|
declare const _default: {
|
|
30
41
|
(props: import('../../..').WithElementProps<PageProps>): import('react').JSX.Element;
|
|
31
42
|
displayName: string;
|
|
@@ -6,66 +6,68 @@ import { RootElement as i } from "../../../Element/RootElement.mjs";
|
|
|
6
6
|
import a from "../LayoutContainer/index.mjs";
|
|
7
7
|
import o from "../../../Element/hooks/useLayoutChain.mjs";
|
|
8
8
|
import s from "./PageHead.mjs";
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import g from "
|
|
14
|
-
import
|
|
9
|
+
import c from "./PageWithheld.mjs";
|
|
10
|
+
import { use as l, useEffect as u, useMemo as d } from "react";
|
|
11
|
+
import { usePlitzi as f } from "@plitzi/sdk-shared/hooks";
|
|
12
|
+
import { useRenderSettings as p, useSdkStore as m } from "@plitzi/sdk-shared/store";
|
|
13
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
14
|
+
import _ from "clsx";
|
|
15
|
+
import { InteractionsContext as v } from "@plitzi/sdk-interactions";
|
|
15
16
|
//#region src/elements/internal/Page/Page.tsx
|
|
16
|
-
var
|
|
17
|
+
var y = {
|
|
17
18
|
locked: "html,body{height:100%;overflow:hidden;overscroll-behavior:none}",
|
|
18
19
|
noBounce: "html,body{overscroll-behavior:none}"
|
|
19
|
-
},
|
|
20
|
+
}, b = (e) => e.map((e) => ({
|
|
20
21
|
...e,
|
|
21
22
|
plitziElementLayout: {
|
|
22
23
|
slots: [e.slot],
|
|
23
24
|
rootId: e.slot,
|
|
24
25
|
type: "layout"
|
|
25
26
|
}
|
|
26
|
-
})),
|
|
27
|
+
})), x = (t, n, r) => t.reduce((t, { layout: r, slot: i, plitziElementLayout: o }) => /* @__PURE__ */ h(e, {
|
|
27
28
|
bodies: { [i]: t },
|
|
28
|
-
children: /* @__PURE__ */
|
|
29
|
+
children: /* @__PURE__ */ h(a, { internalProps: {
|
|
29
30
|
id: r,
|
|
30
31
|
rootId: n,
|
|
31
32
|
plitziElementLayout: o
|
|
32
33
|
} })
|
|
33
|
-
}, i), r),
|
|
34
|
-
let { id:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
}, i), r), S = ({ ref: e, seoEnabled: n = !1, seoPageTitle: a = "Title", seoPageDescription: S = "Description", documentScroll: C = "", withheld: w, className: T = "", layout: E = "", layoutContainer: D = "", children: O }) => {
|
|
35
|
+
let { id: k } = r(), { settings: { previewMode: A } } = f(), { interactionsManager: j } = l(v), { ownsHead: M, renderMode: N } = p(), P = M && N !== "widget", [[F, I]] = m(["navigation.routeParams", "navigation.queryParams"]), L = o(E, D), R = d(() => b(L), [L]), z = d(() => x(R, k, w ? /* @__PURE__ */ h(c, { reason: w }) : O), [
|
|
36
|
+
R,
|
|
37
|
+
k,
|
|
38
|
+
O,
|
|
39
|
+
w
|
|
38
40
|
]);
|
|
39
|
-
return
|
|
41
|
+
return u(() => {
|
|
40
42
|
let e = !1;
|
|
41
43
|
return queueMicrotask(() => {
|
|
42
|
-
e ||
|
|
43
|
-
pageId:
|
|
44
|
-
routeParams:
|
|
45
|
-
queryParams:
|
|
44
|
+
e || j.interactionTrigger(k, "onPageLoad", {
|
|
45
|
+
pageId: k,
|
|
46
|
+
routeParams: F,
|
|
47
|
+
queryParams: I
|
|
46
48
|
});
|
|
47
49
|
}), () => {
|
|
48
50
|
e = !0;
|
|
49
51
|
};
|
|
50
52
|
}, [
|
|
51
|
-
D,
|
|
52
53
|
k,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
j,
|
|
55
|
+
I,
|
|
56
|
+
F
|
|
57
|
+
]), /* @__PURE__ */ g(i, {
|
|
56
58
|
ref: e,
|
|
57
|
-
className:
|
|
59
|
+
className: _("plitzi-component__page", T),
|
|
58
60
|
interactionTriggers: t.triggers,
|
|
59
61
|
children: [
|
|
60
|
-
n &&
|
|
61
|
-
pageId:
|
|
62
|
+
n && A && M && /* @__PURE__ */ h(s, {
|
|
63
|
+
pageId: k,
|
|
62
64
|
title: a,
|
|
63
|
-
description:
|
|
65
|
+
description: S
|
|
64
66
|
}),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
C && P && /* @__PURE__ */ h("style", { children: y[C] }),
|
|
68
|
+
z
|
|
67
69
|
]
|
|
68
70
|
});
|
|
69
|
-
},
|
|
71
|
+
}, C = n(S);
|
|
70
72
|
//#endregion
|
|
71
|
-
export {
|
|
73
|
+
export { S as Page, C as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PageWithheld as Reason } from '@plitzi/sdk-shared/schema';
|
|
2
|
+
export type PageWithheldProps = {
|
|
3
|
+
reason: Reason;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* What a page the server withheld from this visitor shows instead of its content — which was never sent: why, in a
|
|
7
|
+
* sentence, inside the page's own layout so the site around it still works. The server answers it with 401 or 403.
|
|
8
|
+
*/
|
|
9
|
+
declare const PageWithheld: ({ reason }: PageWithheldProps) => import('react').JSX.Element;
|
|
10
|
+
export default PageWithheld;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
//#region src/elements/internal/Page/PageWithheld.tsx
|
|
3
|
+
var n = {
|
|
4
|
+
unauthenticated: {
|
|
5
|
+
title: "Sign in to see this page",
|
|
6
|
+
text: "This page is for people who are signed in and have access to it."
|
|
7
|
+
},
|
|
8
|
+
forbidden: {
|
|
9
|
+
title: "This page is not available to you",
|
|
10
|
+
text: "It is for people with access you do not have. If you think you should, ask whoever runs this site."
|
|
11
|
+
}
|
|
12
|
+
}, r = {
|
|
13
|
+
display: "flex",
|
|
14
|
+
flexDirection: "column",
|
|
15
|
+
gap: "8px",
|
|
16
|
+
maxWidth: "560px",
|
|
17
|
+
margin: "64px auto",
|
|
18
|
+
padding: "0 16px",
|
|
19
|
+
textAlign: "center",
|
|
20
|
+
color: "var(--foreground, inherit)"
|
|
21
|
+
}, i = {
|
|
22
|
+
margin: 0,
|
|
23
|
+
fontSize: "24px",
|
|
24
|
+
lineHeight: 1.25
|
|
25
|
+
}, a = {
|
|
26
|
+
margin: 0,
|
|
27
|
+
color: "var(--muted, inherit)",
|
|
28
|
+
fontSize: "16px",
|
|
29
|
+
lineHeight: 1.55
|
|
30
|
+
}, o = ({ reason: o }) => /* @__PURE__ */ t("section", {
|
|
31
|
+
className: "plitzi-component__page-withheld",
|
|
32
|
+
style: r,
|
|
33
|
+
"data-withheld": o,
|
|
34
|
+
children: [/* @__PURE__ */ e("h1", {
|
|
35
|
+
style: i,
|
|
36
|
+
children: n[o].title
|
|
37
|
+
}), /* @__PURE__ */ e("p", {
|
|
38
|
+
style: a,
|
|
39
|
+
children: n[o].text
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
42
|
+
//#endregion
|
|
43
|
+
export { o as default };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DocumentScroll } from './declaration';
|
|
2
|
+
import { PageAccess } from '@plitzi/sdk-shared/schema';
|
|
2
3
|
type SettingsProps = {
|
|
3
4
|
id?: string;
|
|
4
5
|
seoEnabled?: boolean;
|
|
@@ -14,7 +15,8 @@ type SettingsProps = {
|
|
|
14
15
|
unauthorizedBehaviour?: '' | 'redirect';
|
|
15
16
|
unauthorizedPageRedirect?: string;
|
|
16
17
|
documentScroll?: DocumentScroll | '';
|
|
17
|
-
|
|
18
|
+
access?: PageAccess | '';
|
|
19
|
+
onUpdate?: (key: string, value: string | boolean | number | PageAccess) => void;
|
|
18
20
|
};
|
|
19
|
-
declare const Settings: ({ id, seoEnabled, enabled, name, folder, seoPageTitle, seoPageDescription, slug, layout, layoutContainer, accessLevel, unauthorizedBehaviour, unauthorizedPageRedirect, documentScroll, onUpdate }: SettingsProps) => import('react').JSX.Element;
|
|
21
|
+
declare const Settings: ({ id, seoEnabled, enabled, name, folder, seoPageTitle, seoPageDescription, slug, layout, layoutContainer, accessLevel, unauthorizedBehaviour, unauthorizedPageRedirect, documentScroll, access, onUpdate }: SettingsProps) => import('react').JSX.Element;
|
|
20
22
|
export default Settings;
|
|
@@ -1,243 +1,266 @@
|
|
|
1
1
|
import e from "../../useSettingsUpdate.mjs";
|
|
2
2
|
import t from "../LayoutPicker/index.mjs";
|
|
3
|
-
import { useCallback as n,
|
|
4
|
-
import { useCommonStore as
|
|
5
|
-
import { get as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
3
|
+
import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
4
|
+
import { useCommonStore as o } from "@plitzi/sdk-shared/store";
|
|
5
|
+
import { get as s, pick as c } from "@plitzi/plitzi-ui/helpers";
|
|
6
|
+
import { pageAccessOf as l } from "@plitzi/sdk-shared/schema";
|
|
7
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
8
|
+
import { getPageFullPath as p } from "@plitzi/sdk-navigation";
|
|
9
|
+
import m from "@plitzi/plitzi-ui/Alert";
|
|
10
|
+
import h from "@plitzi/plitzi-ui/Checkbox";
|
|
11
|
+
import g from "@plitzi/plitzi-ui/Input";
|
|
12
|
+
import _ from "@plitzi/plitzi-ui/TextArea";
|
|
13
|
+
import v from "@plitzi/plitzi-ui/Select";
|
|
14
|
+
import y from "@plitzi/plitzi-ui/Select2";
|
|
14
15
|
//#region src/elements/internal/Page/Settings.tsx
|
|
15
|
-
var
|
|
16
|
-
let
|
|
16
|
+
var b = ({ id: b = "", seoEnabled: x = !1, enabled: S = !0, name: C = "", folder: w = "", seoPageTitle: T = "Title", seoPageDescription: E = "Description", slug: D = "", layout: O = "", layoutContainer: k = "", accessLevel: A = "", unauthorizedBehaviour: j = "", unauthorizedPageRedirect: M = "", documentScroll: N = "", access: P = "", onUpdate: F }) => {
|
|
17
|
+
let I = l({ access: P })?.permissions.join(", ") ?? "", [L, R] = a(I);
|
|
18
|
+
r(() => R(I), [I]);
|
|
19
|
+
let [[z, B, V]] = o([
|
|
17
20
|
"schema.flat",
|
|
18
21
|
"schema.pages",
|
|
19
22
|
"schema.pageFolders"
|
|
20
|
-
]),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
]),
|
|
25
|
-
|
|
26
|
-
let t =
|
|
27
|
-
(!
|
|
23
|
+
]), H = i(() => Object.values(c(z, B.filter((e) => e !== b))), [
|
|
24
|
+
z,
|
|
25
|
+
b,
|
|
26
|
+
B
|
|
27
|
+
]), U = e(F), W = n((e) => {
|
|
28
|
+
F?.("name", e);
|
|
29
|
+
let t = C.replaceAll(" ", "-").toLowerCase().replaceAll(/([^a-z0-9]+)/gi, "");
|
|
30
|
+
(!D || D === t) && F?.("slug", e.replaceAll(" ", "-").toLowerCase().replaceAll(/([^a-z0-9-]+)/gi, ""));
|
|
28
31
|
}, [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
]),
|
|
32
|
+
F,
|
|
33
|
+
D,
|
|
34
|
+
C
|
|
35
|
+
]), G = n((e) => {
|
|
33
36
|
if (/^[a-zA-Z0-9:*/_-]+$/gim.test(e) || !e) {
|
|
34
37
|
let t = e.replaceAll("//", "/");
|
|
35
|
-
|
|
38
|
+
F?.("slug", t);
|
|
36
39
|
}
|
|
37
|
-
}, [
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
+
}, [F]), K = n((e) => {
|
|
41
|
+
F?.("accessLevel", e), F?.("unauthorizedBehaviour", ""), F?.("unauthorizedPageRedirect", "");
|
|
42
|
+
}, [F]), q = n(() => {
|
|
43
|
+
let e = L.split(",").map((e) => e.trim()).filter(Boolean);
|
|
44
|
+
F?.("access", e.length > 0 ? { permissions: e } : "");
|
|
45
|
+
}, [F, L]), J = n((e) => F?.("seoEnabled", e.target.checked), [F]), Y = n((e) => F?.("enabled", e.target.checked), [F]), X = n((e) => F?.("folder", e?.value ?? ""), [F]), Z = i(() => [{
|
|
40
46
|
value: "",
|
|
41
47
|
label: "None"
|
|
42
|
-
}, ...
|
|
48
|
+
}, ...V.map(({ id: e, name: t }) => ({
|
|
43
49
|
value: e,
|
|
44
50
|
label: t
|
|
45
|
-
}))], [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
}))], [V]), Q = i(() => p(z, V, b, !0), [
|
|
52
|
+
z,
|
|
53
|
+
V,
|
|
54
|
+
b
|
|
49
55
|
]);
|
|
50
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ f("div", {
|
|
51
57
|
className: "flex flex-col gap-4 py-2",
|
|
52
58
|
children: [
|
|
53
|
-
!
|
|
59
|
+
!S && /* @__PURE__ */ d(m, {
|
|
54
60
|
intent: "info",
|
|
55
61
|
size: "xs",
|
|
56
62
|
solid: !1,
|
|
57
|
-
children: /* @__PURE__ */
|
|
63
|
+
children: /* @__PURE__ */ d("span", {
|
|
58
64
|
className: "text-xs",
|
|
59
65
|
children: "When this option is disable, this page wont be accesible"
|
|
60
66
|
})
|
|
61
67
|
}),
|
|
62
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ d(h, {
|
|
63
69
|
label: " Page Enabled",
|
|
64
|
-
checked:
|
|
65
|
-
onChange:
|
|
70
|
+
checked: S,
|
|
71
|
+
onChange: Y,
|
|
66
72
|
size: "xs"
|
|
67
73
|
}),
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
value:
|
|
74
|
+
/* @__PURE__ */ d(g, {
|
|
75
|
+
value: C,
|
|
70
76
|
label: "Page Name",
|
|
71
|
-
onChange:
|
|
77
|
+
onChange: W,
|
|
72
78
|
size: "xs"
|
|
73
79
|
}),
|
|
74
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ d(m, {
|
|
75
81
|
intent: "info",
|
|
76
82
|
size: "xs",
|
|
77
83
|
solid: !1,
|
|
78
|
-
children: /* @__PURE__ */
|
|
84
|
+
children: /* @__PURE__ */ d("span", {
|
|
79
85
|
className: "text-xs",
|
|
80
86
|
children: "Slug is a combination of letters, numbers and _ - : / *"
|
|
81
87
|
})
|
|
82
88
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ f("div", {
|
|
84
90
|
className: "flex flex-col",
|
|
85
|
-
children: [/* @__PURE__ */
|
|
86
|
-
value:
|
|
87
|
-
onChange:
|
|
91
|
+
children: [/* @__PURE__ */ d(g, {
|
|
92
|
+
value: D,
|
|
93
|
+
onChange: G,
|
|
88
94
|
label: "Slug / Path",
|
|
89
95
|
className: { inputContainer: "rounded-none rounded-tl rounded-tr" },
|
|
90
96
|
size: "xs"
|
|
91
|
-
}), /* @__PURE__ */
|
|
97
|
+
}), /* @__PURE__ */ f("div", {
|
|
92
98
|
className: "truncate rounded-b border-x border-b border-gray-200 px-1 py-0.5 text-xs",
|
|
93
|
-
title:
|
|
94
|
-
children: ["Full Path: ", /* @__PURE__ */
|
|
99
|
+
title: Q,
|
|
100
|
+
children: ["Full Path: ", /* @__PURE__ */ d("span", {
|
|
95
101
|
className: "font-bold",
|
|
96
|
-
children:
|
|
102
|
+
children: Q
|
|
97
103
|
})]
|
|
98
104
|
})]
|
|
99
105
|
}),
|
|
100
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ d(y, {
|
|
101
107
|
label: "Folder",
|
|
102
|
-
value:
|
|
103
|
-
options:
|
|
108
|
+
value: w,
|
|
109
|
+
options: Z,
|
|
104
110
|
placeholder: "None",
|
|
105
|
-
onChange:
|
|
111
|
+
onChange: X,
|
|
106
112
|
size: "xs"
|
|
107
113
|
}),
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
layout:
|
|
110
|
-
layoutContainer:
|
|
111
|
-
onUpdate:
|
|
114
|
+
/* @__PURE__ */ d(t, {
|
|
115
|
+
layout: O,
|
|
116
|
+
layoutContainer: k,
|
|
117
|
+
onUpdate: F
|
|
112
118
|
}),
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
value:
|
|
119
|
+
/* @__PURE__ */ f(v, {
|
|
120
|
+
value: A,
|
|
115
121
|
label: "Restrict Access",
|
|
116
|
-
onChange:
|
|
122
|
+
onChange: K,
|
|
117
123
|
placeholder: "None",
|
|
118
124
|
size: "xs",
|
|
119
|
-
children: [/* @__PURE__ */
|
|
125
|
+
children: [/* @__PURE__ */ d("option", {
|
|
120
126
|
value: "public",
|
|
121
127
|
children: "Public"
|
|
122
|
-
}), /* @__PURE__ */
|
|
128
|
+
}), /* @__PURE__ */ d("option", {
|
|
123
129
|
value: "authenticated",
|
|
124
130
|
children: "Authenticated"
|
|
125
131
|
})]
|
|
126
132
|
}),
|
|
127
|
-
|
|
133
|
+
A === "" && /* @__PURE__ */ d(m, {
|
|
128
134
|
intent: "info",
|
|
129
135
|
solid: !1,
|
|
130
136
|
size: "xs",
|
|
131
|
-
children: /* @__PURE__ */
|
|
137
|
+
children: /* @__PURE__ */ d("span", {
|
|
132
138
|
className: "text-xs",
|
|
133
139
|
children: "Anyone on the internet can access this page"
|
|
134
140
|
})
|
|
135
141
|
}),
|
|
136
|
-
|
|
142
|
+
A === "public" && /* @__PURE__ */ d(m, {
|
|
137
143
|
intent: "info",
|
|
138
144
|
solid: !1,
|
|
139
145
|
size: "xs",
|
|
140
|
-
children: /* @__PURE__ */
|
|
146
|
+
children: /* @__PURE__ */ d("span", {
|
|
141
147
|
className: "text-xs",
|
|
142
148
|
children: "Only Guest can access this page"
|
|
143
149
|
})
|
|
144
150
|
}),
|
|
145
|
-
|
|
151
|
+
/* @__PURE__ */ d(g, {
|
|
152
|
+
label: "Required permissions",
|
|
153
|
+
value: L,
|
|
154
|
+
onChange: R,
|
|
155
|
+
onBlur: q,
|
|
156
|
+
placeholder: "None — anybody this page is for",
|
|
157
|
+
size: "xs"
|
|
158
|
+
}),
|
|
159
|
+
I !== "" && /* @__PURE__ */ d(m, {
|
|
160
|
+
intent: "info",
|
|
161
|
+
solid: !1,
|
|
162
|
+
size: "xs",
|
|
163
|
+
children: /* @__PURE__ */ d("span", {
|
|
164
|
+
className: "text-xs",
|
|
165
|
+
children: "Only visitors holding every one of these see this page. Anybody else is answered 401 or 403, and the server never sends them its content"
|
|
166
|
+
})
|
|
167
|
+
}),
|
|
168
|
+
(A !== "" || I !== "") && /* @__PURE__ */ d(v, {
|
|
146
169
|
label: "Unauthorized Behaviour",
|
|
147
|
-
value:
|
|
148
|
-
onChange:
|
|
170
|
+
value: j,
|
|
171
|
+
onChange: U.text("unauthorizedBehaviour"),
|
|
149
172
|
placeholder: "None",
|
|
150
173
|
size: "xs",
|
|
151
|
-
children: /* @__PURE__ */
|
|
174
|
+
children: /* @__PURE__ */ d("option", {
|
|
152
175
|
value: "redirect",
|
|
153
176
|
children: "Redirect"
|
|
154
177
|
})
|
|
155
178
|
}),
|
|
156
|
-
|
|
157
|
-
value:
|
|
179
|
+
j === "redirect" && /* @__PURE__ */ d(v, {
|
|
180
|
+
value: M,
|
|
158
181
|
label: "Redirect Page",
|
|
159
|
-
onChange:
|
|
182
|
+
onChange: U.text("unauthorizedPageRedirect"),
|
|
160
183
|
placeholder: "None",
|
|
161
184
|
size: "xs",
|
|
162
|
-
children:
|
|
185
|
+
children: H.map((e) => /* @__PURE__ */ d("option", {
|
|
163
186
|
value: e.id,
|
|
164
|
-
children:
|
|
187
|
+
children: s(e, "attributes.name")
|
|
165
188
|
}, e.id))
|
|
166
189
|
}),
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
value:
|
|
190
|
+
/* @__PURE__ */ f(v, {
|
|
191
|
+
value: N,
|
|
169
192
|
label: "Document Scroll",
|
|
170
|
-
onChange:
|
|
193
|
+
onChange: U.text("documentScroll"),
|
|
171
194
|
placeholder: "Scrolls",
|
|
172
195
|
size: "xs",
|
|
173
|
-
children: [/* @__PURE__ */
|
|
196
|
+
children: [/* @__PURE__ */ d("option", {
|
|
174
197
|
value: "noBounce",
|
|
175
198
|
children: "No bounce"
|
|
176
|
-
}), /* @__PURE__ */
|
|
199
|
+
}), /* @__PURE__ */ d("option", {
|
|
177
200
|
value: "locked",
|
|
178
201
|
children: "Locked"
|
|
179
202
|
})]
|
|
180
203
|
}),
|
|
181
|
-
|
|
204
|
+
N === "noBounce" && /* @__PURE__ */ d(m, {
|
|
182
205
|
intent: "info",
|
|
183
206
|
solid: !1,
|
|
184
207
|
size: "xs",
|
|
185
|
-
children: /* @__PURE__ */
|
|
208
|
+
children: /* @__PURE__ */ d("span", {
|
|
186
209
|
className: "text-xs",
|
|
187
210
|
children: "The page scrolls, but a finger pulled past either end no longer bounces it or reloads it"
|
|
188
211
|
})
|
|
189
212
|
}),
|
|
190
|
-
|
|
213
|
+
N === "locked" && /* @__PURE__ */ d(m, {
|
|
191
214
|
intent: "info",
|
|
192
215
|
solid: !1,
|
|
193
216
|
size: "xs",
|
|
194
|
-
children: /* @__PURE__ */
|
|
217
|
+
children: /* @__PURE__ */ d("span", {
|
|
195
218
|
className: "text-xs",
|
|
196
219
|
children: "The page holds still: only the parts set to scroll on their own (overflow auto) move. For a screen that fills the window — a dashboard, a board"
|
|
197
220
|
})
|
|
198
221
|
}),
|
|
199
|
-
/* @__PURE__ */
|
|
222
|
+
/* @__PURE__ */ d(h, {
|
|
200
223
|
label: " SEO Enabled",
|
|
201
|
-
checked:
|
|
202
|
-
onChange:
|
|
224
|
+
checked: x,
|
|
225
|
+
onChange: J,
|
|
203
226
|
size: "xs"
|
|
204
227
|
}),
|
|
205
|
-
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
value:
|
|
228
|
+
x && /* @__PURE__ */ f(u, { children: [
|
|
229
|
+
/* @__PURE__ */ d(g, {
|
|
230
|
+
value: T,
|
|
208
231
|
label: "SEO Title",
|
|
209
|
-
onChange:
|
|
232
|
+
onChange: U.text("seoPageTitle"),
|
|
210
233
|
size: "xs"
|
|
211
234
|
}),
|
|
212
|
-
/* @__PURE__ */
|
|
235
|
+
/* @__PURE__ */ d(_, {
|
|
213
236
|
label: "SEO Description",
|
|
214
|
-
value:
|
|
215
|
-
onChange:
|
|
237
|
+
value: E,
|
|
238
|
+
onChange: U.text("seoPageDescription"),
|
|
216
239
|
rows: 3,
|
|
217
240
|
size: "xs"
|
|
218
241
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ f("div", {
|
|
220
243
|
className: "flex flex-col",
|
|
221
244
|
children: [
|
|
222
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ d("p", {
|
|
223
246
|
className: "mb-4 text-xs",
|
|
224
247
|
children: "Specify this page's title and description. You can see how they'll look in search engine results pages (SERPs) in the preview below."
|
|
225
248
|
}),
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ d("label", { children: "Search Result Preview" }),
|
|
250
|
+
/* @__PURE__ */ f("div", {
|
|
228
251
|
className: "rounded border border-gray-300 px-2 py-1",
|
|
229
252
|
children: [
|
|
230
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ d("div", {
|
|
231
254
|
className: "mb-1 pt-1 text-xl text-[#1a0dab]",
|
|
232
|
-
children: /* @__PURE__ */
|
|
255
|
+
children: /* @__PURE__ */ d("label", { children: T })
|
|
233
256
|
}),
|
|
234
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ d("div", {
|
|
235
258
|
className: "text-sm text-[#006621]",
|
|
236
|
-
children: /* @__PURE__ */
|
|
259
|
+
children: /* @__PURE__ */ d("span", { children: "www.url.com" })
|
|
237
260
|
}),
|
|
238
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ d("div", {
|
|
239
262
|
className: "settings-seo__description mb-1 pt-1 text-sm",
|
|
240
|
-
children: `${
|
|
263
|
+
children: `${E.slice(0, 160)}...`
|
|
241
264
|
})
|
|
242
265
|
]
|
|
243
266
|
})
|
|
@@ -248,4 +271,4 @@ var _ = ({ id: _ = "", seoEnabled: v = !1, enabled: y = !0, name: b = "", folder
|
|
|
248
271
|
});
|
|
249
272
|
};
|
|
250
273
|
//#endregion
|
|
251
|
-
export {
|
|
274
|
+
export { b as default };
|
|
@@ -81,5 +81,7 @@ declare const declaration: import('@plitzi/sdk-shared/authoring').DeclaredElemen
|
|
|
81
81
|
seoPageTitle?: string | undefined;
|
|
82
82
|
seoPageDescription?: string | undefined;
|
|
83
83
|
documentScroll?: (DocumentScroll | "") | undefined;
|
|
84
|
+
withheld?: import('@plitzi/sdk-shared/schema').PageWithheld | undefined;
|
|
85
|
+
access?: import('@plitzi/sdk-shared/schema').PageAccess | undefined;
|
|
84
86
|
}>>;
|
|
85
87
|
export default declaration;
|
|
@@ -75,5 +75,7 @@ declare const Page: {
|
|
|
75
75
|
seoPageTitle?: string | undefined;
|
|
76
76
|
seoPageDescription?: string | undefined;
|
|
77
77
|
documentScroll?: (import('./declaration').DocumentScroll | "") | undefined;
|
|
78
|
+
withheld?: import('@plitzi/sdk-shared/schema').PageWithheld | undefined;
|
|
79
|
+
access?: import('@plitzi/sdk-shared/schema').PageAccess | undefined;
|
|
78
80
|
}>>;
|
|
79
81
|
export default Page;
|
package/dist/index.d.ts
CHANGED
|
@@ -716,6 +716,8 @@ export declare const defaultElements: {
|
|
|
716
716
|
seoPageTitle?: string | undefined;
|
|
717
717
|
seoPageDescription?: string | undefined;
|
|
718
718
|
documentScroll?: (import('./elements/declarations').DocumentScroll | "") | undefined;
|
|
719
|
+
withheld?: import('@plitzi/sdk-shared/schema').PageWithheld | undefined;
|
|
720
|
+
access?: import('@plitzi/sdk-shared/schema').PageAccess | undefined;
|
|
719
721
|
}>>;
|
|
720
722
|
container: {
|
|
721
723
|
(props: import('.').WithElementProps<import('./elements/structure/Container/Container').ContainerProps>): import('react').JSX.Element;
|
|
@@ -3731,6 +3733,7 @@ export declare const defaultElements: {
|
|
|
3731
3733
|
};
|
|
3732
3734
|
export { useRscData, elements, JsxManager };
|
|
3733
3735
|
export { default as useChannel } from './realtime/useChannel';
|
|
3736
|
+
export { default as useJob } from './realtime/useJob';
|
|
3734
3737
|
export { default as useFlag } from './dataSource/useFlag';
|
|
3735
3738
|
export type { ChannelHandle, UseChannelOptions } from './realtime/useChannel';
|
|
3736
3739
|
export { default as withElement } from './Element/hocs/withElement';
|
package/dist/index.mjs
CHANGED
|
@@ -43,12 +43,13 @@ import V from "./elements/structure/ModalContainer/index.mjs";
|
|
|
43
43
|
import H from "./elements/structure/Pagination/index.mjs";
|
|
44
44
|
import U from "./elements/structure/TabContainer/index.mjs";
|
|
45
45
|
import { elements_exports as W } from "./elements/index.mjs";
|
|
46
|
-
import G from "./
|
|
47
|
-
import K from "./
|
|
48
|
-
import q from "./Element/
|
|
49
|
-
import J from "./Element/hooks/
|
|
46
|
+
import G from "./realtime/useJob.mjs";
|
|
47
|
+
import K from "./dataSource/useFlag.mjs";
|
|
48
|
+
import q from "./Element/helpers/elementChildren.mjs";
|
|
49
|
+
import J from "./Element/hooks/useElementVisible.mjs";
|
|
50
|
+
import Y from "./Element/hooks/usePluginTrigger.mjs";
|
|
50
51
|
//#region src/index.ts
|
|
51
|
-
var
|
|
52
|
+
var X = {
|
|
52
53
|
dropdown: h,
|
|
53
54
|
notFound: D,
|
|
54
55
|
loading: E,
|
|
@@ -85,4 +86,4 @@ var Y = {
|
|
|
85
86
|
channel: I
|
|
86
87
|
};
|
|
87
88
|
//#endregion
|
|
88
|
-
export { P as ApiContainer, s as BlockHtml, c as BlockJsx, m as Button, L as Carousel, I as Channel, R as Container, l as Custom, z as DialogContainer, h as Dropdown, e as ElementContext, k as Embed, A as FontAwesome, C as Form, w as FormControl, g as Heading, j as Image, o as JsxManager, T as LayoutContainer, _ as Link, B as List, E as Loading, v as Markdown, V as ModalContainer, u as NodeHtml, D as NotFound, O as Page, H as Pagination, y as Paragraph, d as PluginManager, t as PluginRemote, p as Reference, f as ReplicaProvider, b as RichText, a as RootElement, M as Svg, U as TabContainer, x as Text, S as ThemeToggle, N as Video,
|
|
89
|
+
export { P as ApiContainer, s as BlockHtml, c as BlockJsx, m as Button, L as Carousel, I as Channel, R as Container, l as Custom, z as DialogContainer, h as Dropdown, e as ElementContext, k as Embed, A as FontAwesome, C as Form, w as FormControl, g as Heading, j as Image, o as JsxManager, T as LayoutContainer, _ as Link, B as List, E as Loading, v as Markdown, V as ModalContainer, u as NodeHtml, D as NotFound, O as Page, H as Pagination, y as Paragraph, d as PluginManager, t as PluginRemote, p as Reference, f as ReplicaProvider, b as RichText, a as RootElement, M as Svg, U as TabContainer, x as Text, S as ThemeToggle, N as Video, X as defaultElements, q as elementChildren, W as elements, F as useChannel, r as useElement, J as useElementVisible, K as useFlag, G as useJob, Y as usePluginTrigger, i as useRscData, n as withElement };
|
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
import { useCallback as e, useEffect as t, useMemo as n, useRef as r, useState as i } from "react";
|
|
2
2
|
import { useCommonStore as a } from "@plitzi/sdk-shared/store";
|
|
3
|
-
import { REVOKED_TYPE as o, isValidTopic as s,
|
|
3
|
+
import { REVOKED_TYPE as o, isValidTopic as s, jobOfTopic as c, matchChannel as l, realtimeClientFor as u, trackPresence as d } from "@plitzi/sdk-shared/realtime";
|
|
4
4
|
//#region src/realtime/useChannel.ts
|
|
5
|
-
var
|
|
5
|
+
var f = (e, t) => {
|
|
6
6
|
if (Object.hasOwn(e, t.type) && e[t.type].at > t.at) return e;
|
|
7
7
|
let n = Object.fromEntries(Object.entries(e).filter(([e]) => e !== t.type));
|
|
8
8
|
return t.data === null ? n : {
|
|
9
9
|
...n,
|
|
10
10
|
[t.type]: t
|
|
11
11
|
};
|
|
12
|
-
},
|
|
13
|
-
let [
|
|
14
|
-
onMessage:
|
|
15
|
-
onJoin:
|
|
16
|
-
onLeave:
|
|
12
|
+
}, p = (p, { grant: m, presence: h, onMessage: g, onJoin: _, onLeave: v } = {}) => {
|
|
13
|
+
let [y] = a("schema.settings.channels"), b = p && (c(p) !== void 0 || (y ? l(p, y) : s(p))) ? p : void 0, [x] = a("realtime.endpoint"), [S] = a("realtime.transport"), C = n(() => x && typeof window < "u" ? u(x, S) : void 0, [x, S]), [w, T] = i(!1), [E, D] = i([]), [O, k] = i({}), A = r(void 0), j = r({
|
|
14
|
+
onMessage: g,
|
|
15
|
+
onJoin: _,
|
|
16
|
+
onLeave: v
|
|
17
17
|
});
|
|
18
18
|
t(() => {
|
|
19
|
-
|
|
20
|
-
onMessage:
|
|
21
|
-
onJoin:
|
|
22
|
-
onLeave:
|
|
19
|
+
j.current = {
|
|
20
|
+
onMessage: g,
|
|
21
|
+
onJoin: _,
|
|
22
|
+
onLeave: v
|
|
23
23
|
};
|
|
24
24
|
}), t(() => {
|
|
25
|
-
|
|
25
|
+
C && b && m && C.grant(b, m);
|
|
26
26
|
}, [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
C,
|
|
28
|
+
b,
|
|
29
|
+
m
|
|
30
30
|
]), t(() => {
|
|
31
|
-
if (!
|
|
32
|
-
let e =
|
|
33
|
-
onChange:
|
|
31
|
+
if (!C || !b) return;
|
|
32
|
+
let e = d(C, b, {
|
|
33
|
+
onChange: D,
|
|
34
34
|
onMessage: (e) => {
|
|
35
|
-
e.type === o && e.from === "server" &&
|
|
35
|
+
e.type === o && e.from === "server" && T(!1), e.retained === !0 && e.from === "server" && k((t) => f(t, e)), j.current.onMessage?.(e);
|
|
36
36
|
},
|
|
37
|
-
onArrive: (e) =>
|
|
38
|
-
onDepart: (e) =>
|
|
37
|
+
onArrive: (e) => j.current.onJoin?.(e),
|
|
38
|
+
onDepart: (e) => j.current.onLeave?.(e)
|
|
39
39
|
});
|
|
40
|
-
|
|
41
|
-
let t =
|
|
40
|
+
A.current = e, T(C.status === "open" && !C.refusal(b));
|
|
41
|
+
let t = C.onStatus((e) => T(e === "open" && !C.refusal(b)));
|
|
42
42
|
return () => {
|
|
43
|
-
t(), e.stop(),
|
|
43
|
+
t(), e.stop(), A.current = void 0, D([]), k({}), T(!1);
|
|
44
44
|
};
|
|
45
|
-
}, [
|
|
46
|
-
let
|
|
45
|
+
}, [C, b]);
|
|
46
|
+
let M = h === void 0 ? void 0 : JSON.stringify(h);
|
|
47
47
|
t(() => {
|
|
48
|
-
|
|
48
|
+
M !== void 0 && A.current?.set(JSON.parse(M));
|
|
49
49
|
}, [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
M,
|
|
51
|
+
C,
|
|
52
|
+
b
|
|
53
53
|
]);
|
|
54
|
-
let
|
|
54
|
+
let N = e((e, t, n) => C && b ? C.publish(b, e, t, n) : Promise.resolve(!1), [C, b]), P = e((e) => A.current?.set(e), []), F = n(() => Object.fromEntries(Object.entries(O).map(([e, t]) => [e, t.data])), [O]);
|
|
55
55
|
return {
|
|
56
|
-
connected:
|
|
57
|
-
me:
|
|
58
|
-
members:
|
|
59
|
-
retained:
|
|
60
|
-
publish:
|
|
61
|
-
setPresence:
|
|
56
|
+
connected: w,
|
|
57
|
+
me: w ? C?.me : void 0,
|
|
58
|
+
members: E,
|
|
59
|
+
retained: F,
|
|
60
|
+
publish: N,
|
|
61
|
+
setPresence: P
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
64
|
//#endregion
|
|
65
|
-
export {
|
|
65
|
+
export { p as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionJobView } from '@plitzi/sdk-shared';
|
|
2
|
+
/**
|
|
3
|
+
* One of the space's jobs (`ctx.jobs.start` in its functions), live: its status, how far it is (`progress`, `step`),
|
|
4
|
+
* and its `result` or `error` once it ends — as whoever the job lets watch it sees it, on `$job:<id>`. The latest is
|
|
5
|
+
* there as the page joins, however late. `undefined` until it is heard — or when the job is not this visitor's to watch.
|
|
6
|
+
*/
|
|
7
|
+
declare const useJob: (id: string | undefined) => FunctionJobView | undefined;
|
|
8
|
+
export default useJob;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import e from "./useChannel.mjs";
|
|
2
|
+
import { isRecord as t } from "@plitzi/sdk-shared/helpers";
|
|
3
|
+
import { JOB_TYPE as n, jobTopic as r } from "@plitzi/sdk-shared/realtime";
|
|
4
|
+
//#region src/realtime/useJob.ts
|
|
5
|
+
var i = (e) => t(e) && typeof e.id == "string" && typeof e.name == "string" && typeof e.status == "string", a = (t) => {
|
|
6
|
+
let { retained: a } = e(t ? r(t) : void 0), o = a[n];
|
|
7
|
+
return i(o) && o.id === t ? o : void 0;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { a as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-elements",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.21",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"@dr.pogodin/react-helmet": "^3.3.2",
|
|
34
34
|
"@plitzi/nexus": "^1.4.0",
|
|
35
35
|
"@plitzi/plitzi-ui": "^1.6.34",
|
|
36
|
-
"@plitzi/sdk-auth": "0.38.
|
|
37
|
-
"@plitzi/sdk-event-bridge": "0.38.
|
|
38
|
-
"@plitzi/sdk-interactions": "0.38.
|
|
39
|
-
"@plitzi/sdk-navigation": "0.38.
|
|
40
|
-
"@plitzi/sdk-schema": "0.38.
|
|
41
|
-
"@plitzi/sdk-shared": "0.38.
|
|
36
|
+
"@plitzi/sdk-auth": "0.38.21",
|
|
37
|
+
"@plitzi/sdk-event-bridge": "0.38.21",
|
|
38
|
+
"@plitzi/sdk-interactions": "0.38.21",
|
|
39
|
+
"@plitzi/sdk-navigation": "0.38.21",
|
|
40
|
+
"@plitzi/sdk-schema": "0.38.21",
|
|
41
|
+
"@plitzi/sdk-shared": "0.38.21",
|
|
42
42
|
"clsx": "^2.1.1",
|
|
43
43
|
"immer": "^11.1.21",
|
|
44
44
|
"react-markdown": "^10.1.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ElementContextValue } from '../Element/ElementContext';
|
|
2
|
-
declare const elementEntry: (id: string, overrides?: Partial<ElementContextValue>) => ElementContextValue;
|
|
3
|
-
declare const skipHocEntry: (id?: string) => ElementContextValue;
|
|
4
|
-
export { elementEntry, skipHocEntry };
|