datocms-plugin-sdk 2.1.1 → 3.0.1-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.
@@ -62,8 +62,30 @@ type ProjectProperties = {
62
62
  /** Preferred locale */
63
63
  locale: string;
64
64
  };
65
- /** An object containing the theme colors for the current DatoCMS project */
65
+ /**
66
+ * An object containing the theme colors for the current DatoCMS project
67
+ *
68
+ * @deprecated Use `semanticColorTokensTheme` instead. This property is kept
69
+ * for backward compatibility with third-party plugins.
70
+ */
66
71
  theme: Theme;
72
+ /**
73
+ * Semantic color tokens for the current DatoCMS project, pre-computed by
74
+ * the host. Only available on DatoCMS hosts that support the new token
75
+ * system.
76
+ */
77
+ semanticColorTokensTheme: SemanticColorTokensTheme;
78
+ /**
79
+ * The appearance color scheme the host CMS is currently using. Resolved —
80
+ * `'system'` is already expanded to `'light'` or `'dark'` by the host.
81
+ *
82
+ * The SDK runtime reflects this onto `document.documentElement` as
83
+ * `data-theme="light"` / `data-theme="dark"` so plugin CSS can branch
84
+ * with `[data-theme="dark"] { … }` selectors. For non-CSS decisions
85
+ * (choosing a logo asset, a syntax-highlighting preset, …) branch on
86
+ * `ctx.colorScheme` directly.
87
+ */
88
+ colorScheme: 'light' | 'dark';
67
89
  };
68
90
  /**
69
91
  * These properties provide access to "entity repos", that is, the collection of
@@ -98,7 +120,12 @@ type EntityReposProperties = {
98
120
  */
99
121
  ssoUsers: Partial<Record<string, SsoUser>>;
100
122
  };
