@panneau/codemods 0.0.0-stage → 5.0.0-alpha.6
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 +28 -2
- package/bin/panneau-codemods.js +5 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +62 -0
- package/dist/cli.js.map +1 -0
- package/dist/context.d.ts +80 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +117 -0
- package/dist/context.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/mappings.d.ts +49 -0
- package/dist/mappings.d.ts.map +1 -0
- package/dist/mappings.js +574 -0
- package/dist/mappings.js.map +1 -0
- package/dist/names.d.ts +5 -0
- package/dist/names.d.ts.map +1 -0
- package/dist/names.js +13 -0
- package/dist/names.js.map +1 -0
- package/dist/run.d.ts +23 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +65 -0
- package/dist/run.js.map +1 -0
- package/dist/transform.d.ts +28 -0
- package/dist/transform.d.ts.map +1 -0
- package/dist/transform.js +192 -0
- package/dist/transform.js.map +1 -0
- package/dist/transforms/bootstrap.d.ts +6 -0
- package/dist/transforms/bootstrap.d.ts.map +1 -0
- package/dist/transforms/bootstrap.js +65 -0
- package/dist/transforms/bootstrap.js.map +1 -0
- package/dist/transforms/entry.d.ts +15 -0
- package/dist/transforms/entry.d.ts.map +1 -0
- package/dist/transforms/entry.js +239 -0
- package/dist/transforms/entry.js.map +1 -0
- package/dist/transforms/fieldEntries.d.ts +20 -0
- package/dist/transforms/fieldEntries.d.ts.map +1 -0
- package/dist/transforms/fieldEntries.js +238 -0
- package/dist/transforms/fieldEntries.js.map +1 -0
- package/dist/transforms/fields.d.ts +3 -0
- package/dist/transforms/fields.d.ts.map +1 -0
- package/dist/transforms/fields.js +241 -0
- package/dist/transforms/fields.js.map +1 -0
- package/dist/transforms/imports.d.ts +3 -0
- package/dist/transforms/imports.d.ts.map +1 -0
- package/dist/transforms/imports.js +60 -0
- package/dist/transforms/imports.js.map +1 -0
- package/package.json +44 -5
package/dist/mappings.js
ADDED
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
import { kebabCase } from "./names.js";
|
|
2
|
+
//#region src/mappings.ts
|
|
3
|
+
/** Props of every v5 field (`FieldProps` of `@panneau/fields`), plus React's `key`. */
|
|
4
|
+
var FIELD_PROPS = [
|
|
5
|
+
"key",
|
|
6
|
+
"value",
|
|
7
|
+
"onChange",
|
|
8
|
+
"onBlur",
|
|
9
|
+
"errors",
|
|
10
|
+
"disabled",
|
|
11
|
+
"readOnly",
|
|
12
|
+
"required",
|
|
13
|
+
"label",
|
|
14
|
+
"description",
|
|
15
|
+
"name",
|
|
16
|
+
"id",
|
|
17
|
+
"autoFocus",
|
|
18
|
+
"aria-label",
|
|
19
|
+
"className",
|
|
20
|
+
"labelClassName",
|
|
21
|
+
"descriptionClassName",
|
|
22
|
+
"errorsClassName"
|
|
23
|
+
];
|
|
24
|
+
/** v4 props of every field with another name in v5. */
|
|
25
|
+
var FIELD_RENAMES = { helpText: "description" };
|
|
26
|
+
var TEXT_PROPS = [
|
|
27
|
+
"placeholder",
|
|
28
|
+
"maxLength",
|
|
29
|
+
"prefix",
|
|
30
|
+
"suffix",
|
|
31
|
+
"type",
|
|
32
|
+
"inputMode",
|
|
33
|
+
"autoComplete",
|
|
34
|
+
"controlClassName",
|
|
35
|
+
"inputClassName"
|
|
36
|
+
];
|
|
37
|
+
var TEXT_RENAMES = {
|
|
38
|
+
prepend: "prefix",
|
|
39
|
+
append: "suffix"
|
|
40
|
+
};
|
|
41
|
+
var SELECT_PROPS = [
|
|
42
|
+
"options",
|
|
43
|
+
"placeholder",
|
|
44
|
+
"multiple",
|
|
45
|
+
"widget",
|
|
46
|
+
"controlClassName"
|
|
47
|
+
];
|
|
48
|
+
var MEDIA_PROPS = [
|
|
49
|
+
"accept",
|
|
50
|
+
"adapter",
|
|
51
|
+
"image",
|
|
52
|
+
"itemTitle",
|
|
53
|
+
"maxSize",
|
|
54
|
+
"multiple",
|
|
55
|
+
"refreshInterval",
|
|
56
|
+
"resource",
|
|
57
|
+
"sources",
|
|
58
|
+
"stateKey",
|
|
59
|
+
"uploadSource"
|
|
60
|
+
];
|
|
61
|
+
var MEDIA_NOTE = "it needs `resource`, the id of the media library, and the `mediaPlugin`";
|
|
62
|
+
var text = {
|
|
63
|
+
source: "@panneau/fields/text",
|
|
64
|
+
name: "TextField",
|
|
65
|
+
props: TEXT_PROPS,
|
|
66
|
+
renames: TEXT_RENAMES,
|
|
67
|
+
valueType: "string"
|
|
68
|
+
};
|
|
69
|
+
var select = {
|
|
70
|
+
source: "@panneau/fields/select",
|
|
71
|
+
name: "SelectField",
|
|
72
|
+
props: SELECT_PROPS
|
|
73
|
+
};
|
|
74
|
+
var relation = {
|
|
75
|
+
source: "@panneau/fields/relation",
|
|
76
|
+
name: "RelationField",
|
|
77
|
+
props: [
|
|
78
|
+
"resource",
|
|
79
|
+
"multiple",
|
|
80
|
+
"onCreate",
|
|
81
|
+
"placeholder",
|
|
82
|
+
"source",
|
|
83
|
+
"controlClassName"
|
|
84
|
+
],
|
|
85
|
+
note: "it searches the resource through the relation source of the app: `resource` is its id"
|
|
86
|
+
};
|
|
87
|
+
var media = {
|
|
88
|
+
source: "@panneau/media",
|
|
89
|
+
name: "MediaField",
|
|
90
|
+
props: MEDIA_PROPS,
|
|
91
|
+
note: MEDIA_NOTE
|
|
92
|
+
};
|
|
93
|
+
var image = {
|
|
94
|
+
source: "@panneau/media",
|
|
95
|
+
name: "ImageField",
|
|
96
|
+
props: [
|
|
97
|
+
...MEDIA_PROPS,
|
|
98
|
+
"cropRequired",
|
|
99
|
+
"enforceRatios",
|
|
100
|
+
"focalPoint",
|
|
101
|
+
"ratios",
|
|
102
|
+
"rotate",
|
|
103
|
+
"transformBase"
|
|
104
|
+
],
|
|
105
|
+
note: MEDIA_NOTE
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* The v5 component of each v4 field, by the v4 id in kebab case: `useFieldComponent('date_time')`
|
|
109
|
+
* and `@panneau/field-date-time` both give `date-time`, as v4 looked components up by their name
|
|
110
|
+
* in Pascal case.
|
|
111
|
+
*/
|
|
112
|
+
var FIELD_TARGETS = {
|
|
113
|
+
text,
|
|
114
|
+
textarea: {
|
|
115
|
+
source: "@panneau/fields/textarea",
|
|
116
|
+
name: "TextAreaField",
|
|
117
|
+
valueType: "string",
|
|
118
|
+
props: [
|
|
119
|
+
"maxLength",
|
|
120
|
+
"placeholder",
|
|
121
|
+
"rows",
|
|
122
|
+
"textAreaClassName"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
email: {
|
|
126
|
+
...text,
|
|
127
|
+
source: "@panneau/fields/email",
|
|
128
|
+
name: "EmailField"
|
|
129
|
+
},
|
|
130
|
+
url: {
|
|
131
|
+
source: "@panneau/fields/url",
|
|
132
|
+
name: "UrlField",
|
|
133
|
+
valueType: "string",
|
|
134
|
+
props: [...TEXT_PROPS.filter((prop) => prop !== "suffix"), "defaultScheme"],
|
|
135
|
+
renames: { prepend: "prefix" }
|
|
136
|
+
},
|
|
137
|
+
telephone: {
|
|
138
|
+
...text,
|
|
139
|
+
source: "@panneau/fields/tel",
|
|
140
|
+
name: "TelField"
|
|
141
|
+
},
|
|
142
|
+
tel: {
|
|
143
|
+
...text,
|
|
144
|
+
source: "@panneau/fields/tel",
|
|
145
|
+
name: "TelField"
|
|
146
|
+
},
|
|
147
|
+
number: {
|
|
148
|
+
source: "@panneau/fields/number",
|
|
149
|
+
name: "NumberField",
|
|
150
|
+
valueType: "number",
|
|
151
|
+
props: [
|
|
152
|
+
"controlClassName",
|
|
153
|
+
"formatOptions",
|
|
154
|
+
"inputClassName",
|
|
155
|
+
"max",
|
|
156
|
+
"min",
|
|
157
|
+
"placeholder",
|
|
158
|
+
"step",
|
|
159
|
+
"suffix"
|
|
160
|
+
],
|
|
161
|
+
renames: { append: "suffix" }
|
|
162
|
+
},
|
|
163
|
+
color: {
|
|
164
|
+
source: "@panneau/fields/color",
|
|
165
|
+
name: "ColorField",
|
|
166
|
+
valueType: "string",
|
|
167
|
+
props: TEXT_PROPS.filter((prop) => ![
|
|
168
|
+
"type",
|
|
169
|
+
"prefix",
|
|
170
|
+
"maxLength"
|
|
171
|
+
].includes(prop))
|
|
172
|
+
},
|
|
173
|
+
date: {
|
|
174
|
+
source: "@panneau/fields/date",
|
|
175
|
+
name: "DateField",
|
|
176
|
+
valueType: "string",
|
|
177
|
+
props: [
|
|
178
|
+
"controlClassName",
|
|
179
|
+
"max",
|
|
180
|
+
"min"
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
"date-time": {
|
|
184
|
+
source: "@panneau/fields/datetime",
|
|
185
|
+
name: "DateTimeField",
|
|
186
|
+
valueType: "string",
|
|
187
|
+
props: [
|
|
188
|
+
"controlClassName",
|
|
189
|
+
"hourCycle",
|
|
190
|
+
"timeZone",
|
|
191
|
+
"withSeconds"
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
datetime: {
|
|
195
|
+
source: "@panneau/fields/datetime",
|
|
196
|
+
name: "DateTimeField",
|
|
197
|
+
valueType: "string",
|
|
198
|
+
props: [
|
|
199
|
+
"controlClassName",
|
|
200
|
+
"hourCycle",
|
|
201
|
+
"timeZone",
|
|
202
|
+
"withSeconds"
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
select,
|
|
206
|
+
radios: {
|
|
207
|
+
...select,
|
|
208
|
+
adds: { widget: "radios" }
|
|
209
|
+
},
|
|
210
|
+
checkboxes: {
|
|
211
|
+
...select,
|
|
212
|
+
adds: {
|
|
213
|
+
multiple: true,
|
|
214
|
+
widget: "checkboxes"
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
toggles: {
|
|
218
|
+
...select,
|
|
219
|
+
adds: {
|
|
220
|
+
multiple: true,
|
|
221
|
+
widget: "checkboxes"
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
toggle: {
|
|
225
|
+
source: "@panneau/fields/boolean",
|
|
226
|
+
name: "BooleanField",
|
|
227
|
+
valueType: "boolean",
|
|
228
|
+
props: ["widget", "controlClassName"],
|
|
229
|
+
adds: { widget: "switch" }
|
|
230
|
+
},
|
|
231
|
+
checkbox: {
|
|
232
|
+
source: "@panneau/fields/boolean",
|
|
233
|
+
name: "BooleanField",
|
|
234
|
+
valueType: "boolean",
|
|
235
|
+
props: ["widget", "controlClassName"]
|
|
236
|
+
},
|
|
237
|
+
embed: {
|
|
238
|
+
source: "@panneau/fields/embed",
|
|
239
|
+
name: "EmbedField",
|
|
240
|
+
props: ["embedSource", "placeholder"]
|
|
241
|
+
},
|
|
242
|
+
localized: {
|
|
243
|
+
source: "@panneau/fields/localized",
|
|
244
|
+
name: "LocalizedField",
|
|
245
|
+
props: [
|
|
246
|
+
"children",
|
|
247
|
+
"localeClassName",
|
|
248
|
+
"locales"
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
fields: {
|
|
252
|
+
source: "@panneau/fields/group",
|
|
253
|
+
name: "GroupField",
|
|
254
|
+
props: [
|
|
255
|
+
"fields",
|
|
256
|
+
"fieldsClassName",
|
|
257
|
+
"path"
|
|
258
|
+
],
|
|
259
|
+
note: "`fields` are fields of the definition of Panneau 5 (`Field[]` of `@panneau/protocol`)"
|
|
260
|
+
},
|
|
261
|
+
items: {
|
|
262
|
+
source: "@panneau/fields/repeater",
|
|
263
|
+
name: "RepeaterField",
|
|
264
|
+
props: [
|
|
265
|
+
"fields",
|
|
266
|
+
"itemClassName",
|
|
267
|
+
"max",
|
|
268
|
+
"min",
|
|
269
|
+
"path",
|
|
270
|
+
"types"
|
|
271
|
+
],
|
|
272
|
+
note: "its items are made of fields of the definition of Panneau 5, or of block `types`"
|
|
273
|
+
},
|
|
274
|
+
item: relation,
|
|
275
|
+
"resource-item": relation,
|
|
276
|
+
upload: media,
|
|
277
|
+
media,
|
|
278
|
+
video: {
|
|
279
|
+
...media,
|
|
280
|
+
adds: { accept: ["video/*"] }
|
|
281
|
+
},
|
|
282
|
+
audio: {
|
|
283
|
+
...media,
|
|
284
|
+
adds: { accept: ["audio/*"] }
|
|
285
|
+
},
|
|
286
|
+
document: media,
|
|
287
|
+
image,
|
|
288
|
+
"image-upload": image,
|
|
289
|
+
"video-upload": {
|
|
290
|
+
...media,
|
|
291
|
+
adds: { accept: ["video/*"] }
|
|
292
|
+
},
|
|
293
|
+
"audio-upload": {
|
|
294
|
+
...media,
|
|
295
|
+
adds: { accept: ["audio/*"] }
|
|
296
|
+
},
|
|
297
|
+
"document-upload": media
|
|
298
|
+
};
|
|
299
|
+
/** v4 fields with no v5 component, and what replaces them. */
|
|
300
|
+
var FIELDS_WITHOUT_TARGET = {
|
|
301
|
+
html: "the `richtext` field of `@panneau/editor` replaces it",
|
|
302
|
+
password: "Panneau 5 has no password field",
|
|
303
|
+
autocomplete: "Panneau 5 has no autocomplete field: a `select` or a `relation` replaces it",
|
|
304
|
+
display: "Panneau 5 has no display field: read-only fields (`readOnly`) replace it",
|
|
305
|
+
"input-group": "Panneau 5 has no input group: the `prefix` and `suffix` of text fields replace it",
|
|
306
|
+
import: "Panneau 5 has no import field: the `import` action replaces it"
|
|
307
|
+
};
|
|
308
|
+
/** The v5 component of a v4 field id (`date_time`, `DateTime`, `date-time`). */
|
|
309
|
+
function getFieldTarget(id) {
|
|
310
|
+
return FIELD_TARGETS[kebabCase(id)] ?? null;
|
|
311
|
+
}
|
|
312
|
+
/** v4 namespaces of the `components` prop of the app, and the kinds of v5 plugins. */
|
|
313
|
+
var NAMESPACES = {
|
|
314
|
+
fields: {
|
|
315
|
+
kind: "fields",
|
|
316
|
+
constant: "FIELDS_NAMESPACE"
|
|
317
|
+
},
|
|
318
|
+
displays: {
|
|
319
|
+
kind: "displays",
|
|
320
|
+
constant: "DISPLAYS_NAMESPACE",
|
|
321
|
+
note: "displays of Panneau 5 get `value`, `item`, `field` and `column` (`DisplayProps` of `@panneau/lists`)"
|
|
322
|
+
},
|
|
323
|
+
actions: {
|
|
324
|
+
kind: "actions",
|
|
325
|
+
constant: "ACTIONS_NAMESPACE",
|
|
326
|
+
note: "actions of Panneau 5 are handlers of `client` actions of the definition, not buttons: see decision 0017"
|
|
327
|
+
},
|
|
328
|
+
pages: {
|
|
329
|
+
kind: "pages",
|
|
330
|
+
constant: "PAGES_NAMESPACE",
|
|
331
|
+
note: "pages of Panneau 5 render inside the shell of the app: drop `MainLayout` and `PageHeader`"
|
|
332
|
+
},
|
|
333
|
+
previews: {
|
|
334
|
+
kind: "previews",
|
|
335
|
+
constant: "PREVIEWS_NAMESPACE",
|
|
336
|
+
note: "previews of Panneau 5 get `PreviewProps` of `@panneau/core`"
|
|
337
|
+
},
|
|
338
|
+
lists: {
|
|
339
|
+
kind: "listLayouts",
|
|
340
|
+
constant: "LISTS_NAMESPACE",
|
|
341
|
+
note: "list layouts of Panneau 5 render the list state of `@panneau/lists`"
|
|
342
|
+
},
|
|
343
|
+
forms: {
|
|
344
|
+
kind: null,
|
|
345
|
+
constant: "FORMS_NAMESPACE"
|
|
346
|
+
},
|
|
347
|
+
filters: {
|
|
348
|
+
kind: null,
|
|
349
|
+
constant: "FILTERS_NAMESPACE"
|
|
350
|
+
},
|
|
351
|
+
modals: {
|
|
352
|
+
kind: null,
|
|
353
|
+
constant: "MODALS_NAMESPACE"
|
|
354
|
+
},
|
|
355
|
+
buttons: {
|
|
356
|
+
kind: null,
|
|
357
|
+
constant: "BUTTONS_NAMESPACE"
|
|
358
|
+
},
|
|
359
|
+
app: {
|
|
360
|
+
kind: null,
|
|
361
|
+
constant: "APP_NAMESPACE"
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
/** The namespace of a constant of `@panneau/core/contexts` (`FIELDS_NAMESPACE`). */
|
|
365
|
+
function getNamespaceOfConstant(constant) {
|
|
366
|
+
return Object.entries(NAMESPACES).find(([, namespace]) => namespace.constant === constant)?.[0] ?? null;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Packages of v4 that have a package of the same name in v5. Their main entry point is v5 for
|
|
370
|
+
* every name but those listed here, which only v4 exported (`default` is the default export).
|
|
371
|
+
*/
|
|
372
|
+
var SHARED_PACKAGES = {
|
|
373
|
+
"@panneau/actions": ["default"],
|
|
374
|
+
"@panneau/app": [
|
|
375
|
+
"default",
|
|
376
|
+
"MainLayout",
|
|
377
|
+
"GuestLayout",
|
|
378
|
+
"PageHeader",
|
|
379
|
+
"ResourceFilters",
|
|
380
|
+
"ResourceItemsList",
|
|
381
|
+
"ResourceForm"
|
|
382
|
+
],
|
|
383
|
+
"@panneau/auth": [
|
|
384
|
+
"default",
|
|
385
|
+
"AuthProvider",
|
|
386
|
+
"useAuth",
|
|
387
|
+
"useUser",
|
|
388
|
+
"useSetUser",
|
|
389
|
+
"useLogout",
|
|
390
|
+
"useLoggedIn",
|
|
391
|
+
"useAuthCheck",
|
|
392
|
+
"useAuthLogin",
|
|
393
|
+
"useAuthLogout",
|
|
394
|
+
"useAuthRegister",
|
|
395
|
+
"useAuthRequestPassword",
|
|
396
|
+
"useAuthResetPassword"
|
|
397
|
+
],
|
|
398
|
+
"@panneau/core": [
|
|
399
|
+
"default",
|
|
400
|
+
"ComponentsManager",
|
|
401
|
+
"DefinitionsManager",
|
|
402
|
+
"EventsManager",
|
|
403
|
+
"FieldsManager",
|
|
404
|
+
"FontsParser",
|
|
405
|
+
"FormsManager",
|
|
406
|
+
"MediasParser",
|
|
407
|
+
"Tracking",
|
|
408
|
+
"Action",
|
|
409
|
+
"ActionDefinition",
|
|
410
|
+
"ActionValue",
|
|
411
|
+
"AudioMedia",
|
|
412
|
+
"Breadcrumb",
|
|
413
|
+
"BreakpointsSize",
|
|
414
|
+
"Button",
|
|
415
|
+
"ButtonElement",
|
|
416
|
+
"ButtonSize",
|
|
417
|
+
"ButtonTheme",
|
|
418
|
+
"ButtonType",
|
|
419
|
+
"Column",
|
|
420
|
+
"ComponentsMap",
|
|
421
|
+
"ControlSize",
|
|
422
|
+
"Definition",
|
|
423
|
+
"DialogSize",
|
|
424
|
+
"DropdownAlign",
|
|
425
|
+
"Feedback",
|
|
426
|
+
"Field",
|
|
427
|
+
"FieldDefinition",
|
|
428
|
+
"FieldOption",
|
|
429
|
+
"FieldSettings",
|
|
430
|
+
"Filter",
|
|
431
|
+
"Font",
|
|
432
|
+
"FormDefinition",
|
|
433
|
+
"FormError",
|
|
434
|
+
"ImageMedia",
|
|
435
|
+
"Item",
|
|
436
|
+
"Label",
|
|
437
|
+
"Media",
|
|
438
|
+
"MediaFile",
|
|
439
|
+
"MediaType",
|
|
440
|
+
"MenuItem",
|
|
441
|
+
"Message",
|
|
442
|
+
"MessageValue",
|
|
443
|
+
"MessageValues",
|
|
444
|
+
"Modal",
|
|
445
|
+
"PageDefinition",
|
|
446
|
+
"Pagination",
|
|
447
|
+
"PanneauAuth",
|
|
448
|
+
"PanneauComponents",
|
|
449
|
+
"PanneauDefinition",
|
|
450
|
+
"PanneauIntl",
|
|
451
|
+
"PanneauIntlValues",
|
|
452
|
+
"PanneauMenuItem",
|
|
453
|
+
"PanneauMenus",
|
|
454
|
+
"PanneauPages",
|
|
455
|
+
"PanneauTheme",
|
|
456
|
+
"Preview",
|
|
457
|
+
"Resource",
|
|
458
|
+
"ResourceForm",
|
|
459
|
+
"ResourceForms",
|
|
460
|
+
"ResourceIndex",
|
|
461
|
+
"ResourceIntl",
|
|
462
|
+
"ResourceIntlValues",
|
|
463
|
+
"ResourceItem",
|
|
464
|
+
"ResourcePages",
|
|
465
|
+
"ResourceType",
|
|
466
|
+
"RouteDefinition",
|
|
467
|
+
"Routes",
|
|
468
|
+
"SelectOption",
|
|
469
|
+
"StatusCode",
|
|
470
|
+
"TableColumn",
|
|
471
|
+
"Toggle",
|
|
472
|
+
"TrackingVariables",
|
|
473
|
+
"TriggerUpdate",
|
|
474
|
+
"Uppy",
|
|
475
|
+
"User",
|
|
476
|
+
"VideoMedia"
|
|
477
|
+
],
|
|
478
|
+
"@panneau/data": [
|
|
479
|
+
"default",
|
|
480
|
+
"Api",
|
|
481
|
+
"BaseApi",
|
|
482
|
+
"DataProvider",
|
|
483
|
+
"ApiProvider",
|
|
484
|
+
"useApi",
|
|
485
|
+
"QueryProvider",
|
|
486
|
+
"useQueryContext",
|
|
487
|
+
"useItem",
|
|
488
|
+
"useItems",
|
|
489
|
+
"UseItemsResponse",
|
|
490
|
+
"useResourceDestroy",
|
|
491
|
+
"useResourceItem",
|
|
492
|
+
"useResourceItems",
|
|
493
|
+
"useResourceStore",
|
|
494
|
+
"useResourceUpdate",
|
|
495
|
+
"useResourceClone",
|
|
496
|
+
"useResourceRestore"
|
|
497
|
+
],
|
|
498
|
+
"@panneau/fields": ["default"],
|
|
499
|
+
"@panneau/forms": ["default"],
|
|
500
|
+
"@panneau/intl": [
|
|
501
|
+
"default",
|
|
502
|
+
"IntlManager",
|
|
503
|
+
"IntlProvider",
|
|
504
|
+
"ResourceMessage",
|
|
505
|
+
"useResourceValues"
|
|
506
|
+
],
|
|
507
|
+
"@panneau/lists": ["default"]
|
|
508
|
+
};
|
|
509
|
+
/** Packages that only exist in v4. Their imports are rewritten or reported. */
|
|
510
|
+
function isV4Package(name) {
|
|
511
|
+
return /^@panneau\/(action|display|element|field|filter|form|list|modal)-/.test(name) || [
|
|
512
|
+
"@panneau/ckeditor",
|
|
513
|
+
"@panneau/displays",
|
|
514
|
+
"@panneau/filters",
|
|
515
|
+
"@panneau/form",
|
|
516
|
+
"@panneau/medias",
|
|
517
|
+
"@panneau/modals",
|
|
518
|
+
"@panneau/panneau",
|
|
519
|
+
"@panneau/themes",
|
|
520
|
+
"@panneau/uppy"
|
|
521
|
+
].includes(name);
|
|
522
|
+
}
|
|
523
|
+
/** What replaces v4 exports, by module and name, for the messages of the report. */
|
|
524
|
+
var REPLACEMENTS = {
|
|
525
|
+
"@panneau/core/contexts": {
|
|
526
|
+
usePanneauResource: "`useResource(id)` of `@panneau/core` gives `{ resource, form, list }`: the fields of the resource are `resource.fields`, fields of the protocol",
|
|
527
|
+
usePanneauResources: "`useDefinition()` of `@panneau/data/query` gives the definition, with its `resources`",
|
|
528
|
+
useResource: "a field of Panneau 5 gets its values from its props: `useResource(id)` of `@panneau/core` resolves a resource of the definition",
|
|
529
|
+
useUrlGenerator: "Panneau 5 has no named routes: link to `{basePath}/resources/{resource}/{id}` (decision 0019), or run a resource action",
|
|
530
|
+
usePanneau: "`usePanneau()` of `@panneau/core` gives the definition and the plugins: custom keys of the definition move to `settings` of the resources or fields",
|
|
531
|
+
useFormSetValue: "`useFormContext().setValue(path, value)` of `@panneau/forms` sets the value of another field",
|
|
532
|
+
useForm: "a field of Panneau 5 reads its form through `useFormContext()` of `@panneau/forms`",
|
|
533
|
+
useLocales: "`useFieldsContext().locales` of `@panneau/fields`",
|
|
534
|
+
useListComponent: "list layouts come from plugins (`listLayouts`); `ListView` of `@panneau/lists` renders one",
|
|
535
|
+
useModalComponent: "`Dialog` of `@panneau/ui`",
|
|
536
|
+
useDisplayComponent: "displays come from plugins (`displays`); `@panneau/lists` exports the built-in ones",
|
|
537
|
+
ResourceProvider: "Panneau 5 has no resource context: pass the resource id as a prop"
|
|
538
|
+
},
|
|
539
|
+
"@panneau/data": {
|
|
540
|
+
useResourceItems: "`useResourceList(resource, query)` of `@panneau/data/query`: its `data.data` are the items, and the query is a list query of the protocol (`page`, `perPage`, `filter`)",
|
|
541
|
+
useResourceItem: "`useResourceItem(resource, id)` of `@panneau/data/query`: its `data` is the item",
|
|
542
|
+
useItems: "`useResourceList(resource, query)` of `@panneau/data/query`",
|
|
543
|
+
useItem: "`useResourceItem(resource, id)` of `@panneau/data/query`"
|
|
544
|
+
},
|
|
545
|
+
"@panneau/app": {
|
|
546
|
+
MainLayout: "pages of Panneau 5 render inside the shell of the app: drop the layout",
|
|
547
|
+
PageHeader: "pages of Panneau 5 render inside the shell of the app, which shows their title",
|
|
548
|
+
ResourceItemsList: "`ListView` of `@panneau/lists`, with `useResourceList()` of `@panneau/data/query`",
|
|
549
|
+
ResourceForm: "`FormView` of `@panneau/forms`"
|
|
550
|
+
},
|
|
551
|
+
"@panneau/medias": { MediasBrowserProvider: "the media field and picker of `@panneau/media` (`mediaPlugin`) browse the media libraries through the adapter" },
|
|
552
|
+
"@panneau/intl": {
|
|
553
|
+
default: "messages come with the packages and with plugins (`locales`)",
|
|
554
|
+
useResourceValues: "labels of resources come from the definition, already translated"
|
|
555
|
+
},
|
|
556
|
+
"@panneau/element-button": { default: "`Button` of `@panneau/ui` (`variant` and `tone` instead of `theme`, Lucide icons)" },
|
|
557
|
+
"@panneau/element-buttons": { default: "`Inline` and `Button` of `@panneau/ui`" },
|
|
558
|
+
"@panneau/element-modal": { default: "`Dialog` of `@panneau/ui`" },
|
|
559
|
+
"@panneau/modal-dialog": { default: "`Dialog` of `@panneau/ui`" },
|
|
560
|
+
"@panneau/element-card": { default: "`Card` of `@panneau/ui`" },
|
|
561
|
+
"@panneau/element-alert": { default: "`Alert` of `@panneau/ui`" },
|
|
562
|
+
"@panneau/element-loading": { default: "`Skeleton` of `@panneau/ui` while content loads, `Spinner` for an operation in progress" },
|
|
563
|
+
"@panneau/element-icon": { default: "`Icon` of `@panneau/ui`, with Lucide icons" },
|
|
564
|
+
"@panneau/element-label": { default: "labels are given to fields and primitives as `label`" },
|
|
565
|
+
"@panneau/element-select": { default: "`Select` of `@panneau/ui`, or `SelectField` of `@panneau/fields/select`" },
|
|
566
|
+
"@panneau/element-radios": { default: "`RadioGroup` of `@panneau/ui`" },
|
|
567
|
+
"@panneau/element-range": { default: "`Slider` of `@panneau/ui`" },
|
|
568
|
+
"@panneau/element-table": { default: "`ListView` of `@panneau/lists`" },
|
|
569
|
+
"@panneau/form": { default: "`Form` of `@panneau/forms`, with fields of the protocol" }
|
|
570
|
+
};
|
|
571
|
+
//#endregion
|
|
572
|
+
export { FIELDS_WITHOUT_TARGET, FIELD_PROPS, FIELD_RENAMES, FIELD_TARGETS, NAMESPACES, REPLACEMENTS, SHARED_PACKAGES, getFieldTarget, getNamespaceOfConstant, isV4Package };
|
|
573
|
+
|
|
574
|
+
//# sourceMappingURL=mappings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mappings.js","names":[],"sources":["../src/mappings.ts"],"sourcesContent":["// What v4 code becomes in Panneau 5: the field components, the modules and their exports. The\n// codemods only rewrite what these tables settle, and report the rest.\nimport { kebabCase } from './names';\n\n/** A v5 field component that replaces a v4 one. */\nexport interface FieldTarget {\n /** Module of the v5 component. */\n source: string;\n /** Export of the v5 component. */\n name: string;\n /** Props of the v5 component besides those of every field (`FieldProps`). */\n props: readonly string[];\n /** v4 props that have another name in v5. */\n renames?: Readonly<Record<string, string>>;\n /** Props that give the v5 component the behavior of the v4 one (`widget=\"radios\"`). */\n adds?: Readonly<Record<string, string | true | readonly string[]>>;\n /** The type of the value, for the input of a locale of a localized field in TypeScript. */\n valueType?: 'string' | 'number' | 'boolean';\n /** What to check after the rewrite, when the props of the v4 and v5 components differ. */\n note?: string;\n}\n\n/** Props of every v5 field (`FieldProps` of `@panneau/fields`), plus React's `key`. */\nexport const FIELD_PROPS: readonly string[] = [\n 'key',\n 'value',\n 'onChange',\n 'onBlur',\n 'errors',\n 'disabled',\n 'readOnly',\n 'required',\n 'label',\n 'description',\n 'name',\n 'id',\n 'autoFocus',\n 'aria-label',\n 'className',\n 'labelClassName',\n 'descriptionClassName',\n 'errorsClassName',\n];\n\n/** v4 props of every field with another name in v5. */\nexport const FIELD_RENAMES: Readonly<Record<string, string>> = { helpText: 'description' };\n\nconst TEXT_PROPS = [\n 'placeholder',\n 'maxLength',\n 'prefix',\n 'suffix',\n 'type',\n 'inputMode',\n 'autoComplete',\n 'controlClassName',\n 'inputClassName',\n];\nconst TEXT_RENAMES = { prepend: 'prefix', append: 'suffix' };\nconst SELECT_PROPS = ['options', 'placeholder', 'multiple', 'widget', 'controlClassName'];\nconst MEDIA_PROPS = [\n 'accept',\n 'adapter',\n 'image',\n 'itemTitle',\n 'maxSize',\n 'multiple',\n 'refreshInterval',\n 'resource',\n 'sources',\n 'stateKey',\n 'uploadSource',\n];\nconst MEDIA_NOTE = 'it needs `resource`, the id of the media library, and the `mediaPlugin`';\n\nconst text: FieldTarget = {\n source: '@panneau/fields/text',\n name: 'TextField',\n props: TEXT_PROPS,\n renames: TEXT_RENAMES,\n valueType: 'string',\n};\nconst select: FieldTarget = {\n source: '@panneau/fields/select',\n name: 'SelectField',\n props: SELECT_PROPS,\n};\nconst relation: FieldTarget = {\n source: '@panneau/fields/relation',\n name: 'RelationField',\n props: ['resource', 'multiple', 'onCreate', 'placeholder', 'source', 'controlClassName'],\n note: 'it searches the resource through the relation source of the app: `resource` is its id',\n};\nconst media: FieldTarget = {\n source: '@panneau/media',\n name: 'MediaField',\n props: MEDIA_PROPS,\n note: MEDIA_NOTE,\n};\nconst image: FieldTarget = {\n source: '@panneau/media',\n name: 'ImageField',\n props: [\n ...MEDIA_PROPS,\n 'cropRequired',\n 'enforceRatios',\n 'focalPoint',\n 'ratios',\n 'rotate',\n 'transformBase',\n ],\n note: MEDIA_NOTE,\n};\n\n/**\n * The v5 component of each v4 field, by the v4 id in kebab case: `useFieldComponent('date_time')`\n * and `@panneau/field-date-time` both give `date-time`, as v4 looked components up by their name\n * in Pascal case.\n */\nexport const FIELD_TARGETS: Readonly<Record<string, FieldTarget>> = {\n text,\n textarea: {\n source: '@panneau/fields/textarea',\n name: 'TextAreaField',\n valueType: 'string',\n props: ['maxLength', 'placeholder', 'rows', 'textAreaClassName'],\n },\n email: { ...text, source: '@panneau/fields/email', name: 'EmailField' },\n url: {\n source: '@panneau/fields/url',\n name: 'UrlField',\n valueType: 'string',\n props: [...TEXT_PROPS.filter((prop) => prop !== 'suffix'), 'defaultScheme'],\n renames: { prepend: 'prefix' },\n },\n telephone: { ...text, source: '@panneau/fields/tel', name: 'TelField' },\n tel: { ...text, source: '@panneau/fields/tel', name: 'TelField' },\n number: {\n source: '@panneau/fields/number',\n name: 'NumberField',\n valueType: 'number',\n props: [\n 'controlClassName',\n 'formatOptions',\n 'inputClassName',\n 'max',\n 'min',\n 'placeholder',\n 'step',\n 'suffix',\n ],\n renames: { append: 'suffix' },\n },\n color: {\n source: '@panneau/fields/color',\n name: 'ColorField',\n valueType: 'string',\n props: TEXT_PROPS.filter((prop) => !['type', 'prefix', 'maxLength'].includes(prop)),\n },\n date: {\n source: '@panneau/fields/date',\n name: 'DateField',\n valueType: 'string',\n props: ['controlClassName', 'max', 'min'],\n },\n 'date-time': {\n source: '@panneau/fields/datetime',\n name: 'DateTimeField',\n valueType: 'string',\n props: ['controlClassName', 'hourCycle', 'timeZone', 'withSeconds'],\n },\n datetime: {\n source: '@panneau/fields/datetime',\n name: 'DateTimeField',\n valueType: 'string',\n props: ['controlClassName', 'hourCycle', 'timeZone', 'withSeconds'],\n },\n select,\n radios: { ...select, adds: { widget: 'radios' } },\n checkboxes: { ...select, adds: { multiple: true, widget: 'checkboxes' } },\n toggles: { ...select, adds: { multiple: true, widget: 'checkboxes' } },\n toggle: {\n source: '@panneau/fields/boolean',\n name: 'BooleanField',\n valueType: 'boolean',\n props: ['widget', 'controlClassName'],\n adds: { widget: 'switch' },\n },\n checkbox: {\n source: '@panneau/fields/boolean',\n name: 'BooleanField',\n valueType: 'boolean',\n props: ['widget', 'controlClassName'],\n },\n embed: {\n source: '@panneau/fields/embed',\n name: 'EmbedField',\n props: ['embedSource', 'placeholder'],\n },\n localized: {\n source: '@panneau/fields/localized',\n name: 'LocalizedField',\n props: ['children', 'localeClassName', 'locales'],\n },\n fields: {\n source: '@panneau/fields/group',\n name: 'GroupField',\n props: ['fields', 'fieldsClassName', 'path'],\n note: '`fields` are fields of the definition of Panneau 5 (`Field[]` of `@panneau/protocol`)',\n },\n items: {\n source: '@panneau/fields/repeater',\n name: 'RepeaterField',\n props: ['fields', 'itemClassName', 'max', 'min', 'path', 'types'],\n note: 'its items are made of fields of the definition of Panneau 5, or of block `types`',\n },\n item: relation,\n 'resource-item': relation,\n upload: media,\n media,\n video: { ...media, adds: { accept: ['video/*'] } },\n audio: { ...media, adds: { accept: ['audio/*'] } },\n document: media,\n image,\n 'image-upload': image,\n 'video-upload': { ...media, adds: { accept: ['video/*'] } },\n 'audio-upload': { ...media, adds: { accept: ['audio/*'] } },\n 'document-upload': media,\n};\n\n/** v4 fields with no v5 component, and what replaces them. */\nexport const FIELDS_WITHOUT_TARGET: Readonly<Record<string, string>> = {\n html: 'the `richtext` field of `@panneau/editor` replaces it',\n password: 'Panneau 5 has no password field',\n autocomplete: 'Panneau 5 has no autocomplete field: a `select` or a `relation` replaces it',\n display: 'Panneau 5 has no display field: read-only fields (`readOnly`) replace it',\n 'input-group':\n 'Panneau 5 has no input group: the `prefix` and `suffix` of text fields replace it',\n import: 'Panneau 5 has no import field: the `import` action replaces it',\n};\n\n/** The v5 component of a v4 field id (`date_time`, `DateTime`, `date-time`). */\nexport function getFieldTarget(id: string): FieldTarget | null {\n return FIELD_TARGETS[kebabCase(id)] ?? null;\n}\n\n/** v4 namespaces of the `components` prop of the app, and the kinds of v5 plugins. */\nexport const NAMESPACES: Readonly<\n Record<string, { kind: string | null; note?: string; constant: string }>\n> = {\n fields: { kind: 'fields', constant: 'FIELDS_NAMESPACE' },\n displays: {\n kind: 'displays',\n constant: 'DISPLAYS_NAMESPACE',\n note: 'displays of Panneau 5 get `value`, `item`, `field` and `column` (`DisplayProps` of `@panneau/lists`)',\n },\n actions: {\n kind: 'actions',\n constant: 'ACTIONS_NAMESPACE',\n note: 'actions of Panneau 5 are handlers of `client` actions of the definition, not buttons: see decision 0017',\n },\n pages: {\n kind: 'pages',\n constant: 'PAGES_NAMESPACE',\n note: 'pages of Panneau 5 render inside the shell of the app: drop `MainLayout` and `PageHeader`',\n },\n previews: {\n kind: 'previews',\n constant: 'PREVIEWS_NAMESPACE',\n note: 'previews of Panneau 5 get `PreviewProps` of `@panneau/core`',\n },\n lists: {\n kind: 'listLayouts',\n constant: 'LISTS_NAMESPACE',\n note: 'list layouts of Panneau 5 render the list state of `@panneau/lists`',\n },\n forms: { kind: null, constant: 'FORMS_NAMESPACE' },\n filters: { kind: null, constant: 'FILTERS_NAMESPACE' },\n modals: { kind: null, constant: 'MODALS_NAMESPACE' },\n buttons: { kind: null, constant: 'BUTTONS_NAMESPACE' },\n app: { kind: null, constant: 'APP_NAMESPACE' },\n};\n\n/** The namespace of a constant of `@panneau/core/contexts` (`FIELDS_NAMESPACE`). */\nexport function getNamespaceOfConstant(constant: string): string | null {\n return (\n Object.entries(NAMESPACES).find(([, namespace]) => namespace.constant === constant)?.[0] ??\n null\n );\n}\n\n/**\n * Packages of v4 that have a package of the same name in v5. Their main entry point is v5 for\n * every name but those listed here, which only v4 exported (`default` is the default export).\n */\nexport const SHARED_PACKAGES: Readonly<Record<string, readonly string[]>> = {\n '@panneau/actions': ['default'],\n '@panneau/app': [\n 'default',\n 'MainLayout',\n 'GuestLayout',\n 'PageHeader',\n 'ResourceFilters',\n 'ResourceItemsList',\n 'ResourceForm',\n ],\n '@panneau/auth': [\n 'default',\n 'AuthProvider',\n 'useAuth',\n 'useUser',\n 'useSetUser',\n 'useLogout',\n 'useLoggedIn',\n 'useAuthCheck',\n 'useAuthLogin',\n 'useAuthLogout',\n 'useAuthRegister',\n 'useAuthRequestPassword',\n 'useAuthResetPassword',\n ],\n '@panneau/core': [\n 'default',\n 'ComponentsManager',\n 'DefinitionsManager',\n 'EventsManager',\n 'FieldsManager',\n 'FontsParser',\n 'FormsManager',\n 'MediasParser',\n 'Tracking',\n // Types of v4. `Form` and `FormStatus` are left out: v5 exports types of the same names.\n 'Action',\n 'ActionDefinition',\n 'ActionValue',\n 'AudioMedia',\n 'Breadcrumb',\n 'BreakpointsSize',\n 'Button',\n 'ButtonElement',\n 'ButtonSize',\n 'ButtonTheme',\n 'ButtonType',\n 'Column',\n 'ComponentsMap',\n 'ControlSize',\n 'Definition',\n 'DialogSize',\n 'DropdownAlign',\n 'Feedback',\n 'Field',\n 'FieldDefinition',\n 'FieldOption',\n 'FieldSettings',\n 'Filter',\n 'Font',\n 'FormDefinition',\n 'FormError',\n 'ImageMedia',\n 'Item',\n 'Label',\n 'Media',\n 'MediaFile',\n 'MediaType',\n 'MenuItem',\n 'Message',\n 'MessageValue',\n 'MessageValues',\n 'Modal',\n 'PageDefinition',\n 'Pagination',\n 'PanneauAuth',\n 'PanneauComponents',\n 'PanneauDefinition',\n 'PanneauIntl',\n 'PanneauIntlValues',\n 'PanneauMenuItem',\n 'PanneauMenus',\n 'PanneauPages',\n 'PanneauTheme',\n 'Preview',\n 'Resource',\n 'ResourceForm',\n 'ResourceForms',\n 'ResourceIndex',\n 'ResourceIntl',\n 'ResourceIntlValues',\n 'ResourceItem',\n 'ResourcePages',\n 'ResourceType',\n 'RouteDefinition',\n 'Routes',\n 'SelectOption',\n 'StatusCode',\n 'TableColumn',\n 'Toggle',\n 'TrackingVariables',\n 'TriggerUpdate',\n 'Uppy',\n 'User',\n 'VideoMedia',\n ],\n '@panneau/data': [\n 'default',\n 'Api',\n 'BaseApi',\n 'DataProvider',\n 'ApiProvider',\n 'useApi',\n 'QueryProvider',\n 'useQueryContext',\n 'useItem',\n 'useItems',\n 'UseItemsResponse',\n 'useResourceDestroy',\n 'useResourceItem',\n 'useResourceItems',\n 'useResourceStore',\n 'useResourceUpdate',\n 'useResourceClone',\n 'useResourceRestore',\n ],\n '@panneau/fields': ['default'],\n '@panneau/forms': ['default'],\n '@panneau/intl': [\n 'default',\n 'IntlManager',\n 'IntlProvider',\n 'ResourceMessage',\n 'useResourceValues',\n ],\n '@panneau/lists': ['default'],\n};\n\n/** Packages that only exist in v4. Their imports are rewritten or reported. */\nexport function isV4Package(name: string): boolean {\n return (\n /^@panneau\\/(action|display|element|field|filter|form|list|modal)-/.test(name) ||\n [\n '@panneau/ckeditor',\n '@panneau/displays',\n '@panneau/filters',\n '@panneau/form',\n '@panneau/medias',\n '@panneau/modals',\n '@panneau/panneau',\n '@panneau/themes',\n '@panneau/uppy',\n ].includes(name)\n );\n}\n\n/** What replaces v4 exports, by module and name, for the messages of the report. */\nexport const REPLACEMENTS: Readonly<Record<string, Readonly<Record<string, string>>>> = {\n '@panneau/core/contexts': {\n usePanneauResource:\n '`useResource(id)` of `@panneau/core` gives `{ resource, form, list }`: the fields of the resource are `resource.fields`, fields of the protocol',\n usePanneauResources:\n '`useDefinition()` of `@panneau/data/query` gives the definition, with its `resources`',\n useResource:\n 'a field of Panneau 5 gets its values from its props: `useResource(id)` of `@panneau/core` resolves a resource of the definition',\n useUrlGenerator:\n 'Panneau 5 has no named routes: link to `{basePath}/resources/{resource}/{id}` (decision 0019), or run a resource action',\n usePanneau:\n '`usePanneau()` of `@panneau/core` gives the definition and the plugins: custom keys of the definition move to `settings` of the resources or fields',\n useFormSetValue:\n '`useFormContext().setValue(path, value)` of `@panneau/forms` sets the value of another field',\n useForm:\n 'a field of Panneau 5 reads its form through `useFormContext()` of `@panneau/forms`',\n useLocales: '`useFieldsContext().locales` of `@panneau/fields`',\n useListComponent:\n 'list layouts come from plugins (`listLayouts`); `ListView` of `@panneau/lists` renders one',\n useModalComponent: '`Dialog` of `@panneau/ui`',\n useDisplayComponent:\n 'displays come from plugins (`displays`); `@panneau/lists` exports the built-in ones',\n ResourceProvider: 'Panneau 5 has no resource context: pass the resource id as a prop',\n },\n '@panneau/data': {\n useResourceItems:\n '`useResourceList(resource, query)` of `@panneau/data/query`: its `data.data` are the items, and the query is a list query of the protocol (`page`, `perPage`, `filter`)',\n useResourceItem:\n '`useResourceItem(resource, id)` of `@panneau/data/query`: its `data` is the item',\n useItems: '`useResourceList(resource, query)` of `@panneau/data/query`',\n useItem: '`useResourceItem(resource, id)` of `@panneau/data/query`',\n },\n '@panneau/app': {\n MainLayout: 'pages of Panneau 5 render inside the shell of the app: drop the layout',\n PageHeader:\n 'pages of Panneau 5 render inside the shell of the app, which shows their title',\n ResourceItemsList:\n '`ListView` of `@panneau/lists`, with `useResourceList()` of `@panneau/data/query`',\n ResourceForm: '`FormView` of `@panneau/forms`',\n },\n '@panneau/medias': {\n MediasBrowserProvider:\n 'the media field and picker of `@panneau/media` (`mediaPlugin`) browse the media libraries through the adapter',\n },\n '@panneau/intl': {\n default: 'messages come with the packages and with plugins (`locales`)',\n useResourceValues: 'labels of resources come from the definition, already translated',\n },\n '@panneau/element-button': {\n default:\n '`Button` of `@panneau/ui` (`variant` and `tone` instead of `theme`, Lucide icons)',\n },\n '@panneau/element-buttons': { default: '`Inline` and `Button` of `@panneau/ui`' },\n '@panneau/element-modal': { default: '`Dialog` of `@panneau/ui`' },\n '@panneau/modal-dialog': { default: '`Dialog` of `@panneau/ui`' },\n '@panneau/element-card': { default: '`Card` of `@panneau/ui`' },\n '@panneau/element-alert': { default: '`Alert` of `@panneau/ui`' },\n '@panneau/element-loading': {\n default:\n '`Skeleton` of `@panneau/ui` while content loads, `Spinner` for an operation in progress',\n },\n '@panneau/element-icon': { default: '`Icon` of `@panneau/ui`, with Lucide icons' },\n '@panneau/element-label': { default: 'labels are given to fields and primitives as `label`' },\n '@panneau/element-select': {\n default: '`Select` of `@panneau/ui`, or `SelectField` of `@panneau/fields/select`',\n },\n '@panneau/element-radios': { default: '`RadioGroup` of `@panneau/ui`' },\n '@panneau/element-range': { default: '`Slider` of `@panneau/ui`' },\n '@panneau/element-table': { default: '`ListView` of `@panneau/lists`' },\n '@panneau/form': { default: '`Form` of `@panneau/forms`, with fields of the protocol' },\n};\n"],"mappings":";;;AAuBA,IAAa,cAAiC;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;;AAGA,IAAa,gBAAkD,EAAE,UAAU,cAAc;AAEzF,IAAM,aAAa;CACf;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AACA,IAAM,eAAe;CAAE,SAAS;CAAU,QAAQ;AAAS;AAC3D,IAAM,eAAe;CAAC;CAAW;CAAe;CAAY;CAAU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;CACJ;CACA,iBAAiB;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACJ;CACA,iBAAiB;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACJ;CACA,mBAAmB,CAAC,SAAS;CAC7B,kBAAkB,CAAC,SAAS;CAC5B,iBAAiB;EACb;EACA;EACA;EACA;EACA;CACJ;CACA,kBAAkB,CAAC,SAAS;AAChC;;AAGA,SAAgB,YAAY,MAAuB;CAC/C,OACI,oEAAoE,KAAK,IAAI,KAC7E;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACJ,CAAC,CAAC,SAAS,IAAI;AAEvB;;AAGA,IAAa,eAA2E;CACpF,0BAA0B;EACtB,oBACI;EACJ,qBACI;EACJ,aACI;EACJ,iBACI;EACJ,YACI;EACJ,iBACI;EACJ,SACI;EACJ,YAAY;EACZ,kBACI;EACJ,mBAAmB;EACnB,qBACI;EACJ,kBAAkB;CACtB;CACA,iBAAiB;EACb,kBACI;EACJ,iBACI;EACJ,UAAU;EACV,SAAS;CACb;CACA,gBAAgB;EACZ,YAAY;EACZ,YACI;EACJ,mBACI;EACJ,cAAc;CAClB;CACA,mBAAmB,EACf,uBACI,gHACR;CACA,iBAAiB;EACb,SAAS;EACT,mBAAmB;CACvB;CACA,2BAA2B,EACvB,SACI,oFACR;CACA,4BAA4B,EAAE,SAAS,yCAAyC;CAChF,0BAA0B,EAAE,SAAS,4BAA4B;CACjE,yBAAyB,EAAE,SAAS,4BAA4B;CAChE,yBAAyB,EAAE,SAAS,0BAA0B;CAC9D,0BAA0B,EAAE,SAAS,2BAA2B;CAChE,4BAA4B,EACxB,SACI,0FACR;CACA,yBAAyB,EAAE,SAAS,6CAA6C;CACjF,0BAA0B,EAAE,SAAS,uDAAuD;CAC5F,2BAA2B,EACvB,SAAS,0EACb;CACA,2BAA2B,EAAE,SAAS,gCAAgC;CACtE,0BAA0B,EAAE,SAAS,4BAA4B;CACjE,0BAA0B,EAAE,SAAS,iCAAiC;CACtE,iBAAiB,EAAE,SAAS,0DAA0D;AAC1F"}
|
package/dist/names.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** `VideoOrEmbed` for `video_or_embed`, as v4 looked components up by name. */
|
|
2
|
+
export declare function pascalCase(name: string): string;
|
|
3
|
+
/** `video-or-embed` for `VideoOrEmbed` or `video_or_embed`. */
|
|
4
|
+
export declare function kebabCase(name: string): string;
|
|
5
|
+
//# sourceMappingURL=names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../src/names.ts"],"names":[],"mappings":"AAUA,+EAA+E;AAC/E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI/C;AAED,+DAA+D;AAC/D,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
package/dist/names.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/names.ts
|
|
2
|
+
/** The words of a name: `videoOrEmbed`, `video_or_embed`, `VideoOrEmbed` give video, or, embed. */
|
|
3
|
+
function words(name) {
|
|
4
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z])([A-Z][a-z])/g, "$1 $2").split(/[^a-zA-Z0-9]+/).filter((word) => word !== "").map((word) => word.toLowerCase());
|
|
5
|
+
}
|
|
6
|
+
/** `video-or-embed` for `VideoOrEmbed` or `video_or_embed`. */
|
|
7
|
+
function kebabCase(name) {
|
|
8
|
+
return words(name).join("-");
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { kebabCase };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.js","names":[],"sources":["../src/names.ts"],"sourcesContent":["/** The words of a name: `videoOrEmbed`, `video_or_embed`, `VideoOrEmbed` give video, or, embed. */\nfunction words(name: string): string[] {\n return name\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .replace(/([A-Z])([A-Z][a-z])/g, '$1 $2')\n .split(/[^a-zA-Z0-9]+/)\n .filter((word) => word !== '')\n .map((word) => word.toLowerCase());\n}\n\n/** `VideoOrEmbed` for `video_or_embed`, as v4 looked components up by name. */\nexport function pascalCase(name: string): string {\n return words(name)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n}\n\n/** `video-or-embed` for `VideoOrEmbed` or `video_or_embed`. */\nexport function kebabCase(name: string): string {\n return words(name).join('-');\n}\n"],"mappings":";;AACA,SAAS,MAAM,MAAwB;CACnC,OAAO,KACF,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,wBAAwB,OAAO,CAAC,CACxC,MAAM,eAAe,CAAC,CACtB,QAAQ,SAAS,SAAS,EAAE,CAAC,CAC7B,KAAK,SAAS,KAAK,YAAY,CAAC;AACzC;;AAUA,SAAgB,UAAU,MAAsB;CAC5C,OAAO,MAAM,IAAI,CAAC,CAAC,KAAK,GAAG;AAC/B"}
|