@seedprotocol/mapping 0.5.3 → 0.6.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +213 -36
  3. package/dist/adapters/rss.d.ts +2 -1
  4. package/dist/adapters/rss.d.ts.map +1 -1
  5. package/dist/applyMapping.d.ts +21 -2
  6. package/dist/applyMapping.d.ts.map +1 -1
  7. package/dist/autoMap-OMvtOG0S.js +549 -0
  8. package/dist/autoMap-OMvtOG0S.js.map +1 -0
  9. package/dist/autoMap-PTFd4l-9.js +534 -0
  10. package/dist/autoMap-PTFd4l-9.js.map +1 -0
  11. package/dist/autoMap.d.ts +3 -3
  12. package/dist/autoMap.d.ts.map +1 -1
  13. package/dist/classifyUrl.d.ts +14 -0
  14. package/dist/classifyUrl.d.ts.map +1 -0
  15. package/dist/index.d.ts +7 -3
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +91 -402
  18. package/dist/index.js.map +1 -1
  19. package/dist/react/FieldMapper.d.ts +77 -5
  20. package/dist/react/FieldMapper.d.ts.map +1 -1
  21. package/dist/react/FieldMapperWires.d.ts +20 -0
  22. package/dist/react/FieldMapperWires.d.ts.map +1 -0
  23. package/dist/react/LookupEditor.d.ts +20 -0
  24. package/dist/react/LookupEditor.d.ts.map +1 -0
  25. package/dist/react/PropertyRows.d.ts +20 -0
  26. package/dist/react/PropertyRows.d.ts.map +1 -0
  27. package/dist/react/SourceRows.d.ts +19 -0
  28. package/dist/react/SourceRows.d.ts.map +1 -0
  29. package/dist/react/fieldMapperControls.d.ts +9 -0
  30. package/dist/react/fieldMapperControls.d.ts.map +1 -0
  31. package/dist/react/fieldMapperCore.d.ts +83 -0
  32. package/dist/react/fieldMapperCore.d.ts.map +1 -0
  33. package/dist/react/fieldMapperSlots.d.ts +69 -0
  34. package/dist/react/fieldMapperSlots.d.ts.map +1 -0
  35. package/dist/react/fieldMapperTheme.d.ts +34 -0
  36. package/dist/react/fieldMapperTheme.d.ts.map +1 -0
  37. package/dist/react/fieldMapperTypes.d.ts +77 -0
  38. package/dist/react/fieldMapperTypes.d.ts.map +1 -0
  39. package/dist/react/useFieldMapper.d.ts +8 -0
  40. package/dist/react/useFieldMapper.d.ts.map +1 -0
  41. package/dist/react.d.ts +10 -0
  42. package/dist/react.d.ts.map +1 -0
  43. package/dist/react.js +1690 -0
  44. package/dist/react.js.map +1 -0
  45. package/dist/relationLookup.d.ts +34 -0
  46. package/dist/relationLookup.d.ts.map +1 -0
  47. package/dist/resolvedSources.d.ts +32 -0
  48. package/dist/resolvedSources.d.ts.map +1 -0
  49. package/dist/types.d.ts +74 -2
  50. package/dist/types.d.ts.map +1 -1
  51. package/package.json +19 -1
package/dist/index.d.ts CHANGED
@@ -1,7 +1,11 @@
1
- export type { SourceKind, SourceNode, TargetProperty, FieldMapping, MappingDocument, PropertyBag, } from './types';
2
- export { applyMapping, coerceValue } from './applyMapping';
1
+ export type { SourceKind, SourceNode, TargetProperty, FieldMapping, LookupEntry, MappingDocument, MappingLookups, PropertyBag, ResolveJob, UrlMediaClass, ResolveContext, ResolveCallback, ApplyMappingError, ApplyMappingAsyncResult, } from './types';
2
+ export { applyMapping, applyMappingAsync, coerceValue } from './applyMapping';
3
+ export type { ApplyMappingAsyncOptions } from './applyMapping';
4
+ export { isRelationLookupTarget, normalizeLookupKey, sampleValueFromSource, lookupEntriesFromMapping, lookupRefFromEntries, resolveLookupMapped, shapeLookupValue, withLookupEntries, } from './relationLookup';
3
5
  export { autoMap } from './autoMap';
