@peekling/runtime 0.1.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.
Files changed (120) hide show
  1. package/AUTHORS +8 -0
  2. package/LICENSE +202 -0
  3. package/LICENSING.md +20 -0
  4. package/NOTICE +6 -0
  5. package/README.md +294 -0
  6. package/dist/configuration-validation.d.ts +19 -0
  7. package/dist/configuration-validation.d.ts.map +1 -0
  8. package/dist/configuration-validation.js +298 -0
  9. package/dist/content.d.ts +44 -0
  10. package/dist/content.d.ts.map +1 -0
  11. package/dist/content.js +738 -0
  12. package/dist/contracts.d.ts +10 -0
  13. package/dist/contracts.d.ts.map +1 -0
  14. package/dist/contracts.js +106 -0
  15. package/dist/defaults.d.ts +7 -0
  16. package/dist/defaults.d.ts.map +1 -0
  17. package/dist/defaults.js +6 -0
  18. package/dist/diagnostics.d.ts +25 -0
  19. package/dist/diagnostics.d.ts.map +1 -0
  20. package/dist/diagnostics.js +122 -0
  21. package/dist/direction.d.ts +3 -0
  22. package/dist/direction.d.ts.map +1 -0
  23. package/dist/direction.js +6 -0
  24. package/dist/errors.d.ts +15 -0
  25. package/dist/errors.d.ts.map +1 -0
  26. package/dist/errors.js +53 -0
  27. package/dist/events.d.ts +5 -0
  28. package/dist/events.d.ts.map +1 -0
  29. package/dist/events.js +60 -0
  30. package/dist/index.d.ts +6 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +3 -0
  33. package/dist/input.d.ts +31 -0
  34. package/dist/input.d.ts.map +1 -0
  35. package/dist/input.js +215 -0
  36. package/dist/json.d.ts +3 -0
  37. package/dist/json.d.ts.map +1 -0
  38. package/dist/json.js +109 -0
  39. package/dist/loader.d.ts +33 -0
  40. package/dist/loader.d.ts.map +1 -0
  41. package/dist/loader.js +477 -0
  42. package/dist/locomotion.d.ts +8 -0
  43. package/dist/locomotion.d.ts.map +1 -0
  44. package/dist/locomotion.js +29 -0
  45. package/dist/normalized.d.ts +5 -0
  46. package/dist/normalized.d.ts.map +1 -0
  47. package/dist/normalized.js +266 -0
  48. package/dist/overrides.d.ts +29 -0
  49. package/dist/overrides.d.ts.map +1 -0
  50. package/dist/overrides.js +296 -0
  51. package/dist/own-data.d.ts +18 -0
  52. package/dist/own-data.d.ts.map +1 -0
  53. package/dist/own-data.js +205 -0
  54. package/dist/pack-api.d.ts +9 -0
  55. package/dist/pack-api.d.ts.map +1 -0
  56. package/dist/pack-api.js +6 -0
  57. package/dist/pack-shared.d.ts +28 -0
  58. package/dist/pack-shared.d.ts.map +1 -0
  59. package/dist/pack-shared.js +408 -0
  60. package/dist/pack.d.ts +6 -0
  61. package/dist/pack.d.ts.map +1 -0
  62. package/dist/pack.js +316 -0
  63. package/dist/peekling.css +1 -0
  64. package/dist/peekling.css.sri +1 -0
  65. package/dist/peekling.js +7469 -0
  66. package/dist/peekling.js.sri +1 -0
  67. package/dist/peekling.min.js +2 -0
  68. package/dist/peekling.min.js.sri +1 -0
  69. package/dist/plan-compiler.d.ts +82 -0
  70. package/dist/plan-compiler.d.ts.map +1 -0
  71. package/dist/plan-compiler.js +724 -0
  72. package/dist/plan.d.ts +21 -0
  73. package/dist/plan.d.ts.map +1 -0
  74. package/dist/plan.js +287 -0
  75. package/dist/preflight-api.d.ts +3 -0
  76. package/dist/preflight-api.d.ts.map +1 -0
  77. package/dist/preflight-api.js +1 -0
  78. package/dist/preflight.d.ts +22 -0
  79. package/dist/preflight.d.ts.map +1 -0
  80. package/dist/preflight.js +158 -0
  81. package/dist/registry.d.ts +9 -0
  82. package/dist/registry.d.ts.map +1 -0
  83. package/dist/registry.js +24 -0
  84. package/dist/renderer.d.ts +16 -0
  85. package/dist/renderer.d.ts.map +1 -0
  86. package/dist/renderer.js +176 -0
  87. package/dist/resolver.d.ts +3 -0
  88. package/dist/resolver.d.ts.map +1 -0
  89. package/dist/resolver.js +30 -0
  90. package/dist/runtime-diagnostics.d.ts +3 -0
  91. package/dist/runtime-diagnostics.d.ts.map +1 -0
  92. package/dist/runtime-diagnostics.js +5 -0
  93. package/dist/runtime-validation.d.ts +6 -0
  94. package/dist/runtime-validation.d.ts.map +1 -0
  95. package/dist/runtime-validation.js +104 -0
  96. package/dist/runtime.d.ts +87 -0
  97. package/dist/runtime.d.ts.map +1 -0
  98. package/dist/runtime.js +1015 -0
  99. package/dist/sections.d.ts +15 -0
  100. package/dist/sections.d.ts.map +1 -0
  101. package/dist/sections.js +221 -0
  102. package/dist/styles.d.ts +18 -0
  103. package/dist/styles.d.ts.map +1 -0
  104. package/dist/styles.js +132 -0
  105. package/dist/tooling-preflight.d.ts +23 -0
  106. package/dist/tooling-preflight.d.ts.map +1 -0
  107. package/dist/tooling-preflight.js +207 -0
  108. package/dist/tooling-validation.d.ts +8 -0
  109. package/dist/tooling-validation.d.ts.map +1 -0
  110. package/dist/tooling-validation.js +94 -0
  111. package/dist/types.d.ts +403 -0
  112. package/dist/types.d.ts.map +1 -0
  113. package/dist/types.js +29 -0
  114. package/dist/visibility.d.ts +12 -0
  115. package/dist/visibility.d.ts.map +1 -0
  116. package/dist/visibility.js +333 -0
  117. package/dist/web-component.d.ts +31 -0
  118. package/dist/web-component.d.ts.map +1 -0
  119. package/dist/web-component.js +236 -0
  120. package/package.json +74 -0