101
- /** An object containing the theme colors for the current DatoCMS project */
123
+ /**
124
+ * An object containing the theme colors for the current DatoCMS project
125
+ *
126
+ * @deprecated Use `SemanticColorTokensTheme` instead. This type is kept for
127
+ * backward compatibility with third-party plugins.
128
+ */
102
129
  export type Theme = {
103
130
  primaryColor: string;
104
131
  accentColor: string;
@@ -106,6 +133,114 @@ export type Theme = {
106
133
  lightColor: string;
107
134
  darkColor: string;
108
135
  };
136
+ /**
137
+ * Known semantic color tokens provided by the DatoCMS host.
138
+ * All properties are optional — the host may not send all of them.
139
+ *
140
+ * camelCase keys are converted to kebab-case CSS custom properties via
141
+ * `camelToDash`. For example, `colorRaisedSurface` becomes
142
+ * `--color-raised-surface`.
143
+ */
144
+ type KnownSemanticColorTokens = {
145
+ colorSurface?: string;
146
+ colorSurfaceHover?: string;
147
+ colorSurfaceMuted?: string;
148
+ colorInk?: string;
149
+ colorInkSubtle?: string;
150
+ colorInkHover?: string;
151
+ colorInkMuted?: string;
152
+ colorInkPlaceholder?: string;
153
+ colorInkPrimary?: string;
154
+ colorInkAccent?: string;
155
+ colorInkDisabled?: string;
156
+ colorBorder?: string;
157
+ colorBorderHover?: string;
158
+ colorRaisedSurface?: string;
159
+ colorRaisedSurfaceHover?: string;
160
+ colorRaisedSurfaceActive?: string;
161
+ colorPrimarySurface?: string;
162
+ colorPrimarySurfaceHover?: string;
163
+ colorPrimarySurfaceActive?: string;
164
+ colorPrimarySurfaceMuted?: string;
165
+ colorPrimaryInk?: string;
166
+ colorPrimaryBorder?: string;
167
+ colorTintedSurface?: string;
168
+ colorTintedSurfaceHover?: string;
169
+ colorTintedSurfaceActive?: string;
170
+ colorTintedInk?: string;
171
+ colorAccentSurface?: string;
172
+ colorAccentInk?: string;
173
+ colorSelectedSurface?: string;
174
+ colorSelectedInk?: string;
175
+ colorSelectedBorder?: string;
176
+ colorDisabledSurface?: string;
177
+ colorDisabledInk?: string;
178
+ colorDangerSurface?: string;
179
+ colorDangerInk?: string;
180
+ colorEnterpriseSurface?: string;
181
+ colorFocusBorder?: string;
182
+ colorFocusOutline?: string;
183
+ colorFeedbackFailInk?: string;
184
+ colorFeedbackFailBorder?: string;
185
+ colorFeedbackFailOutline?: string;
186
+ colorFeedbackWarningInk?: string;
187
+ colorFeedbackWarningSurface?: string;
188
+ colorFeedbackSuccessInk?: string;
189
+ colorFeedbackWarningBorder?: string;
190
+ colorFeedbackSuccessBorder?: string;
191
+ colorHighlightSurface?: string;
192
+ colorDiffAddedSurface?: string;
193
+ colorDiffRemovedSurface?: string;
194
+ colorDiffChangedSurface?: string;
195
+ colorDiffAddedSurfaceSubtle?: string;
196
+ colorDiffRemovedSurfaceSubtle?: string;
197
+ colorDiffChangedSurfaceSubtle?: string;
198
+ colorDiffAddedOutlineSubtle?: string;
199
+ colorDiffRemovedOutlineSubtle?: string;
200
+ colorDiffChangedOutlineSubtle?: string;
201
+ colorDiffChangedBorder?: string;
202
+ colorDiffChangedBorderNegative?: string;
203
+ colorStatusDraftInk?: string;
204
+ colorStatusOutdatedInk?: string;
205
+ colorStatusPublishedInk?: string;
206
+ colorBackdropSurface?: string;
207
+ colorBackdropInk?: string;
208
+ colorOverlaySurface?: string;
209
+ colorOverlaySurfaceSubtle?: string;
210
+ colorOverlayInk?: string;
211
+ colorStackedSurfaceBase?: string;
212
+ colorStackedSurface?: string;
213
+ colorStackedSurfaceRaised?: string;
214
+ colorStackedInk?: string;
215
+ colorStackedInkSubtle?: string;
216
+ colorStackedBorder?: string;
217
+ colorStackedSurfaceHover?: string;
218
+ colorStackedSurfaceTranslucent?: string;
219
+ colorStackedSurfaceButton?: string;
220
+ colorStackedSurfaceButtonActive?: string;
221
+ colorProgressTrack?: string;
222
+ colorProgressFill?: string;
223
+ colorProgressFillHover?: string;
224
+ colorTooltipSurface?: string;
225
+ colorTooltipSurfaceHover?: string;
226
+ colorTooltipInk?: string;
227
+ colorTooltipInkSubtle?: string;
228
+ colorCodeSurface?: string;
229
+ colorCodeInk?: string;
230
+ colorShadowSubtle?: string;
231
+ colorShadow?: string;
232
+ colorShadowStrong?: string;
233
+ colorScrollbar?: string;
234
+ shadowElevated?: string;
235
+ shadowFloat?: string;
236
+ shadowAmbient?: string;
237
+ };
238
+ /**
239
+ * Semantic color tokens for the current DatoCMS project, pre-computed by the
240
+ * host. Known tokens get autocomplete; unknown tokens are accepted via the
241
+ * index signature for forward compatibility.
242
+ */
243
+ export type SemanticColorTokensTheme = KnownSemanticColorTokens & Record<string, string>;
109
244
  export type BaseMethods = LoadDataMethods & UpdatePluginParametersMethods & ToastMethods & ItemDialogMethods & UploadDialogMethods & CustomDialogMethods & NavigateMethods;
110
245
  /**
111
246
  * These methods can be used to asyncronously load additional information your
@@ -3110,13 +3110,34 @@ export var manifest = {
3110
3110
  theme: {
3111
3111
  comment: {
3112
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: 87,
3117
+ lineNumber: 92,
3117
3118
  },
3118
3119
  type: 'Theme',
3119
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',
3130
+ },
3131
+ colorScheme: {
3132
+ comment: {
3133
+ markdownText: 'The appearance color scheme the host CMS is currently using. Resolved —\n`\'system\'` is already expanded to `\'light\'` or `\'dark\'` by the host.\n\nThe SDK runtime reflects this onto `document.documentElement` as\n`data-theme="light"` / `data-theme="dark"` so plugin CSS can branch\nwith `[data-theme="dark"] { … }` selectors. For non-CSS decisions\n(choosing a logo asset, a syntax-highlighting preset, …) branch on\n`ctx.colorScheme` directly.',
3134
+ },
3135
+ location: {
3136
+ filePath: 'src/ctx/base.ts',
3137
+ lineNumber: 111,
3138
+ },
3139
+ type: "'light' | 'dark'",
3140
+ },
3120
3141
  },
3121
3142
  },
3122
3143
  {
@@ -3131,7 +3152,7 @@ export var manifest = {
3131
3152
  },
3132
3153
  location: {
3133
3154
  filePath: 'src/ctx/base.ts',
3134
- lineNumber: 97,
3155
+ lineNumber: 121,
3135
3156
  },
3136
3157
  type: 'Partial<Record<string, ItemType>>',
3137
3158
  },
@@ -3141,7 +3162,7 @@ export var manifest = {
3141
3162
  },
3142
3163
  location: {
3143
3164
  filePath: 'src/ctx/base.ts',
3144
- lineNumber: 104,
3165
+ lineNumber: 128,
3145
3166
  },
3146
3167
  type: 'Partial<Record<string, Field>>',
3147
3168
  },
@@ -3151,7 +3172,7 @@ export var manifest = {
3151
3172
  },
3152
3173
  location: {
3153
3174
  filePath: 'src/ctx/base.ts',
3154
- lineNumber: 111,
3175
+ lineNumber: 135,
3155
3176
  },
3156
3177
  type: 'Partial<Record<string, Fieldset>>',
3157
3178
  },
@@ -3161,7 +3182,7 @@ export var manifest = {
3161
3182
  },
3162
3183
  location: {
3163
3184
  filePath: 'src/ctx/base.ts',
3164
- lineNumber: 118,
3185
+ lineNumber: 142,
3165
3186
  },
3166
3187
  type: 'Partial<Record<string, User>>',
3167
3188
  },
@@ -3171,7 +3192,7 @@ export var manifest = {
3171
3192
  },
3172
3193
  location: {
3173
3194
  filePath: 'src/ctx/base.ts',
3174
- lineNumber: 125,
3195
+ lineNumber: 149,
3175
3196
  },
3176
3197
  type: 'Partial<Record<string, SsoUser>>',
3177
3198
  },
@@ -3192,7 +3213,7 @@ export var manifest = {
3192
3213
  },
3193
3214
  location: {
3194
3215
  filePath: 'src/ctx/base.ts',
3195
- lineNumber: 168,
3216
+ lineNumber: 353,
3196
3217
  },
3197
3218
  type: '(itemTypeId: string) => Promise<Field[]>',
3198
3219
  },
@@ -3203,7 +3224,7 @@ export var manifest = {
3203
3224
  },
3204
3225
  location: {
3205
3226
  filePath: 'src/ctx/base.ts',
3206
- lineNumber: 187,
3227
+ lineNumber: 372,
3207
3228
  },
3208
3229
  type: '(itemTypeId: string) => Promise<Fieldset[]>',
3209
3230
  },
@@ -3214,7 +3235,7 @@ export var manifest = {
3214
3235
  },
3215
3236
  location: {
3216
3237
  filePath: 'src/ctx/base.ts',
3217
- lineNumber: 204,
3238
+ lineNumber: 389,
3218
3239
  },
3219
3240
  type: '() => Promise<Field[]>',
3220
3241
  },
@@ -3225,7 +3246,7 @@ export var manifest = {
3225
3246
  },
3226
3247
  location: {
3227
3248
  filePath: 'src/ctx/base.ts',
3228
- lineNumber: 217,
3249
+ lineNumber: 402,
3229
3250
  },
3230
3251
  type: '() => Promise<User[]>',
3231
3252
  },
@@ -3236,7 +3257,7 @@ export var manifest = {
3236
3257
  },
3237
3258
  location: {
3238
3259
  filePath: 'src/ctx/base.ts',
3239
- lineNumber: 230,
3260
+ lineNumber: 415,
3240
3261
  },
3241
3262
  type: '() => Promise<SsoUser[]>',
3242
3263
  },
@@ -3255,7 +3276,7 @@ export var manifest = {
3255
3276
  },
3256
3277
  location: {
3257
3278
  filePath: 'src/ctx/base.ts',
3258
- lineNumber: 252,
3279
+ lineNumber: 437,
3259
3280
  },
3260
3281
  type: '(params: Record<string, unknown>) => Promise<void>',
3261
3282
  },
@@ -3266,7 +3287,7 @@ export var manifest = {
3266
3287
  },
3267
3288
  location: {
3268
3289
  filePath: 'src/ctx/base.ts',
3269
- lineNumber: 303,
3290
+ lineNumber: 488,
3270
3291
  },
3271
3292
  type: '(\n fieldId: string,\n changes: FieldAppearanceChange[],\n ) => Promise<void>',
3272
3293
  },
@@ -3285,7 +3306,7 @@ export var manifest = {
3285
3306
  },
3286
3307
  location: {
3287
3308
  filePath: 'src/ctx/base.ts',
3288
- lineNumber: 408,
3309
+ lineNumber: 593,
3289
3310
  },
3290
3311
  type: '(message: string) => Promise<void>',
3291
3312
  },
@@ -3296,7 +3317,7 @@ export var manifest = {
3296
3317
  },
3297
3318
  location: {
3298
3319
  filePath: 'src/ctx/base.ts',
3299
- lineNumber: 423,
3320
+ lineNumber: 608,
3300
3321
  },
3301
3322
  type: '(message: string) => Promise<void>',
3302
3323
  },
@@ -3307,7 +3328,7 @@ export var manifest = {
3307
3328
  },
3308
3329
  location: {
3309
3330
  filePath: 'src/ctx/base.ts',
3310
- lineNumber: 447,
3331
+ lineNumber: 632,
3311
3332
  },
3312
3333
  type: '<CtaValue = unknown>(\n toast: Toast<CtaValue>,\n ) => Promise<CtaValue | null>',
3313
3334
  },
@@ -3326,7 +3347,7 @@ export var manifest = {
3326
3347
  },
3327
3348
  location: {
3328
3349
  filePath: 'src/ctx/base.ts',
3329
- lineNumber: 333,
3350
+ lineNumber: 518,
3330
3351
  },
3331
3352
  type: '(itemTypeId: string) => Promise<Item | null>',
3332
3353
  },
@@ -3337,7 +3358,7 @@ export var manifest = {
3337
3358
  },
3338
3359
  location: {
3339
3360
  filePath: 'src/ctx/base.ts',
3340
- lineNumber: 354,
3361
+ lineNumber: 539,
3341
3362
  },
3342
3363
  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
3364
  },
@@ -3348,7 +3369,7 @@ export var manifest = {
3348
3369
  },
3349
3370
  location: {
3350
3371
  filePath: 'src/ctx/base.ts',
3351
- lineNumber: 386,
3372
+ lineNumber: 571,
3352
3373
  },
3353
3374
  type: '(itemId: string) => Promise<Item | null>',
3354
3375
  },
@@ -3367,7 +3388,7 @@ export var manifest = {
3367
3388
  },
3368
3389
  location: {
3369
3390
  filePath: 'src/ctx/base.ts',
3370
- lineNumber: 474,
3391
+ lineNumber: 659,
3371
3392
  },
3372
3393
  type: '{\n (options: { multiple: true }): Promise<Upload[] | null>;\n (options?: { multiple: false }): Promise<Upload | null>;\n }',
3373
3394
  },
@@ -3378,7 +3399,7 @@ export var manifest = {
3378
3399
  },
3379
3400
  location: {
3380
3401
  filePath: 'src/ctx/base.ts',
3381
- lineNumber: 502,
3402
+ lineNumber: 687,
3382
3403
  },
3383
3404
  type: '(\n uploadId: string,\n ) => Promise<(Upload & { deleted?: true }) | null>',
3384
3405
  },
@@ -3389,7 +3410,7 @@ export var manifest = {
3389
3410
  },
3390
3411
  location: {
3391
3412
  filePath: 'src/ctx/base.ts',
3392
- lineNumber: 530,
3413
+ lineNumber: 715,
3393
3414
  },
3394
3415
  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
3416
  },
@@ -3408,7 +3429,7 @@ export var manifest = {
3408
3429
  },
3409
3430
  location: {
3410
3431
  filePath: 'src/ctx/base.ts',
3411
- lineNumber: 561,
3432
+ lineNumber: 746,
3412
3433
  },
3413
3434
  type: '(modal: Modal) => Promise<unknown>',
3414
3435
  },
@@ -3419,7 +3440,7 @@ export var manifest = {
3419
3440
  },
3420
3441
  location: {
3421
3442
  filePath: 'src/ctx/base.ts',
3422
- lineNumber: 598,
3443
+ lineNumber: 783,
3423
3444
  },
3424
3445
  type: '(options: ConfirmOptions) => Promise<unknown>',
3425
3446
  },
@@ -3438,7 +3459,7 @@ export var manifest = {
3438
3459
  },
3439
3460
  location: {
3440
3461
  filePath: 'src/ctx/base.ts',
3441
- lineNumber: 612,
3462
+ lineNumber: 797,
3442
3463
  },
3443
3464
  type: '(path: string) => Promise<void>',
3444
3465
  },