6
+ export { classifyUrl, looksLikeUrl } from './classifyUrl';
7
+ export type { ClassifyUrlInput } from './classifyUrl';
8
+ export { buildResolvedSourceNodes, normalizeMappingFromSourceId, parseResolvedSourceId, resolvedSourceId, resolveMappingSource, RESOLVE_EXTRACT_SUFFIX, RESOLVE_FILE_SUFFIX, } from './resolvedSources';
4
9
  export { markdownToSources, parseMarkdownWithFrontmatter, parseMarkdownSections, SECTION_FULL_ID, } from './adapters/markdown';
5
10
  export { rssItemToSources, rssXmlToSources, type RssXmlSourcesResult, } from './adapters/rss';
6
- export { FieldMapper, type FieldMapperProps } from './react/FieldMapper';
7
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,eAAe,EACf,WAAW,GACZ,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,qBAAqB,EACrB,eAAe,GAChB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,cAAc,EACd,WAAW,EACX,UAAU,EACV,aAAa,EACb,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC7E,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,qBAAqB,EACrB,eAAe,GAChB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -1,134 +1,8 @@
1
- import e from "rss-parser";
2
- import { useCallback as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
3
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
- //#region src/applyMapping.ts
5
- function c(e, t) {
6
- if (t === "Number") return parseFloat(String(e)) || 0;
7
- if (t === "Boolean") return e === "true" || e === "1" || String(e).toLowerCase() === "yes";
8
- if (t === "Json") try {
9
- return JSON.parse(e);
10
- } catch {
11
- return e;
12
- }
13
- if (t === "Date") {
14
- let t = new Date(String(e));
15
- return Number.isNaN(t.getTime()) ? e : t.getTime();
16
- }
17
- return String(e ?? "");
18
- }
19
- function l(e, t, n) {
20
- let r = new Map(e.map((e) => [e.id, e])), i = new Map(n.map((e) => [e.name, e])), a = {};
21
- for (let e of t) {
22
- let t = r.get(e.sourceId), n = i.get(e.propertyName);
23
- if (!t || !n) continue;
24
- let o = t.value || t.label;
25
- a[e.propertyName] = c(o, n.dataType);
26
- }
27
- return a;
28
- }
29
- //#endregion
30
- //#region src/autoMap.ts
31
- var u = [
32
- "text",
33
- "content",
34
- "body",
35
- "fulltext",
36
- "markdown"
37
- ];
38
- function d(e) {
39
- return e.toLowerCase().replace(/\s+/g, "").replace(/[:_-]/g, "");
40
- }
41
- function f(e, t) {
42
- let n = d(e), r = d(t);
43
- return n === r || n.includes(r) || r.includes(n);
44
- }
45
- function p(e, t) {
46
- let n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = e.find((e) => e.kind === "full");
47
- if (a) {
48
- let e = t.find((e) => u.includes(e.name.toLowerCase()));
49
- e && (n.push({
50
- sourceId: a.id,
51
- propertyName: e.name
52
- }), r.add(e.name), i.add(a.id));
53
- }
54
- let o = {
55
- title: [
56
- "title",
57
- "name",
58
- "headline"
59
- ],
60
- "content:encoded": [
61
- "html",
62
- "content",
63
- "body",
64
- "text"
65
- ],
66
- content: [
67
- "html",
68
- "content",
69
- "body",
70
- "text"
71
- ],
72
- description: [
73
- "summary",
74
- "description",
75
- "excerpt"
76
- ],
77
- summary: [
78
- "summary",
79
- "description",
80
- "excerpt"
81
- ],
82
- featureimage: [
83
- "featureimage",
84
- "feature_image",
85
- "image",
86
- "cover"
87
- ],
88
- feature_image: [
89
- "featureimage",
90
- "feature_image",
91
- "image",
92
- "cover"
93
- ],
94
- link: [
95
- "url",
96
- "link",
97
- "permalink",
98
- "slug"
99
- ],
100
- creator: [
101
- "author",
102
- "authors",
103
- "creator",
104
- "byline"
105
- ],
106
- author: [
107
- "author",
108
- "authors",
109
- "creator",
110
- "byline"
111
- ]
112
- };
113
- for (let a of e) {
114
- if (i.has(a.id)) continue;
115
- let e = d(a.label), s = a.id.replace(/^rss-/, "").replace(/^fm-/, ""), c = [
116
- ...o[a.label] ?? [],
117
- ...o[s] ?? [],
118
- ...o[e] ?? []
119
- ], l;
120
- for (let e of c) if (l = t.find((t) => !r.has(t.name) && f(t.name, e)), l) break;
121
- l ||= t.find((e) => !r.has(e.name) && (f(e.name, a.label) || f(e.name, s))), l && (n.push({
122
- sourceId: a.id,
123
- propertyName: l.name
124
- }), r.add(l.name), i.add(a.id));
125
- }
126
- return n;
127
- }
128
- //#endregion
1
+ import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, y as b } from "./autoMap-OMvtOG0S.js";
2
+ import x from "rss-parser";
129
3
  //#region src/adapters/markdown.ts
