@qrvey/widget-configurability 0.0.0-beta.4737 → 0.0.0-beta.4750
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 +20 -0
- package/dist/cjs/metadata/customization-applicability.js +58 -0
- package/dist/cjs/metadata/customization-applicability.js.map +1 -0
- package/dist/cjs/metadata/customization-docs.js +15 -12
- package/dist/cjs/metadata/customization-docs.js.map +1 -1
- package/dist/cjs/metadata/customization-metadata.js +64 -6
- package/dist/cjs/metadata/customization-metadata.js.map +1 -1
- package/dist/cjs/metadata/index.js +2 -1
- package/dist/cjs/metadata/index.js.map +1 -1
- package/dist/cjs/metadata/labels/dashboard.applicability.js +108 -0
- package/dist/cjs/metadata/labels/dashboard.applicability.js.map +1 -0
- package/dist/esm/metadata.mjs +463 -43
- package/dist/esm/metadata.mjs.map +1 -1
- package/dist/types/metadata.d.ts +47 -6
- package/package.json +1 -1
package/dist/types/metadata.d.ts
CHANGED
|
@@ -29,14 +29,37 @@ interface CustomizationStructureOptions {
|
|
|
29
29
|
structure?: CustomizationStructureSource;
|
|
30
30
|
subModuleStructures?: Record<string, CustomizationStructureSource>;
|
|
31
31
|
}
|
|
32
|
+
type CustomizationRole = 'item' | 'group' | 'defaults' | 'none';
|
|
33
|
+
type CustomizationRequirement = 'cardView' | 'tableView' | 'fixedCanvas' | 'responsiveCanvas' | 'permission' | 'personalization' | 'content' | 'navigation' | 'environment' | 'composer';
|
|
34
|
+
interface CustomizationApplicability {
|
|
35
|
+
role?: CustomizationRole;
|
|
36
|
+
views?: readonly string[];
|
|
37
|
+
requires?: readonly CustomizationRequirement[];
|
|
38
|
+
}
|
|
39
|
+
type CustomizationApplicabilityMap = Record<string, CustomizationApplicability>;
|
|
40
|
+
interface CustomizationKeyApplicability {
|
|
41
|
+
role: CustomizationRole;
|
|
42
|
+
applies: boolean;
|
|
43
|
+
toggleable: boolean;
|
|
44
|
+
views?: string[];
|
|
45
|
+
requires?: CustomizationRequirement[];
|
|
46
|
+
}
|
|
32
47
|
interface CustomizationTreeNode {
|
|
33
48
|
key: string;
|
|
34
49
|
id: string;
|
|
35
50
|
label: string;
|
|
36
51
|
description?: string;
|
|
37
52
|
kind: 'section' | 'item' | 'subModule';
|
|
53
|
+
role: CustomizationRole;
|
|
54
|
+
applies: boolean;
|
|
55
|
+
toggleable: boolean;
|
|
56
|
+
views?: string[];
|
|
57
|
+
requires?: CustomizationRequirement[];
|
|
38
58
|
children?: CustomizationTreeNode[];
|
|
39
59
|
}
|
|
60
|
+
interface CustomizationTreeOptions extends CustomizationStructureOptions {
|
|
61
|
+
applicableOnly?: boolean;
|
|
62
|
+
}
|
|
40
63
|
interface CustomizationLock {
|
|
41
64
|
verb: 'keep' | 'remove';
|
|
42
65
|
pattern: string;
|
|
@@ -70,9 +93,14 @@ interface CustomizationDocEntry {
|
|
|
70
93
|
since?: string;
|
|
71
94
|
notes?: string;
|
|
72
95
|
audience: CustomizationAudience;
|
|
96
|
+
role: CustomizationRole;
|
|
97
|
+
applies: boolean;
|
|
98
|
+
toggleable: boolean;
|
|
99
|
+
views?: string[];
|
|
100
|
+
requires?: CustomizationRequirement[];
|
|
73
101
|
defaults?: CustomizationDefaultDoc[];
|
|
74
102
|
}
|
|
75
|
-
interface CustomizationDocsOptions extends
|
|
103
|
+
interface CustomizationDocsOptions extends CustomizationTreeOptions {
|
|
76
104
|
views?: string[];
|
|
77
105
|
subModules?: string[];
|
|
78
106
|
validationMap?: ValidationMap;
|
|
@@ -81,6 +109,7 @@ interface CustomizationDocsOptions extends CustomizationStructureOptions {
|
|
|
81
109
|
declare const widgetMetadata: Partial<Record<Widget, {
|
|
82
110
|
labels: CustomizationLabelMap;
|
|
83
111
|
defaults?: CustomizationDefaultLabelMap;
|
|
112
|
+
applicability?: CustomizationApplicabilityMap;
|
|
84
113
|
}>>;
|
|
85
114
|
/**
|
|
86
115
|
* Keys of the structure in a view (or at the root), in structure order, without the view prefix. Reads the structure the
|
|
@@ -94,16 +123,27 @@ declare function structureKeysOf(widget: Widget, view?: string, version?: Widget
|
|
|
94
123
|
* Label of a key: full path first, then the leaf id; a humanized id when neither exists.
|
|
95
124
|
*/
|
|
96
125
|
declare function getCustomizationLabel(widget: Widget, key: string): CustomizationLabel;
|
|
126
|
+
/**
|
|
127
|
+
* Where a key applies in a view and what switching it off does (key-applicability): its role, whether it applies and
|
|
128
|
+
* gets a switch, the views where it renders and what else it needs. `options.subModule` reads a key of the widget the
|
|
129
|
+
* host embeds under that name, gated by the host's `subModules.<name>` entry. The key's kind (a section or an item)
|
|
130
|
+
* comes from the structure, the caller's when the options pass one, and a key that structure does not list in the view
|
|
131
|
+
* does not apply there.
|
|
132
|
+
*/
|
|
133
|
+
declare function getKeyApplicability(widget: Widget, key: string, view?: string, options?: CustomizationStructureOptions & {
|
|
134
|
+
subModule?: string;
|
|
135
|
+
}): CustomizationKeyApplicability;
|
|
97
136
|
/**
|
|
98
137
|
* The labelled tree of a target: a widget view, or the structure of the embedded widget when subModules is set. Options
|
|
99
|
-
* may pass the structures to read (CustomizationStructureOptions).
|
|
138
|
+
* may pass the structures to read (CustomizationStructureOptions). Each node carries its applicability in the target
|
|
139
|
+
* views; `options.applicableOnly` leaves out the nodes that apply in none of them.
|
|
100
140
|
*/
|
|
101
|
-
declare function getCustomizationTree(widget: Widget, target: CustomizationTarget, options?:
|
|
141
|
+
declare function getCustomizationTree(widget: Widget, target: CustomizationTarget, options?: CustomizationTreeOptions): CustomizationTreeNode[];
|
|
102
142
|
/**
|
|
103
143
|
* The tree with the visibility of each node for a customization, computed with the real engine. A node whose
|
|
104
144
|
* visibility differs between the target views is 'mixed'; a hidden node a switch cannot bring back is locked.
|
|
105
145
|
*/
|
|
106
|
-
declare function getCustomizationTreeState(widget: Widget, customization: WidgetCustomization | undefined, target: CustomizationTarget): CustomizationTreeStateNode[];
|
|
146
|
+
declare function getCustomizationTreeState(widget: Widget, customization: WidgetCustomization | undefined, target: CustomizationTarget, options?: Pick<CustomizationTreeOptions, 'applicableOnly'>): CustomizationTreeStateNode[];
|
|
107
147
|
/**
|
|
108
148
|
* A new customization with the minimal change for one switch, applied to every view of the target. It only edits
|
|
109
149
|
* the remove list of each view (or of the submodule inside it), never keep, conditional, defaults or root verbs.
|
|
@@ -113,7 +153,8 @@ declare function toggleCustomizationKey(customization: WidgetCustomization | und
|
|
|
113
153
|
/**
|
|
114
154
|
* The customization keys of a widget as flat doc entries, one per key per scope: each view of the structure, then each
|
|
115
155
|
* submodule of the view ('design::chartPanel') with the keys its structure resolves to inside the host. Options may pass
|
|
116
|
-
* the structures to document, so a host can describe the tree it shipped with instead of this package's.
|
|
156
|
+
* the structures to document, so a host can describe the tree it shipped with instead of this package's. Each entry says
|
|
157
|
+
* whether the key applies in its scope; `options.applicableOnly` leaves out the ones that do not.
|
|
117
158
|
*/
|
|
118
159
|
declare function getCustomizationDocs(widget: Widget, options?: CustomizationDocsOptions): CustomizationDocEntry[];
|
|
119
160
|
/**
|
|
@@ -122,4 +163,4 @@ declare function getCustomizationDocs(widget: Widget, options?: CustomizationDoc
|
|
|
122
163
|
*/
|
|
123
164
|
declare function getCustomizationDefaultDocs(widget: Widget, options?: CustomizationDocsOptions): CustomizationDefaultDocEntry[];
|
|
124
165
|
|
|
125
|
-
export { type CustomizationAudience, type CustomizationDefaultDoc, type CustomizationDefaultDocEntry, type CustomizationDefaultLabel, type CustomizationDefaultLabelMap, type CustomizationDocEntry, type CustomizationDocsOptions, type CustomizationLabel, type CustomizationLabelMap, type CustomizationLock, type CustomizationStructureOptions, type CustomizationStructureSource, type CustomizationTarget, type CustomizationTreeNode, type CustomizationTreeStateNode, getCustomizationDefaultDocs, getCustomizationDocs, getCustomizationLabel, getCustomizationTree, getCustomizationTreeState, structureKeysOf, toggleCustomizationKey, widgetMetadata };
|
|
166
|
+
export { type CustomizationApplicability, type CustomizationApplicabilityMap, type CustomizationAudience, type CustomizationDefaultDoc, type CustomizationDefaultDocEntry, type CustomizationDefaultLabel, type CustomizationDefaultLabelMap, type CustomizationDocEntry, type CustomizationDocsOptions, type CustomizationKeyApplicability, type CustomizationLabel, type CustomizationLabelMap, type CustomizationLock, type CustomizationRequirement, type CustomizationRole, type CustomizationStructureOptions, type CustomizationStructureSource, type CustomizationTarget, type CustomizationTreeNode, type CustomizationTreeOptions, type CustomizationTreeStateNode, getCustomizationDefaultDocs, getCustomizationDocs, getCustomizationLabel, getCustomizationTree, getCustomizationTreeState, getKeyApplicability, structureKeysOf, toggleCustomizationKey, widgetMetadata };
|