@panneau/core 5.0.0-alpha.28 → 5.0.0-alpha.29

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.
@@ -20,8 +20,11 @@ export interface ResolveFormOptions {
20
20
  * `mode`, in that mode only, in nested fields too. Without a mode, every field is kept as is.
21
21
  */
22
22
  mode?: FormMode;
23
- /** The type of the item, among the resource's `types`: its fields are added. */
24
- type?: string;
23
+ /**
24
+ * The type of the item, among the resource's `types` (decision 0077): its fields come after
25
+ * those of the resource. The layout's nodes that name the fields of other types are removed.
26
+ */
27
+ type?: string | undefined;
25
28
  }
26
29
  /**
27
30
  * Resolves fields and a layout into a form. Fields the current user can't see
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/definition/form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAQ,MAAM,mBAAmB,CAAC;AAI3E,qDAAqD;AACrD,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3C,yFAAyF;AACzF,MAAM,WAAW,YAAY;IACzB,mDAAmD;IACnD,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,2BAA2B;IAC3B,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACzC;;;OAGG;IACH,MAAM,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IAC/B;;;;OAIG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,gFAAgF;IAChF,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AA2DD;;;;;GAKG;AACH,wBAAgB,aAAa,CACzB,MAAM,EAAE,SAAS,KAAK,EAAE,EACxB,MAAM,GAAE,SAAS,UAAU,EAAO,EAClC,EAAE,IAAI,EAAE,GAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAM,GAChD,YAAY,CAyBd;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UpdateField, canViewField } from "./abilities.js";
2
+ import { getTypeFields } from "@panneau/protocol/runtime";
2
3
  //#region src/definition/form.ts
3
4
  function referencedNames(nodes, names = /* @__PURE__ */ new Set()) {
4
5
  nodes.forEach((node) => {
@@ -74,8 +75,7 @@ function resolveFields(fields, layout = [], { mode } = {}) {
74
75
  }
75
76
  /** Resolves the form of a resource: its fields (plus those of the item's type) and its layout. */
76
77
  function resolveForm(resource, options = {}) {
77
- const typeFields = options.type !== void 0 ? resource.types?.find((type) => type.id === options.type)?.fields ?? [] : [];
78
- return resolveFields([...resource.fields, ...typeFields], resource.form?.layout ?? [], options);
78
+ return resolveFields(getTypeFields(resource, options.type), resource.form?.layout ?? [], options);
79
79
  }
80
80
  /** The field names a layout references, in order. */
81
81
  function getLayoutFieldNames(layout) {
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","names":["Field","LayoutNode","Resource","Rule","canUpdateField","canViewField","FormMode","ResolvedForm","fields","fieldsByName","ReadonlyMap","layout","ResolveFormOptions","mode","type","referencedNames","nodes","names","Set","forEach","node","name","undefined","add","children","pruneLayout","flatMap","has","resolveRules","rules","rule","_mode","resolved","resolveFieldRules","field","map","nested","types","resolveFields","Pick","declared","notInForm","readOnly","updateOnly","withRules","createOnly","Map","pruned","referenced","appended","filter","resolveForm","resource","options","typeFields","find","id","form","getLayoutFieldNames"],"sources":["../../src/definition/form.ts"],"sourcesContent":["import type { Field, LayoutNode, Resource, Rule } from '@panneau/protocol';\n\nimport { canUpdateField, canViewField } from './abilities';\n\n/** Whether a form creates an item or updates one. */\nexport type FormMode = 'create' | 'update';\n\n/** A form ready to render: its fields and a layout that references every one of them. */\nexport interface ResolvedForm {\n /** The fields of the form, in definition order. */\n fields: Field[];\n /** The fields, by name. */\n fieldsByName: ReadonlyMap<string, Field>;\n /**\n * The layout tree. Field nodes that name an unknown field, or a field left out of the form,\n * are removed, and fields that no node references are appended at the end, as `field` nodes.\n */\n layout: LayoutNode[];\n}\n\nexport interface ResolveFormOptions {\n /**\n * `create` removes `updateOnly` fields; `update` makes `createOnly` fields read-only. Rules\n * limited to a mode (`{ \"rule\": \"required\", \"mode\": \"create\" }`) are kept, without their\n * `mode`, in that mode only, in nested fields too. Without a mode, every field is kept as is.\n */\n mode?: FormMode;\n /** The type of the item, among the resource's `types`: its fields are added. */\n type?: string;\n}\n\nfunction referencedNames(nodes: readonly LayoutNode[], names = new Set<string>()): Set<string> {\n nodes.forEach((node) => {\n if (node.type === 'field' && node.name !== undefined) {\n names.add(node.name);\n }\n referencedNames(node.children ?? [], names);\n });\n return names;\n}\n\nfunction pruneLayout(\n nodes: readonly LayoutNode[],\n fields: ReadonlyMap<string, Field>,\n): LayoutNode[] {\n return nodes.flatMap((node) => {\n if (node.type === 'field' && (node.name === undefined || !fields.has(node.name))) {\n return [];\n }\n if (node.children === undefined) {\n return [node];\n }\n return [{ ...node, children: pruneLayout(node.children, fields) }];\n });\n}\n\n/** The rules that apply in the mode, without their `mode`. */\nfunction resolveRules(rules: readonly Rule[], mode: FormMode): Rule[] {\n return rules.flatMap((rule) => {\n if (rule.mode === undefined) {\n return [rule];\n }\n if (rule.mode !== mode) {\n return [];\n }\n const { mode: _mode, ...resolved } = rule;\n return [resolved as Rule];\n });\n}\n\n/** A field with the rules of the mode, and those of its nested fields and block types. */\nfunction resolveFieldRules(field: Field, mode: FormMode): Field {\n const resolved: Field = { ...field };\n if (field.rules !== undefined) {\n resolved.rules = resolveRules(field.rules, mode);\n }\n if (field.fields !== undefined) {\n resolved.fields = field.fields.map((nested) => resolveFieldRules(nested, mode));\n }\n if (field.types !== undefined) {\n resolved.types = field.types.map((type) => ({\n ...type,\n fields: type.fields.map((nested) => resolveFieldRules(nested, mode)),\n }));\n }\n return resolved;\n}\n\n/**\n * Resolves fields and a layout into a form. Fields the current user can't see\n * (`abilities.view: false`) are left out, and those they can't edit (`abilities.update: false`)\n * are read-only (decision 0046). Fields that only items give (`notInForm`) are left out too, even\n * when the layout names them (decision 0071).\n */\nexport function resolveFields(\n fields: readonly Field[],\n layout: readonly LayoutNode[] = [],\n { mode }: Pick<ResolveFormOptions, 'mode'> = {},\n): ResolvedForm {\n const resolved = fields.flatMap((declared): Field[] => {\n if (!canViewField(declared) || declared.notInForm === true) {\n return [];\n }\n const field = canUpdateField(declared) ? declared : { ...declared, readOnly: true };\n if (mode === undefined) {\n return [field];\n }\n if (mode === 'create' && field.updateOnly === true) {\n return [];\n }\n const withRules = resolveFieldRules(field, mode);\n if (mode === 'update' && field.createOnly === true) {\n return [{ ...withRules, readOnly: true }];\n }\n return [withRules];\n });\n const fieldsByName = new Map(resolved.map((field) => [field.name, field]));\n const pruned = pruneLayout(layout, fieldsByName);\n const referenced = referencedNames(pruned);\n const appended: LayoutNode[] = resolved\n .filter((field) => !referenced.has(field.name))\n .map((field) => ({ type: 'field', name: field.name }));\n return { fields: resolved, fieldsByName, layout: [...pruned, ...appended] };\n}\n\n/** Resolves the form of a resource: its fields (plus those of the item's type) and its layout. */\nexport function resolveForm(resource: Resource, options: ResolveFormOptions = {}): ResolvedForm {\n const typeFields =\n options.type !== undefined\n ? (resource.types?.find((type) => type.id === options.type)?.fields ?? [])\n : [];\n return resolveFields([...resource.fields, ...typeFields], resource.form?.layout ?? [], options);\n}\n\n/** The field names a layout references, in order. */\nexport function getLayoutFieldNames(layout: readonly LayoutNode[]): string[] {\n return [...referencedNames(layout)];\n}\n"],"mappings":";;AA+BA,SAASe,gBAAgBC,OAA8BC,wBAAQ,IAAIC,IAAY,GAAgB;CAC3FF,MAAMG,SAASC,SAAS;EACpB,IAAIA,KAAKN,SAAS,WAAWM,KAAKC,SAASC,KAAAA,GACvCL,MAAMM,IAAIH,KAAKC,IAAI;EAEvBN,gBAAgBK,KAAKI,YAAY,CAAA,GAAIP,KAAK;CAC9C,CAAC;CACD,OAAOA;AACX;AAEA,SAASQ,YACLT,OACAR,QACY;CACZ,OAAOQ,MAAMU,SAASN,SAAS;EAC3B,IAAIA,KAAKN,SAAS,YAAYM,KAAKC,SAAS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pdateField","canViewField","FormMode","ResolvedForm","fields","fieldsByName","ReadonlyMap","layout","ResolveFormOptions","mode","type","referencedNames","nodes","names","Set","forEach","node","name","undefined","add","children","pruneLayout","flatMap","has","resolveRules","rules","rule","_mode","resolved","resolveFieldRules","field","map","nested","types","resolveFields","Pick","declared","notInForm","readOnly","updateOnly","withRules","createOnly","Map","pruned","referenced","appended","filter","resolveForm","resource","options","form","getLayoutFieldNames"],"sources":["../../src/definition/form.ts"],"sourcesContent":["import type { Field, LayoutNode, Resource, Rule } from '@panneau/protocol';\nimport { getTypeFields } from '@panneau/protocol/runtime';\n\nimport { canUpdateField, canViewField } from './abilities';\n\n/** Whether a form creates an item or updates one. */\nexport type FormMode = 'create' | 'update';\n\n/** A form ready to render: its fields and a layout that references every one of them. */\nexport interface ResolvedForm {\n /** The fields of the form, in definition order. */\n fields: Field[];\n /** The fields, by name. */\n fieldsByName: ReadonlyMap<string, Field>;\n /**\n * The layout tree. Field nodes that name an unknown field, or a field left out of the form,\n * are removed, and fields that no node references are appended at the end, as `field` nodes.\n */\n layout: LayoutNode[];\n}\n\nexport interface ResolveFormOptions {\n /**\n * `create` removes `updateOnly` fields; `update` makes `createOnly` fields read-only. Rules\n * limited to a mode (`{ \"rule\": \"required\", \"mode\": \"create\" }`) are kept, without their\n * `mode`, in that mode only, in nested fields too. Without a mode, every field is kept as is.\n */\n mode?: FormMode;\n /**\n * The type of the item, among the resource's `types` (decision 0077): its fields come after\n * those of the resource. The layout's nodes that name the fields of other types are removed.\n */\n type?: string | undefined;\n}\n\nfunction referencedNames(nodes: readonly LayoutNode[], names = new Set<string>()): Set<string> {\n nodes.forEach((node) => {\n if (node.type === 'field' && node.name !== undefined) {\n names.add(node.name);\n }\n referencedNames(node.children ?? [], names);\n });\n return names;\n}\n\nfunction pruneLayout(\n nodes: readonly LayoutNode[],\n fields: ReadonlyMap<string, Field>,\n): LayoutNode[] {\n return nodes.flatMap((node) => {\n if (node.type === 'field' && (node.name === undefined || !fields.has(node.name))) {\n return [];\n }\n if (node.children === undefined) {\n return [node];\n }\n return [{ ...node, children: pruneLayout(node.children, fields) }];\n });\n}\n\n/** The rules that apply in the mode, without their `mode`. */\nfunction resolveRules(rules: readonly Rule[], mode: FormMode): Rule[] {\n return rules.flatMap((rule) => {\n if (rule.mode === undefined) {\n return [rule];\n }\n if (rule.mode !== mode) {\n return [];\n }\n const { mode: _mode, ...resolved } = rule;\n return [resolved as Rule];\n });\n}\n\n/** A field with the rules of the mode, and those of its nested fields and block types. */\nfunction resolveFieldRules(field: Field, mode: FormMode): Field {\n const resolved: Field = { ...field };\n if (field.rules !== undefined) {\n resolved.rules = resolveRules(field.rules, mode);\n }\n if (field.fields !== undefined) {\n resolved.fields = field.fields.map((nested) => resolveFieldRules(nested, mode));\n }\n if (field.types !== undefined) {\n resolved.types = field.types.map((type) => ({\n ...type,\n fields: type.fields.map((nested) => resolveFieldRules(nested, mode)),\n }));\n }\n return resolved;\n}\n\n/**\n * Resolves fields and a layout into a form. Fields the current user can't see\n * (`abilities.view: false`) are left out, and those they can't edit (`abilities.update: false`)\n * are read-only (decision 0046). Fields that only items give (`notInForm`) are left out too, even\n * when the layout names them (decision 0071).\n */\nexport function resolveFields(\n fields: readonly Field[],\n layout: readonly LayoutNode[] = [],\n { mode }: Pick<ResolveFormOptions, 'mode'> = {},\n): ResolvedForm {\n const resolved = fields.flatMap((declared): Field[] => {\n if (!canViewField(declared) || declared.notInForm === true) {\n return [];\n }\n const field = canUpdateField(declared) ? declared : { ...declared, readOnly: true };\n if (mode === undefined) {\n return [field];\n }\n if (mode === 'create' && field.updateOnly === true) {\n return [];\n }\n const withRules = resolveFieldRules(field, mode);\n if (mode === 'update' && field.createOnly === true) {\n return [{ ...withRules, readOnly: true }];\n }\n return [withRules];\n });\n const fieldsByName = new Map(resolved.map((field) => [field.name, field]));\n const pruned = pruneLayout(layout, fieldsByName);\n const referenced = referencedNames(pruned);\n const appended: LayoutNode[] = resolved\n .filter((field) => !referenced.has(field.name))\n .map((field) => ({ type: 'field', name: field.name }));\n return { fields: resolved, fieldsByName, layout: [...pruned, ...appended] };\n}\n\n/** Resolves the form of a resource: its fields (plus those of the item's type) and its layout. */\nexport function resolveForm(resource: Resource, options: ResolveFormOptions = {}): ResolvedForm {\n return resolveFields(\n getTypeFields(resource, options.type),\n resource.form?.layout ?? [],\n options,\n );\n}\n\n/** The field names a layout references, in order. */\nexport function getLayoutFieldNames(layout: readonly LayoutNode[]): string[] {\n return [...referencedNames(layout)];\n}\n"],"mappings":";;;AAmCA,SAASgB,gBAAgBC,OAA8BC,wBAAQ,IAAIC,IAAY,GAAgB;CAC3FF,MAAMG,SAASC,SAAS;EACpB,IAAIA,KAAKN,SAAS,WAAWM,KAAKC,SAASC,KAAAA,GACvCL,MAAMM,IAAIH,KAAKC,IAAI;EAEvBN,gBAAgBK,KAAKI,YAAY,CAAA,GAAIP,KAAK;CAC9C,CAAC;CACD,OAAOA;AACX;AAEA,SAASQ,YACLT,OACAR,QACY;CACZ,OAAOQ,MAAMU,SAASN,SAAS;EAC3B,IAAIA,KAAKN,SAAS,YAAYM,KAAKC,SAASC,KAAAA,KAAa,CAACd,OAAOmB,IAAIP,KAAKC,IAAI,IAC1E,OAAO,CAAA;EAEX,IAAID,KAAKI,aAAaF,KAAAA,GAClB,OAAO,CAACF,IAAI;EAEhB,OAAO,CAAC;GAAE,GAAGA;GAAMI,UAAUC,YAAYL,KAAKI,UAAUhB,MAAM;EAAE,CAAC;CACrE,CAAC;AACL;;AAGA,SAASoB,aAAaC,OAAwBhB,MAAwB;CAClE,OAAOgB,MAAMH,SAASI,SAAS;EAC3B,IAAIA,KAAKjB,SAASS,KAAAA,GACd,OAAO,CAACQ,IAAI;EAEhB,IAAIA,KAAKjB,SAASA,MACd,OAAO,CAAA;EAEX,MAAM,EAAEA,MAAMkB,OAAO,GAAGC,aAAaF;EACrC,OAAO,CAACE,QAAgB;CAC5B,CAAC;AACL;;AAGA,SAASC,kBAAkBC,OAAcrB,MAAuB;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AQhB,UAAU,CAACc,WAAWrB,IAAIO,MAAMb,IAAI,CAAC,CAAC,CAC9Cc,KAAKD,WAAW;EAAEpB,MAAM;EAASO,MAAMa,MAAMb;CAAK,EAAE;CACzD,OAAO;EAAEb,QAAQwB;EAAUvB;EAAcE,QAAQ,CAAC,GAAGoC,QAAQ,GAAGE,QAAQ;CAAE;AAC9E;;AAGA,SAAgBE,YAAYC,UAAoBC,UAA8B,CAAC,GAAiB;CAC5F,OAAOf,cACHnC,cAAciD,UAAUC,QAAQvC,IAAI,GACpCsC,SAASE,MAAM3C,UAAU,CAAA,GACzB0C,OACJ;AACJ;;AAGA,SAAgBE,oBAAoB5C,QAAyC;CACzE,OAAO,CAAC,GAAGI,gBAAgBJ,MAAM,CAAC;AACtC"}
@@ -4,6 +4,7 @@ import { type ResolvedList } from './list.js';
4
4
  /** What the current user can do with a resource as a whole. */
5
5
  export interface ResourceAbilities {
6
6
  viewAny: boolean;
7
+ /** With `types`, only when one of them can be created too (decision 0077). */
7
8
  create: boolean;
8
9
  }
9
10
  /** A resource with its form, its list and its abilities resolved. */
@@ -1 +1 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/definition/resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAe,MAAM,QAAQ,CAAC;AACjF,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,QAAQ,CAAC;AAExD,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACnB;AAED,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,sFAAsF;IACtF,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,iBAAiB,CAAC;CAChC;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAC3B,QAAQ,EAAE,QAAQ,EAClB,WAAW,GAAE,kBAAuC,GACrD,gBAAgB,CAUlB;AAED,8CAA8C;AAC9C,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAErF"}
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/definition/resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI9D,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAe,MAAM,QAAQ,CAAC;AACjF,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,QAAQ,CAAC;AAExD,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,8EAA8E;IAC9E,MAAM,EAAE,OAAO,CAAC;CACnB;AAED,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,sFAAsF;IACtF,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,iBAAiB,CAAC;CAChC;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAC3B,QAAQ,EAAE,QAAQ,EAClB,WAAW,GAAE,kBAAuC,GACrD,gBAAgB,CAYlB;AAED,8CAA8C;AAC9C,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAErF"}
@@ -1,6 +1,7 @@
1
1
  import { can } from "./abilities.js";
2
2
  import { resolveList } from "./list.js";
3
3
  import { resolveForm } from "./form.js";
4
+ import { getCreatableTypes, hasResourceTypes } from "@panneau/protocol/runtime";
4
5
  //#region src/definition/resource.ts
5
6
  /** Resolves a resource into its form, its list and its abilities. */
6
7
  function resolveResource(resource, formOptions = { mode: "create" }) {
@@ -10,7 +11,7 @@ function resolveResource(resource, formOptions = { mode: "create" }) {
10
11
  list: resolveList(resource),
11
12
  abilities: {
12
13
  viewAny: can(resource.abilities, "viewAny"),
13
- create: can(resource.abilities, "create")
14
+ create: can(resource.abilities, "create") && (!hasResourceTypes(resource) || getCreatableTypes(resource).length > 0)
14
15
  }
15
16
  };
16
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resource.js","names":["Definition","Resource","can","ResolveFormOptions","ResolvedForm","resolveForm","ResolvedList","resolveList","ResourceAbilities","viewAny","create","ResolvedResource","resource","form","list","abilities","resolveResource","formOptions","mode","findResource","definition","id","resources","find"],"sources":["../../src/definition/resource.ts"],"sourcesContent":["import type { Definition, Resource } from '@panneau/protocol';\n\nimport { can } from './abilities';\nimport { type ResolveFormOptions, type ResolvedForm, resolveForm } from './form';\nimport { type ResolvedList, resolveList } from './list';\n\n/** What the current user can do with a resource as a whole. */\nexport interface ResourceAbilities {\n viewAny: boolean;\n create: boolean;\n}\n\n/** A resource with its form, its list and its abilities resolved. */\nexport interface ResolvedResource {\n resource: Resource;\n /** The form to create an item. Use `resolveForm()` for an update, or an item type. */\n form: ResolvedForm;\n list: ResolvedList;\n abilities: ResourceAbilities;\n}\n\n/** Resolves a resource into its form, its list and its abilities. */\nexport function resolveResource(\n resource: Resource,\n formOptions: ResolveFormOptions = { mode: 'create' },\n): ResolvedResource {\n return {\n resource,\n form: resolveForm(resource, formOptions),\n list: resolveList(resource),\n abilities: {\n viewAny: can(resource.abilities, 'viewAny'),\n create: can(resource.abilities, 'create'),\n },\n };\n}\n\n/** Finds a resource of a definition by id. */\nexport function findResource(definition: Definition, id: string): Resource | undefined {\n return definition.resources.find((resource) => resource.id === id);\n}\n"],"mappings":";;;;;AAsBA,SAAgBgB,gBACZJ,UACAK,cAAkC,EAAEC,MAAM,SAAS,GACnC;CAChB,OAAO;EACHN;EACAC,MAAMR,YAAYO,UAAUK,WAAW;EACvCH,MAAMP,YAAYK,QAAQ;EAC1BG,WAAW;GACPN,SAASP,IAAIU,SAASG,WAAW,SAAS;GAC1CL,QAAQR,IAAIU,SAASG,WAAW,QAAQ;EAC5C;CACJ;AACJ;;AAGA,SAAgBI,aAAaC,YAAwBC,IAAkC;CACnF,OAAOD,WAAWE,UAAUC,MAAMX,aAAaA,SAASS,OAAOA,EAAE;AACrE"}
1
+ {"version":3,"file":"resource.js","names":["Definition","Resource","getCreatableTypes","hasResourceTypes","can","ResolveFormOptions","ResolvedForm","resolveForm","ResolvedList","resolveList","ResourceAbilities","viewAny","create","ResolvedResource","resource","form","list","abilities","resolveResource","formOptions","mode","length","findResource","definition","id","resources","find"],"sources":["../../src/definition/resource.ts"],"sourcesContent":["import type { Definition, Resource } from '@panneau/protocol';\nimport { getCreatableTypes, hasResourceTypes } from '@panneau/protocol/runtime';\n\nimport { can } from './abilities';\nimport { type ResolveFormOptions, type ResolvedForm, resolveForm } from './form';\nimport { type ResolvedList, resolveList } from './list';\n\n/** What the current user can do with a resource as a whole. */\nexport interface ResourceAbilities {\n viewAny: boolean;\n /** With `types`, only when one of them can be created too (decision 0077). */\n create: boolean;\n}\n\n/** A resource with its form, its list and its abilities resolved. */\nexport interface ResolvedResource {\n resource: Resource;\n /** The form to create an item. Use `resolveForm()` for an update, or an item type. */\n form: ResolvedForm;\n list: ResolvedList;\n abilities: ResourceAbilities;\n}\n\n/** Resolves a resource into its form, its list and its abilities. */\nexport function resolveResource(\n resource: Resource,\n formOptions: ResolveFormOptions = { mode: 'create' },\n): ResolvedResource {\n return {\n resource,\n form: resolveForm(resource, formOptions),\n list: resolveList(resource),\n abilities: {\n viewAny: can(resource.abilities, 'viewAny'),\n create:\n can(resource.abilities, 'create') &&\n (!hasResourceTypes(resource) || getCreatableTypes(resource).length > 0),\n },\n };\n}\n\n/** Finds a resource of a definition by id. */\nexport function findResource(definition: Definition, id: string): Resource | undefined {\n return definition.resources.find((resource) => resource.id === id);\n}\n"],"mappings":";;;;;;AAwBA,SAAgBkB,gBACZJ,UACAK,cAAkC,EAAEC,MAAM,SAAS,GACnC;CAChB,OAAO;EACHN;EACAC,MAAMR,YAAYO,UAAUK,WAAW;EACvCH,MAAMP,YAAYK,QAAQ;EAC1BG,WAAW;GACPN,SAASP,IAAIU,SAASG,WAAW,SAAS;GAC1CL,QACIR,IAAIU,SAASG,WAAW,QAAQ,MAC/B,CAACd,iBAAiBW,QAAQ,KAAKZ,kBAAkBY,QAAQ,CAAC,CAACO,SAAS;EAC7E;CACJ;AACJ;;AAGA,SAAgBC,aAAaC,YAAwBC,IAAkC;CACnF,OAAOD,WAAWE,UAAUC,MAAMZ,aAAaA,SAASU,OAAOA,EAAE;AACrE"}
package/dist/plugins.d.ts CHANGED
@@ -35,6 +35,11 @@ export interface PanneauPlugin {
35
35
  widgets?: Record<string, PluginComponent>;
36
36
  /** Layout node components, for `component` nodes of form layouts. */
37
37
  components?: Record<string, PluginComponent>;
38
+ /**
39
+ * Panels of the sidebar of forms, by name, for `sidebar` nodes with a `panel` (decision 0075).
40
+ * They get `FormPanelProps` of `@panneau/forms`. A later plugin overrides a built-in panel.
41
+ */
42
+ panels?: Record<string, PluginComponent>;
38
43
  /**
39
44
  * Previews of items, by name, for resources whose `features.preview` is a `component`
40
45
  * (`{ "mode": "component", "component": "page" }`). They get `PreviewProps`.
@@ -48,7 +53,7 @@ export interface PanneauPlugin {
48
53
  themes?: Record<string, Theme>;
49
54
  }
50
55
  /** The kinds of components a plugin can provide. */
51
- export type PluginComponentKind = 'fields' | 'displays' | 'listLayouts' | 'actions' | 'pages' | 'widgets' | 'components' | 'previews';
56
+ export type PluginComponentKind = 'fields' | 'displays' | 'listLayouts' | 'actions' | 'pages' | 'widgets' | 'components' | 'panels' | 'previews';
52
57
  /** Everything the plugins provide, merged. A later plugin overrides an earlier one. */
53
58
  export interface PluginRegistry {
54
59
  /** The plugins, in order. */
@@ -60,6 +65,7 @@ export interface PluginRegistry {
60
65
  pages: ReadonlyMap<string, PluginComponent>;
61
66
  widgets: ReadonlyMap<string, PluginComponent>;
62
67
  components: ReadonlyMap<string, PluginComponent>;
68
+ panels: ReadonlyMap<string, PluginComponent>;
63
69
  previews: ReadonlyMap<string, PluginComponent>;
64
70
  /** The commands of the plugins, in plugin order: `getCommands()` makes them. */
65
71
  commands: readonly CommandSource[];
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,sFAAsF;AACtF,YAAY,EAAE,KAAK,EAAE,CAAC;AAEtB;;;GAGG;AAEH,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;AAEjD,oDAAoD;AACpD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C,kFAAkF;AAClF,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,CAAC,MAAM,OAAO,CAAC,QAAQ,GAAG;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC,CAAC;AAE1F,0FAA0F;AAC1F,MAAM,WAAW,aAAa;IAC1B,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACzC,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC3C,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC9C,iEAAiE;IACjE,OAA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CAkB9F;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,eAAe,GAAG,SAAS,EAClC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,GACnC,KAAK,CAWP"}
package/dist/plugins.js CHANGED
@@ -8,6 +8,7 @@ var COMPONENT_KINDS = [
8
8
  "pages",
9
9
  "widgets",
10
10
  "components",
11
+ "panels",
11
12
  "previews"
12
13
  ];
13
14
  /** Declares a plugin. It returns the plugin as is, with its type checked. */
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.js","names":["ComponentType","DefinitionTheme","Theme","mergeThemes","CommandSource","PluginComponent","Messages","Record","MessagesLoader","Promise","default","PanneauPlugin","id","fields","displays","listLayouts","actions","pages","widgets","components","previews","commands","locales","themes","PluginComponentKind","COMPONENT_KINDS","PluginRegistry","plugins","ReadonlyMap","definePlugin","plugin","createPluginRegistry","ids","Set","forEach","has","Error","add","Object","fromEntries","map","kind","Map","flatMap","entries","locale","loader","set","get","undefined","loadMessages","registry","language","split","loaders","loaded","all","result","assign","resolveTheme","theme","colorScheme","_colorScheme","extends","own","extended","found","console","warn"],"sources":["../src/plugins.ts"],"sourcesContent":["import type { ComponentType } from 'react';\n\nimport type { DefinitionTheme, Theme } from '@panneau/protocol';\nimport { mergeThemes } from '@panneau/protocol/runtime';\n\nimport type { CommandSource } from './commands';\n\n/** A theme of `@panneau/ui`, as plain data: what plugins register (decision 0024). */\nexport type { Theme };\n\n/**\n * A component provided by a plugin. Its props are defined by the package that renders it (fields,\n * lists, app), so the registry stores it as given.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- see above\nexport type PluginComponent = ComponentType<any>;\n\n/** UI messages of a locale, keyed by message id. */\nexport type Messages = Record<string, string>;\n\n/** Messages, or a function that loads them (`() => import('./lang/fr.json')`). */\nexport type MessagesLoader = Messages | (() => Promise<Messages | { default: Messages }>);\n\n/** What a plugin adds to Panneau. Every part is keyed by the name the definition uses. */\nexport interface PanneauPlugin {\n /** Unique id of the plugin. */\n id: string;\n /** Field components, by field type (`text`, `page-slug`). */\n fields?: Record<string, PluginComponent>;\n /** Components that display a value in lists, by display (`date`, `page-slug`). */\n displays?: Record<string, PluginComponent>;\n /** List layouts, by id (`table`, `cards`). */\n listLayouts?: Record<string, PluginComponent>;\n /** Handlers of `client` actions, by the action's `component`. */\n actions?: Record<string, PluginComponent>;\n /** Pages, by component name (`dashboard`). */\n pages?: Record<string, PluginComponent>;\n /**\n * Dashboard widgets, by widget type (`map`). They get `WidgetProps`. The built-in types\n * (`stat`, `series`, `list`) stay built in: the `dashboard` page is what a plugin replaces.\n */\n widgets?: Record<string, PluginComponent>;\n /** Layout node components, for `component` nodes of form layouts. */\n components?: Record<string, PluginComponent>;\n /**\n * Previews of items, by name, for resources whose `features.preview` is a `component`\n * (`{ \"mode\": \"component\", \"component\": \"page\" }`). They get `PreviewProps`.\n */\n previews?: Record<string, PluginComponent>;\n /** Commands of the \"Go to…\" palette, or a function that makes them for the definition. */\n commands?: CommandSource;\n /** UI messages, by locale. Messages of later plugins override earlier ones. */\n locales?: Record<string, MessagesLoader>;\n /** Themes, by id, that the theme of the definition can extend. */\n themes?: Record<string, Theme>;\n}\n\n/** The kinds of components a plugin can provide. */\nexport type PluginComponentKind =\n | 'fields'\n | 'displays'\n | 'listLayouts'\n | 'actions'\n | 'pages'\n | 'widgets'\n | 'components'\n | 'previews';\n\nconst COMPONENT_KINDS: PluginComponentKind[] = [\n 'fields',\n 'displays',\n 'listLayouts',\n 'actions',\n 'pages',\n 'widgets',\n 'components',\n 'previews',\n];\n\n/** Everything the plugins provide, merged. A later plugin overrides an earlier one. */\nexport interface PluginRegistry {\n /** The plugins, in order. */\n plugins: readonly PanneauPlugin[];\n fields: ReadonlyMap<string, PluginComponent>;\n displays: ReadonlyMap<string, PluginComponent>;\n listLayouts: ReadonlyMap<string, PluginComponent>;\n actions: ReadonlyMap<string, PluginComponent>;\n pages: ReadonlyMap<string, PluginComponent>;\n widgets: ReadonlyMap<string, PluginComponent>;\n components: ReadonlyMap<string, PluginComponent>;\n previews: ReadonlyMap<string, PluginComponent>;\n /** The commands of the plugins, in plugin order: `getCommands()` makes them. */\n commands: readonly CommandSource[];\n /** Message loaders of each locale, in plugin order. */\n locales: ReadonlyMap<string, readonly MessagesLoader[]>;\n themes: ReadonlyMap<string, Theme>;\n}\n\n/** Declares a plugin. It returns the plugin as is, with its type checked. */\nexport function definePlugin(plugin: PanneauPlugin): PanneauPlugin {\n return plugin;\n}\n\n/**\n * Merges plugins into a registry. Later plugins override the components and themes of earlier\n * ones, so a project can replace a built-in field. Plugin ids must be unique.\n */\nexport function createPluginRegistry(plugins: readonly PanneauPlugin[]): PluginRegistry {\n const ids = new Set<string>();\n plugins.forEach((plugin) => {\n if (ids.has(plugin.id)) {\n throw new Error(`Two plugins have the id \\`${plugin.id}\\`.`);\n }\n ids.add(plugin.id);\n });\n const components = Object.fromEntries(\n COMPONENT_KINDS.map((kind) => [\n kind,\n new Map(plugins.flatMap((plugin) => Object.entries(plugin[kind] ?? {}))),\n ]),\n ) as Record<PluginComponentKind, Map<string, PluginComponent>>;\n const locales = new Map<string, MessagesLoader[]>();\n plugins.forEach((plugin) =>\n Object.entries(plugin.locales ?? {}).forEach(([locale, loader]) => {\n locales.set(locale, [...(locales.get(locale) ?? []), loader]);\n }),\n );\n return {\n plugins: [...plugins],\n ...components,\n locales,\n themes: new Map(plugins.flatMap((plugin) => Object.entries(plugin.themes ?? {}))),\n commands: plugins.flatMap((plugin) =>\n plugin.commands !== undefined ? [plugin.commands] : [],\n ),\n };\n}\n\n/**\n * Loads the messages of a locale from every plugin that provides it, merged in plugin order. A\n * regional locale (`fr-CA`) falls back to its language (`fr`) for missing messages.\n */\nexport async function loadMessages(registry: PluginRegistry, locale: string): Promise<Messages> {\n const language = locale.split('-')[0] ?? locale;\n const loaders = [\n ...(language !== locale ? (registry.locales.get(language) ?? []) : []),\n ...(registry.locales.get(locale) ?? []),\n ];\n const loaded = await Promise.all(\n loaders.map(async (loader) => {\n if (typeof loader !== 'function') {\n return loader;\n }\n const result = await loader();\n return 'default' in result && typeof result.default === 'object'\n ? (result.default as Messages)\n : (result as Messages);\n }),\n );\n return Object.assign({}, ...loaded) as Messages;\n}\n\n/**\n * The theme of the admin: the themes of plugins that the definition's theme extends, in order, then\n * the definition's own tokens, tones and variants. An id no plugin registers is skipped, with a\n * warning.\n */\nexport function resolveTheme(\n theme: DefinitionTheme | undefined,\n themes: ReadonlyMap<string, Theme>,\n): Theme {\n const { colorScheme: _colorScheme, extends: ids, ...own } = theme ?? {};\n const extended = (typeof ids === 'string' ? [ids] : (ids ?? [])).flatMap((id) => {\n const found = themes.get(id);\n if (found === undefined) {\n console.warn(`[panneau] No plugin registers the theme \"${id}\".`);\n return [];\n }\n return [found];\n });\n return mergeThemes(...extended, own);\n}\n"],"mappings":";;AAoEA,IAAMyB,kBAAyC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAU;;AAuBd,SAAgBI,aAAaC,QAAsC;CAC/D,OAAOA;AACX;;;;;AAMA,SAAgBC,qBAAqBJ,SAAmD;CACpF,MAAMK,sBAAM,IAAIC,IAAY;CAC5BN,QAAQO,SAASJ,WAAW;EACxB,IAAIE,IAAIG,IAAIL,OAAOlB,EAAE,GACjB,MAAM,IAAIwB,MAAM,6BAA6BN,OAAOlB,GAAE,IAAK;EAE/DoB,IAAIK,IAAIP,OAAOlB,EAAE;CACrB,CAAC;CACD,MAAMO,aAAamB,OAAOC,YACtBd,gBAAgBe,KAAKC,SAAS,CAC1BA,MACA,IAAIC,IAAIf,QAAQgB,SAASb,WAAWQ,OAAOM,QAAQd,OAAOW,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3E,CACL;CACA,MAAMnB,0BAAU,IAAIoB,IAA8B;CAClDf,QAAQO,SAASJ,WACbQ,OAAOM,QAAQd,OAAOR,WAAW,CAAC,CAAC,CAAC,CAACY,SAAS,CAACW,QAAQC,YAAY;EAC/Dx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AUjB,KAAAA,GAAW;GACrBkB,QAAQC,KAAK,4CAA4CxD,GAAE,GAAI;GAC/D,OAAO,CAAA;EACX;EACA,OAAO,CAACsD,KAAK;CACjB,CAAC;CACD,OAAO/D,YAAY,GAAG8D,UAAUD,GAAG;AACvC"}
1
+ {"version":3,"file":"plugins.js","names":["ComponentType","DefinitionTheme","Theme","mergeThemes","CommandSource","PluginComponent","Messages","Record","MessagesLoader","Promise","default","PanneauPlugin","id","fields","displays","listLayouts","actions","pages","widgets","components","panels","previews","commands","locales","themes","PluginComponentKind","COMPONENT_KINDS","PluginRegistry","plugins","ReadonlyMap","definePlugin","plugin","createPluginRegistry","ids","Set","forEach","has","Error","add","Object","fromEntries","map","kind","Map","flatMap","entries","locale","loader","set","get","undefined","loadMessages","registry","language","split","loaders","loaded","all","result","assign","resolveTheme","theme","colorScheme","_colorScheme","extends","own","extended","found","console","warn"],"sources":["../src/plugins.ts"],"sourcesContent":["import type { ComponentType } from 'react';\n\nimport type { DefinitionTheme, Theme } from '@panneau/protocol';\nimport { mergeThemes } from '@panneau/protocol/runtime';\n\nimport type { CommandSource } from './commands';\n\n/** A theme of `@panneau/ui`, as plain data: what plugins register (decision 0024). */\nexport type { Theme };\n\n/**\n * A component provided by a plugin. Its props are defined by the package that renders it (fields,\n * lists, app), so the registry stores it as given.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- see above\nexport type PluginComponent = ComponentType<any>;\n\n/** UI messages of a locale, keyed by message id. */\nexport type Messages = Record<string, string>;\n\n/** Messages, or a function that loads them (`() => import('./lang/fr.json')`). */\nexport type MessagesLoader = Messages | (() => Promise<Messages | { default: Messages }>);\n\n/** What a plugin adds to Panneau. Every part is keyed by the name the definition uses. */\nexport interface PanneauPlugin {\n /** Unique id of the plugin. */\n id: string;\n /** Field components, by field type (`text`, `page-slug`). */\n fields?: Record<string, PluginComponent>;\n /** Components that display a value in lists, by display (`date`, `page-slug`). */\n displays?: Record<string, PluginComponent>;\n /** List layouts, by id (`table`, `cards`). */\n listLayouts?: Record<string, PluginComponent>;\n /** Handlers of `client` actions, by the action's `component`. */\n actions?: Record<string, PluginComponent>;\n /** Pages, by component name (`dashboard`). */\n pages?: Record<string, PluginComponent>;\n /**\n * Dashboard widgets, by widget type (`map`). They get `WidgetProps`. The built-in types\n * (`stat`, `series`, `list`) stay built in: the `dashboard` page is what a plugin replaces.\n */\n widgets?: Record<string, PluginComponent>;\n /** Layout node components, for `component` nodes of form layouts. */\n components?: Record<string, PluginComponent>;\n /**\n * Panels of the sidebar of forms, by name, for `sidebar` nodes with a `panel` (decision 0075).\n * They get `FormPanelProps` of `@panneau/forms`. A later plugin overrides a built-in panel.\n */\n panels?: Record<string, PluginComponent>;\n /**\n * Previews of items, by name, for resources whose `features.preview` is a `component`\n * (`{ \"mode\": \"component\", \"component\": \"page\" }`). They get `PreviewProps`.\n */\n previews?: Record<string, PluginComponent>;\n /** Commands of the \"Go to…\" palette, or a function that makes them for the definition. */\n commands?: CommandSource;\n /** UI messages, by locale. Messages of later plugins override earlier ones. */\n locales?: Record<string, MessagesLoader>;\n /** Themes, by id, that the theme of the definition can extend. */\n themes?: Record<string, Theme>;\n}\n\n/** The kinds of components a plugin can provide. */\nexport type PluginComponentKind =\n | 'fields'\n | 'displays'\n | 'listLayouts'\n | 'actions'\n | 'pages'\n | 'widgets'\n | 'components'\n | 'panels'\n | 'previews';\n\nconst COMPONENT_KINDS: PluginComponentKind[] = [\n 'fields',\n 'displays',\n 'listLayouts',\n 'actions',\n 'pages',\n 'widgets',\n 'components',\n 'panels',\n 'previews',\n];\n\n/** Everything the plugins provide, merged. A later plugin overrides an earlier one. */\nexport interface PluginRegistry {\n /** The plugins, in order. */\n plugins: readonly PanneauPlugin[];\n fields: ReadonlyMap<string, PluginComponent>;\n displays: ReadonlyMap<string, PluginComponent>;\n listLayouts: ReadonlyMap<string, PluginComponent>;\n actions: ReadonlyMap<string, PluginComponent>;\n pages: ReadonlyMap<string, PluginComponent>;\n widgets: ReadonlyMap<string, PluginComponent>;\n components: ReadonlyMap<string, PluginComponent>;\n panels: ReadonlyMap<string, PluginComponent>;\n previews: ReadonlyMap<string, PluginComponent>;\n /** The commands of the plugins, in plugin order: `getCommands()` makes them. */\n commands: readonly CommandSource[];\n /** Message loaders of each locale, in plugin order. */\n locales: ReadonlyMap<string, readonly MessagesLoader[]>;\n themes: ReadonlyMap<string, Theme>;\n}\n\n/** Declares a plugin. It returns the plugin as is, with its type checked. */\nexport function definePlugin(plugin: PanneauPlugin): PanneauPlugin {\n return plugin;\n}\n\n/**\n * Merges plugins into a registry. Later plugins override the components and themes of earlier\n * ones, so a project can replace a built-in field. Plugin ids must be unique.\n */\nexport function createPluginRegistry(plugins: readonly PanneauPlugin[]): PluginRegistry {\n const ids = new Set<string>();\n plugins.forEach((plugin) => {\n if (ids.has(plugin.id)) {\n throw new Error(`Two plugins have the id \\`${plugin.id}\\`.`);\n }\n ids.add(plugin.id);\n });\n const components = Object.fromEntries(\n COMPONENT_KINDS.map((kind) => [\n kind,\n new Map(plugins.flatMap((plugin) => Object.entries(plugin[kind] ?? {}))),\n ]),\n ) as Record<PluginComponentKind, Map<string, PluginComponent>>;\n const locales = new Map<string, MessagesLoader[]>();\n plugins.forEach((plugin) =>\n Object.entries(plugin.locales ?? {}).forEach(([locale, loader]) => {\n locales.set(locale, [...(locales.get(locale) ?? []), loader]);\n }),\n );\n return {\n plugins: [...plugins],\n ...components,\n locales,\n themes: new Map(plugins.flatMap((plugin) => Object.entries(plugin.themes ?? {}))),\n commands: plugins.flatMap((plugin) =>\n plugin.commands !== undefined ? [plugin.commands] : [],\n ),\n };\n}\n\n/**\n * Loads the messages of a locale from every plugin that provides it, merged in plugin order. A\n * regional locale (`fr-CA`) falls back to its language (`fr`) for missing messages.\n */\nexport async function loadMessages(registry: PluginRegistry, locale: string): Promise<Messages> {\n const language = locale.split('-')[0] ?? locale;\n const loaders = [\n ...(language !== locale ? (registry.locales.get(language) ?? []) : []),\n ...(registry.locales.get(locale) ?? []),\n ];\n const loaded = await Promise.all(\n loaders.map(async (loader) => {\n if (typeof loader !== 'function') {\n return loader;\n }\n const result = await loader();\n return 'default' in result && typeof result.default === 'object'\n ? (result.default as Messages)\n : (result as Messages);\n }),\n );\n return Object.assign({}, ...loaded) as Messages;\n}\n\n/**\n * The theme of the admin: the themes of plugins that the definition's theme extends, in order, then\n * the definition's own tokens, tones and variants. An id no plugin registers is skipped, with a\n * warning.\n */\nexport function resolveTheme(\n theme: DefinitionTheme | undefined,\n themes: ReadonlyMap<string, Theme>,\n): Theme {\n const { colorScheme: _colorScheme, extends: ids, ...own } = theme ?? {};\n const extended = (typeof ids === 'string' ? [ids] : (ids ?? [])).flatMap((id) => {\n const found = themes.get(id);\n if (found === undefined) {\n console.warn(`[panneau] No plugin registers the theme \"${id}\".`);\n return [];\n }\n return [found];\n });\n return mergeThemes(...extended, own);\n}\n"],"mappings":";;AA0EA,IAAM0B,kBAAyC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAU;;AAwBd,SAAgBI,aAAaC,QAAsC;CAC/D,OAAOA;AACX;;;;;AAMA,SAAgBC,qBAAqBJ,SAAmD;CACpF,MAAMK,sBAAM,IAAIC,IAAY;CAC5BN,QAAQO,SAASJ,WAAW;EACxB,IAAIE,IAAIG,IAAIL,OAAOnB,EAAE,GACjB,MAAM,IAAIyB,MAAM,6BAA6BN,OAAOnB,GAAE,IAAK;EAE/DqB,IAAIK,IAAIP,OAAOnB,EAAE;CACrB,CAAC;CACD,MAAMO,aAAaoB,OAAOC,YACtBd,gBAAgBe,KAAKC,SAAS,CAC1BA,MACA,IAAIC,IAAIf,QAAQgB,SAASb,WAAWQ,OAAOM,QAAQd,OAAOW,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3E,CACL;CACA,MAAMnB,0BAAU,IAAIoB,IAA8B;CAClDf,QAAQO,SAASJ,WACbQ,OAAOM,QAAQd,OAAOR,WAAW,CAAC,CAAC,CAAC,CAACY,SAA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C,EAAE;EAC3B,IAAIuD,UAAUjB,KAAAA,GAAW;GACrBkB,QAAQC,KAAK,4CAA4CzD,GAAE,GAAI;GAC/D,OAAO,CAAA;EACX;EACA,OAAO,CAACuD,KAAK;CACjB,CAAC;CACD,OAAOhE,YAAY,GAAG+D,UAAUD,GAAG;AACvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/core",
3
- "version": "5.0.0-alpha.28",
3
+ "version": "5.0.0-alpha.29",
4
4
  "description": "The engine of Panneau: plugin registry, definition to forms and lists, form and list state, with React hooks. No UI.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,6 +33,6 @@
33
33
  "react": "^19.2.0"
34
34
  },
35
35
  "dependencies": {
36
- "@panneau/protocol": "5.0.0-alpha.28"
36
+ "@panneau/protocol": "5.0.0-alpha.29"
37
37
  }
38
38
  }