@septkit/ui 0.0.48 → 0.0.49
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.d.ts
CHANGED
|
@@ -98,11 +98,14 @@ declare type __VLS_Props_10 = {
|
|
|
98
98
|
|
|
99
99
|
declare type __VLS_Props_11 = {
|
|
100
100
|
detail: ElementDetailVM | undefined;
|
|
101
|
+
/** Consumer-supplied fixed prefix/suffix per attribute; the user edits only the core. */
|
|
102
|
+
affixMask?: AffixMaskResolver;
|
|
101
103
|
};
|
|
102
104
|
|
|
103
105
|
declare type __VLS_Props_12 = MergeSessionParams & {
|
|
104
106
|
source?: FileMeta;
|
|
105
107
|
target?: FileMeta;
|
|
108
|
+
affixMask?: AffixMaskResolver;
|
|
106
109
|
};
|
|
107
110
|
|
|
108
111
|
declare type __VLS_Props_13 = {
|
|
@@ -364,6 +367,12 @@ export declare type ActiveFeedback = {
|
|
|
364
367
|
variant: FeedbackVariant;
|
|
365
368
|
} & FeedbackPayload;
|
|
366
369
|
|
|
370
|
+
/** Resolves the affix (if any) for a given element tag + attribute name. Consumer-supplied. */
|
|
371
|
+
export declare type AffixMaskResolver = (params: {
|
|
372
|
+
tag: string;
|
|
373
|
+
attr: string;
|
|
374
|
+
}) => AttributeAffix | undefined;
|
|
375
|
+
|
|
367
376
|
/**
|
|
368
377
|
* Consumer hook run INSIDE the merge transaction, right after `tx.lifecycle.apply`.
|
|
369
378
|
* Receives the `ApplyResult` (the instance roots the write produced) so a caller can
|
|
@@ -380,6 +389,17 @@ declare type AfterApplyContext = {
|
|
|
380
389
|
result: ApplyResult;
|
|
381
390
|
};
|
|
382
391
|
|
|
392
|
+
/**
|
|
393
|
+
* A fixed prefix/suffix wrapped around an editable attribute value. The user edits only
|
|
394
|
+
* the "core" between them; the affix is rendered as inert adornment and re-applied on
|
|
395
|
+
* commit. Lets a consumer keep a convention marker (e.g. SET's `_App`) out of the user's
|
|
396
|
+
* reach without the generic component knowing what the marker means.
|
|
397
|
+
*/
|
|
398
|
+
export declare type AttributeAffix = {
|
|
399
|
+
prefix?: string;
|
|
400
|
+
suffix?: string;
|
|
401
|
+
};
|
|
402
|
+
|
|
383
403
|
export declare const Button: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
384
404
|
|
|
385
405
|
export declare const CATEGORY_ELEMENTS: Record<string, string[]>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region lib/merge/affix.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = t?.prefix ?? "", r = t?.suffix ?? "", i = e;
|
|
4
|
+
return n && i.startsWith(n) && (i = i.slice(n.length)), r && i.endsWith(r) && (i = i.slice(0, i.length - r.length)), {
|
|
5
|
+
prefix: n,
|
|
6
|
+
core: i,
|
|
7
|
+
suffix: r
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function t(e, t) {
|
|
11
|
+
return `${t?.prefix ?? ""}${e}${t?.suffix ?? ""}`;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { t as composeAffix, e as splitAffix };
|
|
@@ -1,52 +1,76 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { composeAffix as e, splitAffix as t } from "./affix.js";
|
|
2
|
+
import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, defineComponent as s, normalizeClass as c, openBlock as l, renderList as u, toDisplayString as d } from "vue";
|
|
2
3
|
//#region lib/merge/element-detail.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
-
var
|
|
4
|
+
var f = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "flex h-full flex-col gap-3 overflow-auto p-3 text-sm"
|
|
6
|
-
},
|
|
7
|
+
}, p = { class: "flex items-center gap-2" }, m = { class: "font-medium" }, h = { class: "badge badge-sm opacity-70" }, g = {
|
|
7
8
|
key: 0,
|
|
8
9
|
class: "flex flex-col gap-2 font-mono text-xs"
|
|
9
|
-
},
|
|
10
|
+
}, _ = { class: "whitespace-nowrap shrink-0 opacity-70" }, v = { class: "flex w-full items-center" }, y = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "shrink-0 select-none opacity-60"
|
|
13
|
+
}, b = ["value", "onInput"], x = {
|
|
14
|
+
key: 1,
|
|
15
|
+
class: "shrink-0 select-none opacity-60"
|
|
16
|
+
}, S = {
|
|
10
17
|
key: 0,
|
|
11
18
|
class: "badge badge-warning badge-xs shrink-0",
|
|
12
19
|
title: "Auto-resolved to avoid a naming collision — edit to override"
|
|
13
|
-
},
|
|
20
|
+
}, C = {
|
|
14
21
|
key: 1,
|
|
15
22
|
class: "text-xs opacity-60"
|
|
16
|
-
},
|
|
23
|
+
}, w = {
|
|
17
24
|
key: 1,
|
|
18
25
|
class: "grid h-full place-items-center p-4 text-sm opacity-60"
|
|
19
|
-
},
|
|
26
|
+
}, T = /*@__PURE__*/ s({
|
|
20
27
|
__name: "element-detail",
|
|
21
|
-
props: {
|
|
28
|
+
props: {
|
|
29
|
+
detail: {},
|
|
30
|
+
affixMask: { type: Function }
|
|
31
|
+
},
|
|
22
32
|
emits: ["edit"],
|
|
23
|
-
setup(
|
|
24
|
-
let
|
|
33
|
+
setup(s, { emit: T }) {
|
|
34
|
+
let E = s, D = T, O = r(() => ({
|
|
25
35
|
added: "badge-success",
|
|
26
36
|
removed: "badge-error",
|
|
27
37
|
modified: "badge-warning",
|
|
28
38
|
unchanged: "badge-ghost"
|
|
29
|
-
})[
|
|
30
|
-
function
|
|
31
|
-
|
|
39
|
+
})[E.detail?.change ?? "unchanged"]), k = r(() => E.detail?.attributes.filter((e) => e.editable));
|
|
40
|
+
function A(e) {
|
|
41
|
+
if (!(!E.detail || !E.affixMask)) return E.affixMask({
|
|
42
|
+
tag: E.detail.tag,
|
|
43
|
+
attr: e.name
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function j(e) {
|
|
47
|
+
return t(e.after ?? "", A(e));
|
|
48
|
+
}
|
|
49
|
+
function M(t, n) {
|
|
50
|
+
let r = n.target.value;
|
|
51
|
+
D("edit", t.name, e(r, A(t)));
|
|
32
52
|
}
|
|
33
|
-
return (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
]),
|
|
53
|
+
return (e, t) => s.detail ? (l(), a("div", f, [o("header", p, [
|
|
54
|
+
o("span", m, d(s.detail.title), 1),
|
|
55
|
+
o("span", h, d(s.detail.tag), 1),
|
|
56
|
+
o("span", { class: c(["badge badge-sm", O.value]) }, d(s.detail.change), 3)
|
|
57
|
+
]), k.value?.length ? (l(), a("div", g, [(l(!0), a(n, null, u(k.value, (e) => (l(), a("label", {
|
|
38
58
|
key: e.name,
|
|
39
59
|
class: "flex items-center gap-2"
|
|
40
60
|
}, [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
61
|
+
o("span", _, d(e.name) + ":", 1),
|
|
62
|
+
o("span", v, [
|
|
63
|
+
j(e).prefix ? (l(), a("span", y, d(j(e).prefix), 1)) : i("", !0),
|
|
64
|
+
o("input", {
|
|
65
|
+
class: c(["input input-xs input-bordered w-full font-mono", { "input-warning": e.conflict }]),
|
|
66
|
+
value: j(e).core,
|
|
67
|
+
onInput: (t) => M(e, t)
|
|
68
|
+
}, null, 42, b),
|
|
69
|
+
j(e).suffix ? (l(), a("span", x, d(j(e).suffix), 1)) : i("", !0)
|
|
70
|
+
]),
|
|
71
|
+
e.conflict ? (l(), a("span", S, " conflict ")) : i("", !0)
|
|
72
|
+
]))), 128))])) : (l(), a("div", C, "No editable fields. See the diff below."))])) : (l(), a("div", w, " Select an element to see its changes. "));
|
|
49
73
|
}
|
|
50
74
|
});
|
|
51
75
|
//#endregion
|
|
52
|
-
export {
|
|
76
|
+
export { T as default };
|
|
@@ -58,7 +58,8 @@ var w = { class: "flex h-full flex-col" }, T = { class: "flex flex-wrap items-ce
|
|
|
58
58
|
anchor: {},
|
|
59
59
|
afterApply: { type: Function },
|
|
60
60
|
source: {},
|
|
61
|
-
target: {}
|
|
61
|
+
target: {},
|
|
62
|
+
affixMask: { type: Function }
|
|
62
63
|
},
|
|
63
64
|
emits: ["applied", "close"],
|
|
64
65
|
setup(g, { emit: F }) {
|
|
@@ -270,8 +271,9 @@ var w = { class: "flex h-full flex-col" }, T = { class: "flex flex-wrap items-ce
|
|
|
270
271
|
}, {
|
|
271
272
|
default: S(() => [h(se, {
|
|
272
273
|
detail: q.value,
|
|
274
|
+
"affix-mask": g.affixMask,
|
|
273
275
|
onEdit: We
|
|
274
|
-
}, null, 8, ["detail"])]),
|
|
276
|
+
}, null, 8, ["detail", "affix-mask"])]),
|
|
275
277
|
_: 1
|
|
276
278
|
}),
|
|
277
279
|
h(x(r), { class: "h-px bg-base-300" }),
|