@rulecms/widget-svelte 0.6.0 → 0.8.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/dist/index.cjs +61 -16
- package/dist/index.d.ts +352 -24
- package/dist/index.js +3288 -2319
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -180,6 +180,19 @@ export declare interface BuildWidgetFetchUrlParams {
|
|
|
180
180
|
endpoint?: string;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Builds the ruleset resolve URL. The token, ruleset key and params travel in
|
|
185
|
+
* the POST body, so the URL carries no query string. Development tokens
|
|
186
|
+
* (`dev.…`) hit the draft resolve route; everything else uses the published one.
|
|
187
|
+
*/
|
|
188
|
+
export declare function buildWidgetResolveUrl({ token, endpoint, }: BuildWidgetResolveUrlParams): string;
|
|
189
|
+
|
|
190
|
+
export declare interface BuildWidgetResolveUrlParams {
|
|
191
|
+
token: string;
|
|
192
|
+
/** Optional override. Defaults by token: rulecms.com (dev) or widget-cache (published). */
|
|
193
|
+
endpoint?: string;
|
|
194
|
+
}
|
|
195
|
+
|
|
183
196
|
export declare interface ChildCollection {
|
|
184
197
|
publishedKey: string;
|
|
185
198
|
name: string;
|
|
@@ -191,6 +204,9 @@ export declare interface ChildCollection {
|
|
|
191
204
|
lastPublishedAt: string;
|
|
192
205
|
}
|
|
193
206
|
|
|
207
|
+
/** Drops the in-process published-widget cache. Tests call this between cases. */
|
|
208
|
+
export declare function clearPublishedWidgetFetchCache(): void;
|
|
209
|
+
|
|
194
210
|
/**
|
|
195
211
|
* A Cloudinary transformation component as an object, e.g.
|
|
196
212
|
* `{ c: 'fill', g: 'auto' }` serializes to `c_fill,g_auto`.
|
|
@@ -390,6 +406,13 @@ export declare const DEFAULT_CLOUDINARY_CLOUD_NAME = "rulecms";
|
|
|
390
406
|
*/
|
|
391
407
|
export declare const DEFAULT_LIBRARY_ID = "default";
|
|
392
408
|
|
|
409
|
+
/**
|
|
410
|
+
* How long a published-token GET stays in the in-process cache when the caller
|
|
411
|
+
* sets no cache policy. Svelte has no Next.js `next.revalidate`; this is the
|
|
412
|
+
* same 60-second default `@rulecms/widget-react` applies on the server.
|
|
413
|
+
*/
|
|
414
|
+
export declare const DEFAULT_PUBLISHED_WIDGET_CACHE_MS = 60000;
|
|
415
|
+
|
|
393
416
|
export declare const DEFAULT_ROW_GAP = "var(--sl-spacing-x-small)";
|
|
394
417
|
|
|
395
418
|
export declare type DefaultAttributeValue = {
|
|
@@ -420,6 +443,9 @@ export declare const DEV_CLIENT_TOKEN_PREFIX = "dev.";
|
|
|
420
443
|
/** Live draft client API path — no cache; reads the widget table directly. */
|
|
421
444
|
export declare const DEV_WIDGET_API_PATH = "/api/v1/c/dev/widget/get";
|
|
422
445
|
|
|
446
|
+
/** Live draft ruleset resolve path (POST) — compiles the draft ruleset in-process. */
|
|
447
|
+
export declare const DEV_WIDGET_RESOLVE_API_PATH = "/api/v1/c/dev/widget/resolve";
|
|
448
|
+
|
|
423
449
|
export declare type DeviceDisplayType = 'phone' | 'tablet' | 'desktop';
|
|
424
450
|
|
|
425
451
|
export declare const DeviceDisplayTypes: {
|
|
@@ -530,27 +556,56 @@ declare interface EditPlugin {
|
|
|
530
556
|
*/
|
|
531
557
|
export declare const EMBEDDED_KEY_SEPARATOR = "___";
|
|
532
558
|
|
|
533
|
-
/**
|
|
559
|
+
/**
|
|
560
|
+
* Fetch widget JSON on the server (or at build time) and return render-ready
|
|
561
|
+
* data. Pass `publishedKey` for one widget, or `rulesetPublishedKey` + `params`
|
|
562
|
+
* to let a ruleset choose (the result then carries `selection`).
|
|
563
|
+
*/
|
|
534
564
|
export declare function fetchRuleCMSWidget(params: FetchRuleCMSWidgetParams): Promise<RuleCMSWidgetData>;
|
|
535
565
|
|
|
566
|
+
declare interface FetchRuleCMSWidgetBaseParams {
|
|
567
|
+
token: string;
|
|
568
|
+
/**
|
|
569
|
+
* Optional API origin override. Omit in apps — defaults to rulecms.com for
|
|
570
|
+
* `dev.` tokens and widget-cache for published tokens.
|
|
571
|
+
*/
|
|
572
|
+
endpoint?: string;
|
|
573
|
+
/**
|
|
574
|
+
* Pass-through to `fetch`. Published-token GETs are cached in-process for
|
|
575
|
+
* 60 seconds unless `cache` is `no-store`, `reload`, or `no-cache`. `dev.`
|
|
576
|
+
* tokens always use `cache: 'no-store'` and are never cached here. A
|
|
577
|
+
* `rulesetPublishedKey` resolve is a POST and is never cached.
|
|
578
|
+
*/
|
|
579
|
+
fetchOptions?: RequestInit;
|
|
580
|
+
}
|
|
581
|
+
|
|
536
582
|
export declare class FetchRuleCMSWidgetError extends Error {
|
|
537
583
|
readonly status?: number;
|
|
538
584
|
constructor(message: string, status?: number);
|
|
539
585
|
}
|
|
540
586
|
|
|
541
|
-
export declare
|
|
587
|
+
export declare type FetchRuleCMSWidgetParams = FetchRuleCMSWidgetPublishedKeyParams | FetchRuleCMSWidgetRulesetParams;
|
|
588
|
+
|
|
589
|
+
/** Fetch one widget by key through the plain GET path. */
|
|
590
|
+
declare interface FetchRuleCMSWidgetPublishedKeyParams extends FetchRuleCMSWidgetBaseParams {
|
|
542
591
|
/**
|
|
543
592
|
* Published key for staging/production tokens, or the live widget key when
|
|
544
593
|
* using a `dev.`-prefixed Development token.
|
|
545
594
|
*/
|
|
546
595
|
publishedKey: string;
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
596
|
+
rulesetPublishedKey?: never;
|
|
597
|
+
params?: never;
|
|
598
|
+
fallbackPublishedKey?: never;
|
|
599
|
+
contentType?: never;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Let a published ruleset pick the widget from `params` (POST resolve). The
|
|
604
|
+
* server never invents an anonymous id — pass `params.anonId` yourself when
|
|
605
|
+
* experiments should bucket a known visitor.
|
|
606
|
+
*/
|
|
607
|
+
declare interface FetchRuleCMSWidgetRulesetParams extends FetchRuleCMSWidgetBaseParams, WidgetResolveRequestOptions {
|
|
608
|
+
publishedKey?: never;
|
|
554
609
|
}
|
|
555
610
|
|
|
556
611
|
/**
|
|
@@ -818,6 +873,15 @@ export declare const getNameFromWidgetKey: (widgetKey: string) => {
|
|
|
818
873
|
errorMessage?: string;
|
|
819
874
|
};
|
|
820
875
|
|
|
876
|
+
/**
|
|
877
|
+
* Returns the anonymous id used as `params.anonId` for experiments, minting
|
|
878
|
+
* and persisting one in `localStorage` on first use. Browser-only: returns
|
|
879
|
+
* `undefined` outside a window (SSR) so the server never invents an id, and
|
|
880
|
+
* when storage is unavailable (private mode, blocked third-party context) a
|
|
881
|
+
* per-page-load id is returned without persisting.
|
|
882
|
+
*/
|
|
883
|
+
export declare function getOrCreateAnonymousId(): string | undefined;
|
|
884
|
+
|
|
821
885
|
/**
|
|
822
886
|
* Where a layer sits above a base at `baseZIndex`: the first layer takes
|
|
823
887
|
* `baseZIndex + 1`, the second `baseZIndex + 2`, and so on.
|
|
@@ -830,20 +894,7 @@ export declare function getOverlayLayerZIndex(baseZIndex: number, layerIndex: nu
|
|
|
830
894
|
|
|
831
895
|
export declare interface GetRuleCMSWidgetResponse {
|
|
832
896
|
success: boolean;
|
|
833
|
-
data:
|
|
834
|
-
widget: WidgetData;
|
|
835
|
-
childCollections: {
|
|
836
|
-
[key: string]: ChildCollection;
|
|
837
|
-
};
|
|
838
|
-
libraries?: ConfigLibrariesMap;
|
|
839
|
-
/**
|
|
840
|
-
* Project CSS variable catalog joined at GET time. Omitted when empty or
|
|
841
|
-
* when emission is off.
|
|
842
|
-
*/
|
|
843
|
-
cssVariables?: ProjectCssVariableDefinitions;
|
|
844
|
-
classDefinitions?: ProjectCssClassDefinitions;
|
|
845
|
-
includeClassDefinitions?: boolean;
|
|
846
|
-
};
|
|
897
|
+
data: RuleCMSWidgetRawData;
|
|
847
898
|
}
|
|
848
899
|
|
|
849
900
|
export declare type GetWidgetKeyForCollection = {
|
|
@@ -1015,6 +1066,13 @@ export declare interface LibraryCardInputs {
|
|
|
1015
1066
|
};
|
|
1016
1067
|
className?: string;
|
|
1017
1068
|
widgetInstanceProps?: WidgetInstanceProps;
|
|
1069
|
+
/**
|
|
1070
|
+
* This instance's column path — enclosing collection columns first, its own
|
|
1071
|
+
* column id last, joined with `/`. `r-button` emits it as
|
|
1072
|
+
* `data-rulecms-column-path`. Absent in the composer and from releases that
|
|
1073
|
+
* predate it.
|
|
1074
|
+
*/
|
|
1075
|
+
columnPath?: string;
|
|
1018
1076
|
/**
|
|
1019
1077
|
* Host-supplied map of mount name → Svelte component. Only `r-mount`
|
|
1020
1078
|
* reads this. Absent in the composer, and absent whenever the host
|
|
@@ -1144,10 +1202,88 @@ export declare const pointerEventsAllowlist: readonly ["auto", "none"];
|
|
|
1144
1202
|
/** Transform raw widget API data into render-ready displayItemList + collections. */
|
|
1145
1203
|
export declare function prepareRuleCMSWidgetData(raw: RuleCMSWidgetRawData): RuleCMSWidgetData;
|
|
1146
1204
|
|
|
1205
|
+
declare const PROJECT_CSS_CLASS_LAYERS: readonly ["utilities", "components"];
|
|
1206
|
+
|
|
1207
|
+
declare const PROJECT_CSS_PROPERTY_SYNTAX_VALUES: readonly ["*", "<number>", "<integer>", "<length>", "<percentage>", "<length-percentage>", "<color>", "<angle>", "<time>", "<transform-function>", "<transform-list>"];
|
|
1208
|
+
|
|
1209
|
+
declare const PROJECT_WIDGET_CHROME_COLOR_SCHEME_VALUES: readonly ["light", "dark", "light dark"];
|
|
1210
|
+
|
|
1211
|
+
declare const PROJECT_WIDGET_CHROME_SCROLLBAR_WIDTH_VALUES: readonly ["auto", "thin", "none"];
|
|
1212
|
+
|
|
1147
1213
|
declare type ProjectCssClassDefinitions = Record<string, string>;
|
|
1148
1214
|
|
|
1215
|
+
declare type ProjectCssClassLayer = (typeof PROJECT_CSS_CLASS_LAYERS)[number];
|
|
1216
|
+
|
|
1217
|
+
declare type ProjectCssKeyframeDefinitions = Record<string, string>;
|
|
1218
|
+
|
|
1219
|
+
declare type ProjectCssPositionTryDefinitions = Record<string, string>;
|
|
1220
|
+
|
|
1221
|
+
declare type ProjectCssPropertyDefinition = {
|
|
1222
|
+
name: string;
|
|
1223
|
+
syntax: ProjectCssPropertySyntax;
|
|
1224
|
+
inherits: boolean;
|
|
1225
|
+
initialValue: string;
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
declare type ProjectCssPropertySyntax = (typeof PROJECT_CSS_PROPERTY_SYNTAX_VALUES)[number];
|
|
1229
|
+
|
|
1149
1230
|
declare type ProjectCssVariableDefinitions = Record<string, string>;
|
|
1150
1231
|
|
|
1232
|
+
declare type ProjectFontFace = {
|
|
1233
|
+
family: string;
|
|
1234
|
+
cssVariable?: string;
|
|
1235
|
+
fallbacks?: string[];
|
|
1236
|
+
applyToWidget?: boolean;
|
|
1237
|
+
source: ProjectFontSource;
|
|
1238
|
+
palettes?: ProjectFontPalette[];
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1241
|
+
declare type ProjectFontPalette = {
|
|
1242
|
+
name: string;
|
|
1243
|
+
overrideColors?: Array<{
|
|
1244
|
+
index: number;
|
|
1245
|
+
color: string;
|
|
1246
|
+
}>;
|
|
1247
|
+
applyToWidget?: boolean;
|
|
1248
|
+
};
|
|
1249
|
+
|
|
1250
|
+
declare type ProjectFontSource = {
|
|
1251
|
+
kind: 'stack-only';
|
|
1252
|
+
} | {
|
|
1253
|
+
kind: 'google';
|
|
1254
|
+
weights: number[];
|
|
1255
|
+
subsets?: string[];
|
|
1256
|
+
};
|
|
1257
|
+
|
|
1258
|
+
declare type ProjectThemeDefinition = {
|
|
1259
|
+
condition: ProjectThemeHostCondition;
|
|
1260
|
+
variables: Record<string, string>;
|
|
1261
|
+
};
|
|
1262
|
+
|
|
1263
|
+
declare type ProjectThemeHostCondition = {
|
|
1264
|
+
kind: 'prefers-color-scheme';
|
|
1265
|
+
value: 'dark' | 'light';
|
|
1266
|
+
} | {
|
|
1267
|
+
kind: 'html-class';
|
|
1268
|
+
value: 'dark';
|
|
1269
|
+
} | {
|
|
1270
|
+
kind: 'data-theme';
|
|
1271
|
+
value: 'dark' | 'light';
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1274
|
+
declare type ProjectWidgetChrome = {
|
|
1275
|
+
colorScheme?: ProjectWidgetChromeColorScheme;
|
|
1276
|
+
selectionBackground?: string;
|
|
1277
|
+
selectionColor?: string;
|
|
1278
|
+
caretColor?: string;
|
|
1279
|
+
scrollbarColor?: string;
|
|
1280
|
+
scrollbarWidth?: ProjectWidgetChromeScrollbarWidth;
|
|
1281
|
+
};
|
|
1282
|
+
|
|
1283
|
+
declare type ProjectWidgetChromeColorScheme = (typeof PROJECT_WIDGET_CHROME_COLOR_SCHEME_VALUES)[number];
|
|
1284
|
+
|
|
1285
|
+
declare type ProjectWidgetChromeScrollbarWidth = (typeof PROJECT_WIDGET_CHROME_SCROLLBAR_WIDTH_VALUES)[number];
|
|
1286
|
+
|
|
1151
1287
|
/**
|
|
1152
1288
|
* Character used to join environmentId and resource key when generating published keys
|
|
1153
1289
|
*/
|
|
@@ -1156,6 +1292,9 @@ export declare const PUBLISHED_KEY_SEPARATOR = "---";
|
|
|
1156
1292
|
/** Published (cached) client API path. */
|
|
1157
1293
|
export declare const PUBLISHED_WIDGET_API_PATH = "/api/v1/c/widget/get";
|
|
1158
1294
|
|
|
1295
|
+
/** Published ruleset resolve path (POST) — picks a widget by params, returns its payload. */
|
|
1296
|
+
export declare const PUBLISHED_WIDGET_RESOLVE_API_PATH = "/api/v1/c/widget/resolve";
|
|
1297
|
+
|
|
1159
1298
|
export declare type PublishedWidgetCollectionForKey = {
|
|
1160
1299
|
publishedKey: string;
|
|
1161
1300
|
name: string;
|
|
@@ -1293,6 +1432,9 @@ export declare interface ResolveWidgetLibrariesParams {
|
|
|
1293
1432
|
*/
|
|
1294
1433
|
export declare function rowBasedPropertiesAreAssigned(row: DisplayItemRow): boolean;
|
|
1295
1434
|
|
|
1435
|
+
/** First-party `localStorage` key holding the SDK-generated anonymous id. */
|
|
1436
|
+
export declare const RULECMS_ANONYMOUS_ID_STORAGE_KEY = "rulecms_anon_id";
|
|
1437
|
+
|
|
1296
1438
|
/** Live draft API host — RulesCMS production (never relative / local). */
|
|
1297
1439
|
export declare const RULECMS_API_ORIGIN = "https://rulecms.com";
|
|
1298
1440
|
|
|
@@ -1307,15 +1449,21 @@ export declare interface RuleCMSWidgetContext {
|
|
|
1307
1449
|
libraryRegistry: ComponentLibraryRegistry;
|
|
1308
1450
|
}
|
|
1309
1451
|
|
|
1452
|
+
/** Render-ready widget payload after parsing API / fetch response. */
|
|
1310
1453
|
export declare interface RuleCMSWidgetData {
|
|
1311
1454
|
displayItemList: Items;
|
|
1312
1455
|
widgetCollections: {
|
|
1313
1456
|
[key: string]: WidgetCollection;
|
|
1314
1457
|
};
|
|
1458
|
+
/**
|
|
1459
|
+
* Platform-served library descriptors (optional; absent for configs that
|
|
1460
|
+
* only use the default library, and until the platform serves them).
|
|
1461
|
+
*/
|
|
1315
1462
|
libraries?: ConfigLibrariesMap;
|
|
1316
1463
|
/**
|
|
1317
1464
|
* Project CSS variable catalog joined onto the widget GET. Optional; omit
|
|
1318
|
-
* or `{}` when the project has none. Not stored on itemList.
|
|
1465
|
+
* or `{}` when the project has none. Not stored on itemList. Dropped when
|
|
1466
|
+
* `includeCssVariables` on the raw GET is `false`.
|
|
1319
1467
|
*/
|
|
1320
1468
|
cssVariables?: ProjectCssVariableDefinitions;
|
|
1321
1469
|
/**
|
|
@@ -1324,6 +1472,46 @@ export declare interface RuleCMSWidgetData {
|
|
|
1324
1472
|
* when `includeClassDefinitions` on the raw GET is `false`.
|
|
1325
1473
|
*/
|
|
1326
1474
|
classDefinitions?: ProjectCssClassDefinitions;
|
|
1475
|
+
/**
|
|
1476
|
+
* Cascade layer to wrap class definitions. Dropped when
|
|
1477
|
+
* `includeClassLayer` on the raw GET is `false`.
|
|
1478
|
+
*/
|
|
1479
|
+
classLayer?: ProjectCssClassLayer;
|
|
1480
|
+
/**
|
|
1481
|
+
* Project font-face catalog joined onto the widget GET. Dropped when
|
|
1482
|
+
* `includeFontFaces` on the raw GET is `false`.
|
|
1483
|
+
*/
|
|
1484
|
+
fontFaces?: ProjectFontFace[];
|
|
1485
|
+
/**
|
|
1486
|
+
* Project keyframes catalog joined onto the widget GET. Dropped when
|
|
1487
|
+
* `includeKeyframes` on the raw GET is `false`.
|
|
1488
|
+
*/
|
|
1489
|
+
keyframes?: ProjectCssKeyframeDefinitions;
|
|
1490
|
+
/**
|
|
1491
|
+
* Project theme-override catalog joined onto the widget GET. Dropped when
|
|
1492
|
+
* `includeThemes` on the raw GET is `false`.
|
|
1493
|
+
*/
|
|
1494
|
+
themes?: ProjectThemeDefinition[];
|
|
1495
|
+
/**
|
|
1496
|
+
* Project typed `@property` catalog joined onto the widget GET. Dropped when
|
|
1497
|
+
* `includeCssProperties` on the raw GET is `false`.
|
|
1498
|
+
*/
|
|
1499
|
+
cssProperties?: ProjectCssPropertyDefinition[];
|
|
1500
|
+
/**
|
|
1501
|
+
* Project widget-root chrome joined onto the widget GET. Dropped when
|
|
1502
|
+
* `includeWidgetChrome` on the raw GET is `false`.
|
|
1503
|
+
*/
|
|
1504
|
+
widgetChrome?: ProjectWidgetChrome;
|
|
1505
|
+
/**
|
|
1506
|
+
* Project position-try catalog joined onto the widget GET. Dropped when
|
|
1507
|
+
* `includePositionTry` on the raw GET is `false`.
|
|
1508
|
+
*/
|
|
1509
|
+
positionTry?: ProjectCssPositionTryDefinitions;
|
|
1510
|
+
/**
|
|
1511
|
+
* Present when this payload came from a ruleset resolve. A plain published-key
|
|
1512
|
+
* GET never sets it.
|
|
1513
|
+
*/
|
|
1514
|
+
selection?: WidgetSelection;
|
|
1327
1515
|
}
|
|
1328
1516
|
|
|
1329
1517
|
export declare interface RuleCMSWidgetRawData {
|
|
@@ -1331,14 +1519,62 @@ export declare interface RuleCMSWidgetRawData {
|
|
|
1331
1519
|
childCollections: {
|
|
1332
1520
|
[key: string]: ChildCollection;
|
|
1333
1521
|
};
|
|
1522
|
+
/** Optional platform-served library descriptors (see RuleCMSWidgetData). */
|
|
1334
1523
|
libraries?: ConfigLibrariesMap;
|
|
1335
1524
|
cssVariables?: ProjectCssVariableDefinitions;
|
|
1525
|
+
/**
|
|
1526
|
+
* When `false`, do not emit the catalog even if `cssVariables` is present.
|
|
1527
|
+
* Missing means include (legacy payloads).
|
|
1528
|
+
*/
|
|
1529
|
+
includeCssVariables?: boolean;
|
|
1336
1530
|
classDefinitions?: ProjectCssClassDefinitions;
|
|
1337
1531
|
/**
|
|
1338
1532
|
* When `false`, do not emit class definitions even if `classDefinitions` is
|
|
1339
1533
|
* present. Missing means include (legacy payloads).
|
|
1340
1534
|
*/
|
|
1341
1535
|
includeClassDefinitions?: boolean;
|
|
1536
|
+
classLayer?: ProjectCssClassLayer;
|
|
1537
|
+
/**
|
|
1538
|
+
* When `false`, emit class definitions unlayered even if `classLayer` is
|
|
1539
|
+
* present. Missing means wrap when `classLayer` is set.
|
|
1540
|
+
*/
|
|
1541
|
+
includeClassLayer?: boolean;
|
|
1542
|
+
fontFaces?: ProjectFontFace[];
|
|
1543
|
+
/**
|
|
1544
|
+
* When `false`, do not emit fonts even if `fontFaces` is present.
|
|
1545
|
+
* Missing means include (legacy payloads).
|
|
1546
|
+
*/
|
|
1547
|
+
includeFontFaces?: boolean;
|
|
1548
|
+
keyframes?: ProjectCssKeyframeDefinitions;
|
|
1549
|
+
/**
|
|
1550
|
+
* When `false`, do not emit keyframes even if `keyframes` is present.
|
|
1551
|
+
* Missing means include (legacy payloads).
|
|
1552
|
+
*/
|
|
1553
|
+
includeKeyframes?: boolean;
|
|
1554
|
+
themes?: ProjectThemeDefinition[];
|
|
1555
|
+
/**
|
|
1556
|
+
* When `false`, do not emit theme overrides even if `themes` is present.
|
|
1557
|
+
* Missing means include (legacy payloads).
|
|
1558
|
+
*/
|
|
1559
|
+
includeThemes?: boolean;
|
|
1560
|
+
cssProperties?: ProjectCssPropertyDefinition[];
|
|
1561
|
+
/**
|
|
1562
|
+
* When `false`, do not emit typed CSS properties even if `cssProperties` is
|
|
1563
|
+
* present. Missing means include (legacy payloads).
|
|
1564
|
+
*/
|
|
1565
|
+
includeCssProperties?: boolean;
|
|
1566
|
+
widgetChrome?: ProjectWidgetChrome;
|
|
1567
|
+
/**
|
|
1568
|
+
* When `false`, do not emit widget chrome even if `widgetChrome` is present.
|
|
1569
|
+
* Missing means include (legacy payloads).
|
|
1570
|
+
*/
|
|
1571
|
+
includeWidgetChrome?: boolean;
|
|
1572
|
+
positionTry?: ProjectCssPositionTryDefinitions;
|
|
1573
|
+
/**
|
|
1574
|
+
* When `false`, do not emit position-try fallbacks even if `positionTry` is
|
|
1575
|
+
* present. Missing means include (legacy payloads).
|
|
1576
|
+
*/
|
|
1577
|
+
includePositionTry?: boolean;
|
|
1342
1578
|
}
|
|
1343
1579
|
|
|
1344
1580
|
export declare interface SourceComponentsPlugin {
|
|
@@ -1377,6 +1613,14 @@ export declare type SpacingSideLiteralValue = {
|
|
|
1377
1613
|
|
|
1378
1614
|
export declare type SpacingSideValue = (SpacingSideLiteralValue & CssVariableCarrier) | CssVariableValue;
|
|
1379
1615
|
|
|
1616
|
+
/**
|
|
1617
|
+
* `JSON.stringify` with object keys sorted at every depth, so two objects with
|
|
1618
|
+
* the same values serialize identically regardless of insertion order. Used as
|
|
1619
|
+
* the effect dependency for resolve `params`: a fresh `{ b, a }` on every render
|
|
1620
|
+
* must not trigger a refetch when `{ a, b }` was already sent.
|
|
1621
|
+
*/
|
|
1622
|
+
export declare function stableJsonStringify(value: unknown): string | undefined;
|
|
1623
|
+
|
|
1380
1624
|
export { SvelteComponent as BreakpointVariantRender }
|
|
1381
1625
|
export { SvelteComponent as DisplayComponent }
|
|
1382
1626
|
export { SvelteComponent as RenderComponents }
|
|
@@ -1432,6 +1676,14 @@ export declare const WIDGET_ATTRIBUTES_IGNORED_IN_COMPOSE_MODE: readonly ["width
|
|
|
1432
1676
|
/** Published (cached) API host. */
|
|
1433
1677
|
export declare const WIDGET_CACHE_API_ORIGIN = "https://widget-cache.rulecms.com";
|
|
1434
1678
|
|
|
1679
|
+
/**
|
|
1680
|
+
* The one key copied from `rulecms-widget`'s `placeholderValues` onto a card.
|
|
1681
|
+
* Must stay the key `r-text` reads (`PLACEHOLDER_VALUES_PROP` in
|
|
1682
|
+
* `@rulecms/source-components-svelte`). The renderer copies the value and does
|
|
1683
|
+
* not look inside it.
|
|
1684
|
+
*/
|
|
1685
|
+
export declare const WIDGET_PLACEHOLDER_VALUES_KEY = "placeholderValues";
|
|
1686
|
+
|
|
1435
1687
|
/**
|
|
1436
1688
|
* True when the widget carries settings that need a real DOM element to land
|
|
1437
1689
|
* on, so the vertical container has to be emitted even where it would
|
|
@@ -1507,6 +1759,82 @@ export declare type WidgetOverlayLayers = {
|
|
|
1507
1759
|
layers: Items[];
|
|
1508
1760
|
};
|
|
1509
1761
|
|
|
1762
|
+
/**
|
|
1763
|
+
* `Content-Type` sent on the resolve POST. `text/plain` is CORS-safelisted, so
|
|
1764
|
+
* the browser skips the preflight; it is the default everywhere.
|
|
1765
|
+
* `application/json` is for server-to-server calls only.
|
|
1766
|
+
*/
|
|
1767
|
+
export declare type WidgetResolveContentType = 'application/json' | 'text/plain';
|
|
1768
|
+
|
|
1769
|
+
/** Options shared by every ruleset-driven entry point (hook, widget, server fetch). */
|
|
1770
|
+
export declare interface WidgetResolveRequestOptions {
|
|
1771
|
+
/**
|
|
1772
|
+
* Staging/production: ruleset published key (`{environmentId}---ruleset-…`).
|
|
1773
|
+
* Development (`dev.` token): the `ruleset-…` key; a published key is
|
|
1774
|
+
* accepted and stripped to its `ruleset-…` suffix.
|
|
1775
|
+
*/
|
|
1776
|
+
rulesetPublishedKey: string;
|
|
1777
|
+
/** Any JSON object. Sent as-is; the server flattens nested objects. */
|
|
1778
|
+
params?: WidgetSelectionParams;
|
|
1779
|
+
/**
|
|
1780
|
+
* Widget to GET through the plain published path when the resolve request
|
|
1781
|
+
* fails at the network level or with a 5xx. Not used on 4xx (bad token,
|
|
1782
|
+
* unknown ruleset…), and not needed for "no rule matched" — the ruleset's
|
|
1783
|
+
* own default covers that on the server.
|
|
1784
|
+
*/
|
|
1785
|
+
fallbackPublishedKey?: string;
|
|
1786
|
+
/**
|
|
1787
|
+
* Defaults to `text/plain` (no CORS preflight). Use `application/json` only
|
|
1788
|
+
* for server-to-server calls.
|
|
1789
|
+
*/
|
|
1790
|
+
contentType?: WidgetResolveContentType;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
/** Which widget a ruleset picked and why. Returned alongside the widget payload. */
|
|
1794
|
+
export declare interface WidgetSelection {
|
|
1795
|
+
rulesetPublishedKey?: string;
|
|
1796
|
+
rulesetVersion?: string;
|
|
1797
|
+
schemaVersion?: number;
|
|
1798
|
+
outcome: WidgetSelectionOutcome;
|
|
1799
|
+
/** Matched rule id, or `null` for the default / fallback-default outcomes. */
|
|
1800
|
+
ruleId: string | null;
|
|
1801
|
+
/** Experiment variant id, or `null` when the rule was not an experiment. */
|
|
1802
|
+
variantId: string | null;
|
|
1803
|
+
widgetKey: string;
|
|
1804
|
+
widgetPublishedKey: string;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
export declare type WidgetSelectionOutcome = 'rule' | 'default' | 'fallback-default';
|
|
1808
|
+
|
|
1809
|
+
/**
|
|
1810
|
+
* Any JSON object. Sent to the resolve endpoint as-is — the server flattens
|
|
1811
|
+
* nested objects (`user.plan`) before evaluating rules. `undefined` values are
|
|
1812
|
+
* allowed for ergonomics (`{ plan: user?.plan }`) and dropped by JSON.
|
|
1813
|
+
*/
|
|
1814
|
+
export declare interface WidgetSelectionParams {
|
|
1815
|
+
[name: string]: WidgetSelectionParamValue | undefined;
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
/** A JSON leaf or nested value accepted in resolve `params`. */
|
|
1819
|
+
declare type WidgetSelectionParamValue = string | number | boolean | null | WidgetSelectionParamValue[] | WidgetSelectionParams;
|
|
1820
|
+
|
|
1821
|
+
/**
|
|
1822
|
+
* Widget-wide placeholder values for one component instance.
|
|
1823
|
+
*
|
|
1824
|
+
* When the host passed `placeholderValues` on `rulecms-widget`, every instance
|
|
1825
|
+
* receives that object unless its own `componentProps` entry already has the
|
|
1826
|
+
* key. An entry that sets the key wins even when the value is `null` or
|
|
1827
|
+
* otherwise unusable: that is how one Text opts out. Other keys on the entry,
|
|
1828
|
+
* such as `onClick`, stay. The host's entry is not mutated.
|
|
1829
|
+
*
|
|
1830
|
+
* `undefined` means the widget input was omitted, which is the common case and
|
|
1831
|
+
* must not invent a bag.
|
|
1832
|
+
*/
|
|
1833
|
+
export declare function withWidgetPlaceholderValues({ widgetInstanceProps, placeholderValues, }: {
|
|
1834
|
+
widgetInstanceProps?: WidgetInstanceProps;
|
|
1835
|
+
placeholderValues?: unknown;
|
|
1836
|
+
}): WidgetInstanceProps | undefined;
|
|
1837
|
+
|
|
1510
1838
|
/**
|
|
1511
1839
|
* The base's own place in the stack. Read here rather than through
|
|
1512
1840
|
* objectStyleAttributeRegistry on purpose: the registry is shared with rows and
|