@abpjs/ui 0.0.0-stage → 0.1.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 +16 -0
- package/LICENSE +55 -0
- package/NOTICE +4 -0
- package/README.md +60 -2
- package/dist/index.d.ts +2482 -0
- package/dist/index.js +8464 -0
- package/dist/index.js.map +1 -0
- package/dist/rules.d.ts +119 -0
- package/dist/rules.js +116 -0
- package/dist/rules.js.map +1 -0
- package/package.json +85 -4
package/dist/rules.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A breadcrumb trail past four levels, folded (UI round 9, step 66): the first and the last two stay, the middle ones
|
|
3
|
+
* go behind "…" (`null` in `shown`) and come back as `hidden`. Four or fewer stay as they are.
|
|
4
|
+
*/
|
|
5
|
+
declare function foldBreadcrumbs<T>(items: readonly T[]): {
|
|
6
|
+
shown: ({
|
|
7
|
+
item: T;
|
|
8
|
+
index: number;
|
|
9
|
+
} | null)[];
|
|
10
|
+
hidden: T[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A query's conditions as the filter builders write them (ADR 0013; UI round 9, step 57): which operators take a value
|
|
15
|
+
* or a list, a typed value as the query takes it and back, and conditions on one field merged into "is any of".
|
|
16
|
+
*/
|
|
17
|
+
/** A field a query can use, as GET /api/query/{entity}/fields returns it. */
|
|
18
|
+
interface QueryField {
|
|
19
|
+
id: string;
|
|
20
|
+
kind: string;
|
|
21
|
+
label: string;
|
|
22
|
+
sortable: boolean;
|
|
23
|
+
groupable: boolean;
|
|
24
|
+
/** JSON-form operator names: eq, ne, in, notIn, contains, isEmpty… */
|
|
25
|
+
operators: string[];
|
|
26
|
+
}
|
|
27
|
+
/** One condition in a query's JSON form. */
|
|
28
|
+
interface QueryConditionJson {
|
|
29
|
+
field: string;
|
|
30
|
+
op: string;
|
|
31
|
+
value?: unknown;
|
|
32
|
+
}
|
|
33
|
+
/** Operators that take no value ("is empty"). */
|
|
34
|
+
declare const NO_VALUE_OPS: ReadonlySet<string>;
|
|
35
|
+
/** Operators whose value is a list ("is any of", and "between" with its two ends). */
|
|
36
|
+
declare const LIST_OPS: ReadonlySet<string>;
|
|
37
|
+
/** A typed value as the query takes it: a function call ("startOfDay()") or the text. */
|
|
38
|
+
declare function parseValue(text: string): unknown;
|
|
39
|
+
/** A condition's value as text (a chip's, or a box's to edit). */
|
|
40
|
+
declare function valueText(value: unknown): string;
|
|
41
|
+
/**
|
|
42
|
+
* Conditions on one field that each say "is" one value become one "is any of" ("Conditions on the same field match any
|
|
43
|
+
* of their values"), where the field takes that operator; everything else stays an AND. The conditions given are left
|
|
44
|
+
* as they were.
|
|
45
|
+
*/
|
|
46
|
+
declare function mergeSameField(conditions: readonly QueryConditionJson[], fields: readonly Pick<QueryField, 'id' | 'operators'>[]): QueryConditionJson[];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A grouped query's rows (ADR 0013): a row's group as a key, a date period's name, and rows cut into their groups.
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* A row's group, as a key: a reference's key or id (a status, a person), a value's text, or "" for none. The groups a
|
|
53
|
+
* grouped query returns key the same way, so a row finds its group's count and name.
|
|
54
|
+
*/
|
|
55
|
+
declare function groupKey(value: unknown): string;
|
|
56
|
+
/**
|
|
57
|
+
* A date period's name from its first day (yyyy-mm-dd), in the reader's language: a day, "Week of 2 Nov 2026",
|
|
58
|
+
* "November 2026", "Q4 2026", "2026". The day is read as written, never shifted by a time zone.
|
|
59
|
+
*/
|
|
60
|
+
declare function periodName(day: string, period: string, locale: string, labels: {
|
|
61
|
+
week: string;
|
|
62
|
+
quarter: string;
|
|
63
|
+
}): string;
|
|
64
|
+
/**
|
|
65
|
+
* Rows in their groups, in the order they came (a grouped query's rows come in group order): a new group wherever the
|
|
66
|
+
* key changes, so a group split by paging stays one when its rows are together.
|
|
67
|
+
*/
|
|
68
|
+
declare function inGroups<T>(rows: readonly T[], of: (row: T) => string): {
|
|
69
|
+
key: string;
|
|
70
|
+
rows: T[];
|
|
71
|
+
}[];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Settings in sections (ADR 0095, moved into the design system by ADR 0109): an area's sections and pages each have a
|
|
75
|
+
* key and a weight. The higher the weight, the nearer the top; equal ones by title. A host's own come in steps of 100,
|
|
76
|
+
* so a package's or a plugin's section or page fits between any two of them.
|
|
77
|
+
*/
|
|
78
|
+
interface SettingsSectionLike {
|
|
79
|
+
key: string;
|
|
80
|
+
weight: number;
|
|
81
|
+
title: string;
|
|
82
|
+
}
|
|
83
|
+
interface SettingsPageLike {
|
|
84
|
+
section: string;
|
|
85
|
+
weight: number;
|
|
86
|
+
title: string;
|
|
87
|
+
}
|
|
88
|
+
/** Heavier first, then by title. */
|
|
89
|
+
declare const heavierFirst: (a: {
|
|
90
|
+
weight: number;
|
|
91
|
+
title: string;
|
|
92
|
+
}, b: {
|
|
93
|
+
weight: number;
|
|
94
|
+
title: string;
|
|
95
|
+
}) => number;
|
|
96
|
+
/** The sections that have pages, heaviest first, each with its pages heaviest first; a page whose section isn't there is left out. */
|
|
97
|
+
declare function inSections<S extends SettingsSectionLike, P extends SettingsPageLike>(sections: S[], pages: P[]): {
|
|
98
|
+
section: S;
|
|
99
|
+
pages: P[];
|
|
100
|
+
}[];
|
|
101
|
+
/** A page that may say who sees it (a flag, or a check the host's rights answer). */
|
|
102
|
+
interface MaybeVisible {
|
|
103
|
+
visible?: boolean | (() => boolean);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* An area's sections with the pages this person may see, heaviest first then by title: the host's static sections and
|
|
107
|
+
* pages together with the ones it loads (ADR 0095's order, unchanged). A section a package or plugin adds under a key
|
|
108
|
+
* the host already has is taken once, the host's first.
|
|
109
|
+
*/
|
|
110
|
+
declare function settingsArea<S extends SettingsSectionLike, P extends SettingsPageLike & MaybeVisible>(sections: S[], pages: P[]): {
|
|
111
|
+
section: S;
|
|
112
|
+
pages: P[];
|
|
113
|
+
}[];
|
|
114
|
+
/** The page an address opens, for a host's catch-all route: the one whose `href` is the address or above it, the longest. */
|
|
115
|
+
declare function findSettingsPage<P extends {
|
|
116
|
+
href: string;
|
|
117
|
+
}>(pages: P[], pathname: string): P | undefined;
|
|
118
|
+
|
|
119
|
+
export { LIST_OPS, type MaybeVisible, NO_VALUE_OPS, type QueryConditionJson, type QueryField, type SettingsPageLike, type SettingsSectionLike, findSettingsPage, foldBreadcrumbs, groupKey, heavierFirst, inGroups, inSections, mergeSameField, parseValue, periodName, settingsArea, valueText };
|
package/dist/rules.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// src/rules/breadcrumbs.ts
|
|
2
|
+
function foldBreadcrumbs(items) {
|
|
3
|
+
if (items.length <= 4) return { shown: items.map((item, index) => ({ item, index })), hidden: [] };
|
|
4
|
+
return {
|
|
5
|
+
shown: [{ item: items[0], index: 0 }, null, ...items.slice(-2).map((item, k) => ({ item, index: items.length - 2 + k }))],
|
|
6
|
+
hidden: items.slice(1, -2)
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// src/rules/conditions.ts
|
|
11
|
+
var NO_VALUE_OPS = /* @__PURE__ */ new Set(["isEmpty", "isNotEmpty"]);
|
|
12
|
+
var LIST_OPS = /* @__PURE__ */ new Set(["in", "notIn", "hasAny", "hasAll", "between"]);
|
|
13
|
+
function parseValue(text) {
|
|
14
|
+
const call = /^([A-Za-z]\w*)\((.*)\)$/.exec(text.trim());
|
|
15
|
+
if (call) {
|
|
16
|
+
const args = call[2].trim() === "" ? [] : call[2].split(",").map((a) => Number.isFinite(Number(a.trim())) ? Number(a.trim()) : a.trim());
|
|
17
|
+
return { fn: call[1], args };
|
|
18
|
+
}
|
|
19
|
+
return text.trim();
|
|
20
|
+
}
|
|
21
|
+
function valueText(value) {
|
|
22
|
+
if (value == null) return "";
|
|
23
|
+
if (Array.isArray(value)) return value.map(valueText).join(", ");
|
|
24
|
+
if (typeof value === "object") {
|
|
25
|
+
const v = value;
|
|
26
|
+
if (typeof v.fn === "string") return `${v.fn}(${Array.isArray(v.args) ? v.args.map(valueText).join(", ") : ""})`;
|
|
27
|
+
if (typeof v.field === "string") return `field(${v.field})`;
|
|
28
|
+
if ("query" in v) return "(\u2026)";
|
|
29
|
+
}
|
|
30
|
+
return String(value);
|
|
31
|
+
}
|
|
32
|
+
function mergeSameField(conditions, fields) {
|
|
33
|
+
const out = [];
|
|
34
|
+
for (const c of conditions) {
|
|
35
|
+
const field = fields.find((f) => f.id === c.field);
|
|
36
|
+
const into = c.op === "eq" && field?.operators.includes("in") ? out.find((o) => o.field === c.field && (o.op === "eq" || o.op === "in")) : void 0;
|
|
37
|
+
if (into) {
|
|
38
|
+
const values = [...into.op === "in" ? into.value : [into.value], c.value];
|
|
39
|
+
into.op = "in";
|
|
40
|
+
into.value = values;
|
|
41
|
+
} else {
|
|
42
|
+
out.push({ ...c });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/rules/grouping.ts
|
|
49
|
+
function groupKey(value) {
|
|
50
|
+
if (value == null) return "";
|
|
51
|
+
if (typeof value === "object") {
|
|
52
|
+
const v = value;
|
|
53
|
+
const id = v.key ?? v.id ?? v.username ?? v.name;
|
|
54
|
+
return id == null ? JSON.stringify(value) : String(id);
|
|
55
|
+
}
|
|
56
|
+
return String(value);
|
|
57
|
+
}
|
|
58
|
+
function periodName(day, period, locale, labels) {
|
|
59
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(day);
|
|
60
|
+
if (!m) return day;
|
|
61
|
+
const date = new Date(Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3])));
|
|
62
|
+
const format = (options) => new Intl.DateTimeFormat(locale, { numberingSystem: "latn", ...options, timeZone: "UTC" }).format(date);
|
|
63
|
+
const fill = (template, values) => template.replace(/\{(\w+)\}/g, (_, k) => values[k] ?? `{${k}}`);
|
|
64
|
+
switch (period) {
|
|
65
|
+
case "year":
|
|
66
|
+
return format({ year: "numeric" });
|
|
67
|
+
case "quarter":
|
|
68
|
+
return fill(labels.quarter, { quarter: new Intl.NumberFormat(locale, { numberingSystem: "latn" }).format(Math.floor((Number(m[2]) - 1) / 3) + 1), year: format({ year: "numeric" }) });
|
|
69
|
+
case "month":
|
|
70
|
+
return format({ month: "long", year: "numeric" });
|
|
71
|
+
case "week":
|
|
72
|
+
return fill(labels.week, { day: format({ day: "numeric", month: "short", year: "numeric" }) });
|
|
73
|
+
default:
|
|
74
|
+
return format({ day: "numeric", month: "short", year: "numeric" });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function inGroups(rows, of) {
|
|
78
|
+
const groups = [];
|
|
79
|
+
for (const row of rows) {
|
|
80
|
+
const key = of(row);
|
|
81
|
+
const last = groups[groups.length - 1];
|
|
82
|
+
if (last && last.key === key) last.rows.push(row);
|
|
83
|
+
else groups.push({ key, rows: [row] });
|
|
84
|
+
}
|
|
85
|
+
return groups;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// src/rules/settings.ts
|
|
89
|
+
var heavierFirst = (a, b) => b.weight - a.weight || a.title.localeCompare(b.title);
|
|
90
|
+
function inSections(sections, pages) {
|
|
91
|
+
return [...sections].sort(heavierFirst).map((section) => ({ section, pages: pages.filter((p) => p.section === section.key).sort(heavierFirst) })).filter((s) => s.pages.length > 0);
|
|
92
|
+
}
|
|
93
|
+
var isVisible = (p) => typeof p.visible === "function" ? p.visible() : p.visible !== false;
|
|
94
|
+
function settingsArea(sections, pages) {
|
|
95
|
+
const once = sections.filter((s, i) => sections.findIndex((x) => x.key === s.key) === i);
|
|
96
|
+
return inSections(once, pages.filter(isVisible));
|
|
97
|
+
}
|
|
98
|
+
function findSettingsPage(pages, pathname) {
|
|
99
|
+
return pages.filter((p) => pathname === p.href || pathname.startsWith(`${p.href}/`)).sort((a, b) => b.href.length - a.href.length)[0];
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
LIST_OPS,
|
|
103
|
+
NO_VALUE_OPS,
|
|
104
|
+
findSettingsPage,
|
|
105
|
+
foldBreadcrumbs,
|
|
106
|
+
groupKey,
|
|
107
|
+
heavierFirst,
|
|
108
|
+
inGroups,
|
|
109
|
+
inSections,
|
|
110
|
+
mergeSameField,
|
|
111
|
+
parseValue,
|
|
112
|
+
periodName,
|
|
113
|
+
settingsArea,
|
|
114
|
+
valueText
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rules/breadcrumbs.ts","../src/rules/conditions.ts","../src/rules/grouping.ts","../src/rules/settings.ts"],"sourcesContent":["/**\r\n * A breadcrumb trail past four levels, folded (UI round 9, step 66): the first and the last two stay, the middle ones\r\n * go behind \"…\" (`null` in `shown`) and come back as `hidden`. Four or fewer stay as they are.\r\n */\r\nexport function foldBreadcrumbs<T>(items: readonly T[]): { shown: ({ item: T; index: number } | null)[]; hidden: T[] } {\r\n if (items.length <= 4) return { shown: items.map((item, index) => ({ item, index })), hidden: [] };\r\n return {\r\n shown: [{ item: items[0], index: 0 }, null, ...items.slice(-2).map((item, k) => ({ item, index: items.length - 2 + k }))],\r\n hidden: items.slice(1, -2),\r\n };\r\n}\r\n","/**\r\n * A query's conditions as the filter builders write them (ADR 0013; UI round 9, step 57): which operators take a value\r\n * or a list, a typed value as the query takes it and back, and conditions on one field merged into \"is any of\".\r\n */\r\n\r\n/** A field a query can use, as GET /api/query/{entity}/fields returns it. */\r\nexport interface QueryField {\r\n id: string;\r\n kind: string;\r\n label: string;\r\n sortable: boolean;\r\n groupable: boolean;\r\n /** JSON-form operator names: eq, ne, in, notIn, contains, isEmpty… */\r\n operators: string[];\r\n}\r\n\r\n/** One condition in a query's JSON form. */\r\nexport interface QueryConditionJson {\r\n field: string;\r\n op: string;\r\n value?: unknown;\r\n}\r\n\r\n/** Operators that take no value (\"is empty\"). */\r\nexport const NO_VALUE_OPS: ReadonlySet<string> = new Set(['isEmpty', 'isNotEmpty']);\r\n/** Operators whose value is a list (\"is any of\", and \"between\" with its two ends). */\r\nexport const LIST_OPS: ReadonlySet<string> = new Set(['in', 'notIn', 'hasAny', 'hasAll', 'between']);\r\n\r\n/** A typed value as the query takes it: a function call (\"startOfDay()\") or the text. */\r\nexport function parseValue(text: string): unknown {\r\n const call = /^([A-Za-z]\\w*)\\((.*)\\)$/.exec(text.trim());\r\n if (call) {\r\n const args = call[2].trim() === '' ? [] : call[2].split(',').map((a) => (Number.isFinite(Number(a.trim())) ? Number(a.trim()) : a.trim()));\r\n return { fn: call[1], args };\r\n }\r\n return text.trim();\r\n}\r\n\r\n/** A condition's value as text (a chip's, or a box's to edit). */\r\nexport function valueText(value: unknown): string {\r\n if (value == null) return '';\r\n if (Array.isArray(value)) return value.map(valueText).join(', ');\r\n if (typeof value === 'object') {\r\n const v = value as Record<string, unknown>;\r\n if (typeof v.fn === 'string') return `${v.fn}(${Array.isArray(v.args) ? v.args.map(valueText).join(', ') : ''})`;\r\n if (typeof v.field === 'string') return `field(${v.field})`;\r\n if ('query' in v) return '(…)';\r\n }\r\n return String(value);\r\n}\r\n\r\n/**\r\n * Conditions on one field that each say \"is\" one value become one \"is any of\" (\"Conditions on the same field match any\r\n * of their values\"), where the field takes that operator; everything else stays an AND. The conditions given are left\r\n * as they were.\r\n */\r\nexport function mergeSameField(conditions: readonly QueryConditionJson[], fields: readonly Pick<QueryField, 'id' | 'operators'>[]): QueryConditionJson[] {\r\n const out: QueryConditionJson[] = [];\r\n for (const c of conditions) {\r\n const field = fields.find((f) => f.id === c.field);\r\n const into = c.op === 'eq' && field?.operators.includes('in') ? out.find((o) => o.field === c.field && (o.op === 'eq' || o.op === 'in')) : undefined;\r\n if (into) {\r\n const values = [...(into.op === 'in' ? (into.value as unknown[]) : [into.value]), c.value];\r\n into.op = 'in';\r\n into.value = values;\r\n } else {\r\n out.push({ ...c });\r\n }\r\n }\r\n return out;\r\n}\r\n","/**\r\n * A grouped query's rows (ADR 0013): a row's group as a key, a date period's name, and rows cut into their groups.\r\n */\r\n\r\n/**\r\n * A row's group, as a key: a reference's key or id (a status, a person), a value's text, or \"\" for none. The groups a\r\n * grouped query returns key the same way, so a row finds its group's count and name.\r\n */\r\nexport function groupKey(value: unknown): string {\r\n if (value == null) return '';\r\n if (typeof value === 'object') {\r\n const v = value as Record<string, unknown>;\r\n const id = v.key ?? v.id ?? v.username ?? v.name;\r\n return id == null ? JSON.stringify(value) : String(id);\r\n }\r\n return String(value);\r\n}\r\n\r\n/**\r\n * A date period's name from its first day (yyyy-mm-dd), in the reader's language: a day, \"Week of 2 Nov 2026\",\r\n * \"November 2026\", \"Q4 2026\", \"2026\". The day is read as written, never shifted by a time zone.\r\n */\r\nexport function periodName(day: string, period: string, locale: string, labels: { week: string; quarter: string }): string {\r\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(day);\r\n if (!m) return day;\r\n const date = new Date(Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3])));\r\n const format = (options: Intl.DateTimeFormatOptions) => new Intl.DateTimeFormat(locale, { numberingSystem: 'latn', ...options, timeZone: 'UTC' }).format(date);\r\n const fill = (template: string, values: Record<string, string>) => template.replace(/\\{(\\w+)\\}/g, (_, k: string) => values[k] ?? `{${k}}`);\r\n switch (period) {\r\n case 'year': return format({ year: 'numeric' });\r\n case 'quarter': return fill(labels.quarter, { quarter: new Intl.NumberFormat(locale, { numberingSystem: 'latn' }).format(Math.floor((Number(m[2]) - 1) / 3) + 1), year: format({ year: 'numeric' }) });\r\n case 'month': return format({ month: 'long', year: 'numeric' });\r\n case 'week': return fill(labels.week, { day: format({ day: 'numeric', month: 'short', year: 'numeric' }) });\r\n default: return format({ day: 'numeric', month: 'short', year: 'numeric' });\r\n }\r\n}\r\n\r\n/**\r\n * Rows in their groups, in the order they came (a grouped query's rows come in group order): a new group wherever the\r\n * key changes, so a group split by paging stays one when its rows are together.\r\n */\r\nexport function inGroups<T>(rows: readonly T[], of: (row: T) => string): { key: string; rows: T[] }[] {\r\n const groups: { key: string; rows: T[] }[] = [];\r\n for (const row of rows) {\r\n const key = of(row);\r\n const last = groups[groups.length - 1];\r\n if (last && last.key === key) last.rows.push(row);\r\n else groups.push({ key, rows: [row] });\r\n }\r\n return groups;\r\n}\r\n","/**\r\n * Settings in sections (ADR 0095, moved into the design system by ADR 0109): an area's sections and pages each have a\r\n * key and a weight. The higher the weight, the nearer the top; equal ones by title. A host's own come in steps of 100,\r\n * so a package's or a plugin's section or page fits between any two of them.\r\n */\r\n\r\nexport interface SettingsSectionLike {\r\n key: string;\r\n weight: number;\r\n title: string;\r\n}\r\n\r\nexport interface SettingsPageLike {\r\n section: string;\r\n weight: number;\r\n title: string;\r\n}\r\n\r\n/** Heavier first, then by title. */\r\nexport const heavierFirst = (a: { weight: number; title: string }, b: { weight: number; title: string }) =>\r\n b.weight - a.weight || a.title.localeCompare(b.title);\r\n\r\n/** The sections that have pages, heaviest first, each with its pages heaviest first; a page whose section isn't there is left out. */\r\nexport function inSections<S extends SettingsSectionLike, P extends SettingsPageLike>(sections: S[], pages: P[]): { section: S; pages: P[] }[] {\r\n return [...sections]\r\n .sort(heavierFirst)\r\n .map((section) => ({ section, pages: pages.filter((p) => p.section === section.key).sort(heavierFirst) }))\r\n .filter((s) => s.pages.length > 0);\r\n}\r\n\r\n/** A page that may say who sees it (a flag, or a check the host's rights answer). */\r\nexport interface MaybeVisible {\r\n visible?: boolean | (() => boolean);\r\n}\r\n\r\nconst isVisible = (p: MaybeVisible) => (typeof p.visible === 'function' ? p.visible() : p.visible !== false);\r\n\r\n/**\r\n * An area's sections with the pages this person may see, heaviest first then by title: the host's static sections and\r\n * pages together with the ones it loads (ADR 0095's order, unchanged). A section a package or plugin adds under a key\r\n * the host already has is taken once, the host's first.\r\n */\r\nexport function settingsArea<S extends SettingsSectionLike, P extends SettingsPageLike & MaybeVisible>(sections: S[], pages: P[]): { section: S; pages: P[] }[] {\r\n const once = sections.filter((s, i) => sections.findIndex((x) => x.key === s.key) === i);\r\n return inSections(once, pages.filter(isVisible));\r\n}\r\n\r\n/** The page an address opens, for a host's catch-all route: the one whose `href` is the address or above it, the longest. */\r\nexport function findSettingsPage<P extends { href: string }>(pages: P[], pathname: string): P | undefined {\r\n return pages.filter((p) => pathname === p.href || pathname.startsWith(`${p.href}/`)).sort((a, b) => b.href.length - a.href.length)[0];\r\n}\r\n"],"mappings":";AAIO,SAAS,gBAAmB,OAAoF;AACrH,MAAI,MAAM,UAAU,EAAG,QAAO,EAAE,OAAO,MAAM,IAAI,CAAC,MAAM,WAAW,EAAE,MAAM,MAAM,EAAE,GAAG,QAAQ,CAAC,EAAE;AACjG,SAAO;AAAA,IACL,OAAO,CAAC,EAAE,MAAM,MAAM,CAAC,GAAG,OAAO,EAAE,GAAG,MAAM,GAAG,MAAM,MAAM,EAAE,EAAE,IAAI,CAAC,MAAM,OAAO,EAAE,MAAM,OAAO,MAAM,SAAS,IAAI,EAAE,EAAE,CAAC;AAAA,IACxH,QAAQ,MAAM,MAAM,GAAG,EAAE;AAAA,EAC3B;AACF;;;ACcO,IAAM,eAAoC,oBAAI,IAAI,CAAC,WAAW,YAAY,CAAC;AAE3E,IAAM,WAAgC,oBAAI,IAAI,CAAC,MAAM,SAAS,UAAU,UAAU,SAAS,CAAC;AAG5F,SAAS,WAAW,MAAuB;AAChD,QAAM,OAAO,0BAA0B,KAAK,KAAK,KAAK,CAAC;AACvD,MAAI,MAAM;AACR,UAAM,OAAO,KAAK,CAAC,EAAE,KAAK,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,EAAE,MAAM,GAAG,EAAE,IAAI,CAAC,MAAO,OAAO,SAAS,OAAO,EAAE,KAAK,CAAC,CAAC,IAAI,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAE;AACzI,WAAO,EAAE,IAAI,KAAK,CAAC,GAAG,KAAK;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|
{
|
|
2
2
|
"name": "@abpjs/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The design system for ABP applications on Chakra UI v3 and React 19: tokens, recipes, the app shell, tables, lists, boards, forms and a settings frame. Names no product: the host gives its prefix, colours and words.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/tekthar/abp-ui.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/tekthar/abp-ui#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/tekthar/abp-ui/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"abp",
|
|
16
|
+
"chakra-ui",
|
|
17
|
+
"react",
|
|
18
|
+
"design-system",
|
|
19
|
+
"rtl"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"module": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./rules": {
|
|
33
|
+
"types": "./dist/rules.d.ts",
|
|
34
|
+
"import": "./dist/rules.js",
|
|
35
|
+
"default": "./dist/rules.js"
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"README.md",
|
|
42
|
+
"LICENSE",
|
|
43
|
+
"NOTICE",
|
|
44
|
+
"CHANGELOG.md"
|
|
45
|
+
],
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=20"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public",
|
|
51
|
+
"provenance": true
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsup",
|
|
55
|
+
"dev": "tsup --watch",
|
|
56
|
+
"typecheck": "tsc --noEmit",
|
|
57
|
+
"test": "node --test \"tests/*.test.mjs\"",
|
|
58
|
+
"check:names": "node scripts/check-names.mjs"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@chakra-ui/react": ">=3.38.0 <4",
|
|
62
|
+
"@emotion/react": "^11.14.0",
|
|
63
|
+
"next-themes": "^0.4.6",
|
|
64
|
+
"react": "^19.0.0",
|
|
65
|
+
"react-dom": "^19.0.0"
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@chakra-ui/charts": "3.38.0",
|
|
69
|
+
"@dnd-kit/core": "6.3.1",
|
|
70
|
+
"@dnd-kit/sortable": "10.0.0",
|
|
71
|
+
"@dnd-kit/utilities": "3.2.2",
|
|
72
|
+
"lucide-react": "1.52.0",
|
|
73
|
+
"motion": "13.5.1",
|
|
74
|
+
"recharts": "3.10.1"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@chakra-ui/react": "3.38.0",
|
|
78
|
+
"@emotion/react": "11.14.0",
|
|
79
|
+
"@types/react": "^19.3.0",
|
|
80
|
+
"@types/react-dom": "^19.3.0",
|
|
81
|
+
"next-themes": "0.4.6",
|
|
82
|
+
"react": "19.3.0",
|
|
83
|
+
"react-dom": "19.3.0",
|
|
84
|
+
"tsup": "8.5.1",
|
|
85
|
+
"typescript": "5.9.3"
|
|
86
|
+
}
|
|
87
|
+
}
|