@rulecms/widget-vue 0.2.0 → 0.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 +14 -0
- package/dist/index.cjs +9 -9
- package/dist/index.d.ts +167 -3
- package/dist/index.js +1024 -783
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ declare type __VLS_Props_2 = {
|
|
|
21
21
|
initialData?: RuleCMSWidgetData;
|
|
22
22
|
libraries?: LibraryRegistrationMap;
|
|
23
23
|
componentProps?: ComponentPropsMap;
|
|
24
|
+
mounts?: MountsMap;
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
declare type __VLS_Props_3 = {
|
|
@@ -34,6 +35,7 @@ declare type __VLS_Props_3 = {
|
|
|
34
35
|
reduxDeviceDisplayType?: string;
|
|
35
36
|
plugins: RenderComponentPlugins;
|
|
36
37
|
componentProps?: ComponentPropsMap;
|
|
38
|
+
mounts?: MountsMap;
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
declare type __VLS_Props_4 = {
|
|
@@ -48,6 +50,7 @@ declare type __VLS_Props_4 = {
|
|
|
48
50
|
deviceDisplayType: keyof typeof DeviceDisplayTypes;
|
|
49
51
|
plugins: RenderComponentPlugins;
|
|
50
52
|
componentProps?: ComponentPropsMap;
|
|
53
|
+
mounts?: MountsMap;
|
|
51
54
|
ancestorColumnIds?: string[];
|
|
52
55
|
};
|
|
53
56
|
|
|
@@ -63,6 +66,7 @@ declare type __VLS_Props_5 = {
|
|
|
63
66
|
plugins: RenderComponentPlugins;
|
|
64
67
|
deviceDisplayType: keyof typeof DeviceDisplayTypes;
|
|
65
68
|
componentProps?: ComponentPropsMap;
|
|
69
|
+
mounts?: MountsMap;
|
|
66
70
|
ancestorColumnIds?: string[];
|
|
67
71
|
};
|
|
68
72
|
|
|
@@ -73,6 +77,7 @@ declare type __VLS_Props_6 = {
|
|
|
73
77
|
};
|
|
74
78
|
plugins: RenderComponentPlugins;
|
|
75
79
|
componentProps?: ComponentPropsMap;
|
|
80
|
+
mounts?: MountsMap;
|
|
76
81
|
scopeIdInput?: string;
|
|
77
82
|
};
|
|
78
83
|
|
|
@@ -87,6 +92,7 @@ declare type __VLS_Props_7 = {
|
|
|
87
92
|
[key: string]: any;
|
|
88
93
|
};
|
|
89
94
|
widgetInstanceProps?: WidgetInstanceProps;
|
|
95
|
+
mounts?: MountsMap;
|
|
90
96
|
};
|
|
91
97
|
|
|
92
98
|
declare function __VLS_template(): {
|
|
@@ -231,6 +237,45 @@ export declare const buildCloudinaryBackgroundUrl: ({ publicId, cloudName, trans
|
|
|
231
237
|
width?: number;
|
|
232
238
|
}) => string;
|
|
233
239
|
|
|
240
|
+
/**
|
|
241
|
+
* One layer's box: out of flow so it cannot inflate the stack it is measuring
|
|
242
|
+
* itself against, stretched to that stack's padding box, and sized in border-box
|
|
243
|
+
* so a layer's own border or padding stays inside the base's footprint.
|
|
244
|
+
*/
|
|
245
|
+
export declare function buildOverlayLayerBoxStyles({ zIndex, pointerEvents, }: {
|
|
246
|
+
zIndex: number;
|
|
247
|
+
pointerEvents?: string;
|
|
248
|
+
}): {
|
|
249
|
+
[key: string]: any;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* The stack wrapper: containing block for every layer, and the element whose
|
|
254
|
+
* used width and height the layers resolve their `100%` against.
|
|
255
|
+
*
|
|
256
|
+
* It takes its size from the base in normal flow, so it carries no size of its
|
|
257
|
+
* own beyond the height default it adopts from the vertical container — the page
|
|
258
|
+
* root is full height, a collection is content height. `baseDeclaresOwnHeight`
|
|
259
|
+
* drops even that, because a base pinned to an authored height has to be the
|
|
260
|
+
* thing the layers match.
|
|
261
|
+
*
|
|
262
|
+
* `isolation: isolate` keeps the layer numbers a private matter between the base
|
|
263
|
+
* and its layers. Without it they would be sorted against the host page, where
|
|
264
|
+
* beating a sticky header was never the point.
|
|
265
|
+
*
|
|
266
|
+
* A non-zero base z-index lands here too, on the widget's outermost box, which
|
|
267
|
+
* is the one the host page sorts. Nothing is emitted for the default 0: an
|
|
268
|
+
* unpositioned stack already paints under its own layers, and staying out of the
|
|
269
|
+
* host's stacking order is the better default.
|
|
270
|
+
*/
|
|
271
|
+
export declare function buildOverlayStackStyles({ isWithinCollection, baseDeclaresOwnHeight, baseZIndex, }: {
|
|
272
|
+
isWithinCollection: boolean;
|
|
273
|
+
baseDeclaresOwnHeight: boolean;
|
|
274
|
+
baseZIndex: number;
|
|
275
|
+
}): {
|
|
276
|
+
[key: string]: any;
|
|
277
|
+
};
|
|
278
|
+
|
|
234
279
|
/**
|
|
235
280
|
* Builds the widget fetch URL. Development tokens (`dev.…`) hit the uncached
|
|
236
281
|
* draft endpoint with `widgetKey`; everything else uses the published API.
|
|
@@ -446,6 +491,9 @@ export declare type CssVariableValue = {
|
|
|
446
491
|
cssVariable: CssVariableName;
|
|
447
492
|
};
|
|
448
493
|
|
|
494
|
+
/** Base z-index when the author set none. */
|
|
495
|
+
export declare const DEFAULT_BASE_Z_INDEX = 0;
|
|
496
|
+
|
|
449
497
|
/** The cloud that hosts both team uploads and the shared RuleCMS library. */
|
|
450
498
|
export declare const DEFAULT_CLOUDINARY_CLOUD_NAME = "rulecms";
|
|
451
499
|
|
|
@@ -885,6 +933,16 @@ export declare const getNameFromWidgetKey: (widgetKey: string) => {
|
|
|
885
933
|
errorMessage?: string;
|
|
886
934
|
};
|
|
887
935
|
|
|
936
|
+
/**
|
|
937
|
+
* Where a layer sits above a base at `baseZIndex`: the first layer takes
|
|
938
|
+
* `baseZIndex + 1`, the second `baseZIndex + 2`, and so on.
|
|
939
|
+
*
|
|
940
|
+
* Derived from the position in the array, never from the layer itself, so a
|
|
941
|
+
* layer that renders nothing — hidden at this width, or with no rows — leaves
|
|
942
|
+
* its number unused rather than pulling the layers above it down.
|
|
943
|
+
*/
|
|
944
|
+
export declare function getOverlayLayerZIndex(baseZIndex: number, layerIndex: number): number;
|
|
945
|
+
|
|
888
946
|
export declare interface GetRuleCMSWidgetResponse {
|
|
889
947
|
success: boolean;
|
|
890
948
|
data: {
|
|
@@ -940,6 +998,9 @@ export declare const hasInvalidCssVariable: (leaf: unknown) => boolean;
|
|
|
940
998
|
|
|
941
999
|
export declare const hasItems: (items: Items | undefined) => boolean | undefined;
|
|
942
1000
|
|
|
1001
|
+
/** True when this Items asks for at least one layer over its rows. */
|
|
1002
|
+
export declare function hasOverlayLayers(items: Items | undefined): boolean;
|
|
1003
|
+
|
|
943
1004
|
export declare const HIDE_WIDGET_ATTRIBUTE_NAME = "hide-component-3-resolutions";
|
|
944
1005
|
|
|
945
1006
|
/**
|
|
@@ -977,6 +1038,16 @@ export declare const isLineHeightValue: (value: unknown) => value is LineHeightV
|
|
|
977
1038
|
|
|
978
1039
|
export declare const isOpacityValue: (value: unknown) => value is OpacityValue;
|
|
979
1040
|
|
|
1041
|
+
/**
|
|
1042
|
+
* True when a layer has nothing to put on screen at this width, so its box is
|
|
1043
|
+
* not worth emitting. Its z-index slot still goes unclaimed — see
|
|
1044
|
+
* getOverlayLayerZIndex.
|
|
1045
|
+
*/
|
|
1046
|
+
export declare function isOverlayLayerEmptyForDevice({ layer, deviceDisplayType, }: {
|
|
1047
|
+
layer: Items;
|
|
1048
|
+
deviceDisplayType: keyof typeof DeviceDisplayTypes;
|
|
1049
|
+
}): boolean;
|
|
1050
|
+
|
|
980
1051
|
export declare function isRowHiddenForDevice({ row, deviceDisplayType, }: {
|
|
981
1052
|
row: DisplayItemRow;
|
|
982
1053
|
deviceDisplayType: keyof typeof DeviceDisplayTypes;
|
|
@@ -1003,6 +1074,12 @@ export declare type Items = {
|
|
|
1003
1074
|
containerAttributes?: {
|
|
1004
1075
|
[key: string]: any;
|
|
1005
1076
|
};
|
|
1077
|
+
/**
|
|
1078
|
+
* Layers drawn over the rows above, each covering exactly the box the rows
|
|
1079
|
+
* occupy. Absent for the overwhelming majority of configs. Honoured in
|
|
1080
|
+
* preview and every published render; the composer canvas ignores it.
|
|
1081
|
+
*/
|
|
1082
|
+
overlayLayers?: WidgetOverlayLayers;
|
|
1006
1083
|
};
|
|
1007
1084
|
|
|
1008
1085
|
/** Column flex layout — matches row Horizontal Alignment options. */
|
|
@@ -1046,6 +1123,12 @@ export declare interface LibraryCardInputs {
|
|
|
1046
1123
|
};
|
|
1047
1124
|
className?: string;
|
|
1048
1125
|
widgetInstanceProps?: WidgetInstanceProps;
|
|
1126
|
+
/**
|
|
1127
|
+
* Host-supplied map of mount name → Vue component. Only `r-mount`
|
|
1128
|
+
* reads this. Absent in the composer, and absent whenever the host
|
|
1129
|
+
* passed no `mounts` on `RuleCMSWidget`.
|
|
1130
|
+
*/
|
|
1131
|
+
mounts?: MountsMap;
|
|
1049
1132
|
}
|
|
1050
1133
|
|
|
1051
1134
|
export declare type LibraryComponentEntry = {
|
|
@@ -1071,6 +1154,15 @@ export declare type LineHeightValue = ({
|
|
|
1071
1154
|
value: number;
|
|
1072
1155
|
} & CssVariableCarrier) | SpacingSideValue;
|
|
1073
1156
|
|
|
1157
|
+
/**
|
|
1158
|
+
* Host-app components `r-mount` can render, keyed by the name an author
|
|
1159
|
+
* types in the composer. The name is a map lookup, not a string that
|
|
1160
|
+
* becomes code. A miss is a placeholder.
|
|
1161
|
+
*/
|
|
1162
|
+
export declare type MountsMap = {
|
|
1163
|
+
[name: string]: Component;
|
|
1164
|
+
};
|
|
1165
|
+
|
|
1074
1166
|
export declare type NoContainerResolverContext = {
|
|
1075
1167
|
componentAttributes?: {
|
|
1076
1168
|
[key: string]: any;
|
|
@@ -1148,6 +1240,15 @@ export declare const PageViewTypes: {
|
|
|
1148
1240
|
|
|
1149
1241
|
export declare const phoneModeWidth = "500px";
|
|
1150
1242
|
|
|
1243
|
+
export declare const POINTER_EVENTS_ATTRIBUTE_NAME = "pointer-events-3-resolutions";
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Whether an element takes pointer input. `none` passes clicks through to
|
|
1247
|
+
* whatever sits behind, which is what an overlay layer covering the base needs;
|
|
1248
|
+
* a descendant can take input back with `auto`, since the property inherits.
|
|
1249
|
+
*/
|
|
1250
|
+
export declare const pointerEventsAllowlist: readonly ["auto", "none"];
|
|
1251
|
+
|
|
1151
1252
|
/** Transform raw widget API data into render-ready displayItemList + collections. */
|
|
1152
1253
|
export declare function prepareRuleCMSWidgetData(raw: RuleCMSWidgetRawData): RuleCMSWidgetData;
|
|
1153
1254
|
|
|
@@ -1181,9 +1282,20 @@ export declare const RenderComponentsForDevice: DefineComponent<__VLS_Props_4, {
|
|
|
1181
1282
|
|
|
1182
1283
|
export declare const RenderComponentsInner: DefineComponent<__VLS_Props_5, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_5> & Readonly<{}>, {
|
|
1183
1284
|
isComposeMode: boolean;
|
|
1184
|
-
showDropContainers: boolean;
|
|
1185
1285
|
isWithinCollection: boolean;
|
|
1186
|
-
|
|
1286
|
+
showDropContainers: boolean;
|
|
1287
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
1288
|
+
|
|
1289
|
+
/**
|
|
1290
|
+
* The base's z-index for this device, or 0 when unset or unusable. Accepts the
|
|
1291
|
+
* number and the numeric string, since hand-authored JSON produces both.
|
|
1292
|
+
*/
|
|
1293
|
+
export declare function resolveBaseZIndex({ containerAttributes, deviceDisplayType, }: {
|
|
1294
|
+
containerAttributes: {
|
|
1295
|
+
[key: string]: any;
|
|
1296
|
+
} | undefined;
|
|
1297
|
+
deviceDisplayType: keyof typeof DeviceDisplayTypes;
|
|
1298
|
+
}): number;
|
|
1187
1299
|
|
|
1188
1300
|
/**
|
|
1189
1301
|
* Maps a component's (libraryId, type) pair to its key in the composed
|
|
@@ -1203,6 +1315,23 @@ export declare interface ResolveLibrariesParams {
|
|
|
1203
1315
|
|
|
1204
1316
|
export declare type ResolveNoContainer = (context: NoContainerResolverContext) => boolean;
|
|
1205
1317
|
|
|
1318
|
+
/**
|
|
1319
|
+
* A layer's `pointer-events` for this device, lifted from the layer's own
|
|
1320
|
+
* container settings. `undefined` leaves the property off the box entirely.
|
|
1321
|
+
*
|
|
1322
|
+
* The layer box covers the whole base, so this has to land there rather than on
|
|
1323
|
+
* the container nested inside it: `none` on an inner element still leaves the
|
|
1324
|
+
* box itself intercepting every click aimed at the base underneath. Because the
|
|
1325
|
+
* property inherits, one `none` on the layer also frees the layer's own content,
|
|
1326
|
+
* which can take input back with `auto` on the column that needs it.
|
|
1327
|
+
*/
|
|
1328
|
+
export declare function resolveOverlayLayerPointerEvents({ containerAttributes, deviceDisplayType, }: {
|
|
1329
|
+
containerAttributes: {
|
|
1330
|
+
[key: string]: any;
|
|
1331
|
+
} | undefined;
|
|
1332
|
+
deviceDisplayType: keyof typeof DeviceDisplayTypes;
|
|
1333
|
+
}): string | undefined;
|
|
1334
|
+
|
|
1206
1335
|
export declare type ResolveRendersOwnElement = (context: NoContainerResolverContext) => boolean;
|
|
1207
1336
|
|
|
1208
1337
|
/**
|
|
@@ -1385,8 +1514,11 @@ export declare function warnUnmatchedComponentProps({ componentProps, displayIte
|
|
|
1385
1514
|
* Flex layout, gap, colors, typography, opacity and CSS classes are absent
|
|
1386
1515
|
* deliberately: they change how the canvas looks without taking away the room
|
|
1387
1516
|
* or the affordances the author needs to keep working.
|
|
1517
|
+
*
|
|
1518
|
+
* `pointer-events` is here for the same reason as hiding: `none` would leave the
|
|
1519
|
+
* author with a widget they cannot click or drag at all.
|
|
1388
1520
|
*/
|
|
1389
|
-
export declare const WIDGET_ATTRIBUTES_IGNORED_IN_COMPOSE_MODE: readonly ["width-3-resolutions", "min-width-3-resolutions", "max-width-3-resolutions", "height-3-resolutions", "min-height-3-resolutions", "max-height-3-resolutions", "margin-3-resolutions", "padding-3-resolutions", "border-3-resolutions", "border-radius-3-resolutions", "box-shadow-3-resolutions", "overflow-3-resolutions", "overflow-x-3-resolutions", "overflow-y-3-resolutions", "hide-component-3-resolutions"];
|
|
1521
|
+
export declare const WIDGET_ATTRIBUTES_IGNORED_IN_COMPOSE_MODE: readonly ["width-3-resolutions", "min-width-3-resolutions", "max-width-3-resolutions", "height-3-resolutions", "min-height-3-resolutions", "max-height-3-resolutions", "margin-3-resolutions", "padding-3-resolutions", "border-3-resolutions", "border-radius-3-resolutions", "box-shadow-3-resolutions", "overflow-3-resolutions", "overflow-x-3-resolutions", "overflow-y-3-resolutions", "hide-component-3-resolutions", "pointer-events-3-resolutions"];
|
|
1390
1522
|
|
|
1391
1523
|
/** Published (cached) API host. */
|
|
1392
1524
|
export declare const WIDGET_CACHE_API_ORIGIN = "https://widget-cache.rulecms.com";
|
|
@@ -1431,6 +1563,17 @@ export declare interface WidgetData {
|
|
|
1431
1563
|
lastPublishedAt: string;
|
|
1432
1564
|
}
|
|
1433
1565
|
|
|
1566
|
+
/**
|
|
1567
|
+
* True when the author gave the widget a height of its own, through either the
|
|
1568
|
+
* structured setting or the legacy raw container CSS.
|
|
1569
|
+
*/
|
|
1570
|
+
export declare function widgetDeclaresOwnHeight({ containerAttributes, widgetContainerStyles, }: {
|
|
1571
|
+
containerAttributes: {
|
|
1572
|
+
[key: string]: any;
|
|
1573
|
+
} | undefined;
|
|
1574
|
+
widgetContainerStyles: WidgetContainerStyles;
|
|
1575
|
+
}): boolean;
|
|
1576
|
+
|
|
1434
1577
|
/**
|
|
1435
1578
|
* Extra props a host application supplies for one component instance, handed
|
|
1436
1579
|
* to the component as `widgetInstanceProps`. Opaque to widget-react: it
|
|
@@ -1441,4 +1584,25 @@ export declare type WidgetInstanceProps = {
|
|
|
1441
1584
|
[key: string]: any;
|
|
1442
1585
|
};
|
|
1443
1586
|
|
|
1587
|
+
/**
|
|
1588
|
+
* An object rather than a bare array so the stacking contract has somewhere to
|
|
1589
|
+
* grow without another breaking shape change.
|
|
1590
|
+
*/
|
|
1591
|
+
export declare type WidgetOverlayLayers = {
|
|
1592
|
+
/**
|
|
1593
|
+
* Each layer is a full `Items` — its own rows, columns, collections and
|
|
1594
|
+
* container settings — so a layer renders through the same recursion as the
|
|
1595
|
+
* base and needs no separate vocabulary. Order is paint order: later
|
|
1596
|
+
* entries sit above earlier ones.
|
|
1597
|
+
*/
|
|
1598
|
+
layers: Items[];
|
|
1599
|
+
};
|
|
1600
|
+
|
|
1601
|
+
/**
|
|
1602
|
+
* The base's own place in the stack. Read here rather than through
|
|
1603
|
+
* objectStyleAttributeRegistry on purpose: the registry is shared with rows and
|
|
1604
|
+
* columns, and z-index is only meaningful to the widget wrapper for now.
|
|
1605
|
+
*/
|
|
1606
|
+
export declare const Z_INDEX_WIDGET_ATTRIBUTE_NAME = "z-index-3-resolutions";
|
|
1607
|
+
|
|
1444
1608
|
export { }
|