@manifest-editor/creator-api 1.2.0 → 1.3.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/index.cjs CHANGED
@@ -26,7 +26,11 @@ var __publicField = (obj, key, value) => {
26
26
  var src_exports = {};
27
27
  __export(src_exports, {
28
28
  Creator: () => Creator,
29
- CreatorResource: () => CreatorResource
29
+ CreatorResource: () => CreatorResource,
30
+ getEmptyType: () => getEmptyType,
31
+ matchBasedOnResource: () => matchBasedOnResource,
32
+ randomId: () => randomId,
33
+ resolveType: () => resolveType
30
34
  });
31
35
  module.exports = __toCommonJS(src_exports);
32
36
 
@@ -112,6 +116,64 @@ function getEmptyType(type) {
112
116
  function randomId() {
113
117
  return `${Math.random().toString(36).substr(2)}-${Date.now().toString(36)}`;
114
118
  }
119
+ function matchBasedOnResource(resource, list, options) {
120
+ const supported = [];
121
+ if (list.length === 0) {
122
+ return [];
123
+ }
124
+ const parent = (0, import_parser2.toRef)(resource.parent);
125
+ const property = resource.property;
126
+ const filter = resource.filter;
127
+ for (const def of list) {
128
+ if (filter) {
129
+ if (!def.tags)
130
+ continue;
131
+ if (!def.tags.includes(filter)) {
132
+ continue;
133
+ }
134
+ }
135
+ if (parent && property) {
136
+ if (def.supports.parentTypes) {
137
+ if (!def.supports.parentTypes.includes(parent.type)) {
138
+ continue;
139
+ }
140
+ }
141
+ if (def.supports.parentFields) {
142
+ if (!def.supports.parentFields.includes(property)) {
143
+ continue;
144
+ }
145
+ }
146
+ if (def.supports.parentFieldMap) {
147
+ const type = def.supports.parentFieldMap[parent.type];
148
+ if (!type || !type.includes(property)) {
149
+ continue;
150
+ }
151
+ }
152
+ if (def.supports.disallowPainting && resource.isPainting) {
153
+ continue;
154
+ }
155
+ if (def.supports.custom) {
156
+ const isValid = def.supports.custom(
157
+ { property, resource: parent, atIndex: resource.index },
158
+ options.vault
159
+ );
160
+ if (!isValid) {
161
+ continue;
162
+ }
163
+ }
164
+ if (!def.supports.initialData && Object.keys(resource.initialData || {}).length !== 0) {
165
+ continue;
166
+ }
167
+ if (def.resourceType !== resource.type) {
168
+ if (!(def.additionalTypes || []).includes(resource.type)) {
169
+ continue;
170
+ }
171
+ }
172
+ supported.push(def);
173
+ }
174
+ }
175
+ return supported;
176
+ }
115
177
 
116
178
  // src/CreatorResource.ts
117
179
  var import_parser3 = require("@iiif/parser");
@@ -486,6 +548,13 @@ var Creator = class {
486
548
  this.vault = vault;
487
549
  this.previewVault = previewVault || new import_vault.Vault();
488
550
  }
551
+ matchBasedOnResource(resource) {
552
+ return matchBasedOnResource(
553
+ resource,
554
+ this.configs || [],
555
+ { vault: this.vault }
556
+ );
557
+ }
489
558
  async create(definition, payload, options) {
490
559
  const foundDefinition = this.configs.find((t) => t.id === definition);
491
560
  if (!foundDefinition) {
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _iiif_presentation_3 from '@iiif/presentation-3';
2
2
  import { Reference, SpecificResource } from '@iiif/presentation-3';
3
- import { Vault } from '@iiif/helpers/vault';
3
+ import { Vault, Entities } from '@iiif/helpers/vault';
4
4
  import { ReactNode } from 'react';
5
5
 
6
6
  declare class ReferencedResource {
@@ -19,22 +19,22 @@ declare class ReferencedResource {
19
19
  modified?: string | undefined;
20
20
  creator?: _iiif_presentation_3.Creator | undefined;
21
21
  generator?: _iiif_presentation_3.Creator | undefined;
22
- audience?: _iiif_presentation_3.Audience | _iiif_presentation_3.Audience[] | undefined;
22
+ audience?: (_iiif_presentation_3.Audience | _iiif_presentation_3.Audience[]) | undefined;
23
23
  accessibility?: string | string[] | undefined;
24
- motivation?: _iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[] | undefined;
24
+ motivation?: (_iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[]) | undefined;
25
25
  rights?: string | string[] | undefined;
26
26
  canonical?: string | undefined;
27
27
  via?: string | string[] | undefined;
28
28
  role?: string | undefined;
29
29
  id?: string | undefined;
30
30
  type: "SpecificResource";
31
- state?: _iiif_presentation_3.State | _iiif_presentation_3.State[] | undefined;
32
- purpose?: _iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[] | undefined;
31
+ state?: (_iiif_presentation_3.State | _iiif_presentation_3.State[]) | undefined;
32
+ purpose?: (_iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[]) | undefined;
33
33
  source?: any;
34
- selector?: _iiif_presentation_3.Selector | _iiif_presentation_3.Selector[] | undefined;
34
+ selector?: (_iiif_presentation_3.Selector | _iiif_presentation_3.Selector[]) | undefined;
35
35
  styleClass?: string | undefined;
36
- renderedVia?: _iiif_presentation_3.Agent | _iiif_presentation_3.Agent[] | undefined;
37
- scope?: any;
36
+ renderedVia?: (_iiif_presentation_3.Agent | _iiif_presentation_3.Agent[]) | undefined;
37
+ scope?: _iiif_presentation_3.LinkedResource;
38
38
  };
39
39
  optionalSpecificResource(): {
40
40
  type: string;
@@ -49,21 +49,21 @@ declare class ReferencedResource {
49
49
  modified?: string | undefined;
50
50
  creator?: _iiif_presentation_3.Creator | undefined;
51
51
  generator?: _iiif_presentation_3.Creator | undefined;
52
- audience?: _iiif_presentation_3.Audience | _iiif_presentation_3.Audience[] | undefined;
52
+ audience?: (_iiif_presentation_3.Audience | _iiif_presentation_3.Audience[]) | undefined;
53
53
  accessibility?: string | string[] | undefined;
54
- motivation?: _iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[] | undefined;
54
+ motivation?: (_iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[]) | undefined;
55
55
  rights?: string | string[] | undefined;
56
56
  canonical?: string | undefined;
57
57
  via?: string | string[] | undefined;
58
58
  role?: string | undefined;
59
59
  id?: string | undefined;
60
60
  type: "SpecificResource";
61
- state?: _iiif_presentation_3.State | _iiif_presentation_3.State[] | undefined;
62
- purpose?: _iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[] | undefined;
63
- selector?: _iiif_presentation_3.Selector | _iiif_presentation_3.Selector[] | undefined;
61
+ state?: (_iiif_presentation_3.State | _iiif_presentation_3.State[]) | undefined;
62
+ purpose?: (_iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[]) | undefined;
63
+ selector?: (_iiif_presentation_3.Selector | _iiif_presentation_3.Selector[]) | undefined;
64
64
  styleClass?: string | undefined;
65
- renderedVia?: _iiif_presentation_3.Agent | _iiif_presentation_3.Agent[] | undefined;
66
- scope?: any;
65
+ renderedVia?: (_iiif_presentation_3.Agent | _iiif_presentation_3.Agent[]) | undefined;
66
+ scope?: _iiif_presentation_3.LinkedResource;
67
67
  };
68
68
  get(): any;
69
69
  }
@@ -85,22 +85,22 @@ declare class CreatorResource {
85
85
  modified?: string | undefined;
86
86
  creator?: _iiif_presentation_3.Creator | undefined;
87
87
  generator?: _iiif_presentation_3.Creator | undefined;
88
- audience?: _iiif_presentation_3.Audience | _iiif_presentation_3.Audience[] | undefined;
88
+ audience?: (_iiif_presentation_3.Audience | _iiif_presentation_3.Audience[]) | undefined;
89
89
  accessibility?: string | string[] | undefined;
90
- motivation?: _iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[] | undefined;
90
+ motivation?: (_iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[]) | undefined;
91
91
  rights?: string | string[] | undefined;
92
92
  canonical?: string | undefined;
93
93
  via?: string | string[] | undefined;
94
94
  role?: string | undefined;
95
95
  id?: string | undefined;
96
96
  type: "SpecificResource";
97
- state?: _iiif_presentation_3.State | _iiif_presentation_3.State[] | undefined;
98
- purpose?: _iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[] | undefined;
97
+ state?: (_iiif_presentation_3.State | _iiif_presentation_3.State[]) | undefined;
98
+ purpose?: (_iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[]) | undefined;
99
99
  source?: any;
100
- selector?: _iiif_presentation_3.Selector | _iiif_presentation_3.Selector[] | undefined;
100
+ selector?: (_iiif_presentation_3.Selector | _iiif_presentation_3.Selector[]) | undefined;
101
101
  styleClass?: string | undefined;
102
- renderedVia?: _iiif_presentation_3.Agent | _iiif_presentation_3.Agent[] | undefined;
103
- scope?: any;
102
+ renderedVia?: (_iiif_presentation_3.Agent | _iiif_presentation_3.Agent[]) | undefined;
103
+ scope?: _iiif_presentation_3.LinkedResource;
104
104
  } | {
105
105
  id: any;
106
106
  type: any;
@@ -161,6 +161,7 @@ interface CreatorDefinition {
161
161
  summary?: string;
162
162
  icon?: any;
163
163
  dependencies?: string[];
164
+ tags?: string[];
164
165
  create: (payload: any, ctx: CreatorInstance) => any | Promise<any>;
165
166
  validate?: (payload: any, vault: Vault) => void | Promise<void>;
166
167
  render?: (ctx: CreatorContext) => ReactNode;
@@ -172,6 +173,7 @@ interface CreatorDefinition {
172
173
  embeddedResources?: string[];
173
174
  staticFields?: Record<string, any>;
174
175
  allowModal?: boolean;
176
+ hiddenModal?: boolean;
175
177
  supports: {
176
178
  initialData?: boolean;
177
179
  parentTypes?: string[];
@@ -192,13 +194,33 @@ interface CreatorSideEffect {
192
194
  replaceSiblings?: boolean;
193
195
  canvasInteraction?: boolean;
194
196
  }
197
+ interface CreatableResource {
198
+ type: string;
199
+ parent?: Reference;
200
+ property?: string;
201
+ index?: number;
202
+ onlyReference?: boolean;
203
+ target?: Reference;
204
+ initialData?: any;
205
+ isPainting?: boolean;
206
+ filter?: string;
207
+ initialCreator?: string;
208
+ }
195
209
 
196
210
  declare class Creator {
197
211
  configs: CreatorDefinition[];
198
212
  vault: Vault;
199
213
  previewVault: Vault;
200
214
  constructor(vault: Vault, configs: CreatorDefinition[], previewVault?: Vault);
215
+ matchBasedOnResource(resource: CreatableResource): CreatorDefinition[];
201
216
  create(definition: string, payload: any, options?: Partial<CreatorOptions>): Promise<Reference>;
202
217
  }
203
218
 
204
- export { Creator, type CreatorContext, type CreatorDefinition, type CreatorFunctionContext, type CreatorOptions, CreatorResource, type CreatorSideEffect };
219
+ declare function resolveType(type: string): keyof Entities;
220
+ declare function getEmptyType(type: string): any;
221
+ declare function randomId(): string;
222
+ declare function matchBasedOnResource(resource: CreatableResource, list: CreatorDefinition[], options: {
223
+ vault: Vault;
224
+ }): CreatorDefinition[];
225
+
226
+ export { type CreatableResource, Creator, type CreatorContext, type CreatorDefinition, type CreatorFunctionContext, type CreatorOptions, CreatorResource, type CreatorSideEffect, getEmptyType, matchBasedOnResource, randomId, resolveType };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _iiif_presentation_3 from '@iiif/presentation-3';
2
2
  import { Reference, SpecificResource } from '@iiif/presentation-3';
3
- import { Vault } from '@iiif/helpers/vault';
3
+ import { Vault, Entities } from '@iiif/helpers/vault';
4
4
  import { ReactNode } from 'react';
5
5
 
6
6
  declare class ReferencedResource {
@@ -19,22 +19,22 @@ declare class ReferencedResource {
19
19
  modified?: string | undefined;
20
20
  creator?: _iiif_presentation_3.Creator | undefined;
21
21
  generator?: _iiif_presentation_3.Creator | undefined;
22
- audience?: _iiif_presentation_3.Audience | _iiif_presentation_3.Audience[] | undefined;
22
+ audience?: (_iiif_presentation_3.Audience | _iiif_presentation_3.Audience[]) | undefined;
23
23
  accessibility?: string | string[] | undefined;
24
- motivation?: _iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[] | undefined;
24
+ motivation?: (_iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[]) | undefined;
25
25
  rights?: string | string[] | undefined;
26
26
  canonical?: string | undefined;
27
27
  via?: string | string[] | undefined;
28
28
  role?: string | undefined;
29
29
  id?: string | undefined;
30
30
  type: "SpecificResource";
31
- state?: _iiif_presentation_3.State | _iiif_presentation_3.State[] | undefined;
32
- purpose?: _iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[] | undefined;
31
+ state?: (_iiif_presentation_3.State | _iiif_presentation_3.State[]) | undefined;
32
+ purpose?: (_iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[]) | undefined;
33
33
  source?: any;
34
- selector?: _iiif_presentation_3.Selector | _iiif_presentation_3.Selector[] | undefined;
34
+ selector?: (_iiif_presentation_3.Selector | _iiif_presentation_3.Selector[]) | undefined;
35
35
  styleClass?: string | undefined;
36
- renderedVia?: _iiif_presentation_3.Agent | _iiif_presentation_3.Agent[] | undefined;
37
- scope?: any;
36
+ renderedVia?: (_iiif_presentation_3.Agent | _iiif_presentation_3.Agent[]) | undefined;
37
+ scope?: _iiif_presentation_3.LinkedResource;
38
38
  };
39
39
  optionalSpecificResource(): {
40
40
  type: string;
@@ -49,21 +49,21 @@ declare class ReferencedResource {
49
49
  modified?: string | undefined;
50
50
  creator?: _iiif_presentation_3.Creator | undefined;
51
51
  generator?: _iiif_presentation_3.Creator | undefined;
52
- audience?: _iiif_presentation_3.Audience | _iiif_presentation_3.Audience[] | undefined;
52
+ audience?: (_iiif_presentation_3.Audience | _iiif_presentation_3.Audience[]) | undefined;
53
53
  accessibility?: string | string[] | undefined;
54
- motivation?: _iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[] | undefined;
54
+ motivation?: (_iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[]) | undefined;
55
55
  rights?: string | string[] | undefined;
56
56
  canonical?: string | undefined;
57
57
  via?: string | string[] | undefined;
58
58
  role?: string | undefined;
59
59
  id?: string | undefined;
60
60
  type: "SpecificResource";
61
- state?: _iiif_presentation_3.State | _iiif_presentation_3.State[] | undefined;
62
- purpose?: _iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[] | undefined;
63
- selector?: _iiif_presentation_3.Selector | _iiif_presentation_3.Selector[] | undefined;
61
+ state?: (_iiif_presentation_3.State | _iiif_presentation_3.State[]) | undefined;
62
+ purpose?: (_iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[]) | undefined;
63
+ selector?: (_iiif_presentation_3.Selector | _iiif_presentation_3.Selector[]) | undefined;
64
64
  styleClass?: string | undefined;
65
- renderedVia?: _iiif_presentation_3.Agent | _iiif_presentation_3.Agent[] | undefined;
66
- scope?: any;
65
+ renderedVia?: (_iiif_presentation_3.Agent | _iiif_presentation_3.Agent[]) | undefined;
66
+ scope?: _iiif_presentation_3.LinkedResource;
67
67
  };
68
68
  get(): any;
69
69
  }
@@ -85,22 +85,22 @@ declare class CreatorResource {
85
85
  modified?: string | undefined;
86
86
  creator?: _iiif_presentation_3.Creator | undefined;
87
87
  generator?: _iiif_presentation_3.Creator | undefined;
88
- audience?: _iiif_presentation_3.Audience | _iiif_presentation_3.Audience[] | undefined;
88
+ audience?: (_iiif_presentation_3.Audience | _iiif_presentation_3.Audience[]) | undefined;
89
89
  accessibility?: string | string[] | undefined;
90
- motivation?: _iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[] | undefined;
90
+ motivation?: (_iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[]) | undefined;
91
91
  rights?: string | string[] | undefined;
92
92
  canonical?: string | undefined;
93
93
  via?: string | string[] | undefined;
94
94
  role?: string | undefined;
95
95
  id?: string | undefined;
96
96
  type: "SpecificResource";
97
- state?: _iiif_presentation_3.State | _iiif_presentation_3.State[] | undefined;
98
- purpose?: _iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[] | undefined;
97
+ state?: (_iiif_presentation_3.State | _iiif_presentation_3.State[]) | undefined;
98
+ purpose?: (_iiif_presentation_3.AnyMotivation | _iiif_presentation_3.AnyMotivation[]) | undefined;
99
99
  source?: any;
100
- selector?: _iiif_presentation_3.Selector | _iiif_presentation_3.Selector[] | undefined;
100
+ selector?: (_iiif_presentation_3.Selector | _iiif_presentation_3.Selector[]) | undefined;
101
101
  styleClass?: string | undefined;
102
- renderedVia?: _iiif_presentation_3.Agent | _iiif_presentation_3.Agent[] | undefined;
103
- scope?: any;
102
+ renderedVia?: (_iiif_presentation_3.Agent | _iiif_presentation_3.Agent[]) | undefined;
103
+ scope?: _iiif_presentation_3.LinkedResource;
104
104
  } | {
105
105
  id: any;
106
106
  type: any;
@@ -161,6 +161,7 @@ interface CreatorDefinition {
161
161
  summary?: string;
162
162
  icon?: any;
163
163
  dependencies?: string[];
164
+ tags?: string[];
164
165
  create: (payload: any, ctx: CreatorInstance) => any | Promise<any>;
165
166
  validate?: (payload: any, vault: Vault) => void | Promise<void>;
166
167
  render?: (ctx: CreatorContext) => ReactNode;
@@ -172,6 +173,7 @@ interface CreatorDefinition {
172
173
  embeddedResources?: string[];
173
174
  staticFields?: Record<string, any>;
174
175
  allowModal?: boolean;
176
+ hiddenModal?: boolean;
175
177
  supports: {
176
178
  initialData?: boolean;
177
179
  parentTypes?: string[];
@@ -192,13 +194,33 @@ interface CreatorSideEffect {
192
194
  replaceSiblings?: boolean;
193
195
  canvasInteraction?: boolean;
194
196
  }
197
+ interface CreatableResource {
198
+ type: string;
199
+ parent?: Reference;
200
+ property?: string;
201
+ index?: number;
202
+ onlyReference?: boolean;
203
+ target?: Reference;
204
+ initialData?: any;
205
+ isPainting?: boolean;
206
+ filter?: string;
207
+ initialCreator?: string;
208
+ }
195
209
 
196
210
  declare class Creator {
197
211
  configs: CreatorDefinition[];
198
212
  vault: Vault;
199
213
  previewVault: Vault;
200
214
  constructor(vault: Vault, configs: CreatorDefinition[], previewVault?: Vault);
215
+ matchBasedOnResource(resource: CreatableResource): CreatorDefinition[];
201
216
  create(definition: string, payload: any, options?: Partial<CreatorOptions>): Promise<Reference>;
202
217
  }
203
218
 
204
- export { Creator, type CreatorContext, type CreatorDefinition, type CreatorFunctionContext, type CreatorOptions, CreatorResource, type CreatorSideEffect };
219
+ declare function resolveType(type: string): keyof Entities;
220
+ declare function getEmptyType(type: string): any;
221
+ declare function randomId(): string;
222
+ declare function matchBasedOnResource(resource: CreatableResource, list: CreatorDefinition[], options: {
223
+ vault: Vault;
224
+ }): CreatorDefinition[];
225
+
226
+ export { type CreatableResource, Creator, type CreatorContext, type CreatorDefinition, type CreatorFunctionContext, type CreatorOptions, CreatorResource, type CreatorSideEffect, getEmptyType, matchBasedOnResource, randomId, resolveType };
package/dist/index.js CHANGED
@@ -57,7 +57,8 @@ import {
57
57
  emptyCollection,
58
58
  emptyManifest,
59
59
  emptyRange,
60
- emptyService
60
+ emptyService,
61
+ toRef
61
62
  } from "@iiif/parser";
62
63
  function resolveType(type) {
63
64
  switch (type) {
@@ -96,6 +97,64 @@ function getEmptyType(type) {
96
97
  function randomId() {
97
98
  return `${Math.random().toString(36).substr(2)}-${Date.now().toString(36)}`;
98
99
  }
100
+ function matchBasedOnResource(resource, list, options) {
101
+ const supported = [];
102
+ if (list.length === 0) {
103
+ return [];
104
+ }
105
+ const parent = toRef(resource.parent);
106
+ const property = resource.property;
107
+ const filter = resource.filter;
108
+ for (const def of list) {
109
+ if (filter) {
110
+ if (!def.tags)
111
+ continue;
112
+ if (!def.tags.includes(filter)) {
113
+ continue;
114
+ }
115
+ }
116
+ if (parent && property) {
117
+ if (def.supports.parentTypes) {
118
+ if (!def.supports.parentTypes.includes(parent.type)) {
119
+ continue;
120
+ }
121
+ }
122
+ if (def.supports.parentFields) {
123
+ if (!def.supports.parentFields.includes(property)) {
124
+ continue;
125
+ }
126
+ }
127
+ if (def.supports.parentFieldMap) {
128
+ const type = def.supports.parentFieldMap[parent.type];
129
+ if (!type || !type.includes(property)) {
130
+ continue;
131
+ }
132
+ }
133
+ if (def.supports.disallowPainting && resource.isPainting) {
134
+ continue;
135
+ }
136
+ if (def.supports.custom) {
137
+ const isValid = def.supports.custom(
138
+ { property, resource: parent, atIndex: resource.index },
139
+ options.vault
140
+ );
141
+ if (!isValid) {
142
+ continue;
143
+ }
144
+ }
145
+ if (!def.supports.initialData && Object.keys(resource.initialData || {}).length !== 0) {
146
+ continue;
147
+ }
148
+ if (def.resourceType !== resource.type) {
149
+ if (!(def.additionalTypes || []).includes(resource.type)) {
150
+ continue;
151
+ }
152
+ }
153
+ supported.push(def);
154
+ }
155
+ }
156
+ return supported;
157
+ }
99
158
 
100
159
  // src/CreatorResource.ts
101
160
  import { HAS_PART, PART_OF } from "@iiif/parser";
@@ -470,6 +529,13 @@ var Creator = class {
470
529
  this.vault = vault;
471
530
  this.previewVault = previewVault || new Vault();
472
531
  }
532
+ matchBasedOnResource(resource) {
533
+ return matchBasedOnResource(
534
+ resource,
535
+ this.configs || [],
536
+ { vault: this.vault }
537
+ );
538
+ }
473
539
  async create(definition, payload, options) {
474
540
  const foundDefinition = this.configs.find((t) => t.id === definition);
475
541
  if (!foundDefinition) {
@@ -541,5 +607,9 @@ var Creator = class {
541
607
  };
542
608
  export {
543
609
  Creator,
544
- CreatorResource
610
+ CreatorResource,
611
+ getEmptyType,
612
+ matchBasedOnResource,
613
+ randomId,
614
+ resolveType
545
615
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manifest-editor/creator-api",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "bugs": "https://github.com/digirati-co-uk/iiif-manifest-editor/issues",
6
6
  "repository": {
@@ -42,16 +42,16 @@
42
42
  "prepack": "tsup src/index.ts"
43
43
  },
44
44
  "dependencies": {
45
- "@iiif/helpers": "^1.2.12",
46
- "@iiif/parser": "^2.1.2",
45
+ "@iiif/helpers": "^1.3.1",
46
+ "@iiif/parser": "^2.1.7",
47
47
  "@iiif/presentation-3": "^2.2.3",
48
48
  "@iiif/presentation-3-normalized": "^0.9.7",
49
- "@manifest-editor/editor-api": "1.1.0",
50
- "polygon-editor": "^0.0.4",
49
+ "@manifest-editor/editor-api": "1.3.0",
50
+ "polygon-editor": "^0.0.6",
51
51
  "react-iiif-vault": "^1.2.1"
52
52
  },
53
53
  "devDependencies": {
54
- "@repo/eslint-config": "0.0.0",
54
+ "@repo/eslint-config": "workspace:*",
55
55
  "@types/react": "^18.3.3",
56
56
  "tiny-invariant": "^1.3.3",
57
57
  "tsup": "^8.0.2"
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "d1de1d181a41f39cd2f01839348fa2da187331cb"
62
+ "gitHead": "deba5190f58c11b91383eacd79715607ba5b8d24"
63
63
  }