@oh-just-another/react-ui 0.62.0 → 0.63.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/CHANGELOG.md +11 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/panels/control-sets.d.ts +42 -0
- package/dist/panels/control-sets.d.ts.map +1 -0
- package/dist/panels/control-sets.js +63 -0
- package/dist/panels/control-sets.js.map +1 -0
- package/dist/panels/property-panel.d.ts.map +1 -1
- package/dist/panels/property-panel.js +244 -149
- package/dist/panels/property-panel.js.map +1 -1
- package/package.json +2 -2
- package/src/styles.css +6 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection-toolbar control sets.
|
|
3
|
+
*
|
|
4
|
+
* Every element type declares the ordered controls it offers, once for a
|
|
5
|
+
* single selection and once for a multi-selection (the "multi" set is the
|
|
6
|
+
* single set minus what makes no sense for several elements — hyperlink,
|
|
7
|
+
* list type, per-file image actions …). A selection of ≥2 elements shows the
|
|
8
|
+
* INTERSECTION of the members' multi sets, so two shapes get the full shape
|
|
9
|
+
* set, a shape + a text share the text-carrier controls, and a shape + a
|
|
10
|
+
* frame share nothing but the tail. Separators are kept where the first
|
|
11
|
+
* member had them and collapse when their cluster empties.
|
|
12
|
+
*
|
|
13
|
+
* The model is deliberately free of React: entries carry an id (the
|
|
14
|
+
* intersection key) and an opaque payload the panel turns into a control.
|
|
15
|
+
*/
|
|
16
|
+
/** Cluster separator marker. */
|
|
17
|
+
export declare const SEPARATOR: "separator";
|
|
18
|
+
export interface ControlEntry<T> {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly payload: T;
|
|
21
|
+
}
|
|
22
|
+
export type ControlSetEntry<T> = ControlEntry<T> | typeof SEPARATOR;
|
|
23
|
+
/** One element's contribution: always-visible row + overflow (mobile ⋮ sheet). */
|
|
24
|
+
export interface ControlSet<T> {
|
|
25
|
+
readonly primary: readonly ControlSetEntry<T>[];
|
|
26
|
+
readonly overflow: readonly ControlSetEntry<T>[];
|
|
27
|
+
}
|
|
28
|
+
export type ControlMode = "single" | "multi";
|
|
29
|
+
/**
|
|
30
|
+
* Drop separators that would not sit between two controls: leading,
|
|
31
|
+
* trailing, and runs of several in a row.
|
|
32
|
+
*/
|
|
33
|
+
export declare const collapseSeparators: <T>(entries: readonly ControlSetEntry<T>[]) => ControlSetEntry<T>[];
|
|
34
|
+
/**
|
|
35
|
+
* Intersect control sets by entry id, keeping the first set's order, row
|
|
36
|
+
* placement and payloads. The primary / overflow split is a layout concern
|
|
37
|
+
* (what the mobile sheet hides), so an id counts as shared wherever the
|
|
38
|
+
* other sets carry it. A single set is returned as is (separators
|
|
39
|
+
* collapsed); an empty input yields empty rows.
|
|
40
|
+
*/
|
|
41
|
+
export declare const intersectControlSets: <T>(sets: readonly ControlSet<T>[]) => ControlSet<T>;
|
|
42
|
+
//# sourceMappingURL=control-sets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-sets.d.ts","sourceRoot":"","sources":["../../src/panels/control-sets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,gCAAgC;AAChC,eAAO,MAAM,SAAS,EAAG,WAAoB,CAAC;AAE9C,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;CACrB;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,SAAS,CAAC;AAEpE,kFAAkF;AAClF,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;CAClD;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAQ7C;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAClC,SAAS,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,KACrC,eAAe,CAAC,CAAC,CAAC,EAYpB,CAAC;AAQF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,MAAM,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,KAAG,UAAU,CAAC,CAAC,CAQpF,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection-toolbar control sets.
|
|
3
|
+
*
|
|
4
|
+
* Every element type declares the ordered controls it offers, once for a
|
|
5
|
+
* single selection and once for a multi-selection (the "multi" set is the
|
|
6
|
+
* single set minus what makes no sense for several elements — hyperlink,
|
|
7
|
+
* list type, per-file image actions …). A selection of ≥2 elements shows the
|
|
8
|
+
* INTERSECTION of the members' multi sets, so two shapes get the full shape
|
|
9
|
+
* set, a shape + a text share the text-carrier controls, and a shape + a
|
|
10
|
+
* frame share nothing but the tail. Separators are kept where the first
|
|
11
|
+
* member had them and collapse when their cluster empties.
|
|
12
|
+
*
|
|
13
|
+
* The model is deliberately free of React: entries carry an id (the
|
|
14
|
+
* intersection key) and an opaque payload the panel turns into a control.
|
|
15
|
+
*/
|
|
16
|
+
/** Cluster separator marker. */
|
|
17
|
+
export const SEPARATOR = "separator";
|
|
18
|
+
const idsOf = (entries) => {
|
|
19
|
+
const ids = new Set();
|
|
20
|
+
for (const e of entries)
|
|
21
|
+
if (e !== SEPARATOR)
|
|
22
|
+
ids.add(e.id);
|
|
23
|
+
return ids;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Drop separators that would not sit between two controls: leading,
|
|
27
|
+
* trailing, and runs of several in a row.
|
|
28
|
+
*/
|
|
29
|
+
export const collapseSeparators = (entries) => {
|
|
30
|
+
const out = [];
|
|
31
|
+
for (const e of entries) {
|
|
32
|
+
if (e === SEPARATOR) {
|
|
33
|
+
if (out.length === 0 || out[out.length - 1] === SEPARATOR)
|
|
34
|
+
continue;
|
|
35
|
+
out.push(e);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
out.push(e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
while (out.length > 0 && out[out.length - 1] === SEPARATOR)
|
|
42
|
+
out.pop();
|
|
43
|
+
return out;
|
|
44
|
+
};
|
|
45
|
+
const intersectEntries = (first, others) => collapseSeparators(first.filter((e) => e === SEPARATOR || others.every((ids) => ids.has(e.id))));
|
|
46
|
+
/**
|
|
47
|
+
* Intersect control sets by entry id, keeping the first set's order, row
|
|
48
|
+
* placement and payloads. The primary / overflow split is a layout concern
|
|
49
|
+
* (what the mobile sheet hides), so an id counts as shared wherever the
|
|
50
|
+
* other sets carry it. A single set is returned as is (separators
|
|
51
|
+
* collapsed); an empty input yields empty rows.
|
|
52
|
+
*/
|
|
53
|
+
export const intersectControlSets = (sets) => {
|
|
54
|
+
const first = sets[0];
|
|
55
|
+
if (first === undefined)
|
|
56
|
+
return { primary: [], overflow: [] };
|
|
57
|
+
const others = sets.slice(1).map((s) => idsOf([...s.primary, ...s.overflow]));
|
|
58
|
+
return {
|
|
59
|
+
primary: intersectEntries(first.primary, others),
|
|
60
|
+
overflow: intersectEntries(first.overflow, others),
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=control-sets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-sets.js","sourceRoot":"","sources":["../../src/panels/control-sets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,gCAAgC;AAChC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAoB,CAAC;AAiB9C,MAAM,KAAK,GAAG,CAAI,OAAsC,EAAuB,EAAE;IAC/E,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,CAAC,IAAI,OAA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AK,SAAS;QAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC9E,OAAO;QACL,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC;QAChD,QAAQ,EAAE,gBAAgB,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC;KACnD,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-panel.d.ts","sourceRoot":"","sources":["../../src/panels/property-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"property-panel.d.ts","sourceRoot":"","sources":["../../src/panels/property-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EAEnB,MAAM,OAAO,CAAC;AAuIf;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,GAAI,8BAAsC,kBAAkB,mDA0FrF,CAAC"}
|