@civitai/app-sdk 0.53.0 → 0.54.0
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/README.md +1 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/messages.d.ts +9 -2
- package/dist/blocks/types.d.ts +22 -0
- package/dist/manifest/defineBlock.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ over `window.postMessage({ type, payload }, targetOrigin)`, discriminated by
|
|
|
87
87
|
- **parent → block**: `BLOCK_INIT`, `TOKEN_REFRESH`, `TOKEN_REFRESH_RESPONSE`,
|
|
88
88
|
`ESTIMATE_RESULT`, `WORKFLOW_SUBMITTED`, `WORKFLOW_STATUS`,
|
|
89
89
|
`BUZZ_PURCHASE_RESULT`, `CHECKPOINT_PICKER_RESULT`, `USER_CHECKPOINT_SET`,
|
|
90
|
-
`APP_STORAGE_*_RESULT`, `SUSPEND`, `RESUME`, `THEME_CHANGE`,
|
|
90
|
+
`APP_STORAGE_*_RESULT`, `SUSPEND`, `RESUME`, `THEME_CHANGE`, `ROUTE_CHANGED`,
|
|
91
91
|
`CONSENT_UNAVAILABLE` (`ParentToBlockMessage`).
|
|
92
92
|
- **block → parent**: `BLOCK_READY`, `BLOCK_ERROR`, `REQUEST_TOKEN`,
|
|
93
93
|
`RESIZE_IFRAME`, `SUBMIT_WORKFLOW`, `ESTIMATE_WORKFLOW`, `POLL_WORKFLOW`,
|
package/dist/blocks/index.d.ts
CHANGED
|
@@ -77,5 +77,5 @@ export { isModelSlotContext, isPageSlotContext } from './types.js';
|
|
|
77
77
|
* in `types.ts` for which of the two it uses and why.
|
|
78
78
|
*/
|
|
79
79
|
export { isSignedIn } from './types.js';
|
|
80
|
-
export type { BlockContext, KnownSlotId, ModelSlotId, PageSlotContext, PageSlotId, UnknownSlotContext, BlockManifest, BlockManifestGood, BlockManifestV1, BlockSettings, BlockToken, ContentRating, ManifestBooleanField, ManifestIframe, ManifestNumberField, ManifestPage, ManifestPreview, ManifestSettingField, ManifestSettings, ManifestStringField, ManifestTarget, ModelSlotContext, SettingScope, SettingWidget, Theme, ViewerInfo, BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockSourceImage, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockTextToImageParams, BlockWorkflowSnapshot, BuzzAccountType, ShowcaseImage, WorkflowBody, WorkflowBodyTextToImage, WorkflowBodyCustomComfy, WorkflowBodyCustomComfyRecipe, WorkflowBodyCustomComfyInline, InlineComfyNode, WorkflowBodyStep, WorkflowBodyPassThroughStep, WorkflowStatus, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, AppWorkflow, AppWorkflowImage, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostRequest, BlockCreatePostResult, BlockCreatePostHostError, } from './types.js';
|
|
80
|
+
export type { BlockContext, KnownSlotId, ModelSlotId, PageSlotContext, PageSlotId, UnknownSlotContext, BlockManifest, BlockManifestGood, BlockManifestV1, BlockSettings, BlockToken, ContentRating, ManifestBooleanField, ManifestIframe, ManifestNumberField, ManifestPage, ManifestPreview, ManifestSettingField, ManifestSettings, ManifestStringField, ManifestTarget, ModelSlotContext, SettingScope, SettingWidget, Theme, ViewerInfo, BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockSourceImage, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockTextToImageParams, BlockWorkflowSnapshot, BuzzAccountType, ShowcaseImage, WorkflowBody, WorkflowBodyTextToImage, WorkflowBodyCustomComfy, WorkflowBodyCustomComfyRecipe, WorkflowBodyCustomComfyInline, InlineComfyNode, WorkflowBodyStep, WorkflowBodyPassThroughStep, WorkflowStatus, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, AppWorkflow, AppWorkflowImage, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostRequest, BlockCreatePostResult, BlockCreatePostHostError, } from './types.js';
|
|
81
81
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Wire format: `window.postMessage({ type, payload }, targetOrigin)`.
|
|
9
9
|
*/
|
|
10
10
|
import type { ColorDomain } from './browsingLevel.js';
|
|
11
|
-
import type { BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockContext, BlockSettings, Theme, ViewerInfo, WorkflowBody, BlockWorkflowSnapshot, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, AppWorkflow, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostResult } from './types.js';
|
|
11
|
+
import type { BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockContext, BlockSettings, Theme, ViewerInfo, WorkflowBody, BlockWorkflowSnapshot, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, AppWorkflow, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostResult } from './types.js';
|
|
12
12
|
/**
|
|
13
13
|
* Filter params for `GET_BUZZ_TRANSACTIONS`. All optional; the host validates
|
|
14
14
|
* them server-side (they are NEVER trusted for auth — the account is self-bound
|
|
@@ -345,6 +345,11 @@ export type ParentToBlockMessage = {
|
|
|
345
345
|
payload: {
|
|
346
346
|
theme: Theme;
|
|
347
347
|
};
|
|
348
|
+
} | {
|
|
349
|
+
type: 'ROUTE_CHANGED';
|
|
350
|
+
payload: {
|
|
351
|
+
subPath: string;
|
|
352
|
+
};
|
|
348
353
|
} | {
|
|
349
354
|
type: 'CONSENT_UNAVAILABLE';
|
|
350
355
|
payload: ConsentUnavailablePayload;
|
|
@@ -785,7 +790,8 @@ export type BlockToParentMessage = {
|
|
|
785
790
|
type: 'OPEN_CHECKPOINT_PICKER';
|
|
786
791
|
payload: {
|
|
787
792
|
requestId: string;
|
|
788
|
-
|
|
793
|
+
/** Optional ecosystem-family filter. Absent ⇒ unconstrained. Never ''. */
|
|
794
|
+
baseModelGroup?: string;
|
|
789
795
|
/** Currently-selected versionId so the picker can pre-highlight it. */
|
|
790
796
|
currentVersionId?: number;
|
|
791
797
|
};
|
|
@@ -814,6 +820,7 @@ export type BlockToParentMessage = {
|
|
|
814
820
|
type: 'NAVIGATE';
|
|
815
821
|
payload: {
|
|
816
822
|
path: string;
|
|
823
|
+
scope?: BlockNavigateScope;
|
|
817
824
|
target: 'current' | 'new_tab';
|
|
818
825
|
};
|
|
819
826
|
} | {
|
package/dist/blocks/types.d.ts
CHANGED
|
@@ -258,6 +258,28 @@ export type BlockImageScanResult = {
|
|
|
258
258
|
* `imageId`/`nsfwLevel`/`contentRating` crosses back into the block.
|
|
259
259
|
*/
|
|
260
260
|
export type BlockUploadPurpose = 'display' | 'generationSource';
|
|
261
|
+
/**
|
|
262
|
+
* Which SPACE a `NAVIGATE` path is resolved in. Mirrors the host's
|
|
263
|
+
* `NavigateScope` in civitai/civitai's `pageBlockHostLogic.ts`. Keep in lockstep.
|
|
264
|
+
*
|
|
265
|
+
* - `'app'` (DEFAULT): the path is resolved under the block's OWN route
|
|
266
|
+
* (`<base>/<slug>/<path>`) and pushed shallowly, so the page stays mounted.
|
|
267
|
+
* - `'site'`: the path is resolved at the SITE root, non-shallow, and the viewer
|
|
268
|
+
* leaves the app. Granted per-surface — the host refuses it outright on a
|
|
269
|
+
* surface that does not hold the capability — and `/api/*` is refused in this
|
|
270
|
+
* scope regardless.
|
|
271
|
+
*
|
|
272
|
+
* 🔴 ABSENT IS `'app'`, and the host compares against the literal `'site'` rather
|
|
273
|
+
* than validating against this union, so an UNKNOWN value fails CLOSED onto
|
|
274
|
+
* `'app'` too. That is what makes the field additive: a block built against an
|
|
275
|
+
* SDK that predates `scope` sends nothing and keeps the behaviour it always had.
|
|
276
|
+
*
|
|
277
|
+
* 🔴 A LEADING SLASH CARRIES NO MEANING. `scope` selects the space and `path` is a
|
|
278
|
+
* path WITHIN it, so the host normalises leading slashes away:
|
|
279
|
+
* `{ scope: 'app', path: '/settings' }` and `{ scope: 'app', path: 'settings' }`
|
|
280
|
+
* are one request. Do not reintroduce punctuation semantics.
|
|
281
|
+
*/
|
|
282
|
+
export type BlockNavigateScope = 'app' | 'site';
|
|
261
283
|
/**
|
|
262
284
|
* The source-image result the host returns from `OPEN_IMAGE_UPLOAD` when the
|
|
263
285
|
* block requested `purpose: 'generationSource'` (`IMAGE_UPLOAD_RESULT.selected`)
|
|
@@ -90,8 +90,9 @@ export const SCHEMA_DIVERGENCES = {
|
|
|
90
90
|
'REVIEW IN THE OTHER DIRECTION: `allow-popups`, `allow-modals`, `allow-downloads` and any ' +
|
|
91
91
|
'other token outside {allow-scripts, allow-forms} PASS HERE and may be refused at review. ' +
|
|
92
92
|
'They are not rejected because the tier is assigned server-side during review and is ' +
|
|
93
|
-
'unknowable locally
|
|
94
|
-
'"allow-scripts allow-forms
|
|
93
|
+
'unknowable locally. Every shipped starter and example now declares exactly ' +
|
|
94
|
+
'"allow-scripts allow-forms", so none of them illustrates this gap any more — the looser ' +
|
|
95
|
+
'arm is pinned by the synthetic cases in test/manifest/divergences.test.ts instead. See ' +
|
|
95
96
|
'KNOWN_GAPS["tier-dependent-sandbox-allowlist"].',
|
|
96
97
|
},
|
|
97
98
|
scopeJustifications: {
|
package/package.json
CHANGED