@openpresentation/opf 0.9.0 → 0.10.1
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 +7 -1
- package/dist/{catalogs-BnnkUX9O.d.ts → catalogs-DoVmvDr7.d.ts} +6 -6
- package/dist/catalogs.d.ts +2 -2
- package/dist/catalogs.js +1 -1
- package/dist/{chunk-GQSK3T7X.js → chunk-D3GQIREP.js} +13 -4
- package/dist/chunk-EWJNRHXA.js +595 -0
- package/dist/{chunk-3GPZMY2W.js → chunk-FHGJX5QK.js} +24 -12
- package/dist/{chunk-JA5W5TVA.js → chunk-PQJRDNA6.js} +624 -73
- package/dist/{chunk-OZULJBSG.js → chunk-RS5GZ5RW.js} +14 -0
- package/dist/{chunk-TWMRZ43O.js → chunk-TU7I3KSB.js} +59 -21
- package/dist/{chunk-ZGV6I23P.js → chunk-ZIL7MGZU.js} +50 -5
- package/dist/composition.d.ts +257 -10
- package/dist/composition.js +1 -1
- package/dist/docs.js +58 -10
- package/dist/examples.js +2284 -1417
- package/dist/index.d.ts +4 -3
- package/dist/index.js +7 -6
- package/dist/lint.d.ts +70 -0
- package/dist/lint.js +5 -0
- package/dist/pagination.d.ts +4 -0
- package/dist/pagination.js +5 -5
- package/dist/{schemas--QRVBhU1.d.ts → schemas-BYe5y8-i.d.ts} +1 -1
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +1 -1
- package/dist/spec/catalogs/layouts/extract/canonical.json +45 -21
- package/dist/spec/catalogs/layouts/index.json +10 -0
- package/dist/spec/catalogs/layouts/number-1x.json +1 -1
- package/dist/spec/catalogs/layouts/number-2x.json +2 -2
- package/dist/spec/catalogs/layouts/number-3x.json +3 -3
- package/dist/spec/catalogs/layouts/number-4x.json +4 -4
- package/dist/spec/catalogs/layouts/number-5x.json +5 -5
- package/dist/spec/catalogs/layouts/number-6x.json +6 -6
- package/dist/spec/catalogs/layouts/quote-1x.json +13 -0
- package/dist/spec/catalogs/layouts/timeline-1x.json +13 -0
- package/dist/spec/schemas/layout.schema.json +12 -3
- package/dist/spec/schemas/narrative.schema.json +1 -1
- package/dist/spec-files.d.ts +1 -1
- package/dist/spec-files.js +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/validator.d.ts +2 -2
- package/dist/validator.js +4 -4
- package/package.json +11 -6
|
@@ -1872,6 +1872,12 @@ var specFileEntries = [
|
|
|
1872
1872
|
"kind": "catalogRecord",
|
|
1873
1873
|
"mediaType": "application/json"
|
|
1874
1874
|
},
|
|
1875
|
+
{
|
|
1876
|
+
"path": "catalogs/layouts/quote-1x.json",
|
|
1877
|
+
"packagePath": "@openpresentation/opf/spec/catalogs/layouts/quote-1x.json",
|
|
1878
|
+
"kind": "catalogRecord",
|
|
1879
|
+
"mediaType": "application/json"
|
|
1880
|
+
},
|
|
1875
1881
|
{
|
|
1876
1882
|
"path": "catalogs/layouts/table-1x.json",
|
|
1877
1883
|
"packagePath": "@openpresentation/opf/spec/catalogs/layouts/table-1x.json",
|
|
@@ -1896,6 +1902,12 @@ var specFileEntries = [
|
|
|
1896
1902
|
"kind": "catalogRecord",
|
|
1897
1903
|
"mediaType": "application/json"
|
|
1898
1904
|
},
|
|
1905
|
+
{
|
|
1906
|
+
"path": "catalogs/layouts/timeline-1x.json",
|
|
1907
|
+
"packagePath": "@openpresentation/opf/spec/catalogs/layouts/timeline-1x.json",
|
|
1908
|
+
"kind": "catalogRecord",
|
|
1909
|
+
"mediaType": "application/json"
|
|
1910
|
+
},
|
|
1899
1911
|
{
|
|
1900
1912
|
"path": "catalogs/layouts/title-subtitle.json",
|
|
1901
1913
|
"packagePath": "@openpresentation/opf/spec/catalogs/layouts/title-subtitle.json",
|
|
@@ -3188,10 +3200,12 @@ var specFilePaths = [
|
|
|
3188
3200
|
"catalogs/layouts/number-4x.json",
|
|
3189
3201
|
"catalogs/layouts/number-5x.json",
|
|
3190
3202
|
"catalogs/layouts/number-6x.json",
|
|
3203
|
+
"catalogs/layouts/quote-1x.json",
|
|
3191
3204
|
"catalogs/layouts/table-1x.json",
|
|
3192
3205
|
"catalogs/layouts/text-1x.json",
|
|
3193
3206
|
"catalogs/layouts/text-2x.json",
|
|
3194
3207
|
"catalogs/layouts/text-3x.json",
|
|
3208
|
+
"catalogs/layouts/timeline-1x.json",
|
|
3195
3209
|
"catalogs/layouts/title-subtitle.json",
|
|
3196
3210
|
"catalogs/layouts/title.json",
|
|
3197
3211
|
"catalogs/narratives/board-meeting.json",
|
|
@@ -1177,7 +1177,7 @@ var layouts = [
|
|
|
1177
1177
|
"type": "title"
|
|
1178
1178
|
},
|
|
1179
1179
|
{
|
|
1180
|
-
"type": "
|
|
1180
|
+
"type": "metric"
|
|
1181
1181
|
}
|
|
1182
1182
|
]
|
|
1183
1183
|
},
|
|
@@ -1190,10 +1190,10 @@ var layouts = [
|
|
|
1190
1190
|
"type": "title"
|
|
1191
1191
|
},
|
|
1192
1192
|
{
|
|
1193
|
-
"type": "
|
|
1193
|
+
"type": "metric"
|
|
1194
1194
|
},
|
|
1195
1195
|
{
|
|
1196
|
-
"type": "
|
|
1196
|
+
"type": "metric"
|
|
1197
1197
|
}
|
|
1198
1198
|
],
|
|
1199
1199
|
"composition": {
|
|
@@ -1209,13 +1209,13 @@ var layouts = [
|
|
|
1209
1209
|
"type": "title"
|
|
1210
1210
|
},
|
|
1211
1211
|
{
|
|
1212
|
-
"type": "
|
|
1212
|
+
"type": "metric"
|
|
1213
1213
|
},
|
|
1214
1214
|
{
|
|
1215
|
-
"type": "
|
|
1215
|
+
"type": "metric"
|
|
1216
1216
|
},
|
|
1217
1217
|
{
|
|
1218
|
-
"type": "
|
|
1218
|
+
"type": "metric"
|
|
1219
1219
|
}
|
|
1220
1220
|
],
|
|
1221
1221
|
"composition": {
|
|
@@ -1231,16 +1231,16 @@ var layouts = [
|
|
|
1231
1231
|
"type": "title"
|
|
1232
1232
|
},
|
|
1233
1233
|
{
|
|
1234
|
-
"type": "
|
|
1234
|
+
"type": "metric"
|
|
1235
1235
|
},
|
|
1236
1236
|
{
|
|
1237
|
-
"type": "
|
|
1237
|
+
"type": "metric"
|
|
1238
1238
|
},
|
|
1239
1239
|
{
|
|
1240
|
-
"type": "
|
|
1240
|
+
"type": "metric"
|
|
1241
1241
|
},
|
|
1242
1242
|
{
|
|
1243
|
-
"type": "
|
|
1243
|
+
"type": "metric"
|
|
1244
1244
|
}
|
|
1245
1245
|
],
|
|
1246
1246
|
"composition": {
|
|
@@ -1257,19 +1257,19 @@ var layouts = [
|
|
|
1257
1257
|
"type": "title"
|
|
1258
1258
|
},
|
|
1259
1259
|
{
|
|
1260
|
-
"type": "
|
|
1260
|
+
"type": "metric"
|
|
1261
1261
|
},
|
|
1262
1262
|
{
|
|
1263
|
-
"type": "
|
|
1263
|
+
"type": "metric"
|
|
1264
1264
|
},
|
|
1265
1265
|
{
|
|
1266
|
-
"type": "
|
|
1266
|
+
"type": "metric"
|
|
1267
1267
|
},
|
|
1268
1268
|
{
|
|
1269
|
-
"type": "
|
|
1269
|
+
"type": "metric"
|
|
1270
1270
|
},
|
|
1271
1271
|
{
|
|
1272
|
-
"type": "
|
|
1272
|
+
"type": "metric"
|
|
1273
1273
|
}
|
|
1274
1274
|
],
|
|
1275
1275
|
"composition": {
|
|
@@ -1286,22 +1286,22 @@ var layouts = [
|
|
|
1286
1286
|
"type": "title"
|
|
1287
1287
|
},
|
|
1288
1288
|
{
|
|
1289
|
-
"type": "
|
|
1289
|
+
"type": "metric"
|
|
1290
1290
|
},
|
|
1291
1291
|
{
|
|
1292
|
-
"type": "
|
|
1292
|
+
"type": "metric"
|
|
1293
1293
|
},
|
|
1294
1294
|
{
|
|
1295
|
-
"type": "
|
|
1295
|
+
"type": "metric"
|
|
1296
1296
|
},
|
|
1297
1297
|
{
|
|
1298
|
-
"type": "
|
|
1298
|
+
"type": "metric"
|
|
1299
1299
|
},
|
|
1300
1300
|
{
|
|
1301
|
-
"type": "
|
|
1301
|
+
"type": "metric"
|
|
1302
1302
|
},
|
|
1303
1303
|
{
|
|
1304
|
-
"type": "
|
|
1304
|
+
"type": "metric"
|
|
1305
1305
|
}
|
|
1306
1306
|
],
|
|
1307
1307
|
"composition": {
|
|
@@ -1309,6 +1309,19 @@ var layouts = [
|
|
|
1309
1309
|
"columns": 3
|
|
1310
1310
|
}
|
|
1311
1311
|
},
|
|
1312
|
+
{
|
|
1313
|
+
"$schema": "https://openpresentation.org/schema/opf-layout/v1",
|
|
1314
|
+
"id": "quote-1x",
|
|
1315
|
+
"name": "Quote 1x",
|
|
1316
|
+
"placeholders": [
|
|
1317
|
+
{
|
|
1318
|
+
"type": "title"
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
"type": "quote"
|
|
1322
|
+
}
|
|
1323
|
+
]
|
|
1324
|
+
},
|
|
1312
1325
|
{
|
|
1313
1326
|
"$schema": "https://openpresentation.org/schema/opf-layout/v1",
|
|
1314
1327
|
"id": "table-1x",
|
|
@@ -1382,6 +1395,19 @@ var layouts = [
|
|
|
1382
1395
|
"mode": "row"
|
|
1383
1396
|
}
|
|
1384
1397
|
},
|
|
1398
|
+
{
|
|
1399
|
+
"$schema": "https://openpresentation.org/schema/opf-layout/v1",
|
|
1400
|
+
"id": "timeline-1x",
|
|
1401
|
+
"name": "Timeline 1x",
|
|
1402
|
+
"placeholders": [
|
|
1403
|
+
{
|
|
1404
|
+
"type": "title"
|
|
1405
|
+
},
|
|
1406
|
+
{
|
|
1407
|
+
"type": "timeline"
|
|
1408
|
+
}
|
|
1409
|
+
]
|
|
1410
|
+
},
|
|
1385
1411
|
{
|
|
1386
1412
|
"$schema": "https://openpresentation.org/schema/opf-layout/v1",
|
|
1387
1413
|
"id": "title",
|
|
@@ -15562,6 +15588,11 @@ var catalogIndexes = {
|
|
|
15562
15588
|
"name": "Number 6x",
|
|
15563
15589
|
"file": "number-6x.json"
|
|
15564
15590
|
},
|
|
15591
|
+
{
|
|
15592
|
+
"id": "quote-1x",
|
|
15593
|
+
"name": "Quote 1x",
|
|
15594
|
+
"file": "quote-1x.json"
|
|
15595
|
+
},
|
|
15565
15596
|
{
|
|
15566
15597
|
"id": "table-1x",
|
|
15567
15598
|
"name": "Table 1x",
|
|
@@ -15582,6 +15613,11 @@ var catalogIndexes = {
|
|
|
15582
15613
|
"name": "Text 3x",
|
|
15583
15614
|
"file": "text-3x.json"
|
|
15584
15615
|
},
|
|
15616
|
+
{
|
|
15617
|
+
"id": "timeline-1x",
|
|
15618
|
+
"name": "Timeline 1x",
|
|
15619
|
+
"file": "timeline-1x.json"
|
|
15620
|
+
},
|
|
15585
15621
|
{
|
|
15586
15622
|
"id": "title",
|
|
15587
15623
|
"name": "Title",
|
|
@@ -18231,10 +18267,12 @@ var catalogEntries = [
|
|
|
18231
18267
|
"number-4x.json",
|
|
18232
18268
|
"number-5x.json",
|
|
18233
18269
|
"number-6x.json",
|
|
18270
|
+
"quote-1x.json",
|
|
18234
18271
|
"table-1x.json",
|
|
18235
18272
|
"text-1x.json",
|
|
18236
18273
|
"text-2x.json",
|
|
18237
18274
|
"text-3x.json",
|
|
18275
|
+
"timeline-1x.json",
|
|
18238
18276
|
"title.json",
|
|
18239
18277
|
"title-subtitle.json"
|
|
18240
18278
|
], records: layouts, index: catalogIndexes.layouts },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MAX_COMPOSITION_DEPTH, tableGrid } from './chunk-
|
|
2
|
-
import { schemas } from './chunk-
|
|
3
|
-
import { catalogSchemaNames } from './chunk-
|
|
1
|
+
import { MAX_COMPOSITION_DEPTH, tableGrid } from './chunk-PQJRDNA6.js';
|
|
2
|
+
import { schemas, schemaEntries } from './chunk-D3GQIREP.js';
|
|
3
|
+
import { catalogSchemaNames } from './chunk-TU7I3KSB.js';
|
|
4
4
|
import Ajv2020 from 'ajv/dist/2020.js';
|
|
5
5
|
import addFormats from 'ajv-formats';
|
|
6
6
|
|
|
@@ -67,10 +67,12 @@ var catalogIds = {
|
|
|
67
67
|
"number-4x",
|
|
68
68
|
"number-5x",
|
|
69
69
|
"number-6x",
|
|
70
|
+
"quote-1x",
|
|
70
71
|
"table-1x",
|
|
71
72
|
"text-1x",
|
|
72
73
|
"text-2x",
|
|
73
74
|
"text-3x",
|
|
75
|
+
"timeline-1x",
|
|
74
76
|
"title",
|
|
75
77
|
"title-subtitle"
|
|
76
78
|
],
|
|
@@ -409,6 +411,46 @@ var catalogIds = {
|
|
|
409
411
|
]
|
|
410
412
|
};
|
|
411
413
|
|
|
414
|
+
// src/validation-definitions.ts
|
|
415
|
+
var schemaLocations;
|
|
416
|
+
var issueLocations = /* @__PURE__ */ new WeakMap();
|
|
417
|
+
function rememberValidationDefinition(issue, parentSchema, keyword) {
|
|
418
|
+
if (!parentSchema || typeof parentSchema !== "object") return;
|
|
419
|
+
if (!schemaLocations) {
|
|
420
|
+
schemaLocations = /* @__PURE__ */ new WeakMap();
|
|
421
|
+
for (const entry of schemaEntries) {
|
|
422
|
+
const stack = [
|
|
423
|
+
{ value: entry.schema, pointer: "" }
|
|
424
|
+
];
|
|
425
|
+
while (stack.length) {
|
|
426
|
+
const current = stack.pop();
|
|
427
|
+
if (!current?.value || typeof current.value !== "object")
|
|
428
|
+
continue;
|
|
429
|
+
schemaLocations.set(current.value, {
|
|
430
|
+
schemaName: entry.name,
|
|
431
|
+
pointer: current.pointer,
|
|
432
|
+
uri: `${entry.schema.$id}#${current.pointer}`
|
|
433
|
+
});
|
|
434
|
+
for (const [key, value] of Object.entries(current.value)) {
|
|
435
|
+
const segment = key.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
436
|
+
stack.push({ value, pointer: `${current.pointer}/${segment}` });
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
const parent = schemaLocations.get(parentSchema);
|
|
442
|
+
if (!parent) return;
|
|
443
|
+
const suffix = `/${keyword.replaceAll("~", "~0").replaceAll("/", "~1")}`;
|
|
444
|
+
issueLocations.set(issue, {
|
|
445
|
+
...parent,
|
|
446
|
+
pointer: parent.pointer + suffix,
|
|
447
|
+
uri: parent.uri + suffix
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
function validationDefinition(issue) {
|
|
451
|
+
return issueLocations.get(issue);
|
|
452
|
+
}
|
|
453
|
+
|
|
412
454
|
// src/validator.ts
|
|
413
455
|
var OPFValidationError = class extends Error {
|
|
414
456
|
issues;
|
|
@@ -555,6 +597,7 @@ function getAjv() {
|
|
|
555
597
|
}
|
|
556
598
|
const instance = new Ajv2020({
|
|
557
599
|
allErrors: true,
|
|
600
|
+
verbose: true,
|
|
558
601
|
strict: false,
|
|
559
602
|
allowUnionTypes: true
|
|
560
603
|
});
|
|
@@ -593,13 +636,15 @@ function resolveValidator(schemaOrKind) {
|
|
|
593
636
|
return { validate: validator };
|
|
594
637
|
}
|
|
595
638
|
function toIssue(error) {
|
|
596
|
-
|
|
639
|
+
const issue = {
|
|
597
640
|
path: error.instancePath || "/",
|
|
598
641
|
message: error.message ?? "failed validation",
|
|
599
642
|
keyword: error.keyword,
|
|
600
643
|
schemaPath: error.schemaPath,
|
|
601
644
|
params: error.params
|
|
602
645
|
};
|
|
646
|
+
rememberValidationDefinition(issue, error.parentSchema, error.keyword);
|
|
647
|
+
return issue;
|
|
603
648
|
}
|
|
604
649
|
function semanticIssue(path, message, params = {}) {
|
|
605
650
|
return {
|
|
@@ -1012,4 +1057,4 @@ function assertValidCatalogRecord(kind, value) {
|
|
|
1012
1057
|
assertValid(value, kind);
|
|
1013
1058
|
}
|
|
1014
1059
|
|
|
1015
|
-
export { OPFValidationError, assertValid, assertValidCatalogRecord, assertValidPresentation, validate, validateCatalogRecord, validatePresentation };
|
|
1060
|
+
export { OPFValidationError, assertValid, assertValidCatalogRecord, assertValidPresentation, validate, validateCatalogRecord, validatePresentation, validationDefinition };
|