@rulecms/widget-vue 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 +59 -14
- package/dist/index.d.ts +387 -25
- package/dist/index.js +1872 -963
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,28 @@ declare type __VLS_Props = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
declare type __VLS_Props_2 = {
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Staging/production: published key (`{environmentId}---{widgetKey}`).
|
|
19
|
+
* Development (`dev.` token): the live widget key itself (`widget-...`).
|
|
20
|
+
* Omit when `rulesetPublishedKey` is set — the ruleset picks the widget.
|
|
21
|
+
*/
|
|
22
|
+
publishedKey?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Staging/production: ruleset published key (`{environmentId}---ruleset-…`).
|
|
25
|
+
* Development (`dev.` token): the `ruleset-…` key.
|
|
26
|
+
*/
|
|
27
|
+
rulesetPublishedKey?: string;
|
|
28
|
+
/** Any JSON object sent to the resolve endpoint. The server flattens nested objects. */
|
|
29
|
+
params?: WidgetSelectionParams;
|
|
30
|
+
/**
|
|
31
|
+
* `false` skips minting an anonymous id. A string is used as `params.anonId`.
|
|
32
|
+
* Omit it in the browser and the widget stores one in `localStorage`.
|
|
33
|
+
*/
|
|
34
|
+
anonymousId?: string | false;
|
|
35
|
+
/** Plain published-key GET used when the resolve request fails with a network error or 5xx. */
|
|
36
|
+
fallbackPublishedKey?: string;
|
|
37
|
+
/** Defaults to `text/plain` so the browser skips the CORS preflight. */
|
|
38
|
+
contentType?: WidgetResolveContentType;
|
|
18
39
|
token?: string;
|
|
19
40
|
endpoint?: string;
|
|
20
41
|
mode?: 'client-fetch' | 'pre-fetched';
|
|
@@ -22,6 +43,13 @@ declare type __VLS_Props_2 = {
|
|
|
22
43
|
libraries?: LibraryRegistrationMap;
|
|
23
44
|
componentProps?: ComponentPropsMap;
|
|
24
45
|
mounts?: MountsMap;
|
|
46
|
+
/**
|
|
47
|
+
* Values copied onto every Text as `placeholderValues`, unless that column's
|
|
48
|
+
* `componentProps` entry already sets the key (including `null` to opt out).
|
|
49
|
+
*/
|
|
50
|
+
placeholderValues?: unknown;
|
|
51
|
+
/** Called when a ruleset resolve returns a selection. */
|
|
52
|
+
onSelection?: (selection: WidgetSelection) => void;
|
|
25
53
|
};
|
|
26
54
|
|
|
27
55
|
declare type __VLS_Props_3 = {
|
|
@@ -36,6 +64,7 @@ declare type __VLS_Props_3 = {
|
|
|
36
64
|
plugins: RenderComponentPlugins;
|
|
37
65
|
componentProps?: ComponentPropsMap;
|
|
38
66
|
mounts?: MountsMap;
|
|
67
|
+
placeholderValues?: unknown;
|
|
39
68
|
};
|
|
40
69
|
|
|
41
70
|
declare type __VLS_Props_4 = {
|
|
@@ -51,6 +80,7 @@ declare type __VLS_Props_4 = {
|
|
|
51
80
|
plugins: RenderComponentPlugins;
|
|
52
81
|
componentProps?: ComponentPropsMap;
|
|
53
82
|
mounts?: MountsMap;
|
|
83
|
+
placeholderValues?: unknown;
|
|
54
84
|
ancestorColumnIds?: string[];
|
|
55
85
|
};
|
|
56
86
|
|
|
@@ -67,6 +97,7 @@ declare type __VLS_Props_5 = {
|
|
|
67
97
|
deviceDisplayType: keyof typeof DeviceDisplayTypes;
|
|
68
98
|
componentProps?: ComponentPropsMap;
|
|
69
99
|
mounts?: MountsMap;
|
|
100
|
+
placeholderValues?: unknown;
|
|
70
101
|
ancestorColumnIds?: string[];
|
|
71
102
|
};
|
|
72
103
|
|
|
@@ -78,6 +109,7 @@ declare type __VLS_Props_6 = {
|
|
|
78
109
|
plugins: RenderComponentPlugins;
|
|
79
110
|
componentProps?: ComponentPropsMap;
|
|
80
111
|
mounts?: MountsMap;
|
|
112
|
+
placeholderValues?: unknown;
|
|
81
113
|
scopeIdInput?: string;
|
|
82
114
|
};
|
|
83
115
|
|
|
@@ -92,6 +124,8 @@ declare type __VLS_Props_7 = {
|
|
|
92
124
|
[key: string]: any;
|
|
93
125
|
};
|
|
94
126
|
widgetInstanceProps?: WidgetInstanceProps;
|
|
127
|
+
pageViewType?: PageViewType;
|
|
128
|
+
columnPath?: string;
|
|
95
129
|
mounts?: MountsMap;
|
|
96
130
|
};
|
|
97
131
|
|
|
@@ -293,6 +327,19 @@ export declare interface BuildWidgetFetchUrlParams {
|
|
|
293
327
|
endpoint?: string;
|
|
294
328
|
}
|
|
295
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Builds the ruleset resolve URL. The token, ruleset key and params travel in
|
|
332
|
+
* the POST body, so the URL carries no query string. Development tokens
|
|
333
|
+
* (`dev.…`) hit the draft resolve route; everything else uses the published one.
|
|
334
|
+
*/
|
|
335
|
+
export declare function buildWidgetResolveUrl({ token, endpoint, }: BuildWidgetResolveUrlParams): string;
|
|
336
|
+
|
|
337
|
+
export declare interface BuildWidgetResolveUrlParams {
|
|
338
|
+
token: string;
|
|
339
|
+
/** Optional override. Defaults by token: rulecms.com (dev) or widget-cache (published). */
|
|
340
|
+
endpoint?: string;
|
|
341
|
+
}
|
|
342
|
+
|
|
296
343
|
export declare interface ChildCollection {
|
|
297
344
|
publishedKey: string;
|
|
298
345
|
name: string;
|
|
@@ -304,6 +351,9 @@ export declare interface ChildCollection {
|
|
|
304
351
|
lastPublishedAt: string;
|
|
305
352
|
}
|
|
306
353
|
|
|
354
|
+
/** Drops the in-process published-widget cache. Tests call this between cases. */
|
|
355
|
+
export declare function clearPublishedWidgetFetchCache(): void;
|
|
356
|
+
|
|
307
357
|
/**
|
|
308
358
|
* A Cloudinary transformation component as an object, e.g.
|
|
309
359
|
* `{ c: 'fill', g: 'auto' }` serializes to `c_fill,g_auto`.
|
|
@@ -503,6 +553,13 @@ export declare const DEFAULT_CLOUDINARY_CLOUD_NAME = "rulecms";
|
|
|
503
553
|
*/
|
|
504
554
|
export declare const DEFAULT_LIBRARY_ID = "default";
|
|
505
555
|
|
|
556
|
+
/**
|
|
557
|
+
* How long a published-token GET stays in the in-process cache when the caller
|
|
558
|
+
* sets no cache policy. Vue has no Next.js `next.revalidate`; this is the
|
|
559
|
+
* same 60-second default `@rulecms/widget-react` applies on the server.
|
|
560
|
+
*/
|
|
561
|
+
export declare const DEFAULT_PUBLISHED_WIDGET_CACHE_MS = 60000;
|
|
562
|
+
|
|
506
563
|
export declare const DEFAULT_ROW_GAP = "var(--sl-spacing-x-small)";
|
|
507
564
|
|
|
508
565
|
export declare type DefaultAttributeValue = {
|
|
@@ -533,6 +590,9 @@ export declare const DEV_CLIENT_TOKEN_PREFIX = "dev.";
|
|
|
533
590
|
/** Live draft client API path — no cache; reads the widget table directly. */
|
|
534
591
|
export declare const DEV_WIDGET_API_PATH = "/api/v1/c/dev/widget/get";
|
|
535
592
|
|
|
593
|
+
/** Live draft ruleset resolve path (POST) — compiles the draft ruleset in-process. */
|
|
594
|
+
export declare const DEV_WIDGET_RESOLVE_API_PATH = "/api/v1/c/dev/widget/resolve";
|
|
595
|
+
|
|
536
596
|
export declare type DeviceDisplayType = 'phone' | 'tablet' | 'desktop';
|
|
537
597
|
|
|
538
598
|
export declare const DeviceDisplayTypes: {
|
|
@@ -645,27 +705,56 @@ declare interface EditPlugin {
|
|
|
645
705
|
*/
|
|
646
706
|
export declare const EMBEDDED_KEY_SEPARATOR = "___";
|
|
647
707
|
|
|
648
|
-
/**
|
|
708
|
+
/**
|
|
709
|
+
* Fetch widget JSON on the server (or at build time) and return render-ready
|
|
710
|
+
* data. Pass `publishedKey` for one widget, or `rulesetPublishedKey` + `params`
|
|
711
|
+
* to let a ruleset choose (the result then carries `selection`).
|
|
712
|
+
*/
|
|
649
713
|
export declare function fetchRuleCMSWidget(params: FetchRuleCMSWidgetParams): Promise<RuleCMSWidgetData>;
|
|
650
714
|
|
|
715
|
+
declare interface FetchRuleCMSWidgetBaseParams {
|
|
716
|
+
token: string;
|
|
717
|
+
/**
|
|
718
|
+
* Optional API origin override. Omit in apps — defaults to rulecms.com for
|
|
719
|
+
* `dev.` tokens and widget-cache for published tokens.
|
|
720
|
+
*/
|
|
721
|
+
endpoint?: string;
|
|
722
|
+
/**
|
|
723
|
+
* Pass-through to `fetch`. Published-token GETs are cached in-process for
|
|
724
|
+
* 60 seconds unless `cache` is `no-store`, `reload`, or `no-cache`. `dev.`
|
|
725
|
+
* tokens always use `cache: 'no-store'` and are never cached here. A
|
|
726
|
+
* `rulesetPublishedKey` resolve is a POST and is never cached.
|
|
727
|
+
*/
|
|
728
|
+
fetchOptions?: RequestInit;
|
|
729
|
+
}
|
|
730
|
+
|
|
651
731
|
export declare class FetchRuleCMSWidgetError extends Error {
|
|
652
732
|
readonly status?: number;
|
|
653
733
|
constructor(message: string, status?: number);
|
|
654
734
|
}
|
|
655
735
|
|
|
656
|
-
export declare
|
|
736
|
+
export declare type FetchRuleCMSWidgetParams = FetchRuleCMSWidgetPublishedKeyParams | FetchRuleCMSWidgetRulesetParams;
|
|
737
|
+
|
|
738
|
+
/** Fetch one widget by key through the plain GET path. */
|
|
739
|
+
declare interface FetchRuleCMSWidgetPublishedKeyParams extends FetchRuleCMSWidgetBaseParams {
|
|
657
740
|
/**
|
|
658
741
|
* Published key for staging/production tokens, or the live widget key when
|
|
659
742
|
* using a `dev.`-prefixed Development token.
|
|
660
743
|
*/
|
|
661
744
|
publishedKey: string;
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
745
|
+
rulesetPublishedKey?: never;
|
|
746
|
+
params?: never;
|
|
747
|
+
fallbackPublishedKey?: never;
|
|
748
|
+
contentType?: never;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Let a published ruleset pick the widget from `params` (POST resolve). The
|
|
753
|
+
* server never invents an anonymous id — pass `params.anonId` yourself when
|
|
754
|
+
* experiments should bucket a known visitor.
|
|
755
|
+
*/
|
|
756
|
+
declare interface FetchRuleCMSWidgetRulesetParams extends FetchRuleCMSWidgetBaseParams, WidgetResolveRequestOptions {
|
|
757
|
+
publishedKey?: never;
|
|
669
758
|
}
|
|
670
759
|
|
|
671
760
|
/**
|
|
@@ -933,6 +1022,15 @@ export declare const getNameFromWidgetKey: (widgetKey: string) => {
|
|
|
933
1022
|
errorMessage?: string;
|
|
934
1023
|
};
|
|
935
1024
|
|
|
1025
|
+
/**
|
|
1026
|
+
* Returns the anonymous id used as `params.anonId` for experiments, minting
|
|
1027
|
+
* and persisting one in `localStorage` on first use. Browser-only: returns
|
|
1028
|
+
* `undefined` outside a window (SSR) so the server never invents an id, and
|
|
1029
|
+
* when storage is unavailable (private mode, blocked third-party context) a
|
|
1030
|
+
* per-page-load id is returned without persisting.
|
|
1031
|
+
*/
|
|
1032
|
+
export declare function getOrCreateAnonymousId(): string | undefined;
|
|
1033
|
+
|
|
936
1034
|
/**
|
|
937
1035
|
* Where a layer sits above a base at `baseZIndex`: the first layer takes
|
|
938
1036
|
* `baseZIndex + 1`, the second `baseZIndex + 2`, and so on.
|
|
@@ -945,20 +1043,7 @@ export declare function getOverlayLayerZIndex(baseZIndex: number, layerIndex: nu
|
|
|
945
1043
|
|
|
946
1044
|
export declare interface GetRuleCMSWidgetResponse {
|
|
947
1045
|
success: boolean;
|
|
948
|
-
data:
|
|
949
|
-
widget: WidgetData;
|
|
950
|
-
childCollections: {
|
|
951
|
-
[key: string]: ChildCollection;
|
|
952
|
-
};
|
|
953
|
-
libraries?: ConfigLibrariesMap;
|
|
954
|
-
/**
|
|
955
|
-
* Project CSS variable catalog joined at GET time. Omitted when empty or
|
|
956
|
-
* when emission is off.
|
|
957
|
-
*/
|
|
958
|
-
cssVariables?: ProjectCssVariableDefinitions;
|
|
959
|
-
classDefinitions?: ProjectCssClassDefinitions;
|
|
960
|
-
includeClassDefinitions?: boolean;
|
|
961
|
-
};
|
|
1046
|
+
data: RuleCMSWidgetRawData;
|
|
962
1047
|
}
|
|
963
1048
|
|
|
964
1049
|
export declare type GetWidgetKeyForCollection = {
|
|
@@ -1130,6 +1215,13 @@ export declare interface LibraryCardInputs {
|
|
|
1130
1215
|
};
|
|
1131
1216
|
className?: string;
|
|
1132
1217
|
widgetInstanceProps?: WidgetInstanceProps;
|
|
1218
|
+
/**
|
|
1219
|
+
* This instance's column path — enclosing collection columns first, its own
|
|
1220
|
+
* column id last, joined with `/`. `r-button` emits it as
|
|
1221
|
+
* `data-rulecms-column-path`. Absent in the composer and from releases that
|
|
1222
|
+
* predate it.
|
|
1223
|
+
*/
|
|
1224
|
+
columnPath?: string;
|
|
1133
1225
|
/**
|
|
1134
1226
|
* Host-supplied map of mount name → Vue component. Only `r-mount`
|
|
1135
1227
|
* reads this. Absent in the composer, and absent whenever the host
|
|
@@ -1259,10 +1351,88 @@ export declare const pointerEventsAllowlist: readonly ["auto", "none"];
|
|
|
1259
1351
|
/** Transform raw widget API data into render-ready displayItemList + collections. */
|
|
1260
1352
|
export declare function prepareRuleCMSWidgetData(raw: RuleCMSWidgetRawData): RuleCMSWidgetData;
|
|
1261
1353
|
|
|
1354
|
+
declare const PROJECT_CSS_CLASS_LAYERS: readonly ["utilities", "components"];
|
|
1355
|
+
|
|
1356
|
+
declare const PROJECT_CSS_PROPERTY_SYNTAX_VALUES: readonly ["*", "<number>", "<integer>", "<length>", "<percentage>", "<length-percentage>", "<color>", "<angle>", "<time>", "<transform-function>", "<transform-list>"];
|
|
1357
|
+
|
|
1358
|
+
declare const PROJECT_WIDGET_CHROME_COLOR_SCHEME_VALUES: readonly ["light", "dark", "light dark"];
|
|
1359
|
+
|
|
1360
|
+
declare const PROJECT_WIDGET_CHROME_SCROLLBAR_WIDTH_VALUES: readonly ["auto", "thin", "none"];
|
|
1361
|
+
|
|
1262
1362
|
declare type ProjectCssClassDefinitions = Record<string, string>;
|
|
1263
1363
|
|
|
1364
|
+
declare type ProjectCssClassLayer = (typeof PROJECT_CSS_CLASS_LAYERS)[number];
|
|
1365
|
+
|
|
1366
|
+
declare type ProjectCssKeyframeDefinitions = Record<string, string>;
|
|
1367
|
+
|
|
1368
|
+
declare type ProjectCssPositionTryDefinitions = Record<string, string>;
|
|
1369
|
+
|
|
1370
|
+
declare type ProjectCssPropertyDefinition = {
|
|
1371
|
+
name: string;
|
|
1372
|
+
syntax: ProjectCssPropertySyntax;
|
|
1373
|
+
inherits: boolean;
|
|
1374
|
+
initialValue: string;
|
|
1375
|
+
};
|
|
1376
|
+
|
|
1377
|
+
declare type ProjectCssPropertySyntax = (typeof PROJECT_CSS_PROPERTY_SYNTAX_VALUES)[number];
|
|
1378
|
+
|
|
1264
1379
|
declare type ProjectCssVariableDefinitions = Record<string, string>;
|
|
1265
1380
|
|
|
1381
|
+
declare type ProjectFontFace = {
|
|
1382
|
+
family: string;
|
|
1383
|
+
cssVariable?: string;
|
|
1384
|
+
fallbacks?: string[];
|
|
1385
|
+
applyToWidget?: boolean;
|
|
1386
|
+
source: ProjectFontSource;
|
|
1387
|
+
palettes?: ProjectFontPalette[];
|
|
1388
|
+
};
|
|
1389
|
+
|
|
1390
|
+
declare type ProjectFontPalette = {
|
|
1391
|
+
name: string;
|
|
1392
|
+
overrideColors?: Array<{
|
|
1393
|
+
index: number;
|
|
1394
|
+
color: string;
|
|
1395
|
+
}>;
|
|
1396
|
+
applyToWidget?: boolean;
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
declare type ProjectFontSource = {
|
|
1400
|
+
kind: 'stack-only';
|
|
1401
|
+
} | {
|
|
1402
|
+
kind: 'google';
|
|
1403
|
+
weights: number[];
|
|
1404
|
+
subsets?: string[];
|
|
1405
|
+
};
|
|
1406
|
+
|
|
1407
|
+
declare type ProjectThemeDefinition = {
|
|
1408
|
+
condition: ProjectThemeHostCondition;
|
|
1409
|
+
variables: Record<string, string>;
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
declare type ProjectThemeHostCondition = {
|
|
1413
|
+
kind: 'prefers-color-scheme';
|
|
1414
|
+
value: 'dark' | 'light';
|
|
1415
|
+
} | {
|
|
1416
|
+
kind: 'html-class';
|
|
1417
|
+
value: 'dark';
|
|
1418
|
+
} | {
|
|
1419
|
+
kind: 'data-theme';
|
|
1420
|
+
value: 'dark' | 'light';
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
declare type ProjectWidgetChrome = {
|
|
1424
|
+
colorScheme?: ProjectWidgetChromeColorScheme;
|
|
1425
|
+
selectionBackground?: string;
|
|
1426
|
+
selectionColor?: string;
|
|
1427
|
+
caretColor?: string;
|
|
1428
|
+
scrollbarColor?: string;
|
|
1429
|
+
scrollbarWidth?: ProjectWidgetChromeScrollbarWidth;
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
declare type ProjectWidgetChromeColorScheme = (typeof PROJECT_WIDGET_CHROME_COLOR_SCHEME_VALUES)[number];
|
|
1433
|
+
|
|
1434
|
+
declare type ProjectWidgetChromeScrollbarWidth = (typeof PROJECT_WIDGET_CHROME_SCROLLBAR_WIDTH_VALUES)[number];
|
|
1435
|
+
|
|
1266
1436
|
/**
|
|
1267
1437
|
* Character used to join environmentId and resource key when generating published keys
|
|
1268
1438
|
*/
|
|
@@ -1271,6 +1441,9 @@ export declare const PUBLISHED_KEY_SEPARATOR = "---";
|
|
|
1271
1441
|
/** Published (cached) client API path. */
|
|
1272
1442
|
export declare const PUBLISHED_WIDGET_API_PATH = "/api/v1/c/widget/get";
|
|
1273
1443
|
|
|
1444
|
+
/** Published ruleset resolve path (POST) — picks a widget by params, returns its payload. */
|
|
1445
|
+
export declare const PUBLISHED_WIDGET_RESOLVE_API_PATH = "/api/v1/c/widget/resolve";
|
|
1446
|
+
|
|
1274
1447
|
export declare type PublishedWidgetCollectionForKey = {
|
|
1275
1448
|
publishedKey: string;
|
|
1276
1449
|
name: string;
|
|
@@ -1418,6 +1591,9 @@ export declare interface ResolveWidgetLibrariesParams {
|
|
|
1418
1591
|
*/
|
|
1419
1592
|
export declare function rowBasedPropertiesAreAssigned(row: DisplayItemRow): boolean;
|
|
1420
1593
|
|
|
1594
|
+
/** First-party `localStorage` key holding the SDK-generated anonymous id. */
|
|
1595
|
+
export declare const RULECMS_ANONYMOUS_ID_STORAGE_KEY = "rulecms_anon_id";
|
|
1596
|
+
|
|
1421
1597
|
/** Live draft API host — RulesCMS production (never relative / local). */
|
|
1422
1598
|
export declare const RULECMS_API_ORIGIN = "https://rulecms.com";
|
|
1423
1599
|
|
|
@@ -1436,15 +1612,21 @@ export declare interface RuleCMSWidgetContext {
|
|
|
1436
1612
|
libraryRegistry: ComponentLibraryRegistry;
|
|
1437
1613
|
}
|
|
1438
1614
|
|
|
1615
|
+
/** Render-ready widget payload after parsing API / fetch response. */
|
|
1439
1616
|
export declare interface RuleCMSWidgetData {
|
|
1440
1617
|
displayItemList: Items;
|
|
1441
1618
|
widgetCollections: {
|
|
1442
1619
|
[key: string]: WidgetCollection;
|
|
1443
1620
|
};
|
|
1621
|
+
/**
|
|
1622
|
+
* Platform-served library descriptors (optional; absent for configs that
|
|
1623
|
+
* only use the default library, and until the platform serves them).
|
|
1624
|
+
*/
|
|
1444
1625
|
libraries?: ConfigLibrariesMap;
|
|
1445
1626
|
/**
|
|
1446
1627
|
* Project CSS variable catalog joined onto the widget GET. Optional; omit
|
|
1447
|
-
* or `{}` when the project has none. Not stored on itemList.
|
|
1628
|
+
* or `{}` when the project has none. Not stored on itemList. Dropped when
|
|
1629
|
+
* `includeCssVariables` on the raw GET is `false`.
|
|
1448
1630
|
*/
|
|
1449
1631
|
cssVariables?: ProjectCssVariableDefinitions;
|
|
1450
1632
|
/**
|
|
@@ -1453,6 +1635,46 @@ export declare interface RuleCMSWidgetData {
|
|
|
1453
1635
|
* when `includeClassDefinitions` on the raw GET is `false`.
|
|
1454
1636
|
*/
|
|
1455
1637
|
classDefinitions?: ProjectCssClassDefinitions;
|
|
1638
|
+
/**
|
|
1639
|
+
* Cascade layer to wrap class definitions. Dropped when
|
|
1640
|
+
* `includeClassLayer` on the raw GET is `false`.
|
|
1641
|
+
*/
|
|
1642
|
+
classLayer?: ProjectCssClassLayer;
|
|
1643
|
+
/**
|
|
1644
|
+
* Project font-face catalog joined onto the widget GET. Dropped when
|
|
1645
|
+
* `includeFontFaces` on the raw GET is `false`.
|
|
1646
|
+
*/
|
|
1647
|
+
fontFaces?: ProjectFontFace[];
|
|
1648
|
+
/**
|
|
1649
|
+
* Project keyframes catalog joined onto the widget GET. Dropped when
|
|
1650
|
+
* `includeKeyframes` on the raw GET is `false`.
|
|
1651
|
+
*/
|
|
1652
|
+
keyframes?: ProjectCssKeyframeDefinitions;
|
|
1653
|
+
/**
|
|
1654
|
+
* Project theme-override catalog joined onto the widget GET. Dropped when
|
|
1655
|
+
* `includeThemes` on the raw GET is `false`.
|
|
1656
|
+
*/
|
|
1657
|
+
themes?: ProjectThemeDefinition[];
|
|
1658
|
+
/**
|
|
1659
|
+
* Project typed `@property` catalog joined onto the widget GET. Dropped when
|
|
1660
|
+
* `includeCssProperties` on the raw GET is `false`.
|
|
1661
|
+
*/
|
|
1662
|
+
cssProperties?: ProjectCssPropertyDefinition[];
|
|
1663
|
+
/**
|
|
1664
|
+
* Project widget-root chrome joined onto the widget GET. Dropped when
|
|
1665
|
+
* `includeWidgetChrome` on the raw GET is `false`.
|
|
1666
|
+
*/
|
|
1667
|
+
widgetChrome?: ProjectWidgetChrome;
|
|
1668
|
+
/**
|
|
1669
|
+
* Project position-try catalog joined onto the widget GET. Dropped when
|
|
1670
|
+
* `includePositionTry` on the raw GET is `false`.
|
|
1671
|
+
*/
|
|
1672
|
+
positionTry?: ProjectCssPositionTryDefinitions;
|
|
1673
|
+
/**
|
|
1674
|
+
* Present when this payload came from a ruleset resolve. A plain published-key
|
|
1675
|
+
* GET never sets it.
|
|
1676
|
+
*/
|
|
1677
|
+
selection?: WidgetSelection;
|
|
1456
1678
|
}
|
|
1457
1679
|
|
|
1458
1680
|
export declare const RuleCMSWidgetProvider: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
@@ -1462,14 +1684,62 @@ export declare interface RuleCMSWidgetRawData {
|
|
|
1462
1684
|
childCollections: {
|
|
1463
1685
|
[key: string]: ChildCollection;
|
|
1464
1686
|
};
|
|
1687
|
+
/** Optional platform-served library descriptors (see RuleCMSWidgetData). */
|
|
1465
1688
|
libraries?: ConfigLibrariesMap;
|
|
1466
1689
|
cssVariables?: ProjectCssVariableDefinitions;
|
|
1690
|
+
/**
|
|
1691
|
+
* When `false`, do not emit the catalog even if `cssVariables` is present.
|
|
1692
|
+
* Missing means include (legacy payloads).
|
|
1693
|
+
*/
|
|
1694
|
+
includeCssVariables?: boolean;
|
|
1467
1695
|
classDefinitions?: ProjectCssClassDefinitions;
|
|
1468
1696
|
/**
|
|
1469
1697
|
* When `false`, do not emit class definitions even if `classDefinitions` is
|
|
1470
1698
|
* present. Missing means include (legacy payloads).
|
|
1471
1699
|
*/
|
|
1472
1700
|
includeClassDefinitions?: boolean;
|
|
1701
|
+
classLayer?: ProjectCssClassLayer;
|
|
1702
|
+
/**
|
|
1703
|
+
* When `false`, emit class definitions unlayered even if `classLayer` is
|
|
1704
|
+
* present. Missing means wrap when `classLayer` is set.
|
|
1705
|
+
*/
|
|
1706
|
+
includeClassLayer?: boolean;
|
|
1707
|
+
fontFaces?: ProjectFontFace[];
|
|
1708
|
+
/**
|
|
1709
|
+
* When `false`, do not emit fonts even if `fontFaces` is present.
|
|
1710
|
+
* Missing means include (legacy payloads).
|
|
1711
|
+
*/
|
|
1712
|
+
includeFontFaces?: boolean;
|
|
1713
|
+
keyframes?: ProjectCssKeyframeDefinitions;
|
|
1714
|
+
/**
|
|
1715
|
+
* When `false`, do not emit keyframes even if `keyframes` is present.
|
|
1716
|
+
* Missing means include (legacy payloads).
|
|
1717
|
+
*/
|
|
1718
|
+
includeKeyframes?: boolean;
|
|
1719
|
+
themes?: ProjectThemeDefinition[];
|
|
1720
|
+
/**
|
|
1721
|
+
* When `false`, do not emit theme overrides even if `themes` is present.
|
|
1722
|
+
* Missing means include (legacy payloads).
|
|
1723
|
+
*/
|
|
1724
|
+
includeThemes?: boolean;
|
|
1725
|
+
cssProperties?: ProjectCssPropertyDefinition[];
|
|
1726
|
+
/**
|
|
1727
|
+
* When `false`, do not emit typed CSS properties even if `cssProperties` is
|
|
1728
|
+
* present. Missing means include (legacy payloads).
|
|
1729
|
+
*/
|
|
1730
|
+
includeCssProperties?: boolean;
|
|
1731
|
+
widgetChrome?: ProjectWidgetChrome;
|
|
1732
|
+
/**
|
|
1733
|
+
* When `false`, do not emit widget chrome even if `widgetChrome` is present.
|
|
1734
|
+
* Missing means include (legacy payloads).
|
|
1735
|
+
*/
|
|
1736
|
+
includeWidgetChrome?: boolean;
|
|
1737
|
+
positionTry?: ProjectCssPositionTryDefinitions;
|
|
1738
|
+
/**
|
|
1739
|
+
* When `false`, do not emit position-try fallbacks even if `positionTry` is
|
|
1740
|
+
* present. Missing means include (legacy payloads).
|
|
1741
|
+
*/
|
|
1742
|
+
includePositionTry?: boolean;
|
|
1473
1743
|
}
|
|
1474
1744
|
|
|
1475
1745
|
export declare interface SourceComponentsPlugin {
|
|
@@ -1508,6 +1778,14 @@ export declare type SpacingSideLiteralValue = {
|
|
|
1508
1778
|
|
|
1509
1779
|
export declare type SpacingSideValue = (SpacingSideLiteralValue & CssVariableCarrier) | CssVariableValue;
|
|
1510
1780
|
|
|
1781
|
+
/**
|
|
1782
|
+
* `JSON.stringify` with object keys sorted at every depth, so two objects with
|
|
1783
|
+
* the same values serialize identically regardless of insertion order. Used as
|
|
1784
|
+
* the effect dependency for resolve `params`: a fresh `{ b, a }` on every render
|
|
1785
|
+
* must not trigger a refetch when `{ a, b }` was already sent.
|
|
1786
|
+
*/
|
|
1787
|
+
export declare function stableJsonStringify(value: unknown): string | undefined;
|
|
1788
|
+
|
|
1511
1789
|
export declare const tabletModeWidth = "820px";
|
|
1512
1790
|
|
|
1513
1791
|
export declare const textAlignAllowlist: readonly ["left", "center", "right", "justify", "start", "end"];
|
|
@@ -1552,6 +1830,14 @@ export declare const WIDGET_ATTRIBUTES_IGNORED_IN_COMPOSE_MODE: readonly ["width
|
|
|
1552
1830
|
/** Published (cached) API host. */
|
|
1553
1831
|
export declare const WIDGET_CACHE_API_ORIGIN = "https://widget-cache.rulecms.com";
|
|
1554
1832
|
|
|
1833
|
+
/**
|
|
1834
|
+
* The one key copied from `rulecms-widget`'s `placeholderValues` onto a card.
|
|
1835
|
+
* Must stay the key `r-text` reads (`PLACEHOLDER_VALUES_PROP` in
|
|
1836
|
+
* `@rulecms/source-components-vue`). The renderer copies the value and does
|
|
1837
|
+
* not look inside it.
|
|
1838
|
+
*/
|
|
1839
|
+
export declare const WIDGET_PLACEHOLDER_VALUES_KEY = "placeholderValues";
|
|
1840
|
+
|
|
1555
1841
|
/**
|
|
1556
1842
|
* True when the widget carries settings that need a real DOM element to land
|
|
1557
1843
|
* on, so the vertical container has to be emitted even where it would
|
|
@@ -1627,6 +1913,82 @@ export declare type WidgetOverlayLayers = {
|
|
|
1627
1913
|
layers: Items[];
|
|
1628
1914
|
};
|
|
1629
1915
|
|
|
1916
|
+
/**
|
|
1917
|
+
* `Content-Type` sent on the resolve POST. `text/plain` is CORS-safelisted, so
|
|
1918
|
+
* the browser skips the preflight; it is the default everywhere.
|
|
1919
|
+
* `application/json` is for server-to-server calls only.
|
|
1920
|
+
*/
|
|
1921
|
+
export declare type WidgetResolveContentType = 'application/json' | 'text/plain';
|
|
1922
|
+
|
|
1923
|
+
/** Options shared by every ruleset-driven entry point (hook, widget, server fetch). */
|
|
1924
|
+
export declare interface WidgetResolveRequestOptions {
|
|
1925
|
+
/**
|
|
1926
|
+
* Staging/production: ruleset published key (`{environmentId}---ruleset-…`).
|
|
1927
|
+
* Development (`dev.` token): the `ruleset-…` key; a published key is
|
|
1928
|
+
* accepted and stripped to its `ruleset-…` suffix.
|
|
1929
|
+
*/
|
|
1930
|
+
rulesetPublishedKey: string;
|
|
1931
|
+
/** Any JSON object. Sent as-is; the server flattens nested objects. */
|
|
1932
|
+
params?: WidgetSelectionParams;
|
|
1933
|
+
/**
|
|
1934
|
+
* Widget to GET through the plain published path when the resolve request
|
|
1935
|
+
* fails at the network level or with a 5xx. Not used on 4xx (bad token,
|
|
1936
|
+
* unknown ruleset…), and not needed for "no rule matched" — the ruleset's
|
|
1937
|
+
* own default covers that on the server.
|
|
1938
|
+
*/
|
|
1939
|
+
fallbackPublishedKey?: string;
|
|
1940
|
+
/**
|
|
1941
|
+
* Defaults to `text/plain` (no CORS preflight). Use `application/json` only
|
|
1942
|
+
* for server-to-server calls.
|
|
1943
|
+
*/
|
|
1944
|
+
contentType?: WidgetResolveContentType;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
/** Which widget a ruleset picked and why. Returned alongside the widget payload. */
|
|
1948
|
+
export declare interface WidgetSelection {
|
|
1949
|
+
rulesetPublishedKey?: string;
|
|
1950
|
+
rulesetVersion?: string;
|
|
1951
|
+
schemaVersion?: number;
|
|
1952
|
+
outcome: WidgetSelectionOutcome;
|
|
1953
|
+
/** Matched rule id, or `null` for the default / fallback-default outcomes. */
|
|
1954
|
+
ruleId: string | null;
|
|
1955
|
+
/** Experiment variant id, or `null` when the rule was not an experiment. */
|
|
1956
|
+
variantId: string | null;
|
|
1957
|
+
widgetKey: string;
|
|
1958
|
+
widgetPublishedKey: string;
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
export declare type WidgetSelectionOutcome = 'rule' | 'default' | 'fallback-default';
|
|
1962
|
+
|
|
1963
|
+
/**
|
|
1964
|
+
* Any JSON object. Sent to the resolve endpoint as-is — the server flattens
|
|
1965
|
+
* nested objects (`user.plan`) before evaluating rules. `undefined` values are
|
|
1966
|
+
* allowed for ergonomics (`{ plan: user?.plan }`) and dropped by JSON.
|
|
1967
|
+
*/
|
|
1968
|
+
export declare interface WidgetSelectionParams {
|
|
1969
|
+
[name: string]: WidgetSelectionParamValue | undefined;
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
/** A JSON leaf or nested value accepted in resolve `params`. */
|
|
1973
|
+
declare type WidgetSelectionParamValue = string | number | boolean | null | WidgetSelectionParamValue[] | WidgetSelectionParams;
|
|
1974
|
+
|
|
1975
|
+
/**
|
|
1976
|
+
* Widget-wide placeholder values for one component instance.
|
|
1977
|
+
*
|
|
1978
|
+
* When the host passed `placeholderValues` on `rulecms-widget`, every instance
|
|
1979
|
+
* receives that object unless its own `componentProps` entry already has the
|
|
1980
|
+
* key. An entry that sets the key wins even when the value is `null` or
|
|
1981
|
+
* otherwise unusable: that is how one Text opts out. Other keys on the entry,
|
|
1982
|
+
* such as `onClick`, stay. The host's entry is not mutated.
|
|
1983
|
+
*
|
|
1984
|
+
* `undefined` means the widget input was omitted, which is the common case and
|
|
1985
|
+
* must not invent a bag.
|
|
1986
|
+
*/
|
|
1987
|
+
export declare function withWidgetPlaceholderValues({ widgetInstanceProps, placeholderValues, }: {
|
|
1988
|
+
widgetInstanceProps?: WidgetInstanceProps;
|
|
1989
|
+
placeholderValues?: unknown;
|
|
1990
|
+
}): WidgetInstanceProps | undefined;
|
|
1991
|
+
|
|
1630
1992
|
/**
|
|
1631
1993
|
* The base's own place in the stack. Read here rather than through
|
|
1632
1994
|
* objectStyleAttributeRegistry on purpose: the registry is shared with rows and
|