@8ux-co/eelzap 0.11.0 → 0.11.1
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 +19 -1
- package/README.md +18 -2
- package/dist/{chunk-72YCJCBI.js → chunk-G2JAAZKS.js} +47 -11
- package/dist/chunk-G2JAAZKS.js.map +1 -0
- package/dist/fields.cjs +3 -0
- package/dist/fields.cjs.map +1 -1
- package/dist/fields.d.cts +22 -1
- package/dist/fields.d.ts +22 -1
- package/dist/fields.js +3 -0
- package/dist/fields.js.map +1 -1
- package/dist/index.d.cts +42 -5
- package/dist/index.d.ts +42 -5
- package/dist/preview.d.ts +54 -20
- package/dist/preview.js +65 -37
- package/dist/preview.js.map +1 -1
- package/dist/react.d.ts +43 -7
- package/dist/react.js +33 -4
- package/dist/react.js.map +1 -1
- package/dist/{suggest-ERMR7PCE.js → suggest-FDD4MBRP.js} +73 -39
- package/dist/suggest-FDD4MBRP.js.map +1 -0
- package/package.json +66 -29
- package/dist/chunk-72YCJCBI.js.map +0 -1
- package/dist/suggest-ERMR7PCE.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -208,11 +208,16 @@ interface EnumValue {
|
|
|
208
208
|
* A CURRENCY field's value, read and written in this one shape.
|
|
209
209
|
*
|
|
210
210
|
* `amountMinor` is in the currency's minor unit (cents: `4800000` is
|
|
211
|
-
* COP 48.000,00), an integer. `currency` is the ISO 4217 code.
|
|
211
|
+
* COP 48.000,00), an integer. `currency` is the ISO 4217 code. Reads also
|
|
212
|
+
* carry `amount`, the same value in major units (`48000`): `amountMinor`
|
|
213
|
+
* divided by ten to the currency's ISO 4217 exponent (COP and USD 2, JPY 0).
|
|
214
|
+
* Writes ignore it.
|
|
212
215
|
*/
|
|
213
216
|
interface CurrencyValue {
|
|
214
217
|
amountMinor: number;
|
|
215
218
|
currency: string;
|
|
219
|
+
/** Major units, on reads: `amountMinor / 10^exponent`. */
|
|
220
|
+
amount?: number;
|
|
216
221
|
}
|
|
217
222
|
/**
|
|
218
223
|
* Access mode for a media value.
|
|
@@ -410,6 +415,12 @@ interface CollectionSummary {
|
|
|
410
415
|
key: string;
|
|
411
416
|
name: string;
|
|
412
417
|
description: string | null;
|
|
418
|
+
/**
|
|
419
|
+
* «Ruta en tu sitio»: the page an entry appears on, `/blog/{slug}`; `null`
|
|
420
|
+
* when unset. Read with a `secret_` key or a suite credential only; a
|
|
421
|
+
* `public_` key's answer does not carry it.
|
|
422
|
+
*/
|
|
423
|
+
previewPath?: string | null;
|
|
413
424
|
itemCount: number;
|
|
414
425
|
fields?: FieldInfo[];
|
|
415
426
|
sections?: SectionInfo[];
|
|
@@ -734,7 +745,7 @@ type CommentStatus = 'OPEN' | 'RESOLVED';
|
|
|
734
745
|
/** How a change request was resolved; APPLIED also covers "changed by hand". */
|
|
735
746
|
type CommentResolution = 'APPLIED' | 'DISMISSED';
|
|
736
747
|
/** Where the thread was made. The API derives it from the credential. */
|
|
737
|
-
type CommentSource = 'EDITOR' | 'PREVIEW' | 'SITE' | 'API' | 'MCP';
|
|
748
|
+
type CommentSource = 'EDITOR' | 'PREVIEW' | 'SITE' | 'API' | 'MCP' | 'AI';
|
|
738
749
|
type CommentAnchorKind = 'field' | 'dom' | 'spot';
|
|
739
750
|
/** A page-normalised rectangle: every value between 0 and 1. */
|
|
740
751
|
interface CommentRect {
|
|
@@ -955,7 +966,7 @@ interface CommentWriteBase {
|
|
|
955
966
|
type CreateCommentInput = CommentRecord & CommentWriteBase & {
|
|
956
967
|
isChangeRequest?: boolean;
|
|
957
968
|
assigneeId?: string | null;
|
|
958
|
-
/** At most 20; TEXT, LONG_TEXT, NUMBER and
|
|
969
|
+
/** At most 20; TEXT, LONG_TEXT, NUMBER, URL and RICH_TEXT (an HTML string) fields. */
|
|
959
970
|
proposedValues?: CommentProposedValueInput[];
|
|
960
971
|
};
|
|
961
972
|
/** `saveToDraft`: always a change request, no assignee, at least one proposed value. */
|
|
@@ -1124,6 +1135,7 @@ declare class CommentsResource {
|
|
|
1124
1135
|
* string.
|
|
1125
1136
|
*/
|
|
1126
1137
|
type VersionStatus = 'DRAFT' | 'PUBLISHED' | 'ARCHIVED';
|
|
1138
|
+
type VersionActorKind = 'PERSON' | 'ASK_ZAP' | 'API_KEY' | 'MCP' | 'SITE_KEY' | 'AI_JOB';
|
|
1127
1139
|
/**
|
|
1128
1140
|
* One row of an entry's history. What `list`, `createDraft`, `publishDraft`
|
|
1129
1141
|
* and `rollback` answer with: no values.
|
|
@@ -1134,6 +1146,20 @@ interface VersionSummary {
|
|
|
1134
1146
|
status: VersionStatus;
|
|
1135
1147
|
/** The account that made the version, or null for an API key or a deleted account. */
|
|
1136
1148
|
createdById: string | null;
|
|
1149
|
+
/**
|
|
1150
|
+
* What wrote the version, recorded when it was written: `PERSON` (the editor,
|
|
1151
|
+
* and every version from before this field), `ASK_ZAP`, `API_KEY` (a workspace
|
|
1152
|
+
* API key), `MCP` (an OAuth connection such as Claude), `SITE_KEY` (a site
|
|
1153
|
+
* secret key) or `AI_JOB` (the dashboard's bulk site translation).
|
|
1154
|
+
*/
|
|
1155
|
+
actorKind: VersionActorKind;
|
|
1156
|
+
/**
|
|
1157
|
+
* The API key's or connection's name as it was when the version was written
|
|
1158
|
+
* (not renamed or removed with it); null for `PERSON` and `ASK_ZAP`.
|
|
1159
|
+
*/
|
|
1160
|
+
actorName: string | null;
|
|
1161
|
+
/** The OAuth client's display name ("Claude Code") for an MCP write; null otherwise. */
|
|
1162
|
+
actorApp: string | null;
|
|
1137
1163
|
/** The author's display name, or null when the account is gone. */
|
|
1138
1164
|
authorName: string | null;
|
|
1139
1165
|
authorAvatarUrl: string | null;
|
|
@@ -1307,6 +1333,11 @@ interface DocumentListEntry {
|
|
|
1307
1333
|
key: string;
|
|
1308
1334
|
name: string;
|
|
1309
1335
|
description: string | null;
|
|
1336
|
+
/**
|
|
1337
|
+
* «Ruta en tu sitio»: the page this document is, `/nosotros`; `null` when
|
|
1338
|
+
* unset. Read with a `secret_` key or a suite credential only.
|
|
1339
|
+
*/
|
|
1340
|
+
previewPath?: string | null;
|
|
1310
1341
|
status: string;
|
|
1311
1342
|
updatedAt: string;
|
|
1312
1343
|
publishedAt: string | null;
|
|
@@ -1319,6 +1350,12 @@ interface DocumentListEntry {
|
|
|
1319
1350
|
interface DocumentDetail<TContent = Record<string, unknown>> {
|
|
1320
1351
|
key: string;
|
|
1321
1352
|
name: string;
|
|
1353
|
+
/**
|
|
1354
|
+
* «Ruta en tu sitio»: the page this document is, `/nosotros`; `null` when
|
|
1355
|
+
* unset. Read with a `secret_` key or a suite credential only; a `public_`
|
|
1356
|
+
* key's answer does not carry it.
|
|
1357
|
+
*/
|
|
1358
|
+
previewPath?: string | null;
|
|
1322
1359
|
status: string;
|
|
1323
1360
|
locale: string;
|
|
1324
1361
|
meta: DocumentMeta;
|
|
@@ -2424,7 +2461,7 @@ interface WebhookCommentData<TEntry extends WebhookCommentRef = WebhookCommentRe
|
|
|
2424
2461
|
} | null;
|
|
2425
2462
|
comments: TEntry[];
|
|
2426
2463
|
}
|
|
2427
|
-
type WebhookCommentSource = 'EDITOR' | 'PREVIEW' | 'SITE' | 'API' | 'MCP';
|
|
2464
|
+
type WebhookCommentSource = 'EDITOR' | 'PREVIEW' | 'SITE' | 'API' | 'MCP' | 'AI';
|
|
2428
2465
|
/** `data` of `zap.comment.created`. */
|
|
2429
2466
|
type WebhookCommentCreatedData = WebhookCommentData<WebhookCommentRef & {
|
|
2430
2467
|
is_change_request: boolean;
|
|
@@ -2513,4 +2550,4 @@ declare function verifyWebhookSignature(payload: string, headers: WebhookHeaders
|
|
|
2513
2550
|
*/
|
|
2514
2551
|
declare function webhookChanges(payload: WebhookPayload): WebhookChange[];
|
|
2515
2552
|
|
|
2516
|
-
export { type ApiErrorDetail, type ApiErrorPayload, type CacheAdapter, type CacheStrategy, type CachedFetchOptions, type ClientConfig, type ClientDefaults, type CollectionDetail, type CollectionFieldListResponse, CollectionFieldsResource, type CollectionListResponse, type CollectionSectionListResponse, CollectionSectionsResource, type CollectionSummary, CollectionsResource, type CommentAnchor, type CommentAnchorInput, type CommentAnchorKind, type CommentDomAnchor, type CommentDraftAnswer, type CommentFieldAnchorInput, type CommentListOptions, type CommentListResponse, type CommentPersonRef, type CommentProposedValue, type CommentProposedValueInput, type CommentRecord, type CommentRect, type CommentReplyAnswer, type CommentResolution, type CommentSource, type CommentSpotAnchor, type CommentStatus, type CommentTarget, type CommentThread, type CommentThreadAnswer, type CommentVersionRef, type CommentViewport, CommentsResource, type CommonRequestOptions, type ConfirmUploadInput, type CreateCollectionInput, type CreateCommentInput, type CreateDocumentFieldInput, type CreateDocumentInput, type CreateDraftInput, type CreateFieldInput, type CreateItemInput, type CreateSectionInput, type CreateUploadUrlInput, type CurrencyValue, type DeleteDocumentOptions, type DeleteItemOptions, type DeleteOptions, type DeliveryStatus, type DocumentDeleteResponse, type DocumentDetail, type DocumentFieldListResponse, DocumentFieldsResource, type DocumentGetOptions, type DocumentListEntry, type DocumentListOptions, type DocumentListResponse, type DocumentMeta, type DocumentMutationResponse, type DocumentSectionListResponse, DocumentSectionsResource, type DocumentSeo, DocumentSeoResource, type DocumentSeoResponse, DocumentValuesResource, type DocumentValuesResponse, type DocumentVersionDetail, type DocumentVersionSeo, type DocumentVersionSummary, type DocumentVersionValue, DocumentVersionsResource, DocumentsResource, EelZapClient, EelZapError, type EelZapErrorCode, EelZapNetworkError, type EnumValue, type FieldConstraints, type FieldInfo, type FieldOptionInput, type FieldType, type FilterOperatorMap, type FilterValue, type GalleryItemValue, type IdempotencyOptions, type ItemDeleteResponse, type ItemDetail, type ItemFilters, type ItemGetOptions, type ItemListOptions, type ItemListResponse, type ItemMeta, type ItemMutationResponse, ItemQueryBuilder, type ItemSeo, ItemSeoResource, type ItemSeoResponse, type ItemVersionDetail, type ItemVersionSeo, type ItemVersionSlug, type ItemVersionSummary, type ItemVersionValue, ItemVersionsResource, ItemsResource, type JsonObject, type MediaAccess, type MediaDetail, type MediaDetailResponse, type MediaFromUrlInput, type MediaListParams, type MediaListResponse, MediaResource, type MediaSort, type MediaType, type MediaUploadInput, type MediaUsage, type MediaValue, MemoryCacheAdapter, type OnPageComment, type OnPageCommentAnchor, type OnPageComments, type OnPageField, type Pagination, type PreviewOption, type PreviewTokenValidation, PreviewTokensResource, type QueryPrimitive, type ReplyCommentInput, type RetryEvent, type RetryOptions, type SaveCommentToDraftInput, type SectionInfo, type SectionMeta, type Seo, type SeoImage, type SeoInput, type SiteInfo, type SiteListEntry, SiteResource, SitesResource, type ThreadComment, type UpdateCollectionInput, type UpdateCommentInput, type UpdateDocumentDraftInput, type UpdateDocumentFieldInput, type UpdateDocumentInput, type UpdateFieldInput, type UpdateItemDraftInput, type UpdateItemInput, type UpdateMediaInput, type UpdateSectionInput, type UpdateSiteInput, type UploadFile, type UploadUrlResponse, type VerifyWebhookOptions, type VersionDetail, type VersionGalleryItem, type VersionListResponse, type VersionSeo, type VersionStatus, type VersionSummary, type VersionValue, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WEBHOOK_TOLERANCE_SECONDS, type WebhookAction, type WebhookActor, type WebhookChange, type WebhookCollectionEventData, type WebhookCollectionRef, type WebhookCommentCreatedData, type WebhookCommentData, type WebhookCommentRef, type WebhookCommentReopenedData, type WebhookCommentRepliedData, type WebhookCommentResolvedData, type WebhookCommentSource, type WebhookCommentTarget, type WebhookCommentUpdatedData, type WebhookDocumentEventData, type WebhookEventName, type WebhookEventType, type WebhookHeaders, type WebhookItemEventData, type WebhookMediaEventData, type WebhookPayload, type WebhookSchemaEventData, type WebhookSeoEventData, type WebhookSiteEventData, type WebhookSiteRef, type WebhookSubject, cachedFetch, cleanStega, createClient, getMediaUrl, hasStega, isEelZapError, verifyWebhookSignature, webhookChanges };
|
|
2553
|
+
export { type ApiErrorDetail, type ApiErrorPayload, type CacheAdapter, type CacheStrategy, type CachedFetchOptions, type ClientConfig, type ClientDefaults, type CollectionDetail, type CollectionFieldListResponse, CollectionFieldsResource, type CollectionListResponse, type CollectionSectionListResponse, CollectionSectionsResource, type CollectionSummary, CollectionsResource, type CommentAnchor, type CommentAnchorInput, type CommentAnchorKind, type CommentDomAnchor, type CommentDraftAnswer, type CommentFieldAnchorInput, type CommentListOptions, type CommentListResponse, type CommentPersonRef, type CommentProposedValue, type CommentProposedValueInput, type CommentRecord, type CommentRect, type CommentReplyAnswer, type CommentResolution, type CommentSource, type CommentSpotAnchor, type CommentStatus, type CommentTarget, type CommentThread, type CommentThreadAnswer, type CommentVersionRef, type CommentViewport, CommentsResource, type CommonRequestOptions, type ConfirmUploadInput, type CreateCollectionInput, type CreateCommentInput, type CreateDocumentFieldInput, type CreateDocumentInput, type CreateDraftInput, type CreateFieldInput, type CreateItemInput, type CreateSectionInput, type CreateUploadUrlInput, type CurrencyValue, type DeleteDocumentOptions, type DeleteItemOptions, type DeleteOptions, type DeliveryStatus, type DocumentDeleteResponse, type DocumentDetail, type DocumentFieldListResponse, DocumentFieldsResource, type DocumentGetOptions, type DocumentListEntry, type DocumentListOptions, type DocumentListResponse, type DocumentMeta, type DocumentMutationResponse, type DocumentSectionListResponse, DocumentSectionsResource, type DocumentSeo, DocumentSeoResource, type DocumentSeoResponse, DocumentValuesResource, type DocumentValuesResponse, type DocumentVersionDetail, type DocumentVersionSeo, type DocumentVersionSummary, type DocumentVersionValue, DocumentVersionsResource, DocumentsResource, EelZapClient, EelZapError, type EelZapErrorCode, EelZapNetworkError, type EnumValue, type FieldConstraints, type FieldInfo, type FieldOptionInput, type FieldType, type FilterOperatorMap, type FilterValue, type GalleryItemValue, type IdempotencyOptions, type ItemDeleteResponse, type ItemDetail, type ItemFilters, type ItemGetOptions, type ItemListOptions, type ItemListResponse, type ItemMeta, type ItemMutationResponse, ItemQueryBuilder, type ItemSeo, ItemSeoResource, type ItemSeoResponse, type ItemVersionDetail, type ItemVersionSeo, type ItemVersionSlug, type ItemVersionSummary, type ItemVersionValue, ItemVersionsResource, ItemsResource, type JsonObject, type MediaAccess, type MediaDetail, type MediaDetailResponse, type MediaFromUrlInput, type MediaListParams, type MediaListResponse, MediaResource, type MediaSort, type MediaType, type MediaUploadInput, type MediaUsage, type MediaValue, MemoryCacheAdapter, type OnPageComment, type OnPageCommentAnchor, type OnPageComments, type OnPageField, type Pagination, type PreviewOption, type PreviewTokenValidation, PreviewTokensResource, type QueryPrimitive, type ReplyCommentInput, type RetryEvent, type RetryOptions, type SaveCommentToDraftInput, type SectionInfo, type SectionMeta, type Seo, type SeoImage, type SeoInput, type SiteInfo, type SiteListEntry, SiteResource, SitesResource, type ThreadComment, type UpdateCollectionInput, type UpdateCommentInput, type UpdateDocumentDraftInput, type UpdateDocumentFieldInput, type UpdateDocumentInput, type UpdateFieldInput, type UpdateItemDraftInput, type UpdateItemInput, type UpdateMediaInput, type UpdateSectionInput, type UpdateSiteInput, type UploadFile, type UploadUrlResponse, type VerifyWebhookOptions, type VersionActorKind, type VersionDetail, type VersionGalleryItem, type VersionListResponse, type VersionSeo, type VersionStatus, type VersionSummary, type VersionValue, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WEBHOOK_TOLERANCE_SECONDS, type WebhookAction, type WebhookActor, type WebhookChange, type WebhookCollectionEventData, type WebhookCollectionRef, type WebhookCommentCreatedData, type WebhookCommentData, type WebhookCommentRef, type WebhookCommentReopenedData, type WebhookCommentRepliedData, type WebhookCommentResolvedData, type WebhookCommentSource, type WebhookCommentTarget, type WebhookCommentUpdatedData, type WebhookDocumentEventData, type WebhookEventName, type WebhookEventType, type WebhookHeaders, type WebhookItemEventData, type WebhookMediaEventData, type WebhookPayload, type WebhookSchemaEventData, type WebhookSeoEventData, type WebhookSiteEventData, type WebhookSiteRef, type WebhookSubject, cachedFetch, cleanStega, createClient, getMediaUrl, hasStega, isEelZapError, verifyWebhookSignature, webhookChanges };
|
package/dist/preview.d.ts
CHANGED
|
@@ -104,11 +104,15 @@ declare function zapAttrs(entry: EntryLike, fieldKey: string): {
|
|
|
104
104
|
* - Comparar (#953), two frames of one page side by side, the published one
|
|
105
105
|
* and the draft. Scroll sync, only to a page whose `zap:ready` advertised
|
|
106
106
|
* `scroll-sync`: `zap:scroll-sync` (editor → page) `{ enabled }` starts or
|
|
107
|
-
* stops `zap:scroll` (page → editor) `{ y, x?, anchor? }`,
|
|
108
|
-
* frame at most, positions as fractions (0..1) of the
|
|
109
|
-
* `anchor` the tagged field
|
|
110
|
-
* (
|
|
111
|
-
*
|
|
107
|
+
* stops `zap:scroll` (page → editor) `{ y, x?, anchor?, next?, progress? }`,
|
|
108
|
+
* one per animation frame at most, positions as fractions (0..1) of the
|
|
109
|
+
* scrollable range, `anchor` the last tagged field whose top is at or above
|
|
110
|
+
* the viewport's top (else the first in view), and since 0.11.1 `next` the
|
|
111
|
+
* tagged field below it and `progress` how far the viewport's top is from
|
|
112
|
+
* one to the other; `zap:scroll-to` (editor → page, same shape) places the
|
|
113
|
+
* page there: between the two fields when it has both, else by the anchor,
|
|
114
|
+
* else by the fraction, at most once per frame, and is never echoed back.
|
|
115
|
+
* `next` and `progress` are optional: a 0.11.0 page or editor ignores them.
|
|
112
116
|
* Diff marks, only to a page whose `zap:ready` advertised `diff-marks`:
|
|
113
117
|
* `zap:marks` (editor → page) `{ marks }`, every element of each field
|
|
114
118
|
* marked in its tone, removed (published) or added (draft); ≤ 200 marks,
|
|
@@ -143,7 +147,7 @@ declare const MAX_MARK_LABEL = 200;
|
|
|
143
147
|
declare const MAX_ANCHOR_NTH = 5000;
|
|
144
148
|
type OverlayMode = 'inspect' | 'select' | 'spot' | 'off';
|
|
145
149
|
declare const OVERLAY_MODES: readonly OverlayMode[];
|
|
146
|
-
type Capability = 'overlay' | 'values' | 'stega' | 'pins' | 'links' | 'refresh' | 'scroll-sync' | 'diff-marks' | 'fragment-token';
|
|
150
|
+
type Capability = 'overlay' | 'values' | 'stega' | 'pins' | 'links' | 'refresh' | 'scroll-sync' | 'diff-marks' | 'fragment-token' | 'structured-values';
|
|
147
151
|
declare const CAPABILITIES: readonly Capability[];
|
|
148
152
|
|
|
149
153
|
/**
|
|
@@ -155,6 +159,12 @@ declare const CAPABILITIES: readonly Capability[];
|
|
|
155
159
|
* should show. A bare string, number or boolean is shorthand for `{ text }`.
|
|
156
160
|
* `{ url }` and `{ email }` (a URL and an EMAIL field, `links` capability) go
|
|
157
161
|
* to a link's `href` rather than its text.
|
|
162
|
+
*
|
|
163
|
+
* With the `structured-values` capability, a CURRENCY field travels as
|
|
164
|
+
* {@link PreviewCurrencyValue} and an ENUM as {@link PreviewEnumValue}: the
|
|
165
|
+
* delivery API's own shapes, so a site's `price.amountMinor` and
|
|
166
|
+
* `category.value` survive a live merge (`useZapLiveUpdates`). The overlay
|
|
167
|
+
* writes their `text` / `label`.
|
|
158
168
|
*/
|
|
159
169
|
type PreviewValue = string | number | boolean | null | {
|
|
160
170
|
text: string;
|
|
@@ -170,7 +180,18 @@ type PreviewValue = string | number | boolean | null | {
|
|
|
170
180
|
srcset?: string | null;
|
|
171
181
|
alt?: string | null;
|
|
172
182
|
};
|
|
173
|
-
};
|
|
183
|
+
} | PreviewCurrencyValue | PreviewEnumValue;
|
|
184
|
+
/** A CURRENCY field: the stored minor units, the ISO 4217 code, and the formatted text to show. */
|
|
185
|
+
interface PreviewCurrencyValue {
|
|
186
|
+
amountMinor: number;
|
|
187
|
+
currency: string;
|
|
188
|
+
text: string;
|
|
189
|
+
}
|
|
190
|
+
/** An ENUM field: the option's value and its label (what the page shows). */
|
|
191
|
+
interface PreviewEnumValue {
|
|
192
|
+
value: string;
|
|
193
|
+
label: string;
|
|
194
|
+
}
|
|
174
195
|
/** Longest EMAIL value accepted (RFC 5321's path limit). */
|
|
175
196
|
declare const MAX_EMAIL_LENGTH = 320;
|
|
176
197
|
/** How the page found an element: a stega marker in its text, or a `data-zap` attribute. */
|
|
@@ -319,27 +340,36 @@ interface PausedPayload {
|
|
|
319
340
|
reason: 'runaway' | 'cap';
|
|
320
341
|
count: number;
|
|
321
342
|
}
|
|
322
|
-
/**
|
|
323
|
-
|
|
324
|
-
* (in `TagIndex.byField` order, 0 first) and its top's distance below the
|
|
325
|
-
* viewport's top, CSS px (negative once it scrolled past).
|
|
326
|
-
*/
|
|
327
|
-
interface ScrollAnchor {
|
|
343
|
+
/** A tagged field's element: the `nth` element of the field (in `TagIndex.byField` order, 0 first). */
|
|
344
|
+
interface ScrollFieldRef {
|
|
328
345
|
recordRef: RecordRef;
|
|
329
346
|
fieldKey: string;
|
|
330
347
|
nth: number;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* A tagged field's element as a scroll anchor, and its top's distance below
|
|
351
|
+
* the viewport's top, CSS px (negative once it scrolled past).
|
|
352
|
+
*/
|
|
353
|
+
interface ScrollAnchor extends ScrollFieldRef {
|
|
331
354
|
offset: number;
|
|
332
355
|
}
|
|
333
356
|
/**
|
|
334
357
|
* `zap:scroll` and `zap:scroll-to`: the scroll position as fractions (0..1) of
|
|
335
358
|
* the scrollable range (`x` only when the page scrolls sideways), and the
|
|
336
|
-
*
|
|
337
|
-
* lengths better than the fraction does.
|
|
359
|
+
* fields around the viewport's top, which align two pages of different
|
|
360
|
+
* lengths better than the fraction does. With `next` and `progress` (0.11.1)
|
|
361
|
+
* the other page puts its top that far between ITS two fields, so the
|
|
362
|
+
* position stays continuous when the anchor moves on to the next field, even
|
|
363
|
+
* where the two pages space their fields differently.
|
|
338
364
|
*/
|
|
339
365
|
interface ScrollPayload {
|
|
340
366
|
y: number;
|
|
341
367
|
x?: number;
|
|
342
368
|
anchor?: ScrollAnchor;
|
|
369
|
+
/** The tagged field below the anchor. */
|
|
370
|
+
next?: ScrollFieldRef;
|
|
371
|
+
/** 0 with the anchor at the viewport's top, 1 with `next` there. */
|
|
372
|
+
progress?: number;
|
|
343
373
|
}
|
|
344
374
|
/**
|
|
345
375
|
* One Comparar mark (`zap:marks`): every element of the field gets a box in
|
|
@@ -471,7 +501,7 @@ declare function parseEditorMessage(data: unknown): ParseResult<EditorMessage>;
|
|
|
471
501
|
declare function parsePageMessage(data: unknown): ParseResult<PageMessage>;
|
|
472
502
|
declare function envelope<T extends string, P>(type: T, session: string, payload: P): Envelope<T, P>;
|
|
473
503
|
|
|
474
|
-
declare const TAG_SELECTOR = "[data-zap],[data-zap-field]";
|
|
504
|
+
declare const TAG_SELECTOR = "[data-zap],[data-zap-field],[data-zap-site-renders]";
|
|
475
505
|
interface TaggedElement {
|
|
476
506
|
element: Element;
|
|
477
507
|
recordRef: RecordRef;
|
|
@@ -482,11 +512,13 @@ interface TaggedElement {
|
|
|
482
512
|
html: boolean;
|
|
483
513
|
/** `attr` for a manual tag, `stega` for a marker found in a text node. */
|
|
484
514
|
source: TagSource;
|
|
515
|
+
/** `data-zap-site-renders`: the site renders this field here; never written into. */
|
|
516
|
+
siteRenders?: true;
|
|
485
517
|
/** Stega only: the text node that carries the marker (values are written to it). */
|
|
486
518
|
textNode?: Text;
|
|
487
519
|
}
|
|
488
520
|
interface TagProblem {
|
|
489
|
-
attribute: 'data-zap' | 'data-zap-field' | 'data-zap-entry';
|
|
521
|
+
attribute: 'data-zap' | 'data-zap-field' | 'data-zap-entry' | 'data-zap-site-renders';
|
|
490
522
|
value: string;
|
|
491
523
|
}
|
|
492
524
|
type ReadTagResult = {
|
|
@@ -756,7 +788,7 @@ declare function createPageBridge(options: PageBridgeOptions): PageBridge;
|
|
|
756
788
|
* Live client (`live.ts`) boots it inside the customer's own page, framed by
|
|
757
789
|
* Zap's editor by its real URL (§2.7).
|
|
758
790
|
*/
|
|
759
|
-
declare const CLIENT_VERSION = "0.11.
|
|
791
|
+
declare const CLIENT_VERSION = "0.11.1";
|
|
760
792
|
interface RuntimeOptions {
|
|
761
793
|
win?: Window;
|
|
762
794
|
doc?: Document;
|
|
@@ -871,7 +903,9 @@ type ValuesHandler = (patch: Record<string, PreviewValue>, payload: ValuesPayloa
|
|
|
871
903
|
/**
|
|
872
904
|
* Call `handler` with each `zap:values` patch for `entry` (unsaved keystrokes
|
|
873
905
|
* from the editor), for sites that compute things from values. The tagged
|
|
874
|
-
* elements are updated anyway
|
|
906
|
+
* elements are updated anyway, except those marked `data-zap-site-renders`
|
|
907
|
+
* (`fields(…).derived(key)`), which the site renders from this patch; this is
|
|
908
|
+
* for everything else. Values arrive
|
|
875
909
|
* formatted for display, exactly as the overlay writes them. Returns an
|
|
876
910
|
* unsubscribe function. Works before or after `initZap`.
|
|
877
911
|
*/
|
|
@@ -1053,4 +1087,4 @@ declare function buildAnchor(element: Element, index: TagIndex, pageUrl: string,
|
|
|
1053
1087
|
*/
|
|
1054
1088
|
declare function findAnchorElement(anchor: DomAnchor, index: TagIndex, doc: Document, win: Window): Element | null;
|
|
1055
1089
|
|
|
1056
|
-
export { CAPABILITIES, CLIENT_VERSION, type Capability, type ClickPayload, type DiffMark, type DomAnchor, type DropReason, type DropStats, EDITOR_MESSAGE_TYPES, type EditorMessage, type EditorMessageType, type EditorMessages, type EntryLike, type Envelope, FIELD_KEY_RE, type FieldRefPayload, type HelloPayload, type InitZapOptions, MAX_ANCHORS, MAX_ANCHOR_NTH, MAX_DRAFT_ROUTE_LENGTH, MAX_EMAIL_LENGTH, MAX_LABELS, MAX_MARKS, MAX_MARK_LABEL, MAX_MESSAGE_BYTES, MAX_PINS, MAX_QUOTE_CONTEXT, MAX_QUOTE_EXACT, MAX_SELECTOR_BYTES, MAX_TAG_REPORT, MAX_URL_LENGTH, type MessageTargetLike, type NormalizedRect, OVERLAY_HOST_TAG, OVERLAY_MODES, type ObserveOptions, Overlay, type OverlayCallbacks, type OverlayMode, type OverlayOptions, type OverlayTheme, PAGE_MESSAGE_TYPES, PAGE_UNLOAD_ERROR, PREVIEW_TOKEN_RE, PREVIEW_TOKEN_STORAGE_KEY, PROTOCOL_SOURCE, PROTOCOL_VERSION, type PageAnchor, type PageBridge, type PageBridgeOptions, type PageMessage, type PageMessageType, type PageMessages, type PageRuntime, type ParseResult, type ParsedRecordRef, type PausedPayload, type Pin, type PreviewValue, RICH_TEXT_ALLOWED_ATTRS, RICH_TEXT_ALLOWED_TAGS, RICH_TEXT_DROPPED_TAGS, type ReadTagResult, type ReadyPayload, type RecordRef, type RuntimeConfig, type RuntimeOptions, type ScrollAnchor, type ScrollPayload, type SpotAnchor, type SpotPayload, type SpotPoint, TAG_SELECTOR, TagIndex, type TagProblem, type TagSource, type TagSummary, type TaggedElement, type TextQuote, ValueApplier, type ValuesHandler, type ValuesPayload, ZAP_PREVIEW_TOKEN_HEADER, ZAP_PRODUCTION_ORIGIN, type ZapLive, buildAnchor, buildDomAnchor, buildSelector, cleanStega, createPageBridge, cssEscape, developmentZapOrigin, emptyDropStats, envelope, findAnchorElement, getPreviewToken, initZap, isDiffMark, isDomAnchor, isDraftRoutePath, isFieldKey, isLocale, isPageAnchor, isPin, isPinId, isPreviewTokenShape, isPreviewValue, isRecordRef, isSafeImageUrl, isSafeSrcset, isSafeUrl, isSession, messageBytes, normalizeText, normalizedRect, observeTags, onValues, parseEditorMessage, parsePageMessage, parseRecordRef, parseTag, previewHeaders, readElementTag, recordRefsOf, richTextToText, safeQueryAll, sanitizeRichText, sanitizeRichTextToString, startRuntime, textQuoteFor, utf8Length, zapAttrs };
|
|
1090
|
+
export { CAPABILITIES, CLIENT_VERSION, type Capability, type ClickPayload, type DiffMark, type DomAnchor, type DropReason, type DropStats, EDITOR_MESSAGE_TYPES, type EditorMessage, type EditorMessageType, type EditorMessages, type EntryLike, type Envelope, FIELD_KEY_RE, type FieldRefPayload, type HelloPayload, type InitZapOptions, MAX_ANCHORS, MAX_ANCHOR_NTH, MAX_DRAFT_ROUTE_LENGTH, MAX_EMAIL_LENGTH, MAX_LABELS, MAX_MARKS, MAX_MARK_LABEL, MAX_MESSAGE_BYTES, MAX_PINS, MAX_QUOTE_CONTEXT, MAX_QUOTE_EXACT, MAX_SELECTOR_BYTES, MAX_TAG_REPORT, MAX_URL_LENGTH, type MessageTargetLike, type NormalizedRect, OVERLAY_HOST_TAG, OVERLAY_MODES, type ObserveOptions, Overlay, type OverlayCallbacks, type OverlayMode, type OverlayOptions, type OverlayTheme, PAGE_MESSAGE_TYPES, PAGE_UNLOAD_ERROR, PREVIEW_TOKEN_RE, PREVIEW_TOKEN_STORAGE_KEY, PROTOCOL_SOURCE, PROTOCOL_VERSION, type PageAnchor, type PageBridge, type PageBridgeOptions, type PageMessage, type PageMessageType, type PageMessages, type PageRuntime, type ParseResult, type ParsedRecordRef, type PausedPayload, type Pin, type PreviewCurrencyValue, type PreviewEnumValue, type PreviewValue, RICH_TEXT_ALLOWED_ATTRS, RICH_TEXT_ALLOWED_TAGS, RICH_TEXT_DROPPED_TAGS, type ReadTagResult, type ReadyPayload, type RecordRef, type RuntimeConfig, type RuntimeOptions, type ScrollAnchor, type ScrollFieldRef, type ScrollPayload, type SpotAnchor, type SpotPayload, type SpotPoint, TAG_SELECTOR, TagIndex, type TagProblem, type TagSource, type TagSummary, type TaggedElement, type TextQuote, ValueApplier, type ValuesHandler, type ValuesPayload, ZAP_PREVIEW_TOKEN_HEADER, ZAP_PRODUCTION_ORIGIN, type ZapLive, buildAnchor, buildDomAnchor, buildSelector, cleanStega, createPageBridge, cssEscape, developmentZapOrigin, emptyDropStats, envelope, findAnchorElement, getPreviewToken, initZap, isDiffMark, isDomAnchor, isDraftRoutePath, isFieldKey, isLocale, isPageAnchor, isPin, isPinId, isPreviewTokenShape, isPreviewValue, isRecordRef, isSafeImageUrl, isSafeSrcset, isSafeUrl, isSession, messageBytes, normalizeText, normalizedRect, observeTags, onValues, parseEditorMessage, parsePageMessage, parseRecordRef, parseTag, previewHeaders, readElementTag, recordRefsOf, richTextToText, safeQueryAll, sanitizeRichText, sanitizeRichTextToString, startRuntime, textQuoteFor, utf8Length, zapAttrs };
|
package/dist/preview.js
CHANGED
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
textQuoteFor,
|
|
65
65
|
utf8Length,
|
|
66
66
|
zapAttrs
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-G2JAAZKS.js";
|
|
68
68
|
import {
|
|
69
69
|
NEST_PRODUCTION_ORIGIN,
|
|
70
70
|
PENDING_STORAGE_KEY,
|
|
@@ -81,7 +81,7 @@ var isLocalHost = (hostname) => LOCAL_ORIGIN.test(`http://${hostname}`);
|
|
|
81
81
|
|
|
82
82
|
// src/preview/site/load.ts
|
|
83
83
|
function loadChunk(name, _base) {
|
|
84
|
-
return name === "signin" ? import("./signin-XOGBCGBL.js") : import("./suggest-
|
|
84
|
+
return name === "signin" ? import("./signin-XOGBCGBL.js") : import("./suggest-FDD4MBRP.js");
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
// src/preview/site/boot.ts
|
|
@@ -224,23 +224,17 @@ function createScrollSync(win, doc, index, post) {
|
|
|
224
224
|
let frame = null;
|
|
225
225
|
let last = "";
|
|
226
226
|
let placed = null;
|
|
227
|
+
let target = null;
|
|
227
228
|
const at = () => `${Math.round(win.scrollX)},${Math.round(win.scrollY)}`;
|
|
228
229
|
const range = (size, view) => Math.max(0, size - view);
|
|
229
|
-
function
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
top = rect.top;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
if (!best) return void 0;
|
|
241
|
-
const { recordRef, fieldKey } = best;
|
|
242
|
-
const nth = index.byField(recordRef, fieldKey).indexOf(best);
|
|
243
|
-
return nth < 0 ? void 0 : { recordRef, fieldKey, nth, offset: Math.round(top) };
|
|
230
|
+
const nextFrame = (fn) => typeof win.requestAnimationFrame === "function" ? win.requestAnimationFrame(fn) : win.setTimeout(fn, 16);
|
|
231
|
+
function fieldRef(tagged) {
|
|
232
|
+
const { recordRef, fieldKey } = tagged;
|
|
233
|
+
return { recordRef, fieldKey, nth: index.byField(recordRef, fieldKey).indexOf(tagged) };
|
|
234
|
+
}
|
|
235
|
+
function topOf(ref) {
|
|
236
|
+
const element = ref && index.byField(ref.recordRef, ref.fieldKey)[ref.nth]?.element;
|
|
237
|
+
return element?.isConnected ? element.getBoundingClientRect().top : void 0;
|
|
244
238
|
}
|
|
245
239
|
function measure() {
|
|
246
240
|
const root = doc.documentElement;
|
|
@@ -252,8 +246,31 @@ function createScrollSync(win, doc, index, post) {
|
|
|
252
246
|
if (range(root.scrollWidth, win.innerWidth) > 0) {
|
|
253
247
|
payload.x = fraction(win.scrollX, root.scrollWidth, win.innerWidth);
|
|
254
248
|
}
|
|
255
|
-
|
|
256
|
-
|
|
249
|
+
let above = null;
|
|
250
|
+
let below = null;
|
|
251
|
+
let up = -Infinity;
|
|
252
|
+
let down = Infinity;
|
|
253
|
+
for (const tagged of index.elements) {
|
|
254
|
+
const { top, height } = tagged.element.getBoundingClientRect();
|
|
255
|
+
if (height <= 0) continue;
|
|
256
|
+
if (top > 0) {
|
|
257
|
+
if (top < down) {
|
|
258
|
+
below = tagged;
|
|
259
|
+
down = top;
|
|
260
|
+
}
|
|
261
|
+
} else if (top > up) {
|
|
262
|
+
above = tagged;
|
|
263
|
+
up = top;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const anchor = above ?? (down < win.innerHeight ? below : null);
|
|
267
|
+
if (anchor) {
|
|
268
|
+
payload.anchor = { ...fieldRef(anchor), offset: Math.round(above ? up : down) };
|
|
269
|
+
if (above && below) {
|
|
270
|
+
payload.next = fieldRef(below);
|
|
271
|
+
payload.progress = round(-up / (down - up));
|
|
272
|
+
}
|
|
273
|
+
}
|
|
257
274
|
return payload;
|
|
258
275
|
}
|
|
259
276
|
function flush() {
|
|
@@ -267,9 +284,30 @@ function createScrollSync(win, doc, index, post) {
|
|
|
267
284
|
last = key;
|
|
268
285
|
post(payload);
|
|
269
286
|
}
|
|
287
|
+
function apply() {
|
|
288
|
+
const next = target;
|
|
289
|
+
target = null;
|
|
290
|
+
if (!next) return;
|
|
291
|
+
const root = doc.documentElement;
|
|
292
|
+
const { y, x, anchor, progress } = next;
|
|
293
|
+
let top = y * range(root.scrollHeight, win.innerHeight);
|
|
294
|
+
const from = topOf(anchor);
|
|
295
|
+
const to = topOf(next.next);
|
|
296
|
+
if (from !== void 0) {
|
|
297
|
+
top = win.scrollY + from + (to !== void 0 && progress !== void 0 ? progress * (to - from) : -anchor.offset);
|
|
298
|
+
}
|
|
299
|
+
const left = x === void 0 ? win.scrollX : x * range(root.scrollWidth, win.innerWidth);
|
|
300
|
+
try {
|
|
301
|
+
win.scrollTo({ top, left, behavior: "instant" });
|
|
302
|
+
} catch {
|
|
303
|
+
win.scrollTo(left, top);
|
|
304
|
+
}
|
|
305
|
+
placed = at();
|
|
306
|
+
last = JSON.stringify(measure());
|
|
307
|
+
}
|
|
270
308
|
const onScroll = () => {
|
|
271
309
|
if (!enabled || frame !== null) return;
|
|
272
|
-
frame =
|
|
310
|
+
frame = nextFrame(flush);
|
|
273
311
|
};
|
|
274
312
|
return {
|
|
275
313
|
setEnabled(next) {
|
|
@@ -282,24 +320,13 @@ function createScrollSync(win, doc, index, post) {
|
|
|
282
320
|
flush();
|
|
283
321
|
} else win.removeEventListener("scroll", onScroll);
|
|
284
322
|
},
|
|
285
|
-
scrollTo(
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
const element = target && index.byField(target.recordRef, target.fieldKey)[target.nth]?.element;
|
|
289
|
-
if (element?.isConnected) {
|
|
290
|
-
top = win.scrollY + element.getBoundingClientRect().top - target.offset;
|
|
291
|
-
}
|
|
292
|
-
const left = x === void 0 ? win.scrollX : x * range(root.scrollWidth, win.innerWidth);
|
|
293
|
-
try {
|
|
294
|
-
win.scrollTo({ top, left, behavior: "instant" });
|
|
295
|
-
} catch {
|
|
296
|
-
win.scrollTo(left, top);
|
|
297
|
-
}
|
|
298
|
-
placed = at();
|
|
299
|
-
last = JSON.stringify(measure());
|
|
323
|
+
scrollTo(next) {
|
|
324
|
+
if (!target) nextFrame(apply);
|
|
325
|
+
target = next;
|
|
300
326
|
},
|
|
301
327
|
destroy() {
|
|
302
328
|
enabled = false;
|
|
329
|
+
target = null;
|
|
303
330
|
win.removeEventListener("scroll", onScroll);
|
|
304
331
|
}
|
|
305
332
|
};
|
|
@@ -475,6 +502,7 @@ var ValueApplier = class {
|
|
|
475
502
|
}
|
|
476
503
|
write(tagged, locale, value) {
|
|
477
504
|
if (tagged.locale && tagged.locale !== locale) return false;
|
|
505
|
+
if (tagged.siteRenders) return false;
|
|
478
506
|
const element = tagged.element;
|
|
479
507
|
if (tagged.textNode) {
|
|
480
508
|
const text2 = plainText(value);
|
|
@@ -511,7 +539,7 @@ var ValueApplier = class {
|
|
|
511
539
|
function plainText(value) {
|
|
512
540
|
if (value === null || typeof value !== "object") return value === null ? "" : String(value);
|
|
513
541
|
const v = value;
|
|
514
|
-
return v.text ?? v.url ?? v.email ?? null;
|
|
542
|
+
return v.text ?? v.label ?? v.url ?? v.email ?? null;
|
|
515
543
|
}
|
|
516
544
|
function writeLink(element, value, base) {
|
|
517
545
|
const email = "email" in value;
|
|
@@ -564,7 +592,7 @@ function writeImage(element, image, base) {
|
|
|
564
592
|
}
|
|
565
593
|
|
|
566
594
|
// src/preview/runtime.ts
|
|
567
|
-
var CLIENT_VERSION = "0.11.
|
|
595
|
+
var CLIENT_VERSION = "0.11.1";
|
|
568
596
|
var MAX_PROBLEM_REPORTS = 20;
|
|
569
597
|
function startRuntime(config, options = {}) {
|
|
570
598
|
const win = options.win ?? window;
|