130
- var m = "section-full";
131
- function h(e) {
4
+ var S = "section-full";
5
+ function C(e) {
132
6
  try {
133
7
  let t = e.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
134
8
  if (!t) return {
@@ -171,7 +45,7 @@ function h(e) {
171
45
  };
172
46
  }
173
47
  }
174
- function g(e) {
48
+ function w(e) {
175
49
  let t = e.split("\n"), n = [], r = null;
176
50
  for (let e of t) {
177
51
  let t = e.match(/^## (.+)/), i = e.match(/^# (.+)/);
@@ -189,8 +63,8 @@ function g(e) {
189
63
  }
190
64
  return r && n.push(r), n;
191
65
  }
192
- function _(e) {
193
- let t = h(e), n = g(t.body), r = [];
66
+ function T(e) {
67
+ let t = C(e), n = w(t.body), r = [];
194
68
  for (let e of t.frontmatter) r.push({
195
69
  id: e.id,
196
70
  label: e.key,
@@ -199,7 +73,7 @@ function _(e) {
199
73
  meta: { valueType: e.valueType }
200
74
  });
201
75
  r.push({
202
- id: m,
76
+ id: S,
203
77
  label: "Full document",
204
78
  kind: "full",
205
79
  value: t.body
@@ -218,30 +92,32 @@ function _(e) {
218
92
  }
219
93
  //#endregion
220
94
  //#region src/adapters/rss.ts
221
- function v(e) {
95
+ function E(e) {
222
96
  try {
223
97
  return JSON.parse(JSON.stringify(e));
224
98
  } catch {
225
99
  return { ...e };
226
100
  }
227
101
  }
228
- var y = new e({ customFields: { item: [
102
+ var D = new x({ customFields: { item: [
229
103
  "featureImage",
230
104
  "feature_image",
231
105
  "content:encoded",
232
106
  "seedUid",
233
- "SeedUid"
107
+ "SeedUid",
108
+ ["media:content", "mediaContent"],
109
+ ["media:thumbnail", "mediaThumbnail"]
234
110
  ] } });
235
- async function b(e) {
236
- let t = await y.parseString(e);
111
+ async function O(e) {
112
+ let t = await D.parseString(e);
237
113
  return {
238
114
  title: t.title,
239
115
  link: t.link,
240
116
  description: t.description,
241
- items: (t.items ?? []).map(v)
117
+ items: (t.items ?? []).map(E)
242
118
  };
243
119
  }
244
- function x(e) {
120
+ function k(e) {
245
121
  if (e == null) return null;
246
122
  if (typeof e == "string") {
247
123
  let t = e.trim();
@@ -265,280 +141,93 @@ function x(e) {
265
141
  }
266
142
  return null;
267
143
  }
268
- function S(e) {
269
- let t = [], n = /* @__PURE__ */ new Set();
270
- for (let [r, i] of Object.entries(e)) {
271
- if (r === "items" || r.startsWith("$")) continue;
272
- let e = x(i);
273
- e != null && (n.has(r) || (n.add(r), t.push({
274
- id: `rss-${r}`,
275
- label: r,
144
+ function A(e) {
145
+ if (e == null) return null;
146
+ if (typeof e == "string") {
147
+ let t = e.trim();
148
+ return t ? { url: t } : null;
149
+ }
150
+ if (typeof e != "object") return null;
151
+ let t = e, n = t.$ && typeof t.$ == "object" ? t.$ : void 0, r = typeof t.url == "string" && t.url || typeof n?.url == "string" && n.url || typeof t.link == "string" && t.link || null;
152
+ if (!r || !String(r).trim()) return null;
153
+ let i = typeof t.type == "string" && t.type || typeof n?.type == "string" && n.type || typeof t.medium == "string" && t.medium || void 0, a = typeof t.length == "string" && t.length || typeof t.length == "number" && String(t.length) || typeof n?.length == "string" && n.length || typeof n?.length == "number" && String(n.length) || void 0;
154
+ return {
155
+ url: String(r).trim(),
156
+ contentType: i ? String(i).trim() : void 0,
157
+ length: a ? String(a).trim() : void 0
158
+ };
159
+ }
160
+ function j(e) {
161
+ if (e == null) return [];
162
+ if (Array.isArray(e)) return e.map(A).filter((e) => e != null);
163
+ let t = A(e);
164
+ return t ? [t] : [];
165
+ }
166
+ var M = /* @__PURE__ */ new Set([
167
+ "enclosure",
168
+ "enclosures",
169
+ "media:content",
170
+ "mediaContent",
171
+ "media:thumbnail",
172
+ "mediaThumbnail"
173
+ ]);
174
+ function N(e, t, n, r, i) {
175
+ if (t.has(n)) return;
176
+ t.add(n);
177
+ let a = o({
178
+ url: i.url,
179
+ contentType: i.contentType
180
+ });
181
+ e.push({
182
+ id: n,
183
+ label: r,
184
+ kind: "rssField",
185
+ value: i.url,
186
+ meta: {
187
+ url: i.url,
188
+ contentType: i.contentType,
189
+ length: i.length,
190
+ class: a
191
+ }
192
+ });
193
+ }
194
+ function P(e) {
195
+ let t = [], n = /* @__PURE__ */ new Set(), r = 0;
196
+ for (let [i, a] of Object.entries(e)) {
197
+ if (i === "items" || i.startsWith("$")) continue;
198
+ if (M.has(i)) {
199
+ let e = j(a);
200
+ for (let a of e) N(t, n, i === "enclosure" || i === "enclosures" ? `rss-enclosure-${r}` : `rss-${i}-${r}`, i === "enclosure" || i === "enclosures" ? `enclosure[${r}]` : `${i}[${r}]`, a), r += 1;
201
+ continue;
202
+ }
203
+ let e = k(a);
204
+ if (e == null || n.has(i)) continue;
205
+ n.add(i);
206
+ let s = {
207
+ id: `rss-${i}`,
208
+ label: i,
276
209
  kind: "rssField",
277
210
  value: e
278
- })));
211
+ };
212
+ (i === "featureImage" || i === "feature_image") && /^https?:\/\//i.test(e) && (s.meta = {
213
+ url: e,
214
+ class: o({ url: e })
215
+ }), t.push(s);
279
216
  }
280
217
  return t;
281
218
  }
282
- async function C(e) {
283
- let t = await b(e);
219
+ async function F(e) {
220
+ let t = await O(e);
284
221
  return {
285
222
  channel: {
286
223
  title: t.title,
287
224
  link: t.link,
288
225
  description: t.description
289
226
  },
290
- items: t.items.map((e) => S(e))
291
- };
292
- }
293
- //#endregion
294
- //#region src/react/FieldMapper.tsx
295
- var w = [
296
- "#3b82f6",
297
- "#8b5cf6",
298
- "#ec4899",
299
- "#f59e0b",
300
- "#10b981",
301
- "#06b6d4",
302
- "#f97316",
303
- "#14b8a6"
304
- ], T = {
305
- String: {
306
- bg: "rgba(59,130,246,0.12)",
307
- border: "#3b82f6",
308
- text: "#93c5fd"
309
- },
310
- Text: {
311
- bg: "rgba(59,130,246,0.12)",
312
- border: "#3b82f6",
313
- text: "#93c5fd"
314
- },
315
- Number: {
316
- bg: "rgba(16,185,129,0.12)",
317
- border: "#10b981",
318
- text: "#6ee7b7"
319
- },
320
- Boolean: {
321
- bg: "rgba(167,139,250,0.12)",
322
- border: "#a78bfa",
323
- text: "#c4b5fd"
324
- },
325
- Json: {
326
- bg: "rgba(251,191,36,0.12)",
327
- border: "#fbbf24",
328
- text: "#fcd34d"
329
- },
330
- Date: {
331
- bg: "rgba(244,114,182,0.12)",
332
- border: "#f472b6",
333
- text: "#f9a8d4"
334
- },
335
- Relation: {
336
- bg: "rgba(34,211,238,0.12)",
337
- border: "#22d3ee",
338
- text: "#67e8f9"
339
- }
340
- };
341
- function E(e) {
342
- return T[e] ?? {
343
- bg: "rgba(148,163,184,0.12)",
344
- border: "#94a3b8",
345
- text: "#cbd5e1"
227
+ items: t.items.map((e) => P(e))
346
228
  };
347
229
  }
348
- function D(e, t) {
349
- let n = e.replace(/\s+/g, " ").trim();
350
- return n.length <= t ? n : `${n.slice(0, t)}…`;
351
- }
352
- function O({ sources: e, targets: c, mappings: u, onChange: d, onAutoMap: f, className: m, showPreview: h = !0 }) {
353
- let [g, _] = a(null), [v, y] = a(null), [b, x] = a(null), [S, C] = a(!1), [T, O] = a({
354
- width: 0,
355
- height: 0
356
- }), [k, A] = a([]), j = i(null), M = i({}), N = i({}), P = t((e) => w[e % w.length], []), F = t(() => {
357
- if (!j.current) return [];
358
- let e = j.current.getBoundingClientRect();
359
- return u.map((t, n) => {
360
- let r = M.current[t.sourceId], i = N.current[t.propertyName];
361
- if (!r || !i) return null;
362
- let a = r.getBoundingClientRect(), o = i.getBoundingClientRect();
363
- return {
364
- x1: a.right - e.left,
365
- y1: a.top + a.height / 2 - e.top,
366
- x2: o.left - e.left,
367
- y2: o.top + o.height / 2 - e.top,
368
- color: P(n),
369
- mapping: t
370
- };
371
- }).filter((e) => e !== null);
372
- }, [u, P]);
373
- n(() => {
374
- let e = () => {
375
- if (j.current) {
376
- let e = j.current.getBoundingClientRect();
377
- O({
378
- width: e.width,
379
- height: e.height
380
- });
381
- }
382
- A(F());
383
- };
384
- e(), window.addEventListener("resize", e);
385
- let t = setInterval(e, 200);
386
- return () => {
387
- window.removeEventListener("resize", e), clearInterval(t);
388
- };
389
- }, [
390
- F,
391
- u,
392
- e,
393
- c
394
- ]);
395
- let I = (e) => {
396
- _((t) => t === e ? null : e);
397
- }, L = (e) => {
398
- if (!g) return;
399
- let t = [...u];
400
- t = t.filter((t) => t.sourceId !== g && t.propertyName !== e), t.push({
401
- sourceId: g,
402
- propertyName: e
403
- }), d(t), _(null);
404
- }, R = (e) => {
405
- d(u.filter((t) => t.sourceId !== e));
406
- }, z = (e) => u.find((t) => t.sourceId === e), B = (e) => u.find((t) => t.propertyName === e), V = v ? u.find((e) => e.propertyName === v) : b ? u.find((e) => e.sourceId === b) : null, H = r(() => l(e, u, c), [
407
- e,
408
- u,
409
- c
410
- ]);
411
- return /* @__PURE__ */ s("div", {
412
- className: `seed-field-mapper ${m ?? ""}`.trim(),
413
- children: [
414
- /* @__PURE__ */ o("style", { children: "\n .seed-field-mapper {\n font-family: 'DM Sans', system-ui, sans-serif;\n color: #e2e8f0;\n background: #0f172a;\n border-radius: 12px;\n padding: 16px;\n }\n .seed-field-mapper * { box-sizing: border-box; }\n .seed-field-mapper .fm-toolbar {\n display: flex;\n gap: 8px;\n align-items: center;\n margin-bottom: 12px;\n flex-wrap: wrap;\n }\n .seed-field-mapper .fm-btn {\n background: #1e293b;\n border: 1px solid #334155;\n color: #e2e8f0;\n border-radius: 8px;\n padding: 6px 12px;\n cursor: pointer;\n font-size: 13px;\n }\n .seed-field-mapper .fm-btn:hover { border-color: #64748b; }\n .seed-field-mapper .fm-btn-primary {\n background: #2563eb;\n border-color: #3b82f6;\n }\n .seed-field-mapper .fm-meta {\n font-size: 12px;\n color: #94a3b8;\n margin-left: auto;\n }\n .seed-field-mapper .fm-grid {\n position: relative;\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 48px;\n min-height: 240px;\n }\n .seed-field-mapper .fm-col-title {\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: 0.06em;\n color: #64748b;\n margin-bottom: 8px;\n }\n .seed-field-mapper .fm-card {\n border: 1px solid #334155;\n border-radius: 8px;\n padding: 10px 12px;\n margin-bottom: 8px;\n background: #1e293b;\n cursor: pointer;\n transition: border-color 0.15s, box-shadow 0.15s;\n }\n .seed-field-mapper .fm-card.active {\n border-color: #3b82f6;\n box-shadow: 0 0 0 1px #3b82f6;\n }\n .seed-field-mapper .fm-card.mapped {\n border-color: #475569;\n }\n .seed-field-mapper .fm-card.highlight {\n border-color: #f59e0b;\n }\n .seed-field-mapper .fm-label {\n font-weight: 600;\n font-size: 13px;\n margin-bottom: 4px;\n }\n .seed-field-mapper .fm-value {\n font-family: 'JetBrains Mono', ui-monospace, monospace;\n font-size: 11px;\n color: #94a3b8;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n .seed-field-mapper .fm-kind {\n font-size: 10px;\n color: #64748b;\n margin-left: 6px;\n }\n .seed-field-mapper .fm-prop-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n .seed-field-mapper .fm-dtype {\n font-size: 10px;\n padding: 2px 6px;\n border-radius: 4px;\n border: 1px solid;\n }\n .seed-field-mapper .fm-remove {\n background: transparent;\n border: none;\n color: #94a3b8;\n cursor: pointer;\n font-size: 14px;\n padding: 0 4px;\n }\n .seed-field-mapper .fm-remove:hover { color: #f87171; }\n .seed-field-mapper .fm-svg {\n position: absolute;\n inset: 0;\n pointer-events: none;\n overflow: visible;\n }\n .seed-field-mapper .fm-preview {\n margin-top: 12px;\n background: #020617;\n border: 1px solid #334155;\n border-radius: 8px;\n padding: 12px;\n font-family: 'JetBrains Mono', ui-monospace, monospace;\n font-size: 11px;\n white-space: pre-wrap;\n color: #cbd5e1;\n max-height: 200px;\n overflow: auto;\n }\n " }),
415
- /* @__PURE__ */ s("div", {
416
- className: "fm-toolbar",
417
- children: [
418
- /* @__PURE__ */ o("button", {
419
- type: "button",
420
- className: "fm-btn fm-btn-primary",
421
- onClick: () => {
422
- d(f ? f() : p(e, c));
423
- },
424
- children: "Auto-map"
425
- }),
426
- h && /* @__PURE__ */ o("button", {
427
- type: "button",
428
- className: "fm-btn",
429
- onClick: () => C((e) => !e),
430
- children: S ? "Hide preview" : "Preview JSON"
431
- }),
432
- /* @__PURE__ */ s("span", {
433
- className: "fm-meta",
434
- children: [
435
- u.length,
436
- " / ",
437
- c.length,
438
- " mapped",
439
- g ? " · click a property" : " · click a source"
440
- ]
441
- })
442
- ]
443
- }),
444
- /* @__PURE__ */ s("div", {
445
- className: "fm-grid",
446
- ref: j,
447
- children: [
448
- /* @__PURE__ */ o("svg", {
449
- className: "fm-svg",
450
- width: T.width,
451
- height: T.height,
452
- children: k.map((e) => {
453
- let t = V?.sourceId === e.mapping.sourceId && V?.propertyName === e.mapping.propertyName, n = (e.x1 + e.x2) / 2;
454
- return /* @__PURE__ */ o("path", {
455
- d: `M ${e.x1} ${e.y1} C ${n} ${e.y1}, ${n} ${e.y2}, ${e.x2} ${e.y2}`,
456
- stroke: e.color,
457
- strokeWidth: t ? 3 : 2,
458
- fill: "none",
459
- opacity: V && !t ? .25 : .85
460
- }, `${e.mapping.sourceId}-${e.mapping.propertyName}`);
461
- })
462
- }),
463
- /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("div", {
464
- className: "fm-col-title",
465
- children: "Sources"
466
- }), e.map((e) => {
467
- let t = z(e.id), n = g === e.id, r = V?.sourceId === e.id;
468
- return /* @__PURE__ */ s("div", {
469
- ref: (t) => {
470
- M.current[e.id] = t;
471
- },
472
- className: `fm-card${n ? " active" : ""}${t ? " mapped" : ""}${r ? " highlight" : ""}`,
473
- onClick: () => I(e.id),
474
- onMouseEnter: () => x(e.id),
475
- onMouseLeave: () => x(null),
476
- children: [/* @__PURE__ */ s("div", {
477
- className: "fm-prop-row",
478
- children: [/* @__PURE__ */ s("div", {
479
- className: "fm-label",
480
- children: [e.label, /* @__PURE__ */ o("span", {
481
- className: "fm-kind",
482
- children: e.kind
483
- })]
484
- }), t && /* @__PURE__ */ o("button", {
485
- type: "button",
486
- className: "fm-remove",
487
- "aria-label": "Remove mapping",
488
- onClick: (t) => {
489
- t.stopPropagation(), R(e.id);
490
- },
491
- children: "×"
492
- })]
493
- }), /* @__PURE__ */ o("div", {
494
- className: "fm-value",
495
- children: D(e.value, 80)
496
- })]
497
- }, e.id);
498
- })] }),
499
- /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("div", {
500
- className: "fm-col-title",
501
- children: "Model properties"
502
- }), c.map((e) => {
503
- let t = B(e.name), n = E(e.dataType), r = V?.propertyName === e.name;
504
- return /* @__PURE__ */ s("div", {
505
- ref: (t) => {
506
- N.current[e.name] = t;
507
- },
508
- className: `fm-card${t ? " mapped" : ""}${r ? " highlight" : ""}${g ? " active" : ""}`,
509
- onClick: () => L(e.name),
510
- onMouseEnter: () => y(e.name),
511
- onMouseLeave: () => y(null),
512
- children: [/* @__PURE__ */ s("div", {
513
- className: "fm-prop-row",
514
- children: [/* @__PURE__ */ o("div", {
515
- className: "fm-label",
516
- children: e.name
517
- }), /* @__PURE__ */ o("span", {
518
- className: "fm-dtype",
519
- style: {
520
- background: n.bg,
521
- borderColor: n.border,
522
- color: n.text
523
- },
524
- children: e.dataType
525
- })]
526
- }), t && /* @__PURE__ */ s("div", {
527
- className: "fm-value",
528
- children: ["← ", t.sourceId]
529
- })]
530
- }, e.name);
531
- })] })
532
- ]
533
- }),
534
- h && S && /* @__PURE__ */ o("pre", {
535
- className: "fm-preview",
536
- children: JSON.stringify(H, null, 2)
537
- })
538
- ]
539
- });
540
- }
541
230
  //#endregion
542
- export { O as FieldMapper, m as SECTION_FULL_ID, l as applyMapping, p as autoMap, c as coerceValue, _ as markdownToSources, g as parseMarkdownSections, h as parseMarkdownWithFrontmatter, S as rssItemToSources, C as rssXmlToSources };
231
+ export { n as RESOLVE_EXTRACT_SUFFIX, p as RESOLVE_FILE_SUFFIX, S as SECTION_FULL_ID, f as applyMapping, h as applyMappingAsync, _ as autoMap, g as buildResolvedSourceNodes, o as classifyUrl, l as coerceValue, d as isRelationLookupTarget, m as looksLikeUrl, c as lookupEntriesFromMapping, s as lookupRefFromEntries, T as markdownToSources, t as normalizeLookupKey, i as normalizeMappingFromSourceId, w as parseMarkdownSections, C as parseMarkdownWithFrontmatter, u as parseResolvedSourceId, y as resolveLookupMapped, v as resolveMappingSource, a as resolvedSourceId, P as rssItemToSources, F as rssXmlToSources, b as sampleValueFromSource, r as shapeLookupValue, e as withLookupEntries };
543
232
 
544
233
  //# sourceMappingURL=index.js.map