@encorekit/web-sdk 2.3.0 → 2.4.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 +66 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/preview.cjs +2 -0
- package/dist/cjs/preview.cjs.map +1 -0
- package/dist/cjs/react.cjs +1 -1
- package/dist/cjs/react.cjs.map +1 -1
- package/dist/esm/chunks/ClaimReminder-DFyrm5bJ.js +2 -0
- package/dist/esm/chunks/ClaimReminder-DFyrm5bJ.js.map +1 -0
- package/dist/esm/chunks/GiftsButton-B0lVB463.js +2 -0
- package/dist/esm/chunks/GiftsButton-B0lVB463.js.map +1 -0
- package/dist/esm/chunks/TriggerHost-CNTiNrTH.js +2 -0
- package/dist/esm/chunks/TriggerHost-CNTiNrTH.js.map +1 -0
- package/dist/esm/chunks/autoPops-CngtK_R0.js +2 -0
- package/dist/esm/chunks/autoPops-CngtK_R0.js.map +1 -0
- package/dist/esm/chunks/customClaim-B4uj-aOc.js +2 -0
- package/dist/esm/chunks/customClaim-B4uj-aOc.js.map +1 -0
- package/dist/esm/chunks/eligibility-BY7fL8Ve.js +2 -0
- package/dist/esm/chunks/eligibility-BY7fL8Ve.js.map +1 -0
- package/dist/esm/chunks/index-CaBSqauy.js +2 -0
- package/dist/esm/chunks/index-CaBSqauy.js.map +1 -0
- package/dist/esm/chunks/lookValues-B9z2VWpH.js +2 -0
- package/dist/esm/chunks/lookValues-B9z2VWpH.js.map +1 -0
- package/dist/esm/chunks/sduiView-Ds7QtFId.js +2 -0
- package/dist/esm/chunks/sduiView-Ds7QtFId.js.map +1 -0
- package/dist/esm/chunks/spot-DkKMLpB-.js +2 -0
- package/dist/esm/chunks/spot-DkKMLpB-.js.map +1 -0
- package/dist/esm/chunks/template-B9p4CbPD.js +2 -0
- package/dist/esm/chunks/template-B9p4CbPD.js.map +1 -0
- package/dist/esm/chunks/textSlots-BnwxUg9V.js +2 -0
- package/dist/esm/chunks/textSlots-BnwxUg9V.js.map +1 -0
- package/dist/esm/chunks/timers-Bva4yoGM.js +2 -0
- package/dist/esm/chunks/timers-Bva4yoGM.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/preview.js +2 -0
- package/dist/esm/preview.js.map +1 -0
- package/dist/esm/react.js +1 -1
- package/dist/esm/react.js.map +1 -1
- package/dist/umd/encore.min.js +1 -1
- package/dist/umd/encore.min.js.map +1 -1
- package/package.json +9 -1
- package/types/analytics/DiagnosticsOutbox.d.ts +1 -0
- package/types/analytics/DiagnosticsOutbox.d.ts.map +1 -1
- package/types/analytics/events.d.ts +105 -5
- package/types/analytics/events.d.ts.map +1 -1
- package/types/analytics/models.d.ts +2 -0
- package/types/analytics/models.d.ts.map +1 -1
- package/types/analytics/transport.d.ts +6 -0
- package/types/analytics/transport.d.ts.map +1 -1
- package/types/api/APIClient.d.ts +58 -3
- package/types/api/APIClient.d.ts.map +1 -1
- package/types/api/contract.d.ts +4 -1
- package/types/api/contract.d.ts.map +1 -1
- package/types/api/generated/types.d.ts +420 -39
- package/types/api/generated/types.d.ts.map +1 -1
- package/types/api/models.d.ts +18 -2
- package/types/api/models.d.ts.map +1 -1
- package/types/api/offerBuilder.d.ts +10 -4
- package/types/api/offerBuilder.d.ts.map +1 -1
- package/types/core/Encore.d.ts +145 -3
- package/types/core/Encore.d.ts.map +1 -1
- package/types/core/OfferManager.d.ts +25 -3
- package/types/core/OfferManager.d.ts.map +1 -1
- package/types/core/PlacementBuilder.d.ts +6 -1
- package/types/core/PlacementBuilder.d.ts.map +1 -1
- package/types/core/SignalManager.d.ts.map +1 -1
- package/types/core/StorageManager.d.ts +3 -2
- package/types/core/StorageManager.d.ts.map +1 -1
- package/types/core/StrictUnlockReconciler.d.ts +1 -1
- package/types/core/StrictUnlockReconciler.d.ts.map +1 -1
- package/types/core/claimHandle.d.ts +44 -0
- package/types/core/claimHandle.d.ts.map +1 -0
- package/types/core/claimLog.d.ts +102 -0
- package/types/core/claimLog.d.ts.map +1 -0
- package/types/core/claimRefusal.d.ts +3 -0
- package/types/core/claimRefusal.d.ts.map +1 -0
- package/types/core/claimStatusCheck.d.ts +62 -0
- package/types/core/claimStatusCheck.d.ts.map +1 -0
- package/types/core/giftVariant.d.ts +5 -0
- package/types/core/giftVariant.d.ts.map +1 -1
- package/types/core/hostDisplay.d.ts +9 -2
- package/types/core/hostDisplay.d.ts.map +1 -1
- package/types/core/sduiVariables.d.ts +20 -0
- package/types/core/sduiVariables.d.ts.map +1 -0
- package/types/core/strings.d.ts +114 -0
- package/types/core/strings.d.ts.map +1 -0
- package/types/core/unlockCode.d.ts +8 -1
- package/types/core/unlockCode.d.ts.map +1 -1
- package/types/core/userKeys.d.ts +7 -0
- package/types/core/userKeys.d.ts.map +1 -0
- package/types/core/version.d.ts +1 -1
- package/types/experiments/ExposureOutbox.d.ts +1 -0
- package/types/experiments/ExposureOutbox.d.ts.map +1 -1
- package/types/preview.d.ts +51 -0
- package/types/preview.d.ts.map +1 -0
- package/types/react.d.ts +53 -1
- package/types/react.d.ts.map +1 -1
- package/types/sdui/actions.d.ts +93 -0
- package/types/sdui/actions.d.ts.map +1 -0
- package/types/sdui/bindings.d.ts +63 -0
- package/types/sdui/bindings.d.ts.map +1 -0
- package/types/sdui/compile.d.ts +88 -0
- package/types/sdui/compile.d.ts.map +1 -0
- package/types/sdui/conditions.d.ts +22 -0
- package/types/sdui/conditions.d.ts.map +1 -0
- package/types/sdui/context.d.ts +132 -0
- package/types/sdui/context.d.ts.map +1 -0
- package/types/sdui/countdown.d.ts +31 -0
- package/types/sdui/countdown.d.ts.map +1 -0
- package/types/sdui/decode.d.ts +35 -0
- package/types/sdui/decode.d.ts.map +1 -0
- package/types/sdui/deps.d.ts +43 -0
- package/types/sdui/deps.d.ts.map +1 -0
- package/types/sdui/dominantColor.d.ts +24 -0
- package/types/sdui/dominantColor.d.ts.map +1 -0
- package/types/sdui/elements/confetti.d.ts +38 -0
- package/types/sdui/elements/confetti.d.ts.map +1 -0
- package/types/sdui/elements/content.d.ts +27 -0
- package/types/sdui/elements/content.d.ts.map +1 -0
- package/types/sdui/elements/interactive.d.ts +48 -0
- package/types/sdui/elements/interactive.d.ts.map +1 -0
- package/types/sdui/elements/layout.d.ts +41 -0
- package/types/sdui/elements/layout.d.ts.map +1 -0
- package/types/sdui/elements/marquee.d.ts +17 -0
- package/types/sdui/elements/marquee.d.ts.map +1 -0
- package/types/sdui/elements/progress.d.ts +10 -0
- package/types/sdui/elements/progress.d.ts.map +1 -0
- package/types/sdui/elements/shared.d.ts +138 -0
- package/types/sdui/elements/shared.d.ts.map +1 -0
- package/types/sdui/elements/symbols.d.ts +22 -0
- package/types/sdui/elements/symbols.d.ts.map +1 -0
- package/types/sdui/elements/triggerText.d.ts +55 -0
- package/types/sdui/elements/triggerText.d.ts.map +1 -0
- package/types/sdui/host.d.ts +274 -0
- package/types/sdui/host.d.ts.map +1 -0
- package/types/sdui/inlineMarkup.d.ts +22 -0
- package/types/sdui/inlineMarkup.d.ts.map +1 -0
- package/types/sdui/lookValues.d.ts +50 -0
- package/types/sdui/lookValues.d.ts.map +1 -0
- package/types/sdui/model.d.ts +130 -0
- package/types/sdui/model.d.ts.map +1 -0
- package/types/sdui/motion.d.ts +37 -0
- package/types/sdui/motion.d.ts.map +1 -0
- package/types/sdui/precheck.d.ts +94 -0
- package/types/sdui/precheck.d.ts.map +1 -0
- package/types/sdui/scrollMath.d.ts +32 -0
- package/types/sdui/scrollMath.d.ts.map +1 -0
- package/types/sdui/style.d.ts +99 -0
- package/types/sdui/style.d.ts.map +1 -0
- package/types/sdui/triggerKit.d.ts +24 -0
- package/types/sdui/triggerKit.d.ts.map +1 -0
- package/types/sdui/unrunnable.d.ts +11 -0
- package/types/sdui/unrunnable.d.ts.map +1 -0
- package/types/sdui/vocabulary.d.ts +119 -0
- package/types/sdui/vocabulary.d.ts.map +1 -0
- package/types/triggers/claimReminder/ClaimReminder.d.ts +65 -0
- package/types/triggers/claimReminder/ClaimReminder.d.ts.map +1 -0
- package/types/triggers/claimReminder/bindings.d.ts +40 -0
- package/types/triggers/claimReminder/bindings.d.ts.map +1 -0
- package/types/triggers/claimReminder/config.d.ts +56 -0
- package/types/triggers/claimReminder/config.d.ts.map +1 -0
- package/types/triggers/claimReminder/eligibility.d.ts +37 -0
- package/types/triggers/claimReminder/eligibility.d.ts.map +1 -0
- package/types/triggers/claimReminder/servedWindow.d.ts +15 -0
- package/types/triggers/claimReminder/servedWindow.d.ts.map +1 -0
- package/types/triggers/claimReminder/source.d.ts +29 -0
- package/types/triggers/claimReminder/source.d.ts.map +1 -0
- package/types/triggers/giftsButton/GiftsButton.d.ts +60 -0
- package/types/triggers/giftsButton/GiftsButton.d.ts.map +1 -0
- package/types/triggers/giftsButton/config.d.ts +53 -0
- package/types/triggers/giftsButton/config.d.ts.map +1 -0
- package/types/triggers/giftsButton/spot.d.ts +54 -0
- package/types/triggers/giftsButton/spot.d.ts.map +1 -0
- package/types/triggers/host/TriggerHost.d.ts +127 -0
- package/types/triggers/host/TriggerHost.d.ts.map +1 -0
- package/types/triggers/host/autoPops.d.ts +16 -0
- package/types/triggers/host/autoPops.d.ts.map +1 -0
- package/types/triggers/host/configCache.d.ts +29 -0
- package/types/triggers/host/configCache.d.ts.map +1 -0
- package/types/triggers/host/customClaim.d.ts +85 -0
- package/types/triggers/host/customClaim.d.ts.map +1 -0
- package/types/triggers/host/dismissStore.d.ts +37 -0
- package/types/triggers/host/dismissStore.d.ts.map +1 -0
- package/types/triggers/host/readThrottle.d.ts +15 -0
- package/types/triggers/host/readThrottle.d.ts.map +1 -0
- package/types/triggers/host/registry.d.ts +17 -0
- package/types/triggers/host/registry.d.ts.map +1 -0
- package/types/triggers/host/sduiView.d.ts +31 -0
- package/types/triggers/host/sduiView.d.ts.map +1 -0
- package/types/triggers/host/template.d.ts +28 -0
- package/types/triggers/host/template.d.ts.map +1 -0
- package/types/triggers/host/textSlots.d.ts +35 -0
- package/types/triggers/host/textSlots.d.ts.map +1 -0
- package/types/triggers/host/theme.d.ts +87 -0
- package/types/triggers/host/theme.d.ts.map +1 -0
- package/types/triggers/host/timers.d.ts +11 -0
- package/types/triggers/host/timers.d.ts.map +1 -0
- package/types/triggers/host/types.d.ts +278 -0
- package/types/triggers/host/types.d.ts.map +1 -0
- package/types/triggers/host/wire.d.ts +55 -0
- package/types/triggers/host/wire.d.ts.map +1 -0
- package/types/triggers/preview.d.ts +78 -0
- package/types/triggers/preview.d.ts.map +1 -0
- package/types/triggers/request.d.ts +53 -0
- package/types/triggers/request.d.ts.map +1 -0
- package/types/types.d.ts +329 -1
- package/types/types.d.ts.map +1 -1
- package/types/ui/ClaimScreen.d.ts +1 -1
- package/types/ui/ClaimScreen.d.ts.map +1 -1
- package/types/ui/CodeUnlock.d.ts +12 -2
- package/types/ui/CodeUnlock.d.ts.map +1 -1
- package/types/ui/GiftHero.d.ts.map +1 -1
- package/types/ui/GiftList.d.ts.map +1 -1
- package/types/ui/GiftPicker.d.ts.map +1 -1
- package/types/ui/GiftPickerHero.d.ts.map +1 -1
- package/types/ui/GiftReveal.d.ts.map +1 -1
- package/types/ui/GiftSheet.d.ts +5 -5
- package/types/ui/GiftSheet.d.ts.map +1 -1
- package/types/ui/GiftUnwrap.d.ts.map +1 -1
- package/types/ui/OfferCard.d.ts.map +1 -1
- package/types/ui/OfferCarousel.d.ts.map +1 -1
- package/types/ui/OfferModal.d.ts +31 -0
- package/types/ui/OfferModal.d.ts.map +1 -1
- package/types/ui/PrimerScreen.d.ts +2 -0
- package/types/ui/PrimerScreen.d.ts.map +1 -1
- package/types/ui/RedemptionScreen.d.ts +5 -0
- package/types/ui/RedemptionScreen.d.ts.map +1 -1
- package/types/ui/RewardActions.d.ts.map +1 -1
- package/types/ui/RewardCard.d.ts.map +1 -1
- package/types/ui/SduiRewardSurface.d.ts +145 -0
- package/types/ui/SduiRewardSurface.d.ts.map +1 -0
- package/types/ui/Tooltip.d.ts.map +1 -1
- package/types/ui/brandComponents.d.ts.map +1 -1
- package/types/ui/brandTint.d.ts.map +1 -1
- package/types/ui/colorScheme.d.ts +15 -0
- package/types/ui/colorScheme.d.ts.map +1 -0
- package/types/ui/covered.d.ts +12 -0
- package/types/ui/covered.d.ts.map +1 -0
- package/types/ui/giftCategoryGroups.d.ts +13 -0
- package/types/ui/giftCategoryGroups.d.ts.map +1 -1
- package/types/ui/giftCopy.d.ts +14 -9
- package/types/ui/giftCopy.d.ts.map +1 -1
- package/types/ui/giftUnwrapCopy.d.ts.map +1 -1
- package/types/ui/imageURL.d.ts +44 -0
- package/types/ui/imageURL.d.ts.map +1 -0
- package/types/ui/impressionGate.d.ts +9 -0
- package/types/ui/impressionGate.d.ts.map +1 -1
- package/types/ui/offerBadge.d.ts.map +1 -1
- package/types/ui/rewardSurface.d.ts +11 -1
- package/types/ui/rewardSurface.d.ts.map +1 -1
- package/types/ui/sduiTheme.d.ts +48 -0
- package/types/ui/sduiTheme.d.ts.map +1 -0
- package/types/ui/sheetDetents.d.ts +28 -0
- package/types/ui/sheetDetents.d.ts.map +1 -0
- package/types/ui/styles.d.ts +11 -8
- package/types/ui/styles.d.ts.map +1 -1
- package/types/ui/termsLine.d.ts +3 -3
- package/types/ui/termsLine.d.ts.map +1 -1
- package/types/ui/toast.d.ts +11 -0
- package/types/ui/toast.d.ts.map +1 -0
- package/types/utils/logger.d.ts +10 -0
- package/types/utils/logger.d.ts.map +1 -1
- package/types/utils/text.d.ts +17 -0
- package/types/utils/text.d.ts.map +1 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What every element renderer does with style, in one place.
|
|
3
|
+
*
|
|
4
|
+
* Applying CSS is only half of it. `planStyle` hands back structural intents
|
|
5
|
+
* that are not declarations: `overlay` and `backgroundElement` are child NODES,
|
|
6
|
+
* and both need a positioned wrapper. Doing that per renderer is how one of
|
|
7
|
+
* them ends up quietly unimplemented on a single element.
|
|
8
|
+
*/
|
|
9
|
+
import type { CompileServices, Rendered } from "../compile";
|
|
10
|
+
import type { SduiEvaluationContext } from "../context";
|
|
11
|
+
import type { SduiNode } from "../model";
|
|
12
|
+
import type { ColorResolver } from "../style";
|
|
13
|
+
import type { MotionSheet } from "../motion";
|
|
14
|
+
import type { TriggerKit } from "../triggerKit";
|
|
15
|
+
/** What a trigger (inline) mount adds; a sheet has none. */
|
|
16
|
+
export interface TriggerDeps {
|
|
17
|
+
/** Multiplies every text font size (`maxFontScale` already applied). */
|
|
18
|
+
readonly fontScale: number;
|
|
19
|
+
/** The trigger-only engine code, loaded with the trigger chunk (`triggerKit.ts`). */
|
|
20
|
+
readonly kit: TriggerKit;
|
|
21
|
+
/** This look's text `scaleGroup`s (one per mount): members shrink by one shared factor. */
|
|
22
|
+
readonly scaleGroups: InstanceType<TriggerKit["ScaleGroups"]>;
|
|
23
|
+
}
|
|
24
|
+
/** Injected once by the host, so renderers stay free of theme knowledge. */
|
|
25
|
+
export interface RenderDeps {
|
|
26
|
+
readonly color: ColorResolver;
|
|
27
|
+
/** Present only in a trigger (inline) mount, where the trigger vocabulary renders. */
|
|
28
|
+
readonly trigger?: TriggerDeps;
|
|
29
|
+
/** Trigger mounts only: where `style.loop` and `marquee` keyframes go. */
|
|
30
|
+
readonly motion?: MotionSheet;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a colour operand now, and again whenever a key it binds moves.
|
|
34
|
+
*
|
|
35
|
+
* A `binding` colour resolves at RENDER time. Only `fillColor` and
|
|
36
|
+
* `highlightColor` ever passed `values`, so every other colour in the vocabulary
|
|
37
|
+
* resolved once with none and painted its fallback for ever.
|
|
38
|
+
*/
|
|
39
|
+
export declare function bindColor(operand: unknown, ctx: SduiEvaluationContext, services: CompileServices, deps: RenderDeps, apply: (css: string | undefined) => void): void;
|
|
40
|
+
/** The layout properties a parent hands to a child. */
|
|
41
|
+
export type ChildFill = Partial<Record<"alignSelf" | "justifySelf" | "flexGrow" | "flexShrink" | "flexBasis" | "minWidth" | "minHeight" | "maxWidth" | "maxHeight" | "marginInline" | "width" | "height" | "zIndex" | "gridArea" | "pointerEvents" | "scrollSnapAlign", string>>;
|
|
42
|
+
/**
|
|
43
|
+
* Give a child a layout property, THROUGH any `display: contents` wrapper.
|
|
44
|
+
*
|
|
45
|
+
* A `conditional` and a `forEach` compile to a wrapper with no box, so a
|
|
46
|
+
* property set on one does nothing: the branch or the row is the real flex or
|
|
47
|
+
* grid item. The wrapper carries the intent instead, and re-applies it to
|
|
48
|
+
* whatever it mounts, because a conditional swaps branches and a `forEach`
|
|
49
|
+
* builds rows long after this runs.
|
|
50
|
+
*
|
|
51
|
+
* This is why the offer rows stayed three different widths after the stacks
|
|
52
|
+
* started handing out the fill: every one of them sits behind a `forEach` host.
|
|
53
|
+
*/
|
|
54
|
+
export declare function setChildFill(el: HTMLElement, fill: ChildFill): void;
|
|
55
|
+
export declare function readChildFill(el: HTMLElement): ChildFill;
|
|
56
|
+
/** Pass a host's carried fill to a node it has just mounted. */
|
|
57
|
+
export declare function inheritChildFill(host: HTMLElement, mounted: Node): void;
|
|
58
|
+
export declare function applyCss(el: HTMLElement, css: Readonly<Record<string, string>>): void;
|
|
59
|
+
/**
|
|
60
|
+
* Apply a node's style to `el`, mounting any structural intent.
|
|
61
|
+
*
|
|
62
|
+
* The overlay and background wrappers make `el` a positioning context. That is
|
|
63
|
+
* a real layout change, so it happens ONLY when an intent is present.
|
|
64
|
+
*/
|
|
65
|
+
export declare function applyNodeStyle(el: HTMLElement, node: SduiNode, ctx: SduiEvaluationContext, services: CompileServices, deps: RenderDeps): void;
|
|
66
|
+
/**
|
|
67
|
+
* Whether this subtree holds a `spacer` that is greedy on the HORIZONTAL axis.
|
|
68
|
+
*
|
|
69
|
+
* Only an `hStack`'s spacer is: in a `vStack` a spacer eats height instead. The
|
|
70
|
+
* greed propagates up, because the space a spacer claims is space its ancestors
|
|
71
|
+
* had to be offered first. An explicit `frame.width` stops it, since that is the
|
|
72
|
+
* author fixing the size.
|
|
73
|
+
*/
|
|
74
|
+
export declare function hasGreedySpacer(node: SduiNode, depth?: number): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* What this child asks to fill, looking THROUGH the wrappers that have no box.
|
|
77
|
+
*
|
|
78
|
+
* A `conditional` and a `forEach` compile to `display: contents`, so the node
|
|
79
|
+
* the parent sees carries no frame of its own: the intent is on the branch or
|
|
80
|
+
* the row template inside it. Reading only the wrapper's own style missed every
|
|
81
|
+
* one of them, which is most of this variant. The thank-you column asks for
|
|
82
|
+
* `maxHeight: .infinity` from inside a `conditional`, so it never filled the
|
|
83
|
+
* sheet and the spacers that should push the buttons to the bottom stayed flat.
|
|
84
|
+
*
|
|
85
|
+
* An explicit `frame.width` is the author fixing the size, so it wins.
|
|
86
|
+
*/
|
|
87
|
+
export declare function fillIntent(node: SduiNode, depth?: number): {
|
|
88
|
+
wide: boolean;
|
|
89
|
+
tall: boolean;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Elements whose own size is their single child's, so the intent is inside.
|
|
93
|
+
*
|
|
94
|
+
* The bottom sheet's dim backdrop is a `button` wrapping a rectangle that asks
|
|
95
|
+
* for both infinities, so reading only the button gave it no height and the
|
|
96
|
+
* screen behind the sheet was never dimmed.
|
|
97
|
+
*/
|
|
98
|
+
export declare const PASSTHROUGH: Set<string>;
|
|
99
|
+
/**
|
|
100
|
+
* Hand a single-content container's fill to the content it holds.
|
|
101
|
+
*
|
|
102
|
+
* Only a stack hands out fill, and a `button` is not a stack, so the sheet's
|
|
103
|
+
* dim backdrop stretched to the screen while the rectangle inside it stayed
|
|
104
|
+
* 0px high and nothing was dimmed. Applied only when the content asks, so an
|
|
105
|
+
* ordinary button keeps the layout it had.
|
|
106
|
+
*/
|
|
107
|
+
export declare function applyContentFill(el: HTMLElement, node: SduiNode): void;
|
|
108
|
+
/** A container element with its children compiled in order. */
|
|
109
|
+
export declare function container(tag: string, node: SduiNode, ctx: SduiEvaluationContext, services: CompileServices, deps: RenderDeps): {
|
|
110
|
+
el: HTMLElement;
|
|
111
|
+
rendered: Rendered;
|
|
112
|
+
};
|
|
113
|
+
declare const rec: (v: unknown) => Record<string, unknown> | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* A gradient stroke drawn OVER the element, as Swift's `strokeBorder` overlay
|
|
116
|
+
* is: the element keeps its background and its size. A masked child rather than
|
|
117
|
+
* a border, because CSS has no gradient border that follows a radius.
|
|
118
|
+
*/
|
|
119
|
+
declare function applyGradientBorder(el: HTMLElement, raw: Record<string, unknown>, deps: RenderDeps, ctx: SduiEvaluationContext): void;
|
|
120
|
+
/**
|
|
121
|
+
* Scroll-driven transforms.
|
|
122
|
+
*
|
|
123
|
+
* Compose hands Android `phase` and `centerDistance` from its scroll state; the
|
|
124
|
+
* DOM hands us neither, so both are computed from geometry here. The arithmetic
|
|
125
|
+
* itself is `scrollMath`, ported from Android, which until now was imported by
|
|
126
|
+
* nothing but its own test.
|
|
127
|
+
*/
|
|
128
|
+
declare function attachScrollEffects(el: HTMLElement, transition: Record<string, unknown>, faded: {
|
|
129
|
+
opacity: number;
|
|
130
|
+
}): () => void;
|
|
131
|
+
export { applyGradientBorder, attachScrollEffects, rec };
|
|
132
|
+
/**
|
|
133
|
+
* Collapse a `group` whose content renders nothing, and restore it when content
|
|
134
|
+
* returns. Swift styles a SwiftUI `Group`, whose modifiers vanish with an
|
|
135
|
+
* `EmptyView`, so an empty `maxHeight: infinity` group took no space on iOS.
|
|
136
|
+
*/
|
|
137
|
+
export declare function syncGroupVacancy(from: Element | null): void;
|
|
138
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/sdui/elements/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,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QAAQ,CAAA;CAAE,CAUzC;AAKD,QAAA,MAAM,GAAG,GAAI,GAAG,OAAO,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAGrC,CAAC;AAShB;;;;GAIG;AACH,iBAAS,mBAAmB,CAC1B,EAAE,EAAE,WAAW,EACf,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,qBAAqB,GACzB,IAAI,CAsCN;AAyDD;;;;;;;GAOG;AACH,iBAAS,mBAAmB,CAC1B,EAAE,EAAE,WAAW,EACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACzB,MAAM,IAAI,CA8EZ;AAED,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,GAAG,EAAE,CAAC;AAazD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAa3D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SF Symbols a variant may reference.
|
|
3
|
+
*
|
|
4
|
+
* SF Symbols are an Apple font with no web equivalent, so each one used by a
|
|
5
|
+
* shipped variant is drawn here as inline SVG. The set is exactly the eleven
|
|
6
|
+
* that appear across every checked-in variant, matching Android's
|
|
7
|
+
* `SduiSymbol.kt`, plus the three the trigger vocabulary adds: a deliberately
|
|
8
|
+
* small CLOSED set, because each addition is bytes in every host page.
|
|
9
|
+
*
|
|
10
|
+
* 🔴 THESE ARE APPROXIMATIONS AND NEED DESIGN SIGN-OFF. They are simple
|
|
11
|
+
* geometric stand-ins drawn to the same 24x24 box and stroke weight, not
|
|
12
|
+
* reproductions of Apple's artwork, which is not ours to copy. Parity of
|
|
13
|
+
* MEANING is the bar they meet today; parity of appearance is a design pass
|
|
14
|
+
* that has not happened. An unknown name renders nothing rather than a
|
|
15
|
+
* placeholder glyph, because a wrong icon reads as a bug and a missing one
|
|
16
|
+
* reads as an empty slot.
|
|
17
|
+
*/
|
|
18
|
+
/** Wire name to SVG body, drawn in a 0 0 24 24 box. */
|
|
19
|
+
export declare const SF_SYMBOLS: Readonly<Record<string, string>>;
|
|
20
|
+
/** An unknown symbol renders nothing. A wrong icon is worse than none. */
|
|
21
|
+
export declare function symbolSvg(name: unknown, size: number): string | undefined;
|
|
22
|
+
//# sourceMappingURL=symbols.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../../../src/sdui/elements/symbols.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAkBH,uDAAuD;AACvD,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA2BvD,CAAC;AAQF,0EAA0E;AAC1E,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMzE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trigger-only text treatments: a ticking countdown and one-line shrink to fit.
|
|
3
|
+
* Part of the trigger kit (`../triggerKit.ts`), loaded with the trigger chunk on first
|
|
4
|
+
* mount, so a page that only shows sheets never downloads them.
|
|
5
|
+
*/
|
|
6
|
+
import type { SduiEvaluationContext } from "../context";
|
|
7
|
+
import type { Dependency } from "../deps";
|
|
8
|
+
import type { ContentDeps } from "./content";
|
|
9
|
+
/**
|
|
10
|
+
* A `text.countdown` (trigger mounts): the time left to a host time key, in the
|
|
11
|
+
* countdown's `format`, re-rendered whenever the clock or the keys move. The
|
|
12
|
+
* `units` are `${...}` text, resolved as any text is.
|
|
13
|
+
*/
|
|
14
|
+
export declare function countdownText(el: HTMLElement, countdown: Readonly<Record<string, unknown>>, deps: ContentDeps): {
|
|
15
|
+
node: Node;
|
|
16
|
+
deps: Dependency[];
|
|
17
|
+
update(c: SduiEvaluationContext): void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Trigger vocabulary `minimumScaleFactor` (0.5..1) on a one-line text: shrink the font
|
|
21
|
+
* to fit the width before truncating, never below the factor, then the line clamp
|
|
22
|
+
* ellipsizes. Measured with wrapping off, from the authored size each time, so a
|
|
23
|
+
* string that gets shorter grows back. Refits when the element's box changes size
|
|
24
|
+
* (e.g. once it is attached). Undefined when it does not apply.
|
|
25
|
+
*/
|
|
26
|
+
export declare function oneLineFit(el: HTMLElement, props: Readonly<Record<string, unknown>>): (() => void) | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The widest text a countdown format can show, so a scale group measures its countdown
|
|
29
|
+
* the same at every tick ("88:88" for hoursMinutes). Empty for a format whose width
|
|
30
|
+
* follows its words (`largestUnit`): that member is measured as shown.
|
|
31
|
+
*/
|
|
32
|
+
export declare function widestCountdownText(format: unknown): string;
|
|
33
|
+
/**
|
|
34
|
+
* What a countdown member is measured at: the format's widest sample, or the shown text with every
|
|
35
|
+
* digit at its widest when that is longer (a reminder window past 99 hours shows three hour digits,
|
|
36
|
+
* "719:59:59", which the two-digit sample would under-measure).
|
|
37
|
+
*/
|
|
38
|
+
export declare function countdownMeasureText(sample: string, shown: string | null): string;
|
|
39
|
+
/**
|
|
40
|
+
* Text `scaleGroup`s of one look: every member shrinks by one shared factor, the smallest
|
|
41
|
+
* any member needs to fit (each over its own lineLimit; a countdown at its widest text),
|
|
42
|
+
* never below the members' minimumScaleFactor, and keeps its own font size times that
|
|
43
|
+
* factor. A member that still does not fit truncates. Refits when a member's space or
|
|
44
|
+
* text changes.
|
|
45
|
+
*/
|
|
46
|
+
export declare class ScaleGroups {
|
|
47
|
+
#private;
|
|
48
|
+
/**
|
|
49
|
+
* Add `el` (its font size already set) to `group`. `countdownFormat`: the member is a
|
|
50
|
+
* countdown in that format. Returns the call that refits the whole group.
|
|
51
|
+
*/
|
|
52
|
+
join(group: string, el: HTMLElement, props: Readonly<Record<string, unknown>>, countdownFormat?: unknown): () => void;
|
|
53
|
+
fit(group: string): void;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=triggerText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggerText.d.ts","sourceRoot":"","sources":["../../../src/sdui/elements/triggerText.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAW7C;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,WAAW,EACf,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC5C,IAAI,EAAE,WAAW,GAChB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,UAAU,EAAE,CAAC;IAAC,MAAM,CAAC,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAA;CAAE,CAuB5E;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,EAAE,EAAE,WAAW,EACf,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACvC,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CA+B1B;AAqBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAa3D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAGjF;AAyCD;;;;;;GAMG;AACH,qBAAa,WAAW;;IAGtB;;;OAGG;IACH,IAAI,CACF,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,WAAW,EACf,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACxC,eAAe,CAAC,EAAE,OAAO,GACxB,MAAM,IAAI;IA8Bb,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CA4CzB"}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns the served template `Encore.ts` caches into DOM. Every entry point returns
|
|
3
|
+
* `undefined` rather than throwing, so a variant this build cannot draw keeps the
|
|
4
|
+
* built-in surface: a half-rendered sheet is worse than the surface that works.
|
|
5
|
+
*/
|
|
6
|
+
import type { CompiledTree } from "./compile";
|
|
7
|
+
import type { SduiEvaluationContext, SduiOfferBindingData, SduiTextDefaults, SduiHostListItem } from "./context";
|
|
8
|
+
import type { ActionHost } from "./actions";
|
|
9
|
+
import type { SduiAction } from "./model";
|
|
10
|
+
import type { ColorResolver } from "./style";
|
|
11
|
+
import type { TextEnvironment } from "./elements/content";
|
|
12
|
+
import type { MotionSheet } from "./motion";
|
|
13
|
+
import type { TriggerKit } from "./triggerKit";
|
|
14
|
+
/** The SDK's offer shape, narrowed to what the engine reads. */
|
|
15
|
+
export interface HostOffer {
|
|
16
|
+
id: string;
|
|
17
|
+
title?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
ctaText?: string;
|
|
20
|
+
merchantName?: string;
|
|
21
|
+
imageUrl?: string;
|
|
22
|
+
logoUrl?: string;
|
|
23
|
+
heroImageUrl?: string;
|
|
24
|
+
termsUrl?: string;
|
|
25
|
+
shareUrl?: string;
|
|
26
|
+
perk?: string;
|
|
27
|
+
badgeLabel?: string;
|
|
28
|
+
category?: string;
|
|
29
|
+
quickInstructions?: string;
|
|
30
|
+
instructions?: {
|
|
31
|
+
title: string;
|
|
32
|
+
subtitle: string;
|
|
33
|
+
ctaButtonText?: string;
|
|
34
|
+
imageUrl?: string;
|
|
35
|
+
}[];
|
|
36
|
+
displayProperties?: Record<string, string>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Map the SDK's offer onto the engine's.
|
|
40
|
+
*
|
|
41
|
+
* `shareUrl` is carried only when the backend minted one, so `hasOfferAttribute:
|
|
42
|
+
* "shareUrl"` stays false for an offer with no link and its share control does not
|
|
43
|
+
* draw: a link the backend never minted cannot be attributed. `newPrice` and
|
|
44
|
+
* `oldPrice` are absent because `OfferModel` carries neither.
|
|
45
|
+
*/
|
|
46
|
+
export declare function toBindingData(offer: HostOffer): SduiOfferBindingData;
|
|
47
|
+
/**
|
|
48
|
+
* What the ENGINE knows and the host cannot see, for the `sdk_sdui_*` events.
|
|
49
|
+
*
|
|
50
|
+
* The engine reports facts, not events: it has no analytics client, no
|
|
51
|
+
* `distinctId`, and no `presentationId`, `variantId`, `useCase` or
|
|
52
|
+
* `placementId`. Those are the host's, and Swift passes them INTO its context
|
|
53
|
+
* (`SDUIContext.swift:508-556`). So the engine hands over the half only it
|
|
54
|
+
* holds and the host stamps the rest, which is also how a host drops an event
|
|
55
|
+
* that has no presentation yet, the way Swift's `guard let presentationId`
|
|
56
|
+
* does.
|
|
57
|
+
*/
|
|
58
|
+
export type SduiAnalyticsEvent = {
|
|
59
|
+
readonly kind: "stateTransition";
|
|
60
|
+
readonly fromState: string;
|
|
61
|
+
readonly toState: string;
|
|
62
|
+
readonly timeInPreviousStateMs: number;
|
|
63
|
+
} | {
|
|
64
|
+
readonly kind: "valueSet";
|
|
65
|
+
readonly key: string;
|
|
66
|
+
readonly value: string;
|
|
67
|
+
/** Set when `value` is a selected offer's id, so the host can report its campaign. */
|
|
68
|
+
readonly offerId?: string;
|
|
69
|
+
} | {
|
|
70
|
+
readonly kind: "buttonTapped";
|
|
71
|
+
readonly actionType: string;
|
|
72
|
+
readonly currentState: string;
|
|
73
|
+
};
|
|
74
|
+
export interface SduiSurfaceOptions {
|
|
75
|
+
/** The tree cached by `Encore.ts`, exactly as served. */
|
|
76
|
+
readonly template: unknown;
|
|
77
|
+
readonly offers: readonly HostOffer[];
|
|
78
|
+
readonly textEnvironment: TextEnvironment;
|
|
79
|
+
readonly actionHost: ActionHost;
|
|
80
|
+
/** Resolves an SDUI colour operand. Wrapped in the cssSafe grammar here. */
|
|
81
|
+
readonly color: ColorResolver;
|
|
82
|
+
readonly initialState?: string;
|
|
83
|
+
readonly initialIndex?: number;
|
|
84
|
+
readonly document?: Document;
|
|
85
|
+
/** Fire and forget. Never throws into the engine; see `#report`. */
|
|
86
|
+
readonly analytics?: (event: SduiAnalyticsEvent) => void;
|
|
87
|
+
/** Reads a logo's brand colour. Defaults to the canvas extractor. */
|
|
88
|
+
readonly dominantColor?: (url: string) => Promise<string | null>;
|
|
89
|
+
/** False dims and disables every claim button, as Swift does. */
|
|
90
|
+
readonly claimEnabled?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* `inline`: a trigger mount. Draws inside a host element at the root's own
|
|
93
|
+
* `frame.height` instead of filling a sheet, decodes the trigger vocabulary
|
|
94
|
+
* (`TRIGGER_*` in `vocabulary.ts`), and reads `lists`. A root without a
|
|
95
|
+
* positive numeric height does not mount. Absent is the sheet, unchanged.
|
|
96
|
+
*/
|
|
97
|
+
readonly mode?: "sheet" | "inline";
|
|
98
|
+
/**
|
|
99
|
+
* Inline mounts only, and required there: the trigger-only engine code
|
|
100
|
+
* (`triggerKit.ts`), which the trigger chunk loads and passes in.
|
|
101
|
+
*/
|
|
102
|
+
readonly kit?: TriggerKit;
|
|
103
|
+
/**
|
|
104
|
+
* Inline mounts only: whether a colour operand names a colour its owner chose
|
|
105
|
+
* exactly, so the operand's `opacity` does not apply (`lighten` and `darken` still
|
|
106
|
+
* do). A trigger's `secondary` or `track` is faded only when it falls back to the
|
|
107
|
+
* text colour, never when the publisher set it.
|
|
108
|
+
*/
|
|
109
|
+
readonly exactColor?: (raw: unknown) => boolean;
|
|
110
|
+
/** Inline mounts only: the trigger host's named lists, for `hostList` rows. */
|
|
111
|
+
readonly lists?: Readonly<Record<string, readonly SduiHostListItem[]>>;
|
|
112
|
+
/**
|
|
113
|
+
* Inline mounts only: the host's time keys (`start`, `deadline`), ms since the
|
|
114
|
+
* epoch, read by `text.countdown` and `progress`.
|
|
115
|
+
*/
|
|
116
|
+
readonly times?: Readonly<Record<string, number>>;
|
|
117
|
+
/** Inline mounts only: the clock at mount, ms since the epoch. Defaults to `Date.now()`. */
|
|
118
|
+
readonly now?: number;
|
|
119
|
+
/** Inline mounts only: loops and marquees hold still (§2.6; the host computes it). */
|
|
120
|
+
readonly motionPaused?: boolean;
|
|
121
|
+
/** Inline mounts only: the host's reduce-motion read (web: `prefers-reduced-motion`). */
|
|
122
|
+
readonly reduceMotion?: boolean;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* How much an inline mount scales its text: the user's default text size (what the
|
|
126
|
+
* browser computes for `font-size: medium`, which the page's own CSS cannot move)
|
|
127
|
+
* against 16px, clamped to [1, `maxFontScale`]. Never below 1. Read from a probe,
|
|
128
|
+
* not the root element: a page that sets a larger root size as a design choice is
|
|
129
|
+
* not a user asking for larger text.
|
|
130
|
+
*/
|
|
131
|
+
export declare function inlineFontScale(doc: Document, maxFontScale: unknown): number;
|
|
132
|
+
/**
|
|
133
|
+
* The positive numeric `frame.height` on the template's root element, or
|
|
134
|
+
* undefined. Read from the wire: the root is one `{ element: payload }` object.
|
|
135
|
+
*/
|
|
136
|
+
export declare function rootFrameHeight(template: unknown): number | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* A mounted variant.
|
|
139
|
+
*
|
|
140
|
+
* State changes go through the setters, which compute the dependencies that
|
|
141
|
+
* moved and re-run only the sites that read them. Nothing here re-walks the
|
|
142
|
+
* tree.
|
|
143
|
+
*/
|
|
144
|
+
export declare class SduiSurface {
|
|
145
|
+
#private;
|
|
146
|
+
readonly root: Node;
|
|
147
|
+
/** The root's height in an inline mount; undefined for a sheet. */
|
|
148
|
+
readonly inlineHeight?: number;
|
|
149
|
+
constructor(root: Node, tree: CompiledTree, ctx: SduiEvaluationContext, stateActions?: Readonly<Record<string, {
|
|
150
|
+
onEnter?: SduiAction;
|
|
151
|
+
}>>, analytics?: (event: SduiAnalyticsEvent) => void, extractColor?: (url: string) => Promise<string | null>, inlineHeight?: number, motion?: MotionSheet);
|
|
152
|
+
/** Take the surface out of the page, with its generated keyframes. */
|
|
153
|
+
destroy(): void;
|
|
154
|
+
/** Extract every offer logo's colour, as Swift does on first render. */
|
|
155
|
+
requestDominantColors(): void;
|
|
156
|
+
/**
|
|
157
|
+
* Hand a fact to the host's sink, and survive a sink that throws.
|
|
158
|
+
*
|
|
159
|
+
* The repo's rule is that analytics never blocks UX. A host callback that
|
|
160
|
+
* throws must not take the state machine with it, so the write has already
|
|
161
|
+
* happened by the time this runs.
|
|
162
|
+
*/
|
|
163
|
+
report(event: SduiAnalyticsEvent): void;
|
|
164
|
+
get context(): SduiEvaluationContext;
|
|
165
|
+
/** The action a state declares for being entered, or undefined. */
|
|
166
|
+
onEnter(state: string): SduiAction | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Move to a state, and hand back the action it declares for being entered.
|
|
169
|
+
*
|
|
170
|
+
* The engine does NOT run it, exactly as Swift's `setState` does not: it
|
|
171
|
+
* returns the action and the host decides. That matters, because the host has
|
|
172
|
+
* policy the engine cannot have. On a claim success Swift fires the success
|
|
173
|
+
* state's `onEnter` WITHOUT transitioning to it
|
|
174
|
+
* (`OfferSheetViewModel.swift:1354-1359`), and an `onEnter` never counts as the
|
|
175
|
+
* user answering a question, because no tap happened.
|
|
176
|
+
*/
|
|
177
|
+
setState(state: string): SduiAction | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* A text field's keystroke, as Swift writes it: the value with no analytics
|
|
180
|
+
* event (it can be an email address), and `<key>Error` removed on edit.
|
|
181
|
+
*/
|
|
182
|
+
editValue(key: string, value: string): void;
|
|
183
|
+
setValue(key: string, value: string): void;
|
|
184
|
+
/**
|
|
185
|
+
* Move what the sheet is focused on, and publish the offer it lands on.
|
|
186
|
+
*
|
|
187
|
+
* Writing only `currentIndex` was the bug Swift's own comment
|
|
188
|
+
* (`SDUIContext.swift:441-444`) describes: the carousel moves while
|
|
189
|
+
* `${selectedAdvertiserName}` and `selectedOfferId` stay on the card the user
|
|
190
|
+
* scrolled away from, so the CTA names one advertiser and the claim targets
|
|
191
|
+
* another. `scopedOfferId` is selection-first, so a claim after an advance hit
|
|
192
|
+
* the OLD offer.
|
|
193
|
+
*
|
|
194
|
+
* An out-of-range index is a no-op, as it is in Swift.
|
|
195
|
+
*/
|
|
196
|
+
setOfferIndex(index: number, targetKey?: string): void;
|
|
197
|
+
/**
|
|
198
|
+
* Move an offer to `index`, reordering the list the rows are keyed against.
|
|
199
|
+
*
|
|
200
|
+
* An unknown id, an unchanged position and an empty list are all no-ops, and
|
|
201
|
+
* the target is clamped into range. `promoteToIndex` rides `selectOffer`, so
|
|
202
|
+
* this runs first and `selectOffer` then finds the offer where the user will
|
|
203
|
+
* see it.
|
|
204
|
+
*/
|
|
205
|
+
promoteOffer(offerId: string, index: number): void;
|
|
206
|
+
/**
|
|
207
|
+
* Commit to an offer: write the whole selection snapshot AND re-centre.
|
|
208
|
+
*
|
|
209
|
+
* Both halves are load bearing, and writing only the id was wrong twice over.
|
|
210
|
+
* Swift's `writeSelectionValues` (`SDUIContext.swift:387`) publishes the
|
|
211
|
+
* advertiser, logo, description, perk and free-trial flag, which is what
|
|
212
|
+
* `${selectedAdvertiserName}` and the free-trial copy gates read. And moving
|
|
213
|
+
* `currentIndex` is what Android's `selectOffer` carries Swift's comment
|
|
214
|
+
* about: without it a tap wrote the selection while the centred card stayed
|
|
215
|
+
* put, so the CTA named one advertiser and the claim button targeted another.
|
|
216
|
+
*
|
|
217
|
+
* `selectedOfferIsFreeTrial` publishes "false" when the backend labelled
|
|
218
|
+
* nothing. Never promise a free month the offer does not carry.
|
|
219
|
+
*/
|
|
220
|
+
selectOffer(offerId: string, targetKey?: string): void;
|
|
221
|
+
/**
|
|
222
|
+
* The mount-time selection, which is NOT a user choice and reports nothing.
|
|
223
|
+
*
|
|
224
|
+
* `initialSelection: "first"` pre-seeds the selection keys so
|
|
225
|
+
* `${selectedAdvertiserName}` resolves on the first frame. Swift seeds it the
|
|
226
|
+
* same way, through the direct write, because at that point no user has acted
|
|
227
|
+
* and it has no `presentationId` yet (`SDUIContext.swift:380-385`). Routing it
|
|
228
|
+
* through `selectOffer` would open every presentation with a selection event
|
|
229
|
+
* nobody made.
|
|
230
|
+
*/
|
|
231
|
+
seedSelection(offerId: string, targetKey?: string): void;
|
|
232
|
+
setOffers(offers: readonly HostOffer[]): void;
|
|
233
|
+
/** Trigger mounts: replace the host's lists, re-running every row and count that reads them. */
|
|
234
|
+
setLists(lists: Readonly<Record<string, readonly SduiHostListItem[]>>): void;
|
|
235
|
+
/**
|
|
236
|
+
* Trigger mounts: advance the clock. Re-runs only the sites that read time
|
|
237
|
+
* (`countdown`, `progress`); the host owns the interval and when to call it.
|
|
238
|
+
*/
|
|
239
|
+
setNow(now: number): void;
|
|
240
|
+
/** Trigger mounts: replace the host's time keys, as `setNow` re-running only what reads time. */
|
|
241
|
+
setTimes(times: Readonly<Record<string, number>>): void;
|
|
242
|
+
/**
|
|
243
|
+
* Trigger mounts: the host's motion flags. `data-paused` on the root mirrors
|
|
244
|
+
* `paused`, and every loop and marquee re-reads both.
|
|
245
|
+
*/
|
|
246
|
+
setMotion(motion: {
|
|
247
|
+
readonly paused: boolean;
|
|
248
|
+
readonly reduce: boolean;
|
|
249
|
+
}): void;
|
|
250
|
+
/** Re-run everything. For a wholesale context swap, not for a single change. */
|
|
251
|
+
refresh(): void;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Why a served template cannot render on web, or undefined: the checks
|
|
255
|
+
* `mountSduiSurface` runs. Read before a presentation is stamped.
|
|
256
|
+
*/
|
|
257
|
+
export declare function templateRejection(raw: unknown): string | undefined;
|
|
258
|
+
/**
|
|
259
|
+
* Decode, compile and mount a served template.
|
|
260
|
+
*
|
|
261
|
+
* Returns `undefined` on ANY failure, so the caller keeps its hard-coded
|
|
262
|
+
* surface. The reason is logged, never thrown.
|
|
263
|
+
*/
|
|
264
|
+
export declare function mountSduiSurface(options: SduiSurfaceOptions): SduiSurface | undefined;
|
|
265
|
+
/**
|
|
266
|
+
* Display order from ORIGINAL indices, as Swift's `applyOfferDisplayOrder`: each
|
|
267
|
+
* valid, unused index in turn, then every offer not listed, in original order.
|
|
268
|
+
*/
|
|
269
|
+
export declare function applyOfferDisplayOrder<T>(order: readonly number[] | undefined, offers: readonly T[]): T[];
|
|
270
|
+
/** Swift's `SDUIInitialSelection.resolvedIndex`; any other value rejects the config. */
|
|
271
|
+
export declare function initialSelectionIndex(raw: unknown, count: number): number | undefined;
|
|
272
|
+
/** Re-exported so a host need not reach into the engine's internals. */
|
|
273
|
+
export type { SduiTextDefaults, TextEnvironment, ActionHost };
|
|
274
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/sdui/host.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C,OAAO,KAAK,EACV,qBAAqB,EAErB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAc1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO/C,gEAAgE;AAChE,MAAM,WAAW,SAAS;IACxB,EAAE,EAA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MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IAQ/E,gFAAgF;IAChF,OAAO,IAAI,IAAI;CAQhB;AAUD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAclE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,kBAAkB,GAC1B,WAAW,GAAG,SAAS,CAoMzB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EACpC,MAAM,EAAE,SAAS,CAAC,EAAE,GACnB,CAAC,EAAE,CAaL;AAED,wFAAwF;AACxF,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAYpB;AAqID,wEAAwE;AACxE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `*marked*` inline markup, ported from Swift's `SDUIInlineMarkup`.
|
|
3
|
+
*
|
|
4
|
+
* A single asterisk rather than markdown's `**`, because the copy is written by
|
|
5
|
+
* humans in a CMS field, not by a markdown author.
|
|
6
|
+
*
|
|
7
|
+
* Deliberately conservative. This runs on publisher-authored copy, so the
|
|
8
|
+
* failure mode has to be "renders as typed", never "eats the sentence":
|
|
9
|
+
*
|
|
10
|
+
* - An unmatched marker is literal: `"5 * 3"` stays `"5 * 3"`.
|
|
11
|
+
* - An empty pair `**` contributes nothing but is still consumed.
|
|
12
|
+
* - Nesting is not a concept; the first close ends the run.
|
|
13
|
+
*
|
|
14
|
+
* Returns one un-highlighted run when there is nothing to mark, which lets the
|
|
15
|
+
* caller treat "no markup" and "no highlightColor" as the same path.
|
|
16
|
+
*/
|
|
17
|
+
export interface MarkupRun {
|
|
18
|
+
readonly text: string;
|
|
19
|
+
readonly isHighlighted: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function parseInlineMarkup(text: string): MarkupRun[];
|
|
22
|
+
//# sourceMappingURL=inlineMarkup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inlineMarkup.d.ts","sourceRoot":"","sources":["../../src/sdui/inlineMarkup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAID,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,CAiC3D"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Look values: an app's own words and numbers in a trigger's look, as
|
|
3
|
+
* `${values.K}` (trigger vocabulary §2.2). The look declares a default for every key
|
|
4
|
+
* it uses in a root `values` block; the app may pass its own on the mount. They are
|
|
5
|
+
* filled on the device and never leave it: no request, event, log or store.
|
|
6
|
+
*
|
|
7
|
+
* One rule set for the strict pre-check (the look's defaults) and the host (the
|
|
8
|
+
* mount's values), the same on every platform.
|
|
9
|
+
*/
|
|
10
|
+
/** A value key: what follows `values.`. */
|
|
11
|
+
export declare const LOOK_VALUE_KEY: RegExp;
|
|
12
|
+
/** At most this many keys, in the look's defaults and on a mount. */
|
|
13
|
+
export declare const MAX_LOOK_VALUES = 16;
|
|
14
|
+
/** At most this many characters in one value. */
|
|
15
|
+
export declare const MAX_LOOK_VALUE_LENGTH = 64;
|
|
16
|
+
/** The token prefix. */
|
|
17
|
+
export declare const LOOK_VALUE_PREFIX = "values.";
|
|
18
|
+
/**
|
|
19
|
+
* The text slots' names (triggers/host/textSlots.ts): set with their own options, never a
|
|
20
|
+
* value key, on a look or on a mount.
|
|
21
|
+
*/
|
|
22
|
+
export declare const TEXT_SLOT_NAMES: readonly string[];
|
|
23
|
+
/** Plain text a value may hold: 1 to 64 characters, no `${`, newline or control character. */
|
|
24
|
+
export declare function isPlainValue(value: unknown): value is string;
|
|
25
|
+
/** A look's own default: plain, and digits and punctuation only. */
|
|
26
|
+
export declare function isLookDefault(value: unknown): value is string;
|
|
27
|
+
/**
|
|
28
|
+
* The values a mount passed, as the look may use them: each entry checked on its own
|
|
29
|
+
* (a bad key or value is dropped, so the look's default shows), then the first 16
|
|
30
|
+
* keys in code-point order. `dropped` hears each dropped key, never its value.
|
|
31
|
+
*/
|
|
32
|
+
export declare function mountLookValues(raw: unknown, dropped?: (key: string) => void): Readonly<Record<string, string>>;
|
|
33
|
+
/** A look's `values` defaults, already through the pre-check; anything unusable is skipped. */
|
|
34
|
+
export declare function lookValueDefaults(template: unknown): Readonly<Record<string, string>>;
|
|
35
|
+
/** Every `${values.K}` key in `text`. */
|
|
36
|
+
export declare function lookValueKeysIn(text: string): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Fill one look string, in one pass that is never rescanned: `${values.K}` from
|
|
39
|
+
* `values` (the mount's over the look's defaults), and the host's `advertiserName`
|
|
40
|
+
* and `claimCount`. Any other token is left for the engine. A string that still holds
|
|
41
|
+
* a `${values.` token (a translation that lost its default) becomes `fallback` (the
|
|
42
|
+
* built-in English for that key), else empty: never a raw token, drawn or spoken.
|
|
43
|
+
*/
|
|
44
|
+
export declare function fillLookString(text: string, values: Readonly<Record<string, string>>, host: Readonly<{
|
|
45
|
+
advertiserName?: string;
|
|
46
|
+
claimCount?: string;
|
|
47
|
+
}>, fallback?: string): string;
|
|
48
|
+
/** Every string the look declares (`template.strings`), as served. */
|
|
49
|
+
export declare function lookStringsOf(template: unknown): Readonly<Record<string, string>>;
|
|
50
|
+
//# sourceMappingURL=lookValues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookValues.d.ts","sourceRoot":"","sources":["../../src/sdui/lookValues.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;A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