@@ -0,0 +1,94 @@
1
+ export function toolingDiagnostic(code, path, detail) {
2
+ const field = path.slice(path.lastIndexOf(".") + 1);
3
+ const diagnostic = (message, fix) => ({
4
+ code,
5
+ path,
6
+ message,
7
+ fix,
8
+ });
9
+ switch (code) {
10
+ case "manifest.selection":
11
+ return diagnostic("Select an explicit character, packUrl, or Pack", "Set character, packUrl, or pack");
12
+ case "unknown-field":
13
+ return diagnostic(`Unknown field ${detail ?? field}`, "Remove this field");
14
+ case "unsupported-format":
15
+ return diagnostic("Options format must be 1", "Use format 1");
16
+ case "invalid-character":
17
+ return diagnostic("character must be a bounded lowercase ID", "Use a lowercase ID");
18
+ case "character.unknown":
19
+ return diagnostic(`Unknown Peekling character: ${detail ?? ""}`.trim(), "Use a character included in the runtime registry");
20
+ case "out-of-range":
21
+ return diagnostic("scale must be an integer from 1 through 4", "Use 1 through 4");
22
+ case "invalid-density":
23
+ return diagnostic(`${detail ?? field} must be 1, 2, or 4`, "Use 1, 2, or 4");
24
+ case "incompatible-density":
25
+ return diagnostic("density cannot exceed maxDensity", "Raise maxDensity or lower density");
26
+ case "atlas.max-density":
27
+ return diagnostic(detail === "single"
28
+ ? "Single atlas density exceeds maxDensity"
29
+ : "No declared atlas variant is at or below maxDensity", detail === "single"
30
+ ? "Raise maxDensity or use a lower-density Pack"
31
+ : "Raise maxDensity or add a matching lower-density atlas variant");
32
+ case "atlas.override-density":
33
+ return diagnostic(detail === "single"
34
+ ? "density must match the single atlas density"
35
+ : detail === "missing"
36
+ ? "atlasUrl with variants requires an explicit density"
37
+ : "atlasUrl density must name a declared variant at or below maxDensity", detail === "single"
38
+ ? "Match the Pack atlas density or remove density"
39
+ : "Set density to an available atlas variant");
40
+ case "invalid-name":
41
+ return diagnostic("name must be true, false, or short plain text", "Use true, false, or 1-80 plain characters");
42
+ case "invalid-url":
43
+ return diagnostic(`${detail ?? field} must be a relative path or absolute HTTPS URL`, "Use a relative path or HTTPS URL");
44
+ case "invalid-position":
45
+ return diagnostic("position must be a preset or bounded point with finite coordinates from -100000 through 100000", "Use a preset or bounded x and y values");
46
+ case "invalid-styles":
47
+ return diagnostic(detail ?? "styles must be an object", "Pass an external stylesheet URL and optional SRI hash");
48
+ case "invalid-styles-url":
49
+ return diagnostic("styles.url must be a relative path or absolute HTTPS URL", "Use a relative path or allowed pinned HTTPS URL");
50
+ case "invalid-styles-integrity":
51
+ return diagnostic("styles.integrity must be one SRI hash", "Use the release-provided stylesheet SRI value");
52
+ case "invalid-content":
53
+ return diagnostic(detail ?? "content is invalid", "Fix the named content surface");
54
+ case "invalid-bindings":
55
+ return diagnostic(path === "$.bindings"
56
+ ? "bindings must be an object"
57
+ : `${detail ?? field} must be a registry object`, "Pass a bounded mount registry");
58
+ case "binding-limit":
59
+ return diagnostic(`${detail ?? field} exceeds 64 entries`, "Reduce the mount registry");
60
+ case "invalid-binding":
61
+ return diagnostic("Mount binding is invalid", "Use a bounded ID and function value");
62
+ case "missing-binding":
63
+ return diagnostic(`Unknown mount binding ${detail ?? ""}`.trim(), "Register the mount binding");
64
+ case "invalid-theme":
65
+ if (path === "$.theme") {
66
+ return diagnostic("theme must be an object", "Pass theme tokens");
67
+ }
68
+ if (["background", "color", "linkColor", "borderColor"].includes(field)) {
69
+ return diagnostic(`${field} must be transparent or a 3, 4, 6, or 8 digit hex color`, "Use transparent or a supported hex color");
70
+ }
71
+ return diagnostic(`${field} is outside its supported range`, "Use the documented CSS pixel range");
72
+ case "invalid-diagnostics":
73
+ return diagnostic(path === "$.diagnostics"
74
+ ? "diagnostics must be an object"
75
+ : `${detail ?? field} must be boolean`, "Pass bounded diagnostics options");
76
+ case "invalid-diagnostic-context":
77
+ return diagnostic(path === "$.diagnostics.context"
78
+ ? "Diagnostic context must be an object"
79
+ : "Diagnostic context needs bounded scalars", "Use up to 16 bounded scalar fields");
80
+ case "diagnostic-context-limit":
81
+ return diagnostic("Diagnostic context exceeds 16 fields", "Keep up to 16 bounded fields");
82
+ case "invalid-accessibility":
83
+ if (path === "$.accessibility") {
84
+ return diagnostic("accessibility must be an object", "Pass accessibility options");
85
+ }
86
+ return field === "announceContent"
87
+ ? diagnostic("announceContent must be boolean", "Use a boolean")
88
+ : diagnostic("contentLabel must be short plain text", "Use 1-120 plain characters");
89
+ case "invalid-callback":
90
+ return diagnostic(`${detail ?? field} must be a function`, "Pass a JavaScript callback");
91
+ default:
92
+ return diagnostic(detail ?? code, "Fix this field");
93
+ }
94
+ }
@@ -0,0 +1,403 @@
1
+ export declare const NATIVE_CELL_SIZE = 32;
2
+ export declare const NATIVE_LOGICAL_SIZES: readonly [32, 64];
3
+ export type NativeLogicalSize = (typeof NATIVE_LOGICAL_SIZES)[number];
4
+ export declare const NATIVE_COLUMNS = 16;
5
+ export declare const NATIVE_DENSITIES: readonly [1, 2, 4];
6
+ export type NativeDensity = (typeof NATIVE_DENSITIES)[number];
7
+ export declare const NATIVE_DIRECTIONS: readonly ["N", "NE", "E", "SE", "S", "SW", "W", "NW"];
8
+ export type Direction = (typeof NATIVE_DIRECTIONS)[number];
9
+ interface StateDefinitionBase {
10
+ frames: number[];
11
+ loop: boolean;
12
+ }
13
+ export type StateDefinition = (StateDefinitionBase & {
14
+ fps: number;
15
+ durations?: never;
16
+ }) | (StateDefinitionBase & {
17
+ durations: number[];
18
+ fps?: never;
19
+ });
20
+ export interface NativeManifest {
21
+ format: 1;
22
+ name: string;
23
+ version: string;
24
+ license: string;
25
+ metadata: {
26
+ title?: string;
27
+ author?: string;
28
+ description: string;
29
+ tags?: string[];
30
+ };
31
+ assets: {
32
+ atlas: {
33
+ src: string;
34
+ sha256: string;
35
+ columns: 16;
36
+ rows: number;
37
+ density?: NativeDensity;
38
+ logicalCellSize?: NativeLogicalSize;
39
+ sourceCellSize?: number;
40
+ };
41
+ } | {
42
+ atlases: {
43
+ columns: 16;
44
+ rows: number;
45
+ logicalCellSize: NativeLogicalSize;
46
+ lineage: string;
47
+ variants: Array<{
48
+ src: string;
49
+ density: NativeDensity;
50
+ sourceCellSize: number;
51
+ sha256: string;
52
+ }>;
53
+ };
54
+ };
55
+ states: Record<string, StateDefinition>;
56
+ capabilities?: {
57
+ locomotion?: LocomotionCapability;
58
+ };
59
+ defaults?: {
60
+ scale?: number;
61
+ };
62
+ }
63
+ export interface LocomotionKeyframe {
64
+ at: number;
65
+ advance: number;
66
+ lift: number;
67
+ }
68
+ export interface LocomotionCapability {
69
+ directions: Record<Direction, string>;
70
+ motion?: {
71
+ keyframes: LocomotionKeyframe[];
72
+ };
73
+ }
74
+ export interface AtlasGeometry {
75
+ width: number;
76
+ height: number;
77
+ byteLength?: number;
78
+ }
79
+ /**
80
+ * Stable, serializable adapter IR. This is an adapter output contract, not a
81
+ * character authoring format. Validation is mandatory at the runtime boundary.
82
+ */
83
+ export interface NormalizedPack {
84
+ name: string;
85
+ displayName: string;
86
+ version: string;
87
+ license: string;
88
+ atlas: {
89
+ src: string;
90
+ sha256?: string;
91
+ columns: number;
92
+ rows: number;
93
+ cellWidth: number;
94
+ cellHeight: number;
95
+ logicalWidth?: number;
96
+ logicalHeight?: number;
97
+ density?: NativeDensity;
98
+ lineage?: string;
99
+ variants?: ReadonlyArray<{
100
+ src: string;
101
+ density: NativeDensity;
102
+ cellWidth: number;
103
+ cellHeight: number;
104
+ sha256: string;
105
+ }>;
106
+ };
107
+ states: Record<string, StateDefinition>;
108
+ defaultScale: number;
109
+ directionalStates?: Partial<Record<Direction, string>>;
110
+ locomotionMotion?: ReadonlyArray<Readonly<LocomotionKeyframe>>;
111
+ reactionStates?: Readonly<Record<string, string>>;
112
+ /** Opaque JSON provenance. The engine never interprets this field. */
113
+ source?: Readonly<Record<string, JsonValue>>;
114
+ }
115
+ export interface Point {
116
+ x: number;
117
+ y: number;
118
+ }
119
+ export declare const PLAN_BROWSER_EVENTS: readonly ["pointer.click", "pointer.move", "document.visibility", "window.focus", "window.scroll", "section.visibility", "page.lifecycle"];
120
+ export type PlanBrowserEvent = (typeof PLAN_BROWSER_EVENTS)[number];
121
+ export type PlanEventSource = "browser" | "application";
122
+ export type PlanDisposition = "update" | "replace" | "ignore" | "interrupt";
123
+ export type PlanCapability = "locomotion";
124
+ export type PlanChannel = "motion" | "state" | `surface:${string}`;
125
+ export type PlanEventCoalescing = "latest";
126
+ export type PlanInterruptLifetime = {
127
+ type: "duration";
128
+ ms: number;
129
+ } | {
130
+ type: "event";
131
+ /** Application Event or discrete browser Event. Continuous observations are rejected. */
132
+ name: string;
133
+ timeout?: number;
134
+ };
135
+ type PlanDiscreteCondition = {
136
+ source: "application";
137
+ event: string;
138
+ coalesce?: PlanEventCoalescing;
139
+ } | {
140
+ source: "browser";
141
+ event: Exclude<PlanBrowserEvent, "pointer.move" | "section.visibility" | "window.scroll">;
142
+ coalesce?: never;
143
+ } | {
144
+ source: "browser";
145
+ event: "window.scroll";
146
+ coalesce?: PlanEventCoalescing;
147
+ } | {
148
+ source: "browser";
149
+ event: "section.visibility";
150
+ selector: string;
151
+ phase: "enter" | "leave";
152
+ threshold?: number;
153
+ coalesce?: never;
154
+ };
155
+ type PlanContinuousCondition = {
156
+ source: "browser";
157
+ event: "pointer.move";
158
+ coalesce?: never;
159
+ } | {
160
+ source: "browser";
161
+ event: "section.visibility";
162
+ selector: string;
163
+ phase: "while-visible";
164
+ threshold?: number;
165
+ coalesce?: never;
166
+ };
167
+ export type PlanCondition = PlanDiscreteCondition | PlanContinuousCondition;
168
+ export type PlanStateSelection = {
169
+ state: string;
170
+ } | {
171
+ capability: PlanCapability;
172
+ };
173
+ export interface PlanMotionEffect {
174
+ type: "follow-pointer";
175
+ speed?: number;
176
+ arrivalRadius?: number;
177
+ }
178
+ export interface PlanSurfaceOrdering {
179
+ sessionField: string;
180
+ revisionField?: string;
181
+ terminal?: boolean;
182
+ }
183
+ export interface PlanSurfaceEffect {
184
+ id: string;
185
+ contentId: string;
186
+ data?: JsonValue | "event-payload";
187
+ disposition?: PlanDisposition;
188
+ ordering?: PlanSurfaceOrdering;
189
+ }
190
+ export interface PlanEffect {
191
+ channels: readonly PlanChannel[];
192
+ state?: PlanStateSelection;
193
+ motion?: PlanMotionEffect;
194
+ surfaces?: readonly PlanSurfaceEffect[];
195
+ /** Required bounded ending behavior for a declarative interrupt Effect. */
196
+ until?: PlanInterruptLifetime;
197
+ }
198
+ interface PlanContinuousEffect {
199
+ channels: readonly PlanChannel[];
200
+ state?: PlanStateSelection;
201
+ motion?: PlanMotionEffect;
202
+ surfaces?: never;
203
+ until?: never;
204
+ }
205
+ export interface PlanBaselineSurfaceEffect {
206
+ id: string;
207
+ contentId: string;
208
+ data?: JsonValue;
209
+ disposition?: Exclude<PlanDisposition, "interrupt">;
210
+ ordering?: never;
211
+ }
212
+ export interface PlanBaselineEffect {
213
+ channels: readonly PlanChannel[];
214
+ state: PlanStateSelection;
215
+ motion?: PlanMotionEffect;
216
+ surfaces?: readonly PlanBaselineSurfaceEffect[];
217
+ until?: never;
218
+ }
219
+ export type PlanRule = {
220
+ id: string;
221
+ when: PlanDiscreteCondition;
222
+ effect: PlanEffect;
223
+ } | {
224
+ id: string;
225
+ when: PlanContinuousCondition;
226
+ effect: PlanContinuousEffect;
227
+ };
228
+ /** Canonical 0.1 Plan input compiled by the bounded runtime compiler. */
229
+ export interface Plan {
230
+ baseline: PlanBaselineEffect;
231
+ rules?: readonly PlanRule[];
232
+ }
233
+ export declare const CONTENT_REGIONS: readonly ["top-left", "top-center", "top-right", "bottom"];
234
+ export type ContentRegion = (typeof CONTENT_REGIONS)[number];
235
+ export interface HostSurfaceMountContext {
236
+ surfaceId: string;
237
+ contentId: string;
238
+ region: ContentRegion;
239
+ root: HTMLElement;
240
+ data?: JsonValue;
241
+ signal: AbortSignal;
242
+ emit(name: string, payload?: unknown): EmitResult;
243
+ }
244
+ export interface HostSurfaceMountResult {
245
+ /** Optional own data function. Accessor properties are rejected. */
246
+ update?(data: JsonValue | undefined): void | PromiseLike<void>;
247
+ /** Required own data function. Accessor properties are rejected. */
248
+ cleanup(): void | PromiseLike<void>;
249
+ }
250
+ export type HostSurfaceMount = (context: Readonly<HostSurfaceMountContext>) => HostSurfaceMountResult | PromiseLike<HostSurfaceMountResult>;
251
+ export interface HostContentSurfaceFields {
252
+ title?: string;
253
+ text?: string;
254
+ /** Safe label with a semantically validated relative or HTTPS destination. */
255
+ link?: {
256
+ label: string;
257
+ href: string;
258
+ };
259
+ mountId?: string;
260
+ announce?: boolean;
261
+ }
262
+ export type HostContentSurface = HostContentSurfaceFields & ({
263
+ title: string;
264
+ } | {
265
+ text: string;
266
+ } | {
267
+ link: {
268
+ label: string;
269
+ href: string;
270
+ };
271
+ } | {
272
+ mountId: string;
273
+ });
274
+ export interface HostBindings {
275
+ mounts?: Readonly<Record<string, HostSurfaceMount>>;
276
+ }
277
+ export interface SurfaceTheme {
278
+ /** Lowercase `transparent` or a 3, 4, 6, or 8 digit hex color. */
279
+ background?: "transparent" | `#${string}`;
280
+ color?: "transparent" | `#${string}`;
281
+ linkColor?: "transparent" | `#${string}`;
282
+ borderColor?: "transparent" | `#${string}`;
283
+ radius?: number;
284
+ width?: number;
285
+ padding?: number;
286
+ }
287
+ export type DiagnosticSeverity = "debug" | "info" | "warning" | "error";
288
+ export interface DiagnosticRecord {
289
+ code: string;
290
+ severity: DiagnosticSeverity;
291
+ message: string;
292
+ phase: "config" | "event" | "override" | "trigger" | "render" | "lifecycle" | "internal";
293
+ sequence: number;
294
+ timestamp: number;
295
+ instanceId: string;
296
+ overrideId?: string;
297
+ eventId?: number;
298
+ metadata?: Readonly<Record<string, string | number | boolean>>;
299
+ context?: Readonly<Record<string, string | number | boolean>>;
300
+ cause?: {
301
+ name: string;
302
+ message: string;
303
+ stack?: string;
304
+ };
305
+ }
306
+ export interface EmitResult {
307
+ accepted: boolean;
308
+ id?: number;
309
+ coalesced?: boolean;
310
+ reason?: "invalid-name" | "invalid-payload" | "queue-full" | "hidden" | "destroyed" | "not-ready";
311
+ }
312
+ export type OverrideLifetime = {
313
+ type: "duration";
314
+ ms: number;
315
+ } | {
316
+ type: "event";
317
+ name: string;
318
+ timeout?: number;
319
+ } | {
320
+ type: "manual";
321
+ maxMs?: number;
322
+ };
323
+ export interface OverrideInput {
324
+ effect: PlanEffect;
325
+ until?: OverrideLifetime;
326
+ mode?: "reject" | "replace";
327
+ }
328
+ export type OverrideCompletionReason = "event" | "timeout" | "cancelled" | "replaced" | "rejected" | "conflict" | "overflow" | "dismissed" | "destroyed";
329
+ export type OverrideStatus = "active" | "finished" | "rejected";
330
+ export interface OverrideResult {
331
+ id: string;
332
+ reason: OverrideCompletionReason;
333
+ }
334
+ export interface OverrideHandle {
335
+ id: string;
336
+ readonly status: OverrideStatus;
337
+ finished: Promise<OverrideResult>;
338
+ cancel(): void;
339
+ }
340
+ export type HostContentPrimitive = string | HostContentSurface;
341
+ type HostContentRegionMap = Readonly<Partial<Record<ContentRegion, HostContentPrimitive>>>;
342
+ export type HostContentItem = HostContentRegionMap & {
343
+ [Region in ContentRegion]: Readonly<Record<Region, HostContentPrimitive>>;
344
+ }[ContentRegion];
345
+ export type HostContent = Readonly<Record<string, HostContentItem>>;
346
+ export interface SectionSnapshot {
347
+ ratio: number;
348
+ previousRatio: number;
349
+ }
350
+ export interface ReactionEvent {
351
+ id: number;
352
+ source: PlanEventSource;
353
+ name: string;
354
+ at: number;
355
+ payload?: JsonValue;
356
+ }
357
+ export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
358
+ readonly [key: string]: JsonValue;
359
+ };
360
+ export interface World {
361
+ now: number;
362
+ pointer?: Point;
363
+ position: Point;
364
+ viewport: {
365
+ width: number;
366
+ height: number;
367
+ };
368
+ lastActivityAt: number;
369
+ reaction?: ReactionEvent;
370
+ reducedMotion: boolean;
371
+ pageVisible?: boolean;
372
+ sections?: Readonly<Record<string, SectionSnapshot>>;
373
+ }
374
+ export interface MotionRequest {
375
+ x: number;
376
+ y: number;
377
+ speed: number;
378
+ maxDistance?: number;
379
+ }
380
+ export interface BehaviorRequest {
381
+ state?: string;
382
+ capability?: PlanCapability;
383
+ motion?: MotionRequest;
384
+ lock?: number;
385
+ reactionId?: number;
386
+ contentId?: string;
387
+ content?: HostContentItem;
388
+ contentKey?: string;
389
+ contentData?: JsonValue;
390
+ surfaces?: readonly SurfacePresentation[];
391
+ }
392
+ export interface SurfacePresentation {
393
+ id: string;
394
+ channel: `surface:${string}`;
395
+ contentId: string;
396
+ data?: JsonValue;
397
+ key: string;
398
+ }
399
+ export interface ResolvedState {
400
+ name: string;
401
+ }
402
+ export {};
403
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,oBAAoB,YAAI,EA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;IACvB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,WAAW,MAAM,EAAE,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd"}
package/dist/types.js ADDED
@@ -0,0 +1,29 @@
1
+ export const NATIVE_CELL_SIZE = 32;
2
+ export const NATIVE_LOGICAL_SIZES = [32, 64];
3
+ export const NATIVE_COLUMNS = 16;
4
+ export const NATIVE_DENSITIES = [1, 2, 4];
5
+ export const NATIVE_DIRECTIONS = [
6
+ "N",
7
+ "NE",
8
+ "E",
9
+ "SE",
10
+ "S",
11
+ "SW",
12
+ "W",
13
+ "NW",
14
+ ];
15
+ export const PLAN_BROWSER_EVENTS = [
16
+ "pointer.click",
17
+ "pointer.move",
18
+ "document.visibility",
19
+ "window.focus",
20
+ "window.scroll",
21
+ "section.visibility",
22
+ "page.lifecycle",
23
+ ];
24
+ export const CONTENT_REGIONS = [
25
+ "top-left",
26
+ "top-center",
27
+ "top-right",
28
+ "bottom",
29
+ ];
@@ -0,0 +1,12 @@
1
+ import { type RuntimeStyleAsset } from "./styles.js";
2
+ export type PeeklingHideDuration = "10-minutes" | "1-hour" | "until-tomorrow" | "session" | "forever";
3
+ type VisibilityListener = (hidden: boolean | null) => void;
4
+ export declare function registerSiteVisibility(document: Document, window: Window, listener: VisibilityListener, styles: RuntimeStyleAsset): {
5
+ unregister(): void;
6
+ ready: Promise<void>;
7
+ };
8
+ export declare function hidePeekling(duration: PeeklingHideDuration, document?: Document, window?: Window): void;
9
+ export declare function showPeekling(document?: Document, window?: Window): void;
10
+ export declare function isPeeklingHidden(window?: Window): boolean;
11
+ export {};
12
+ //# sourceMappingURL=visibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../src/visibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,oBAAoB,GAC9B,YAAY,GAAG,QAAQ,GAAG,gBAAgB,GAAG,SAAS,GAAG,SAAS,CAAC;AAqBrE,KAAK,kBAAkB,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;AA2W3D,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,EAAE,iBAAiB,GACxB;IAAE,UAAU,IAAI,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAO9C;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,GAAE,QAA8B,EACxC,MAAM,GAAE,MAA0B,GACjC,IAAI,CAQN;AAED,wBAAgB,YAAY,CAC1B,QAAQ,GAAE,QAA8B,EACxC,MAAM,GAAE,MAA0B,GACjC,IAAI,CAQN;AAED,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,MAA0B,GAAG,OAAO,CAM5E"}