datocms-plugin-sdk 2.1.0 → 3.0.0-alpha.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/cjs/hooks/contentAreaSidebarItems.js +1 -1
- package/dist/cjs/hooks/contentAreaSidebarItems.js.map +1 -1
- package/dist/cjs/icon.js +5 -1
- package/dist/cjs/icon.js.map +1 -1
- package/dist/cjs/manifest.js +36 -25
- package/dist/cjs/manifest.js.map +1 -1
- package/dist/esm/ctx/base.d.ts +126 -2
- package/dist/esm/hooks/contentAreaSidebarItems.d.ts +3 -3
- package/dist/esm/hooks/contentAreaSidebarItems.js +2 -2
- package/dist/esm/hooks/contentAreaSidebarItems.js.map +1 -1
- package/dist/esm/icon.d.ts +7 -1
- package/dist/esm/icon.js +4 -1
- package/dist/esm/icon.js.map +1 -1
- package/dist/esm/manifest.js +36 -25
- package/dist/esm/manifest.js.map +1 -1
- package/dist/types/ctx/base.d.ts +126 -2
- package/dist/types/hooks/contentAreaSidebarItems.d.ts +3 -3
- package/dist/types/icon.d.ts +7 -1
- package/manifest.json +37 -26
- package/package.json +2 -2
- package/src/ctx/base.ts +175 -2
- package/src/hooks/contentAreaSidebarItems.ts +4 -4
- package/src/icon.ts +12 -2
- package/src/manifest.ts +38 -25
package/manifest.json
CHANGED
|
@@ -3109,13 +3109,24 @@
|
|
|
3109
3109
|
},
|
|
3110
3110
|
"theme": {
|
|
3111
3111
|
"comment": {
|
|
3112
|
-
"markdownText": "An object containing the theme colors for the current DatoCMS project."
|
|
3112
|
+
"markdownText": "An object containing the theme colors for the current DatoCMS project.",
|
|
3113
|
+
"deprecatedMarkdownText": "Use `semanticColorTokensTheme` instead. This property is kept\nfor backward compatibility with third-party plugins."
|
|
3113
3114
|
},
|
|
3114
3115
|
"location": {
|
|
3115
3116
|
"filePath": "src/ctx/base.ts",
|
|
3116
|
-
"lineNumber":
|
|
3117
|
+
"lineNumber": 92
|
|
3117
3118
|
},
|
|
3118
3119
|
"type": "Theme"
|
|
3120
|
+
},
|
|
3121
|
+
"semanticColorTokensTheme": {
|
|
3122
|
+
"comment": {
|
|
3123
|
+
"markdownText": "Semantic color tokens for the current DatoCMS project, pre-computed by\nthe host. Only available on DatoCMS hosts that support the new token\nsystem."
|
|
3124
|
+
},
|
|
3125
|
+
"location": {
|
|
3126
|
+
"filePath": "src/ctx/base.ts",
|
|
3127
|
+
"lineNumber": 99
|
|
3128
|
+
},
|
|
3129
|
+
"type": "SemanticColorTokensTheme"
|
|
3119
3130
|
}
|
|
3120
3131
|
}
|
|
3121
3132
|
},
|
|
@@ -3131,7 +3142,7 @@
|
|
|
3131
3142
|
},
|
|
3132
3143
|
"location": {
|
|
3133
3144
|
"filePath": "src/ctx/base.ts",
|
|
3134
|
-
"lineNumber":
|
|
3145
|
+
"lineNumber": 109
|
|
3135
3146
|
},
|
|
3136
3147
|
"type": "Partial<Record<string, ItemType>>"
|
|
3137
3148
|
},
|
|
@@ -3141,7 +3152,7 @@
|
|
|
3141
3152
|
},
|
|
3142
3153
|
"location": {
|
|
3143
3154
|
"filePath": "src/ctx/base.ts",
|
|
3144
|
-
"lineNumber":
|
|
3155
|
+
"lineNumber": 116
|
|
3145
3156
|
},
|
|
3146
3157
|
"type": "Partial<Record<string, Field>>"
|
|
3147
3158
|
},
|
|
@@ -3151,7 +3162,7 @@
|
|
|
3151
3162
|
},
|
|
3152
3163
|
"location": {
|
|
3153
3164
|
"filePath": "src/ctx/base.ts",
|
|
3154
|
-
"lineNumber":
|
|
3165
|
+
"lineNumber": 123
|
|
3155
3166
|
},
|
|
3156
3167
|
"type": "Partial<Record<string, Fieldset>>"
|
|
3157
3168
|
},
|
|
@@ -3161,7 +3172,7 @@
|
|
|
3161
3172
|
},
|
|
3162
3173
|
"location": {
|
|
3163
3174
|
"filePath": "src/ctx/base.ts",
|
|
3164
|
-
"lineNumber":
|
|
3175
|
+
"lineNumber": 130
|
|
3165
3176
|
},
|
|
3166
3177
|
"type": "Partial<Record<string, User>>"
|
|
3167
3178
|
},
|
|
@@ -3171,7 +3182,7 @@
|
|
|
3171
3182
|
},
|
|
3172
3183
|
"location": {
|
|
3173
3184
|
"filePath": "src/ctx/base.ts",
|
|
3174
|
-
"lineNumber":
|
|
3185
|
+
"lineNumber": 137
|
|
3175
3186
|
},
|
|
3176
3187
|
"type": "Partial<Record<string, SsoUser>>"
|
|
3177
3188
|
}
|
|
@@ -3192,7 +3203,7 @@
|
|
|
3192
3203
|
},
|
|
3193
3204
|
"location": {
|
|
3194
3205
|
"filePath": "src/ctx/base.ts",
|
|
3195
|
-
"lineNumber":
|
|
3206
|
+
"lineNumber": 341
|
|
3196
3207
|
},
|
|
3197
3208
|
"type": "(itemTypeId: string) => Promise<Field[]>"
|
|
3198
3209
|
},
|
|
@@ -3203,7 +3214,7 @@
|
|
|
3203
3214
|
},
|
|
3204
3215
|
"location": {
|
|
3205
3216
|
"filePath": "src/ctx/base.ts",
|
|
3206
|
-
"lineNumber":
|
|
3217
|
+
"lineNumber": 360
|
|
3207
3218
|
},
|
|
3208
3219
|
"type": "(itemTypeId: string) => Promise<Fieldset[]>"
|
|
3209
3220
|
},
|
|
@@ -3214,7 +3225,7 @@
|
|
|
3214
3225
|
},
|
|
3215
3226
|
"location": {
|
|
3216
3227
|
"filePath": "src/ctx/base.ts",
|
|
3217
|
-
"lineNumber":
|
|
3228
|
+
"lineNumber": 377
|
|
3218
3229
|
},
|
|
3219
3230
|
"type": "() => Promise<Field[]>"
|
|
3220
3231
|
},
|
|
@@ -3225,7 +3236,7 @@
|
|
|
3225
3236
|
},
|
|
3226
3237
|
"location": {
|
|
3227
3238
|
"filePath": "src/ctx/base.ts",
|
|
3228
|
-
"lineNumber":
|
|
3239
|
+
"lineNumber": 390
|
|
3229
3240
|
},
|
|
3230
3241
|
"type": "() => Promise<User[]>"
|
|
3231
3242
|
},
|
|
@@ -3236,7 +3247,7 @@
|
|
|
3236
3247
|
},
|
|
3237
3248
|
"location": {
|
|
3238
3249
|
"filePath": "src/ctx/base.ts",
|
|
3239
|
-
"lineNumber":
|
|
3250
|
+
"lineNumber": 403
|
|
3240
3251
|
},
|
|
3241
3252
|
"type": "() => Promise<SsoUser[]>"
|
|
3242
3253
|
}
|
|
@@ -3255,7 +3266,7 @@
|
|
|
3255
3266
|
},
|
|
3256
3267
|
"location": {
|
|
3257
3268
|
"filePath": "src/ctx/base.ts",
|
|
3258
|
-
"lineNumber":
|
|
3269
|
+
"lineNumber": 425
|
|
3259
3270
|
},
|
|
3260
3271
|
"type": "(params: Record<string, unknown>) => Promise<void>"
|
|
3261
3272
|
},
|
|
@@ -3266,7 +3277,7 @@
|
|
|
3266
3277
|
},
|
|
3267
3278
|
"location": {
|
|
3268
3279
|
"filePath": "src/ctx/base.ts",
|
|
3269
|
-
"lineNumber":
|
|
3280
|
+
"lineNumber": 476
|
|
3270
3281
|
},
|
|
3271
3282
|
"type": "(\n fieldId: string,\n changes: FieldAppearanceChange[],\n ) => Promise<void>"
|
|
3272
3283
|
}
|
|
@@ -3285,7 +3296,7 @@
|
|
|
3285
3296
|
},
|
|
3286
3297
|
"location": {
|
|
3287
3298
|
"filePath": "src/ctx/base.ts",
|
|
3288
|
-
"lineNumber":
|
|
3299
|
+
"lineNumber": 581
|
|
3289
3300
|
},
|
|
3290
3301
|
"type": "(message: string) => Promise<void>"
|
|
3291
3302
|
},
|
|
@@ -3296,7 +3307,7 @@
|
|
|
3296
3307
|
},
|
|
3297
3308
|
"location": {
|
|
3298
3309
|
"filePath": "src/ctx/base.ts",
|
|
3299
|
-
"lineNumber":
|
|
3310
|
+
"lineNumber": 596
|
|
3300
3311
|
},
|
|
3301
3312
|
"type": "(message: string) => Promise<void>"
|
|
3302
3313
|
},
|
|
@@ -3307,7 +3318,7 @@
|
|
|
3307
3318
|
},
|
|
3308
3319
|
"location": {
|
|
3309
3320
|
"filePath": "src/ctx/base.ts",
|
|
3310
|
-
"lineNumber":
|
|
3321
|
+
"lineNumber": 620
|
|
3311
3322
|
},
|
|
3312
3323
|
"type": "<CtaValue = unknown>(\n toast: Toast<CtaValue>,\n ) => Promise<CtaValue | null>"
|
|
3313
3324
|
}
|
|
@@ -3326,7 +3337,7 @@
|
|
|
3326
3337
|
},
|
|
3327
3338
|
"location": {
|
|
3328
3339
|
"filePath": "src/ctx/base.ts",
|
|
3329
|
-
"lineNumber":
|
|
3340
|
+
"lineNumber": 506
|
|
3330
3341
|
},
|
|
3331
3342
|
"type": "(itemTypeId: string) => Promise<Item | null>"
|
|
3332
3343
|
},
|
|
@@ -3337,7 +3348,7 @@
|
|
|
3337
3348
|
},
|
|
3338
3349
|
"location": {
|
|
3339
3350
|
"filePath": "src/ctx/base.ts",
|
|
3340
|
-
"lineNumber":
|
|
3351
|
+
"lineNumber": 527
|
|
3341
3352
|
},
|
|
3342
3353
|
"type": "{\n (\n itemTypeId: string,\n options: { multiple: true; initialLocationQuery?: ItemListLocationQuery },\n ): Promise<Item[] | null>;\n (\n itemTypeId: string,\n options?: {\n multiple: false;\n initialLocationQuery?: ItemListLocationQuery;\n },\n ): Promise<Item | null>;\n }"
|
|
3343
3354
|
},
|
|
@@ -3348,7 +3359,7 @@
|
|
|
3348
3359
|
},
|
|
3349
3360
|
"location": {
|
|
3350
3361
|
"filePath": "src/ctx/base.ts",
|
|
3351
|
-
"lineNumber":
|
|
3362
|
+
"lineNumber": 559
|
|
3352
3363
|
},
|
|
3353
3364
|
"type": "(itemId: string) => Promise<Item | null>"
|
|
3354
3365
|
}
|
|
@@ -3367,7 +3378,7 @@
|
|
|
3367
3378
|
},
|
|
3368
3379
|
"location": {
|
|
3369
3380
|
"filePath": "src/ctx/base.ts",
|
|
3370
|
-
"lineNumber":
|
|
3381
|
+
"lineNumber": 647
|
|
3371
3382
|
},
|
|
3372
3383
|
"type": "{\n (options: { multiple: true }): Promise<Upload[] | null>;\n (options?: { multiple: false }): Promise<Upload | null>;\n }"
|
|
3373
3384
|
},
|
|
@@ -3378,7 +3389,7 @@
|
|
|
3378
3389
|
},
|
|
3379
3390
|
"location": {
|
|
3380
3391
|
"filePath": "src/ctx/base.ts",
|
|
3381
|
-
"lineNumber":
|
|
3392
|
+
"lineNumber": 675
|
|
3382
3393
|
},
|
|
3383
3394
|
"type": "(\n uploadId: string,\n ) => Promise<(Upload & { deleted?: true }) | null>"
|
|
3384
3395
|
},
|
|
@@ -3389,7 +3400,7 @@
|
|
|
3389
3400
|
},
|
|
3390
3401
|
"location": {
|
|
3391
3402
|
"filePath": "src/ctx/base.ts",
|
|
3392
|
-
"lineNumber":
|
|
3403
|
+
"lineNumber": 703
|
|
3393
3404
|
},
|
|
3394
3405
|
"type": "(\n /** The \"single asset\" field structure */\n fileFieldValue: FileFieldValue,\n /** Shows metadata information for a specific locale */\n locale?: string,\n ) => Promise<FileFieldValue | null>"
|
|
3395
3406
|
}
|
|
@@ -3408,7 +3419,7 @@
|
|
|
3408
3419
|
},
|
|
3409
3420
|
"location": {
|
|
3410
3421
|
"filePath": "src/ctx/base.ts",
|
|
3411
|
-
"lineNumber":
|
|
3422
|
+
"lineNumber": 734
|
|
3412
3423
|
},
|
|
3413
3424
|
"type": "(modal: Modal) => Promise<unknown>"
|
|
3414
3425
|
},
|
|
@@ -3419,7 +3430,7 @@
|
|
|
3419
3430
|
},
|
|
3420
3431
|
"location": {
|
|
3421
3432
|
"filePath": "src/ctx/base.ts",
|
|
3422
|
-
"lineNumber":
|
|
3433
|
+
"lineNumber": 771
|
|
3423
3434
|
},
|
|
3424
3435
|
"type": "(options: ConfirmOptions) => Promise<unknown>"
|
|
3425
3436
|
}
|
|
@@ -3438,7 +3449,7 @@
|
|
|
3438
3449
|
},
|
|
3439
3450
|
"location": {
|
|
3440
3451
|
"filePath": "src/ctx/base.ts",
|
|
3441
|
-
"lineNumber":
|
|
3452
|
+
"lineNumber": 785
|
|
3442
3453
|
},
|
|
3443
3454
|
"type": "(path: string) => Promise<void>"
|
|
3444
3455
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datocms-plugin-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
4
|
"description": "DatoCMS Plugin SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"glob": "^11.0.0",
|
|
47
47
|
"typescript": "^5.6.2"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "01c46332e40377d305c3abd262c3d1840385ec49"
|
|
50
50
|
}
|
package/src/ctx/base.ts
CHANGED
|
@@ -83,8 +83,20 @@ type ProjectProperties = {
|
|
|
83
83
|
locale: string;
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* An object containing the theme colors for the current DatoCMS project
|
|
88
|
+
*
|
|
89
|
+
* @deprecated Use `semanticColorTokensTheme` instead. This property is kept
|
|
90
|
+
* for backward compatibility with third-party plugins.
|
|
91
|
+
*/
|
|
87
92
|
theme: Theme;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Semantic color tokens for the current DatoCMS project, pre-computed by
|
|
96
|
+
* the host. Only available on DatoCMS hosts that support the new token
|
|
97
|
+
* system.
|
|
98
|
+
*/
|
|
99
|
+
semanticColorTokensTheme: SemanticColorTokensTheme;
|
|
88
100
|
};
|
|
89
101
|
|
|
90
102
|
/**
|
|
@@ -125,7 +137,12 @@ type EntityReposProperties = {
|
|
|
125
137
|
ssoUsers: Partial<Record<string, SsoUser>>;
|
|
126
138
|
};
|
|
127
139
|
|
|
128
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* An object containing the theme colors for the current DatoCMS project
|
|
142
|
+
*
|
|
143
|
+
* @deprecated Use `SemanticColorTokensTheme` instead. This type is kept for
|
|
144
|
+
* backward compatibility with third-party plugins.
|
|
145
|
+
*/
|
|
129
146
|
export type Theme = {
|
|
130
147
|
primaryColor: string;
|
|
131
148
|
accentColor: string;
|
|
@@ -134,6 +151,162 @@ export type Theme = {
|
|
|
134
151
|
darkColor: string;
|
|
135
152
|
};
|
|
136
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Known semantic color tokens provided by the DatoCMS host.
|
|
156
|
+
* All properties are optional — the host may not send all of them.
|
|
157
|
+
*
|
|
158
|
+
* camelCase keys are converted to kebab-case CSS custom properties via
|
|
159
|
+
* `camelToDash`. For example, `colorRaisedSurface` becomes
|
|
160
|
+
* `--color-raised-surface`.
|
|
161
|
+
*/
|
|
162
|
+
type KnownSemanticColorTokens = {
|
|
163
|
+
/* --- Standalone --- */
|
|
164
|
+
colorSurface?: string;
|
|
165
|
+
colorSurfaceHover?: string;
|
|
166
|
+
colorSurfaceMuted?: string;
|
|
167
|
+
colorInk?: string;
|
|
168
|
+
colorInkSubtle?: string;
|
|
169
|
+
colorInkHover?: string;
|
|
170
|
+
colorInkMuted?: string;
|
|
171
|
+
colorInkPlaceholder?: string;
|
|
172
|
+
colorInkPrimary?: string;
|
|
173
|
+
colorInkAccent?: string;
|
|
174
|
+
colorInkDisabled?: string;
|
|
175
|
+
colorBorder?: string;
|
|
176
|
+
colorBorderHover?: string;
|
|
177
|
+
|
|
178
|
+
/* --- Context: raised --- */
|
|
179
|
+
colorRaisedSurface?: string;
|
|
180
|
+
colorRaisedSurfaceHover?: string;
|
|
181
|
+
colorRaisedSurfaceActive?: string;
|
|
182
|
+
|
|
183
|
+
/* --- Context: primary --- */
|
|
184
|
+
colorPrimarySurface?: string;
|
|
185
|
+
colorPrimarySurfaceHover?: string;
|
|
186
|
+
colorPrimarySurfaceActive?: string;
|
|
187
|
+
colorPrimarySurfaceMuted?: string;
|
|
188
|
+
colorPrimaryInk?: string;
|
|
189
|
+
colorPrimaryBorder?: string;
|
|
190
|
+
|
|
191
|
+
/* --- Context: tinted --- */
|
|
192
|
+
colorTintedSurface?: string;
|
|
193
|
+
colorTintedSurfaceHover?: string;
|
|
194
|
+
colorTintedSurfaceActive?: string;
|
|
195
|
+
colorTintedInk?: string;
|
|
196
|
+
|
|
197
|
+
/* --- Context: accent --- */
|
|
198
|
+
colorAccentSurface?: string;
|
|
199
|
+
colorAccentInk?: string;
|
|
200
|
+
|
|
201
|
+
/* --- Context: selected --- */
|
|
202
|
+
colorSelectedSurface?: string;
|
|
203
|
+
colorSelectedInk?: string;
|
|
204
|
+
colorSelectedBorder?: string;
|
|
205
|
+
|
|
206
|
+
/* --- Context: disabled --- */
|
|
207
|
+
colorDisabledSurface?: string;
|
|
208
|
+
colorDisabledInk?: string;
|
|
209
|
+
|
|
210
|
+
/* --- Context: danger --- */
|
|
211
|
+
colorDangerSurface?: string;
|
|
212
|
+
colorDangerInk?: string;
|
|
213
|
+
|
|
214
|
+
/* --- Context: enterprise --- */
|
|
215
|
+
colorEnterpriseSurface?: string;
|
|
216
|
+
|
|
217
|
+
/* --- Context: focus --- */
|
|
218
|
+
colorFocusBorder?: string;
|
|
219
|
+
colorFocusOutline?: string;
|
|
220
|
+
|
|
221
|
+
/* --- Feedback --- */
|
|
222
|
+
colorFeedbackFailInk?: string;
|
|
223
|
+
colorFeedbackFailBorder?: string;
|
|
224
|
+
colorFeedbackFailOutline?: string;
|
|
225
|
+
colorFeedbackWarningInk?: string;
|
|
226
|
+
colorFeedbackWarningSurface?: string;
|
|
227
|
+
colorFeedbackSuccessInk?: string;
|
|
228
|
+
colorFeedbackWarningBorder?: string;
|
|
229
|
+
colorFeedbackSuccessBorder?: string;
|
|
230
|
+
|
|
231
|
+
/* --- Context: highlight --- */
|
|
232
|
+
colorHighlightSurface?: string;
|
|
233
|
+
|
|
234
|
+
/* --- Diffs --- */
|
|
235
|
+
colorDiffAddedSurface?: string;
|
|
236
|
+
colorDiffRemovedSurface?: string;
|
|
237
|
+
colorDiffChangedSurface?: string;
|
|
238
|
+
colorDiffAddedSurfaceSubtle?: string;
|
|
239
|
+
colorDiffRemovedSurfaceSubtle?: string;
|
|
240
|
+
colorDiffChangedSurfaceSubtle?: string;
|
|
241
|
+
colorDiffAddedOutlineSubtle?: string;
|
|
242
|
+
colorDiffRemovedOutlineSubtle?: string;
|
|
243
|
+
colorDiffChangedOutlineSubtle?: string;
|
|
244
|
+
colorDiffChangedBorder?: string;
|
|
245
|
+
colorDiffChangedBorderNegative?: string;
|
|
246
|
+
|
|
247
|
+
/* --- Status --- */
|
|
248
|
+
colorStatusDraftInk?: string;
|
|
249
|
+
colorStatusOutdatedInk?: string;
|
|
250
|
+
colorStatusPublishedInk?: string;
|
|
251
|
+
|
|
252
|
+
/* --- Backdrop --- */
|
|
253
|
+
colorBackdropSurface?: string;
|
|
254
|
+
colorBackdropInk?: string;
|
|
255
|
+
|
|
256
|
+
/* --- Overlay --- */
|
|
257
|
+
colorOverlaySurface?: string;
|
|
258
|
+
colorOverlaySurfaceSubtle?: string;
|
|
259
|
+
colorOverlayInk?: string;
|
|
260
|
+
|
|
261
|
+
/* --- Stacked --- */
|
|
262
|
+
colorStackedSurfaceBase?: string;
|
|
263
|
+
colorStackedSurface?: string;
|
|
264
|
+
colorStackedSurfaceRaised?: string;
|
|
265
|
+
colorStackedInk?: string;
|
|
266
|
+
colorStackedInkSubtle?: string;
|
|
267
|
+
colorStackedBorder?: string;
|
|
268
|
+
colorStackedSurfaceHover?: string;
|
|
269
|
+
colorStackedSurfaceTranslucent?: string;
|
|
270
|
+
colorStackedSurfaceButton?: string;
|
|
271
|
+
colorStackedSurfaceButtonActive?: string;
|
|
272
|
+
|
|
273
|
+
/* --- Progress --- */
|
|
274
|
+
colorProgressTrack?: string;
|
|
275
|
+
colorProgressFill?: string;
|
|
276
|
+
colorProgressFillHover?: string;
|
|
277
|
+
|
|
278
|
+
/* --- Tooltip --- */
|
|
279
|
+
colorTooltipSurface?: string;
|
|
280
|
+
colorTooltipSurfaceHover?: string;
|
|
281
|
+
colorTooltipInk?: string;
|
|
282
|
+
colorTooltipInkSubtle?: string;
|
|
283
|
+
|
|
284
|
+
/* --- Code --- */
|
|
285
|
+
colorCodeSurface?: string;
|
|
286
|
+
colorCodeInk?: string;
|
|
287
|
+
|
|
288
|
+
/* --- Shadows --- */
|
|
289
|
+
colorShadowSubtle?: string;
|
|
290
|
+
colorShadow?: string;
|
|
291
|
+
colorShadowStrong?: string;
|
|
292
|
+
|
|
293
|
+
/* --- Scrollbar --- */
|
|
294
|
+
colorScrollbar?: string;
|
|
295
|
+
|
|
296
|
+
/* --- Shadow composites --- */
|
|
297
|
+
shadowElevated?: string;
|
|
298
|
+
shadowFloat?: string;
|
|
299
|
+
shadowAmbient?: string;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Semantic color tokens for the current DatoCMS project, pre-computed by the
|
|
304
|
+
* host. Known tokens get autocomplete; unknown tokens are accepted via the
|
|
305
|
+
* index signature for forward compatibility.
|
|
306
|
+
*/
|
|
307
|
+
export type SemanticColorTokensTheme = KnownSemanticColorTokens &
|
|
308
|
+
Record<string, string>;
|
|
309
|
+
|
|
137
310
|
export type BaseMethods = LoadDataMethods &
|
|
138
311
|
UpdatePluginParametersMethods &
|
|
139
312
|
ToastMethods &
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
isRecord,
|
|
8
8
|
isString,
|
|
9
9
|
} from '../guardUtils.js';
|
|
10
|
-
import {
|
|
10
|
+
import { IconWithEmoji, isIconWithEmoji } from '../icon';
|
|
11
11
|
|
|
12
12
|
export type ContentAreaSidebarItemsHook = {
|
|
13
13
|
/**
|
|
@@ -32,11 +32,11 @@ export type ContentAreaSidebarItem = {
|
|
|
32
32
|
label: string;
|
|
33
33
|
/**
|
|
34
34
|
* Icon to be shown alongside the label. Can be a FontAwesome icon name (ie.
|
|
35
|
-
* `"address-book"`)
|
|
35
|
+
* `"address-book"`), a custom SVG definition, or an emoji. To maintain visual
|
|
36
36
|
* consistency with the rest of the interface, try to use FontAwesome icons
|
|
37
37
|
* whenever possible.
|
|
38
38
|
*/
|
|
39
|
-
icon:
|
|
39
|
+
icon: IconWithEmoji;
|
|
40
40
|
/** ID of the page linked to the item */
|
|
41
41
|
pointsTo: {
|
|
42
42
|
pageId: string;
|
|
@@ -63,7 +63,7 @@ export function isContentAreaSidebarItem(
|
|
|
63
63
|
return (
|
|
64
64
|
isRecord(value) &&
|
|
65
65
|
isString(value.label) &&
|
|
66
|
-
|
|
66
|
+
isIconWithEmoji(value.icon) &&
|
|
67
67
|
isRecord(value.pointsTo) &&
|
|
68
68
|
isString(value.pointsTo.pageId) &&
|
|
69
69
|
(isNullish(value.placement) || isPlacement(value.placement)) &&
|
package/src/icon.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isEmoji, isRecord, isString } from './guardUtils.js';
|
|
2
2
|
|
|
3
|
-
export type Icon = AwesomeFontIconIdentifier | SvgDefinition
|
|
3
|
+
export type Icon = AwesomeFontIconIdentifier | SvgDefinition;
|
|
4
4
|
|
|
5
5
|
export function isIcon(value: unknown): value is Icon {
|
|
6
|
-
return isString(value) || isSvgDefinition(value)
|
|
6
|
+
return isString(value) || isSvgDefinition(value);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -78,6 +78,16 @@ export function isEmojiDefinition(value: unknown): value is EmojiDefinition {
|
|
|
78
78
|
return isRecord(value) && value.type === 'emoji' && isEmoji(value.emoji);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Extended icon type that includes emoji support in addition to Font Awesome and SVG icons.
|
|
83
|
+
* This type is specifically used for content area sidebar items where emoji icons are supported.
|
|
84
|
+
*/
|
|
85
|
+
export type IconWithEmoji = Icon | EmojiDefinition;
|
|
86
|
+
|
|
87
|
+
export function isIconWithEmoji(value: unknown): value is IconWithEmoji {
|
|
88
|
+
return isIcon(value) || isEmojiDefinition(value);
|
|
89
|
+
}
|
|
90
|
+
|
|
81
91
|
/**
|
|
82
92
|
* Font Awesome icon identifier for use in DatoCMS plugins.
|
|
83
93
|
*
|