@panneau/protocol 5.0.0-alpha.0 → 5.0.0-alpha.2
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/README.md +13 -8
- package/dist/conformance/index.d.ts.map +1 -1
- package/dist/conformance/index.js +27 -0
- package/dist/conformance/index.js.map +1 -1
- package/dist/constants.d.ts +21 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +73 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -13
- package/dist/mock/example.d.ts.map +1 -1
- package/dist/mock/example.js +4 -0
- package/dist/mock/example.js.map +1 -1
- package/dist/mock/index.d.ts.map +1 -1
- package/dist/mock/index.js +5 -1
- package/dist/mock/index.js.map +1 -1
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.d.ts.map +1 -1
- package/dist/openapi.js +13 -2
- package/dist/openapi.js.map +1 -1
- package/dist/problem.d.ts +7 -0
- package/dist/problem.d.ts.map +1 -0
- package/dist/problem.js +22 -0
- package/dist/problem.js.map +1 -0
- package/dist/query.d.ts +26 -2
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +37 -6
- package/dist/query.js.map +1 -1
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +1 -1
- package/dist/rules.js.map +1 -1
- package/dist/runtime/index.d.ts +11 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +10 -0
- package/dist/schemas/action.d.ts +0 -3
- package/dist/schemas/action.d.ts.map +1 -1
- package/dist/schemas/action.js +1 -11
- package/dist/schemas/action.js.map +1 -1
- package/dist/schemas/api.d.ts.map +1 -1
- package/dist/schemas/api.js +1 -1
- package/dist/schemas/api.js.map +1 -1
- package/dist/schemas/boot.d.ts +0 -5
- package/dist/schemas/boot.d.ts.map +1 -1
- package/dist/schemas/boot.js +1 -6
- package/dist/schemas/boot.js.map +1 -1
- package/dist/schemas/definition.d.ts +54 -1
- package/dist/schemas/definition.d.ts.map +1 -1
- package/dist/schemas/definition.js +2 -5
- package/dist/schemas/definition.js.map +1 -1
- package/dist/schemas/field.d.ts +0 -6
- package/dist/schemas/field.d.ts.map +1 -1
- package/dist/schemas/field.js +2 -35
- package/dist/schemas/field.js.map +1 -1
- package/dist/schemas/index.d.ts +224 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +15 -6
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/layout.d.ts +0 -3
- package/dist/schemas/layout.d.ts.map +1 -1
- package/dist/schemas/layout.js +1 -13
- package/dist/schemas/layout.js.map +1 -1
- package/dist/schemas/list.d.ts +0 -3
- package/dist/schemas/list.d.ts.map +1 -1
- package/dist/schemas/list.js +2 -9
- package/dist/schemas/list.js.map +1 -1
- package/dist/schemas/theme.d.ts +179 -0
- package/dist/schemas/theme.d.ts.map +1 -0
- package/dist/schemas/theme.js +66 -0
- package/dist/schemas/theme.js.map +1 -0
- package/dist/themes.d.ts +11 -0
- package/dist/themes.d.ts.map +1 -0
- package/dist/themes.js +80 -0
- package/dist/themes.js.map +1 -0
- package/dist/validate.d.ts +0 -3
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +2 -7
- package/dist/validate.js.map +1 -1
- package/package.json +7 -1
- package/schema/boot.schema.json +255 -12
- package/schema/definition.schema.json +255 -12
- package/schema/openapi.json +422 -15
- package/schema/theme.schema.json +234 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB,OAAO,EAAa,SAAS,EAA8B,MAAM,UAAU,CAAC;AAC5E,OAAO,EAIH,QAAQ,EAKX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAQ,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,UAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDY,CAAC;AAEtC,0FAA0F;AAC1F,wBAAgB,oBAAoB;QACE,MAAM;kFAG3C"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Abilities, Condition, Id, Option, RouteReference } from "./common.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Action, ActionConfirm, ActionPlacement, ActionScope
|
|
5
|
-
import {
|
|
2
|
+
import { BlockType, Field, Rule } from "./field.js";
|
|
3
|
+
import { LayoutNode } from "./layout.js";
|
|
4
|
+
import { Action, ActionConfirm, ActionPlacement, ActionScope } from "./action.js";
|
|
5
|
+
import { Column, Filter, ListDefinition } from "./list.js";
|
|
6
6
|
import { Resource, ResourceFeatures } from "./resource.js";
|
|
7
|
+
import { DefinitionTheme, Theme, ThemeFont, ThemeFontFace, ThemeFontStylesheet, ThemeTokens, ToneInput, ToneValues } from "./theme.js";
|
|
7
8
|
import { Auth, AuthProvider, Definition, MenuItem, Page, Uploads, User, Widget } from "./definition.js";
|
|
8
9
|
import { ActionItemResult, ActionRequest, ActionResult, ActionRun, ActionRunResponse, Item, ItemResponse, ListResponse, Media, MediaListResponse, MediaResponse, MediaTransform, Pagination, PreviewResponse, Problem, SearchResponse, Selection, Session } from "./api.js";
|
|
9
|
-
import {
|
|
10
|
+
import { BootConfig } from "./boot.js";
|
|
10
11
|
import { z } from "zod";
|
|
11
12
|
//#region src/schemas/index.ts
|
|
12
13
|
/** The named schemas of the protocol, as they appear in the generated JSON Schema and OpenAPI files. */
|
|
@@ -36,6 +37,14 @@ var namedSchemas = {
|
|
|
36
37
|
Page,
|
|
37
38
|
Widget,
|
|
38
39
|
Uploads,
|
|
40
|
+
ThemeTokens,
|
|
41
|
+
ToneValues,
|
|
42
|
+
ToneInput,
|
|
43
|
+
ThemeFontFace,
|
|
44
|
+
ThemeFontStylesheet,
|
|
45
|
+
ThemeFont,
|
|
46
|
+
Theme,
|
|
47
|
+
DefinitionTheme,
|
|
39
48
|
Definition,
|
|
40
49
|
Item,
|
|
41
50
|
Pagination,
|
|
@@ -63,6 +72,6 @@ function createSchemaRegistry() {
|
|
|
63
72
|
return registry;
|
|
64
73
|
}
|
|
65
74
|
//#endregion
|
|
66
|
-
export { Abilities, Action, ActionConfirm, ActionItemResult, ActionPlacement, ActionRequest, ActionResult, ActionRun, ActionRunResponse, ActionScope, Auth, AuthProvider,
|
|
75
|
+
export { Abilities, Action, ActionConfirm, ActionItemResult, ActionPlacement, ActionRequest, ActionResult, ActionRun, ActionRunResponse, ActionScope, Auth, AuthProvider, BlockType, BootConfig, Column, Condition, Definition, DefinitionTheme, Field, Filter, Id, Item, ItemResponse, LayoutNode, ListDefinition, ListResponse, Media, MediaListResponse, MediaResponse, MediaTransform, MenuItem, Option, Page, Pagination, PreviewResponse, Problem, Resource, ResourceFeatures, RouteReference, Rule, SearchResponse, Selection, Session, Theme, ThemeFont, ThemeFontFace, ThemeFontStylesheet, ThemeTokens, ToneInput, ToneValues, Uploads, User, Widget, createSchemaRegistry, namedSchemas };
|
|
67
76
|
|
|
68
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/schemas/index.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Action, ActionConfirm, ActionPlacement, ActionScope } from './action';\nimport {\n ActionItemResult,\n ActionRequest,\n ActionResult,\n ActionRun,\n ActionRunResponse,\n Item,\n ItemResponse,\n ListResponse,\n Media,\n MediaListResponse,\n MediaResponse,\n MediaTransform,\n Pagination,\n PreviewResponse,\n Problem,\n SearchResponse,\n Selection,\n Session,\n} from './api';\nimport { Abilities, Condition, Id, Option, RouteReference } from './common';\nimport {\n Auth,\n AuthProvider,\n Definition,\n MenuItem,\n Page,\n Uploads,\n User,\n Widget,\n} from './definition';\nimport { BlockType, Field, Rule } from './field';\nimport { LayoutNode } from './layout';\nimport { Column, Filter, ListDefinition } from './list';\nimport { Resource, ResourceFeatures } from './resource';\n\nexport * from './common';\nexport * from './field';\nexport * from './layout';\nexport * from './list';\nexport * from './action';\nexport * from './resource';\nexport * from './definition';\nexport * from './api';\nexport * from './boot';\n\n/** The named schemas of the protocol, as they appear in the generated JSON Schema and OpenAPI files. */\nexport const namedSchemas = {\n Id,\n Abilities,\n RouteReference,\n Condition,\n Option,\n Rule,\n BlockType,\n Field,\n LayoutNode,\n Column,\n Filter,\n ListDefinition,\n ActionScope,\n ActionPlacement,\n ActionConfirm,\n Action,\n ResourceFeatures,\n Resource,\n User,\n AuthProvider,\n Auth,\n MenuItem,\n Page,\n Widget,\n Uploads,\n Definition,\n Item,\n Pagination,\n ItemResponse,\n ListResponse,\n Problem,\n Selection,\n ActionRequest,\n ActionItemResult,\n ActionResult,\n ActionRun,\n ActionRunResponse,\n MediaTransform,\n Media,\n MediaResponse,\n MediaListResponse,\n Session,\n SearchResponse,\n PreviewResponse,\n} satisfies Record<string, z.ZodType>;\n\n/** A registry of the named schemas, used to reference them by name in generated files. */\nexport function createSchemaRegistry() {\n const registry = z.registry<{ id: string }>();\n Object.entries(namedSchemas).forEach(([id, schema]) => registry.add(schema, { id }));\n return registry;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/schemas/index.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Action, ActionConfirm, ActionPlacement, ActionScope } from './action';\nimport {\n ActionItemResult,\n ActionRequest,\n ActionResult,\n ActionRun,\n ActionRunResponse,\n Item,\n ItemResponse,\n ListResponse,\n Media,\n MediaListResponse,\n MediaResponse,\n MediaTransform,\n Pagination,\n PreviewResponse,\n Problem,\n SearchResponse,\n Selection,\n Session,\n} from './api';\nimport { Abilities, Condition, Id, Option, RouteReference } from './common';\nimport {\n Auth,\n AuthProvider,\n Definition,\n MenuItem,\n Page,\n Uploads,\n User,\n Widget,\n} from './definition';\nimport { BlockType, Field, Rule } from './field';\nimport { LayoutNode } from './layout';\nimport { Column, Filter, ListDefinition } from './list';\nimport { Resource, ResourceFeatures } from './resource';\nimport {\n DefinitionTheme,\n Theme,\n ThemeFont,\n ThemeFontFace,\n ThemeFontStylesheet,\n ThemeTokens,\n ToneInput,\n ToneValues,\n} from './theme';\n\nexport * from './common';\nexport * from './field';\nexport * from './layout';\nexport * from './list';\nexport * from './action';\nexport * from './resource';\nexport * from './theme';\nexport * from './definition';\nexport * from './api';\nexport * from './boot';\n\n/** The named schemas of the protocol, as they appear in the generated JSON Schema and OpenAPI files. */\nexport const namedSchemas = {\n Id,\n Abilities,\n RouteReference,\n Condition,\n Option,\n Rule,\n BlockType,\n Field,\n LayoutNode,\n Column,\n Filter,\n ListDefinition,\n ActionScope,\n ActionPlacement,\n ActionConfirm,\n Action,\n ResourceFeatures,\n Resource,\n User,\n AuthProvider,\n Auth,\n MenuItem,\n Page,\n Widget,\n Uploads,\n ThemeTokens,\n ToneValues,\n ToneInput,\n ThemeFontFace,\n ThemeFontStylesheet,\n ThemeFont,\n Theme,\n DefinitionTheme,\n Definition,\n Item,\n Pagination,\n ItemResponse,\n ListResponse,\n Problem,\n Selection,\n ActionRequest,\n ActionItemResult,\n ActionResult,\n ActionRun,\n ActionRunResponse,\n MediaTransform,\n Media,\n MediaResponse,\n MediaListResponse,\n Session,\n SearchResponse,\n PreviewResponse,\n} satisfies Record<string, z.ZodType>;\n\n/** A registry of the named schemas, used to reference them by name in generated files. */\nexport function createSchemaRegistry() {\n const registry = z.registry<{ id: string }>();\n Object.entries(namedSchemas).forEach(([id, schema]) => registry.add(schema, { id }));\n return registry;\n}\n"],"mappings":";;;;;;;;;;;;;AA6DA,IAAa,eAAe;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;;AAGA,SAAgB,uBAAuB;CACnC,MAAM,WAAW,EAAE,SAAyB;CAC5C,OAAO,QAAQ,YAAY,CAAC,CAAC,SAAS,CAAC,IAAI,YAAY,SAAS,IAAI,QAAQ,EAAE,GAAG,CAAC,CAAC;CACnF,OAAO;AACX"}
|
package/dist/schemas/layout.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Condition } from './common';
|
|
3
|
-
/** Layout node types every Panneau frontend renders. */
|
|
4
|
-
export declare const BUILT_IN_LAYOUT_NODE_TYPES: readonly ["row", "column", "section", "tabs", "tab", "sidebar", "field", "text", "component"];
|
|
5
3
|
export declare const LayoutNode: z.ZodObject<{
|
|
6
4
|
type: z.ZodString;
|
|
7
5
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -24,6 +22,5 @@ export declare const LayoutNode: z.ZodObject<{
|
|
|
24
22
|
}, z.core.$loose>>;
|
|
25
23
|
children: z.ZodOptional<z.ZodArray<typeof LayoutNode>>;
|
|
26
24
|
}, z.core.$loose>;
|
|
27
|
-
export type BuiltInLayoutNodeType = (typeof BUILT_IN_LAYOUT_NODE_TYPES)[number];
|
|
28
25
|
export type LayoutNode = z.infer<typeof LayoutNode>;
|
|
29
26
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/schemas/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/schemas/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;cA0BC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC;iBAO9D,CAAC;AAEP,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
package/dist/schemas/layout.js
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import { Condition } from "./common.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/schemas/layout.ts
|
|
4
|
-
/** Layout node types every Panneau frontend renders. */
|
|
5
|
-
var BUILT_IN_LAYOUT_NODE_TYPES = [
|
|
6
|
-
"row",
|
|
7
|
-
"column",
|
|
8
|
-
"section",
|
|
9
|
-
"tabs",
|
|
10
|
-
"tab",
|
|
11
|
-
"sidebar",
|
|
12
|
-
"field",
|
|
13
|
-
"text",
|
|
14
|
-
"component"
|
|
15
|
-
];
|
|
16
4
|
var LayoutNode = z.looseObject({
|
|
17
5
|
type: z.string().min(1).meta({ description: "A built-in node type, or a type provided by a plugin." }),
|
|
18
6
|
name: z.string().min(1).optional().meta({ description: "`field`: the name of the field." }),
|
|
@@ -30,6 +18,6 @@ var LayoutNode = z.looseObject({
|
|
|
30
18
|
}
|
|
31
19
|
}).meta({ description: "A node of a form layout. Containers (`row`, `column`, `section`, `tabs`, `tab`, `sidebar`) have `children`. Fields that no node references are appended at the end of the form." });
|
|
32
20
|
//#endregion
|
|
33
|
-
export {
|
|
21
|
+
export { LayoutNode };
|
|
34
22
|
|
|
35
23
|
//# sourceMappingURL=layout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","names":[],"sources":["../../src/schemas/layout.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Condition } from './common';\n\
|
|
1
|
+
{"version":3,"file":"layout.js","names":[],"sources":["../../src/schemas/layout.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Condition } from './common';\n\nexport const LayoutNode = z\n .looseObject({\n type: z\n .string()\n .min(1)\n .meta({ description: 'A built-in node type, or a type provided by a plugin.' }),\n name: z.string().min(1).optional().meta({ description: '`field`: the name of the field.' }),\n label: z.string().optional().meta({ description: '`section`, `tab`: the title.' }),\n description: z.string().optional(),\n text: z.string().optional().meta({ description: '`text`: a static paragraph.' }),\n component: z\n .string()\n .optional()\n .meta({ description: '`component`: a component provided by a plugin.' }),\n props: z.record(z.string(), z.unknown()).optional(),\n width: z\n .number()\n .int()\n .min(1)\n .max(12)\n .optional()\n .meta({ description: 'Width on a 12-column grid, inside a `row`.' }),\n collapsible: z.boolean().optional(),\n collapsed: z.boolean().optional(),\n visibleWhen: Condition.optional(),\n // The return type is written out so that declaration files keep the recursion.\n get children(): z.ZodOptional<z.ZodArray<typeof LayoutNode>> {\n return z.array(LayoutNode).optional();\n },\n })\n .meta({\n description:\n 'A node of a form layout. Containers (`row`, `column`, `section`, `tabs`, `tab`, `sidebar`) have `children`. Fields that no node references are appended at the end of the form.',\n });\n\nexport type LayoutNode = z.infer<typeof LayoutNode>;\n"],"mappings":";;;AAIA,IAAa,aAAa,EACrB,YAAY;CACT,MAAM,EACD,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,KAAK,EAAE,aAAa,wDAAwD,CAAC;CAClF,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,aAAa,kCAAkC,CAAC;CAC1F,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,aAAa,+BAA+B,CAAC;CACjF,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,aAAa,8BAA8B,CAAC;CAC/E,WAAW,EACN,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,iDAAiD,CAAC;CAC3E,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS;CAClD,OAAO,EACF,OAAO,CAAC,CACR,IAAI,CAAC,CACL,IAAI,CAAC,CAAC,CACN,IAAI,EAAE,CAAC,CACP,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,6CAA6C,CAAC;CACvE,aAAa,EAAE,QAAQ,CAAC,CAAC,SAAS;CAClC,WAAW,EAAE,QAAQ,CAAC,CAAC,SAAS;CAChC,aAAa,UAAU,SAAS;CAEhC,IAAI,WAAyD;EACzD,OAAO,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS;CACxC;AACJ,CAAC,CAAC,CACD,KAAK,EACF,aACI,kLACR,CAAC"}
|
package/dist/schemas/list.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
/** List layouts every Panneau frontend renders. Plugins add others. */
|
|
3
|
-
export declare const BUILT_IN_LIST_LAYOUTS: readonly ["table", "cards", "gallery", "calendar"];
|
|
4
2
|
export declare const Column: z.ZodObject<{
|
|
5
3
|
field: z.ZodOptional<z.ZodString>;
|
|
6
4
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -65,7 +63,6 @@ export declare const ListDefinition: z.ZodObject<{
|
|
|
65
63
|
inlineEdit: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
66
64
|
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
67
65
|
}, z.core.$loose>;
|
|
68
|
-
export type BuiltInListLayout = (typeof BUILT_IN_LIST_LAYOUTS)[number];
|
|
69
66
|
export type Column = z.infer<typeof Column>;
|
|
70
67
|
export type Filter = z.infer<typeof Filter>;
|
|
71
68
|
export type ListDefinition = z.infer<typeof ListDefinition>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/schemas/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/schemas/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,MAAM;;;;;;;;;;;;iBAgBb,CAAC;AAEP,eAAO,MAAM,MAAM;;;;;;;;;;;;;iBAWjB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoBzB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
package/dist/schemas/list.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { Option } from "./common.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/schemas/list.ts
|
|
4
|
-
/** List layouts every Panneau frontend renders. Plugins add others. */
|
|
5
|
-
var BUILT_IN_LIST_LAYOUTS = [
|
|
6
|
-
"table",
|
|
7
|
-
"cards",
|
|
8
|
-
"gallery",
|
|
9
|
-
"calendar"
|
|
10
|
-
];
|
|
11
4
|
var Column = z.looseObject({
|
|
12
5
|
field: z.string().min(1).optional().meta({ description: "The field shown in the column." }),
|
|
13
6
|
id: z.string().min(1).optional().meta({ description: "Id of a column that is not a field." }),
|
|
@@ -23,7 +16,7 @@ var Column = z.looseObject({
|
|
|
23
16
|
}).refine((column) => column.field !== void 0 || column.id !== void 0, { message: "A column needs a `field` or an `id`." });
|
|
24
17
|
var Filter = z.looseObject({
|
|
25
18
|
id: z.string().min(1).meta({ description: "Sent as `filter[id]`." }),
|
|
26
|
-
type: z.string().min(1).meta({ description: "Built-in: `text`, `select`, `toggle`, `date`, `date-range`, `relation`." }),
|
|
19
|
+
type: z.string().min(1).meta({ description: "Built-in: `text`, `select`, `toggle`, `date`, `date-range`, `relation`. A `date-range` value is the bounds of a range: `filter[id][from]` and `filter[id][to]`, days (`2026-01-31`), both inclusive and both optional." }),
|
|
27
20
|
label: z.string().optional(),
|
|
28
21
|
options: z.array(Option).optional(),
|
|
29
22
|
resource: z.string().optional(),
|
|
@@ -43,6 +36,6 @@ var ListDefinition = z.looseObject({
|
|
|
43
36
|
selectable: z.boolean().optional()
|
|
44
37
|
});
|
|
45
38
|
//#endregion
|
|
46
|
-
export {
|
|
39
|
+
export { Column, Filter, ListDefinition };
|
|
47
40
|
|
|
48
41
|
//# sourceMappingURL=list.js.map
|
package/dist/schemas/list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","names":[],"sources":["../../src/schemas/list.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Option } from './common';\n\
|
|
1
|
+
{"version":3,"file":"list.js","names":[],"sources":["../../src/schemas/list.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Option } from './common';\n\nexport const Column = z\n .looseObject({\n field: z.string().min(1).optional().meta({ description: 'The field shown in the column.' }),\n id: z\n .string()\n .min(1)\n .optional()\n .meta({ description: 'Id of a column that is not a field.' }),\n label: z.string().optional(),\n display: z.string().optional().meta({ description: 'How the value is displayed.' }),\n sortable: z.boolean().optional(),\n width: z.union([z.number(), z.string()]).optional(),\n align: z.enum(['start', 'center', 'end']).optional(),\n })\n .refine((column) => column.field !== undefined || column.id !== undefined, {\n message: 'A column needs a `field` or an `id`.',\n });\n\nexport const Filter = z.looseObject({\n id: z.string().min(1).meta({ description: 'Sent as `filter[id]`.' }),\n type: z.string().min(1).meta({\n description:\n 'Built-in: `text`, `select`, `toggle`, `date`, `date-range`, `relation`. A `date-range` value is the bounds of a range: `filter[id][from]` and `filter[id][to]`, days (`2026-01-31`), both inclusive and both optional.',\n }),\n label: z.string().optional(),\n options: z.array(Option).optional(),\n resource: z.string().optional(),\n multiple: z.boolean().optional(),\n default: z.unknown().optional(),\n});\n\nexport const ListDefinition = z.looseObject({\n columns: z.array(Column).optional(),\n filters: z.array(Filter).optional(),\n sorts: z\n .array(z.string().min(1))\n .optional()\n .meta({ description: 'Fields the list can be sorted by.' }),\n defaultSort: z\n .string()\n .optional()\n .meta({ description: 'Same format as the `sort` query parameter: `-published_at,title`.' }),\n search: z.boolean().optional().meta({ description: 'Whether the `q` parameter is supported.' }),\n layouts: z.array(z.string().min(1)).optional(),\n perPage: z.number().int().positive().optional(),\n perPageOptions: z.array(z.number().int().positive()).optional(),\n inlineEdit: z\n .array(z.string().min(1))\n .optional()\n .meta({ description: 'Fields editable in the list.' }),\n selectable: z.boolean().optional(),\n});\n\nexport type Column = z.infer<typeof Column>;\nexport type Filter = z.infer<typeof Filter>;\nexport type ListDefinition = z.infer<typeof ListDefinition>;\n"],"mappings":";;;AAIA,IAAa,SAAS,EACjB,YAAY;CACT,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,aAAa,iCAAiC,CAAC;CAC1F,IAAI,EACC,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,sCAAsC,CAAC;CAChE,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE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AM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;CAC7C,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAC9C,gBAAgB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;CAC9D,YAAY,EACP,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACxB,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,+BAA+B,CAAC;CACzD,YAAY,EAAE,QAAQ,CAAC,CAAC,SAAS;AACrC,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ThemeTokens: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
3
|
+
export declare const ToneValues: z.ZodObject<{
|
|
4
|
+
text: z.ZodString;
|
|
5
|
+
subtle: z.ZodString;
|
|
6
|
+
border: z.ZodString;
|
|
7
|
+
outline: z.ZodString;
|
|
8
|
+
solid: z.ZodString;
|
|
9
|
+
solidHover: z.ZodString;
|
|
10
|
+
solidText: z.ZodString;
|
|
11
|
+
}, z.core.$loose>;
|
|
12
|
+
export declare const ToneInput: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
13
|
+
text: z.ZodString;
|
|
14
|
+
subtle: z.ZodString;
|
|
15
|
+
border: z.ZodString;
|
|
16
|
+
outline: z.ZodString;
|
|
17
|
+
solid: z.ZodString;
|
|
18
|
+
solidHover: z.ZodString;
|
|
19
|
+
solidText: z.ZodString;
|
|
20
|
+
dark: z.ZodOptional<z.ZodObject<{
|
|
21
|
+
text: z.ZodOptional<z.ZodString>;
|
|
22
|
+
subtle: z.ZodOptional<z.ZodString>;
|
|
23
|
+
border: z.ZodOptional<z.ZodString>;
|
|
24
|
+
outline: z.ZodOptional<z.ZodString>;
|
|
25
|
+
solid: z.ZodOptional<z.ZodString>;
|
|
26
|
+
solidHover: z.ZodOptional<z.ZodString>;
|
|
27
|
+
solidText: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$loose>>;
|
|
29
|
+
}, z.core.$loose>]>;
|
|
30
|
+
export declare const ThemeFontFace: z.ZodObject<{
|
|
31
|
+
family: z.ZodString;
|
|
32
|
+
src: z.ZodString;
|
|
33
|
+
weight: z.ZodOptional<z.ZodString>;
|
|
34
|
+
style: z.ZodOptional<z.ZodString>;
|
|
35
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
36
|
+
optional: "optional";
|
|
37
|
+
auto: "auto";
|
|
38
|
+
block: "block";
|
|
39
|
+
swap: "swap";
|
|
40
|
+
fallback: "fallback";
|
|
41
|
+
}>>;
|
|
42
|
+
unicodeRange: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$loose>;
|
|
44
|
+
export declare const ThemeFontStylesheet: z.ZodObject<{
|
|
45
|
+
stylesheet: z.ZodString;
|
|
46
|
+
}, z.core.$loose>;
|
|
47
|
+
export declare const ThemeFont: z.ZodUnion<readonly [z.ZodObject<{
|
|
48
|
+
family: z.ZodString;
|
|
49
|
+
src: z.ZodString;
|
|
50
|
+
weight: z.ZodOptional<z.ZodString>;
|
|
51
|
+
style: z.ZodOptional<z.ZodString>;
|
|
52
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
53
|
+
optional: "optional";
|
|
54
|
+
auto: "auto";
|
|
55
|
+
block: "block";
|
|
56
|
+
swap: "swap";
|
|
57
|
+
fallback: "fallback";
|
|
58
|
+
}>>;
|
|
59
|
+
unicodeRange: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
61
|
+
stylesheet: z.ZodString;
|
|
62
|
+
}, z.core.$loose>]>;
|
|
63
|
+
export declare const Theme: z.ZodObject<{
|
|
64
|
+
label: z.ZodOptional<z.ZodString>;
|
|
65
|
+
tokens: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
66
|
+
dark: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
67
|
+
palette: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
68
|
+
tones: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
69
|
+
text: z.ZodString;
|
|
70
|
+
subtle: z.ZodString;
|
|
71
|
+
border: z.ZodString;
|
|
72
|
+
outline: z.ZodString;
|
|
73
|
+
solid: z.ZodString;
|
|
74
|
+
solidHover: z.ZodString;
|
|
75
|
+
solidText: z.ZodString;
|
|
76
|
+
dark: z.ZodOptional<z.ZodObject<{
|
|
77
|
+
text: z.ZodOptional<z.ZodString>;
|
|
78
|
+
subtle: z.ZodOptional<z.ZodString>;
|
|
79
|
+
border: z.ZodOptional<z.ZodString>;
|
|
80
|
+
outline: z.ZodOptional<z.ZodString>;
|
|
81
|
+
solid: z.ZodOptional<z.ZodString>;
|
|
82
|
+
solidHover: z.ZodOptional<z.ZodString>;
|
|
83
|
+
solidText: z.ZodOptional<z.ZodString>;
|
|
84
|
+
}, z.core.$loose>>;
|
|
85
|
+
}, z.core.$loose>]>>>;
|
|
86
|
+
components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
87
|
+
variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
88
|
+
}, z.core.$loose>>>;
|
|
89
|
+
densities: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
compact: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
91
|
+
comfortable: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
92
|
+
touch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
93
|
+
}, z.core.$loose>>;
|
|
94
|
+
fonts: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
95
|
+
family: z.ZodString;
|
|
96
|
+
src: z.ZodString;
|
|
97
|
+
weight: z.ZodOptional<z.ZodString>;
|
|
98
|
+
style: z.ZodOptional<z.ZodString>;
|
|
99
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
optional: "optional";
|
|
101
|
+
auto: "auto";
|
|
102
|
+
block: "block";
|
|
103
|
+
swap: "swap";
|
|
104
|
+
fallback: "fallback";
|
|
105
|
+
}>>;
|
|
106
|
+
unicodeRange: z.ZodOptional<z.ZodString>;
|
|
107
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
108
|
+
stylesheet: z.ZodString;
|
|
109
|
+
}, z.core.$loose>]>>>;
|
|
110
|
+
}, z.core.$loose>;
|
|
111
|
+
export declare const DefinitionTheme: z.ZodObject<{
|
|
112
|
+
tokens: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
113
|
+
colorScheme: z.ZodOptional<z.ZodEnum<{
|
|
114
|
+
dark: "dark";
|
|
115
|
+
auto: "auto";
|
|
116
|
+
light: "light";
|
|
117
|
+
}>>;
|
|
118
|
+
density: z.ZodOptional<z.ZodEnum<{
|
|
119
|
+
auto: "auto";
|
|
120
|
+
compact: "compact";
|
|
121
|
+
comfortable: "comfortable";
|
|
122
|
+
touch: "touch";
|
|
123
|
+
}>>;
|
|
124
|
+
extends: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
125
|
+
label: z.ZodOptional<z.ZodString>;
|
|
126
|
+
dark: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
127
|
+
palette: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
128
|
+
tones: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
129
|
+
text: z.ZodString;
|
|
130
|
+
subtle: z.ZodString;
|
|
131
|
+
border: z.ZodString;
|
|
132
|
+
outline: z.ZodString;
|
|
133
|
+
solid: z.ZodString;
|
|
134
|
+
solidHover: z.ZodString;
|
|
135
|
+
solidText: z.ZodString;
|
|
136
|
+
dark: z.ZodOptional<z.ZodObject<{
|
|
137
|
+
text: z.ZodOptional<z.ZodString>;
|
|
138
|
+
subtle: z.ZodOptional<z.ZodString>;
|
|
139
|
+
border: z.ZodOptional<z.ZodString>;
|
|
140
|
+
outline: z.ZodOptional<z.ZodString>;
|
|
141
|
+
solid: z.ZodOptional<z.ZodString>;
|
|
142
|
+
solidHover: z.ZodOptional<z.ZodString>;
|
|
143
|
+
solidText: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$loose>>;
|
|
145
|
+
}, z.core.$loose>]>>>;
|
|
146
|
+
components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
147
|
+
variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
148
|
+
}, z.core.$loose>>>;
|
|
149
|
+
densities: z.ZodOptional<z.ZodObject<{
|
|
150
|
+
compact: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
151
|
+
comfortable: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
152
|
+
touch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
153
|
+
}, z.core.$loose>>;
|
|
154
|
+
fonts: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
155
|
+
family: z.ZodString;
|
|
156
|
+
src: z.ZodString;
|
|
157
|
+
weight: z.ZodOptional<z.ZodString>;
|
|
158
|
+
style: z.ZodOptional<z.ZodString>;
|
|
159
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
160
|
+
optional: "optional";
|
|
161
|
+
auto: "auto";
|
|
162
|
+
block: "block";
|
|
163
|
+
swap: "swap";
|
|
164
|
+
fallback: "fallback";
|
|
165
|
+
}>>;
|
|
166
|
+
unicodeRange: z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
168
|
+
stylesheet: z.ZodString;
|
|
169
|
+
}, z.core.$loose>]>>>;
|
|
170
|
+
}, z.core.$loose>;
|
|
171
|
+
export type ThemeTokens = z.infer<typeof ThemeTokens>;
|
|
172
|
+
export type ToneValues = z.infer<typeof ToneValues>;
|
|
173
|
+
export type ToneInput = z.infer<typeof ToneInput>;
|
|
174
|
+
export type Theme = z.infer<typeof Theme>;
|
|
175
|
+
export type DefinitionTheme = z.infer<typeof DefinitionTheme>;
|
|
176
|
+
export type ThemeFontFace = z.infer<typeof ThemeFontFace>;
|
|
177
|
+
export type ThemeFontStylesheet = z.infer<typeof ThemeFontStylesheet>;
|
|
178
|
+
export type ThemeFont = z.infer<typeof ThemeFont>;
|
|
179
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/schemas/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,WAAW,uCAKlB,CAAC;AAEP,eAAO,MAAM,UAAU;;;;;;;;iBAQrB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;mBAKqE,CAAC;AAE5F,eAAO,MAAM,aAAa;;;;;;;;;;;;;iBAuBiD,CAAC;AAE5E,eAAO,MAAM,mBAAmB;;iBAE2C,CAAC;AAE5E,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;mBAAgD,CAAC;AA0CvE,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEoE,CAAC;AAEvF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAc8D,CAAC;AAE3F,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAC1C,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/schemas/theme.ts
|
|
3
|
+
/** Names of tones, palette colors, components and variants: they become CSS class names. */
|
|
4
|
+
var Name = z.string().regex(/^[a-z0-9-]+$/);
|
|
5
|
+
var ThemeTokens = z.record(z.string().regex(/^[a-zA-Z0-9_-]+$/), z.string().regex(/^[^{};<]*$/)).meta({ description: "CSS variables without the leading `--`, and their values: `{ \"panneau-color-accent\": \"#05f\" }`. Values cannot contain `{`, `}`, `;` or `<`." });
|
|
6
|
+
var ToneValues = z.looseObject({
|
|
7
|
+
text: z.string().meta({ description: "Text and icons on surfaces." }),
|
|
8
|
+
subtle: z.string().meta({ description: "Background of the subtle appearance." }),
|
|
9
|
+
border: z.string().meta({ description: "Border of the subtle appearance." }),
|
|
10
|
+
outline: z.string().meta({ description: "Border of the outline appearance." }),
|
|
11
|
+
solid: z.string().meta({ description: "Background of the solid appearance." }),
|
|
12
|
+
solidHover: z.string().meta({ description: "Background of the solid appearance on hover." }),
|
|
13
|
+
solidText: z.string().meta({ description: "Text on the solid appearance." })
|
|
14
|
+
});
|
|
15
|
+
var ToneInput = z.union([z.string().meta({ description: "One color, from which Panneau derives the others." }), ToneValues.extend({ dark: ToneValues.partial().optional() })]).meta({ description: "A tone: one color, or every value with dark scheme overrides." });
|
|
16
|
+
var ThemeFontFace = z.looseObject({
|
|
17
|
+
family: z.string().regex(/^[^{}<;"\\]+$/),
|
|
18
|
+
src: z.string().regex(/^[^{}<]+$/).meta({ description: "The `src` descriptor: `url(/fonts/geist.woff2) format('woff2')`." }),
|
|
19
|
+
weight: z.string().regex(/^[^{}<;]*$/).optional(),
|
|
20
|
+
style: z.string().regex(/^[^{}<;]*$/).optional(),
|
|
21
|
+
display: z.enum([
|
|
22
|
+
"auto",
|
|
23
|
+
"block",
|
|
24
|
+
"swap",
|
|
25
|
+
"fallback",
|
|
26
|
+
"optional"
|
|
27
|
+
]).optional(),
|
|
28
|
+
unicodeRange: z.string().regex(/^[^{}<;]*$/).optional()
|
|
29
|
+
}).meta({ description: "A font face, written as an `@font-face` rule." });
|
|
30
|
+
var ThemeFontStylesheet = z.looseObject({ stylesheet: z.string().min(1) }).meta({ description: "A hosted stylesheet that declares font faces." });
|
|
31
|
+
var ThemeFont = z.union([ThemeFontFace, ThemeFontStylesheet]);
|
|
32
|
+
var themeShape = {
|
|
33
|
+
label: z.string().optional(),
|
|
34
|
+
tokens: ThemeTokens.meta({ description: "Tokens of the light scheme, or of both schemes when `dark` does not set them." }),
|
|
35
|
+
dark: ThemeTokens.optional().meta({ description: "Tokens that change in the dark scheme." }),
|
|
36
|
+
palette: z.record(Name, z.string().regex(/^[^{};<]*$/)).optional().meta({ description: "Raw colors, written as `--panneau-palette-<name>`: tokens and tones use them with `var(--panneau-palette-<name>)`." }),
|
|
37
|
+
tones: z.record(Name, ToneInput).optional().meta({ description: "Tones added or redefined by the theme, applied by `panneau-tone-<name>`." }),
|
|
38
|
+
components: z.record(Name, z.looseObject({ variants: z.record(Name, ThemeTokens).optional() })).optional().meta({ description: "Named variants of components: tokens applied by `panneau-<component>-variant-<name>`." }),
|
|
39
|
+
densities: z.looseObject({
|
|
40
|
+
compact: ThemeTokens.optional(),
|
|
41
|
+
comfortable: ThemeTokens.optional(),
|
|
42
|
+
touch: ThemeTokens.optional()
|
|
43
|
+
}).optional().meta({ description: "Tokens of each density (`panneau-control-height`…), which change with the density of the root." }),
|
|
44
|
+
fonts: z.array(ThemeFont).optional().meta({ description: "Font faces and font stylesheets, added to the page once." })
|
|
45
|
+
};
|
|
46
|
+
var Theme = z.looseObject(themeShape).meta({ description: "A theme of `@panneau/ui`, as plain data (decision 0024)." });
|
|
47
|
+
var DefinitionTheme = z.looseObject({
|
|
48
|
+
...themeShape,
|
|
49
|
+
tokens: themeShape.tokens.optional(),
|
|
50
|
+
colorScheme: z.enum([
|
|
51
|
+
"light",
|
|
52
|
+
"dark",
|
|
53
|
+
"auto"
|
|
54
|
+
]).optional(),
|
|
55
|
+
density: z.enum([
|
|
56
|
+
"compact",
|
|
57
|
+
"comfortable",
|
|
58
|
+
"touch",
|
|
59
|
+
"auto"
|
|
60
|
+
]).optional(),
|
|
61
|
+
extends: z.union([z.string(), z.array(z.string())]).optional().meta({ description: "Themes registered by plugins, by id, that this theme builds on, in order: its own values override theirs." })
|
|
62
|
+
}).meta({ description: "The theme of the admin: a theme, built on themes of plugins." });
|
|
63
|
+
//#endregion
|
|
64
|
+
export { DefinitionTheme, Theme, ThemeFont, ThemeFontFace, ThemeFontStylesheet, ThemeTokens, ToneInput, ToneValues };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","names":[],"sources":["../../src/schemas/theme.ts"],"sourcesContent":["import { z } from 'zod';\n\n/** Names of tones, palette colors, components and variants: they become CSS class names. */\nconst Name = z.string().regex(/^[a-z0-9-]+$/);\n\nexport const ThemeTokens = z\n .record(z.string().regex(/^[a-zA-Z0-9_-]+$/), z.string().regex(/^[^{};<]*$/))\n .meta({\n description:\n 'CSS variables without the leading `--`, and their values: `{ \"panneau-color-accent\": \"#05f\" }`. Values cannot contain `{`, `}`, `;` or `<`.',\n });\n\nexport const ToneValues = z.looseObject({\n text: z.string().meta({ description: 'Text and icons on surfaces.' }),\n subtle: z.string().meta({ description: 'Background of the subtle appearance.' }),\n border: z.string().meta({ description: 'Border of the subtle appearance.' }),\n outline: z.string().meta({ description: 'Border of the outline appearance.' }),\n solid: z.string().meta({ description: 'Background of the solid appearance.' }),\n solidHover: z.string().meta({ description: 'Background of the solid appearance on hover.' }),\n solidText: z.string().meta({ description: 'Text on the solid appearance.' }),\n});\n\nexport const ToneInput = z\n .union([\n z.string().meta({ description: 'One color, from which Panneau derives the others.' }),\n ToneValues.extend({ dark: ToneValues.partial().optional() }),\n ])\n .meta({ description: 'A tone: one color, or every value with dark scheme overrides.' });\n\nexport const ThemeFontFace = z\n .looseObject({\n family: z.string().regex(/^[^{}<;\"\\\\]+$/),\n src: z\n .string()\n .regex(/^[^{}<]+$/)\n .meta({\n description: \"The `src` descriptor: `url(/fonts/geist.woff2) format('woff2')`.\",\n }),\n weight: z\n .string()\n .regex(/^[^{}<;]*$/)\n .optional(),\n style: z\n .string()\n .regex(/^[^{}<;]*$/)\n .optional(),\n display: z.enum(['auto', 'block', 'swap', 'fallback', 'optional']).optional(),\n unicodeRange: z\n .string()\n .regex(/^[^{}<;]*$/)\n .optional(),\n })\n .meta({ description: 'A font face, written as an `@font-face` rule.' });\n\nexport const ThemeFontStylesheet = z\n .looseObject({ stylesheet: z.string().min(1) })\n .meta({ description: 'A hosted stylesheet that declares font faces.' });\n\nexport const ThemeFont = z.union([ThemeFontFace, ThemeFontStylesheet]);\n\nconst themeShape = {\n label: z.string().optional(),\n tokens: ThemeTokens.meta({\n description:\n 'Tokens of the light scheme, or of both schemes when `dark` does not set them.',\n }),\n dark: ThemeTokens.optional().meta({ description: 'Tokens that change in the dark scheme.' }),\n palette: z\n .record(Name, z.string().regex(/^[^{};<]*$/))\n .optional()\n .meta({\n description:\n 'Raw colors, written as `--panneau-palette-<name>`: tokens and tones use them with `var(--panneau-palette-<name>)`.',\n }),\n tones: z.record(Name, ToneInput).optional().meta({\n description: 'Tones added or redefined by the theme, applied by `panneau-tone-<name>`.',\n }),\n components: z\n .record(Name, z.looseObject({ variants: z.record(Name, ThemeTokens).optional() }))\n .optional()\n .meta({\n description:\n 'Named variants of components: tokens applied by `panneau-<component>-variant-<name>`.',\n }),\n densities: z\n .looseObject({\n compact: ThemeTokens.optional(),\n comfortable: ThemeTokens.optional(),\n touch: ThemeTokens.optional(),\n })\n .optional()\n .meta({\n description:\n 'Tokens of each density (`panneau-control-height`…), which change with the density of the root.',\n }),\n fonts: z.array(ThemeFont).optional().meta({\n description: 'Font faces and font stylesheets, added to the page once.',\n }),\n};\n\nexport const Theme = z\n .looseObject(themeShape)\n .meta({ description: 'A theme of `@panneau/ui`, as plain data (decision 0024).' });\n\nexport const DefinitionTheme = z\n .looseObject({\n ...themeShape,\n tokens: themeShape.tokens.optional(),\n colorScheme: z.enum(['light', 'dark', 'auto']).optional(),\n density: z.enum(['compact', 'comfortable', 'touch', 'auto']).optional(),\n extends: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .meta({\n description:\n 'Themes registered by plugins, by id, that this theme builds on, in order: its own values override theirs.',\n }),\n })\n .meta({ description: 'The theme of the admin: a theme, built on themes of plugins.' });\n\nexport type ThemeTokens = z.infer<typeof ThemeTokens>;\nexport type ToneValues = z.infer<typeof ToneValues>;\nexport type ToneInput = z.infer<typeof ToneInput>;\nexport type Theme = z.infer<typeof Theme>;\nexport type DefinitionTheme = z.infer<typeof DefinitionTheme>;\nexport type ThemeFontFace = z.infer<typeof ThemeFontFace>;\nexport type ThemeFontStylesheet = z.infer<typeof ThemeFontStylesheet>;\nexport type ThemeFont = z.infer<typeof ThemeFont>;\n"],"mappings":";;;AAGA,IAAM,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,cAAc;AAE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AY,UAAU,CAAC,CACvB,KAAK,EAAE,aAAa,2DAA2D,CAAC;AAErF,IAAa,kBAAkB,EAC1B,YAAY;CACT,GAAG;CACH,QAAQ,WAAW,OAAO,SAAS;CACnC,aAAa,EAAE,KAAK;EAAC;EAAS;EAAQ;CAAM,CAAC,CAAC,CAAC,SAAS;CACxD,SAAS,EAAE,KAAK;EAAC;EAAW;EAAe;EAAS;CAAM,CAAC,CAAC,CAAC,SAAS;CACtE,SAAS,EACJ,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CACxC,SAAS,CAAC,CACV,KAAK,EACF,aACI,4GACR,CAAC;AACT,CAAC,CAAC,CACD,KAAK,EAAE,aAAa,+DAA+D,CAAC"}
|
package/dist/themes.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Theme } from './schemas/theme';
|
|
2
|
+
/** A theme to merge: `tokens` can be left out, as in the theme of a definition. */
|
|
3
|
+
export type PartialTheme = Partial<Theme>;
|
|
4
|
+
/**
|
|
5
|
+
* Merges themes, in order: each one overrides the tokens, palette colors, tones and variants of
|
|
6
|
+
* those before it. A token a theme sets in `tokens` but not in `dark` applies to both schemes, so it
|
|
7
|
+
* also replaces the dark value of earlier themes. Variants merge token by token; tones are replaced
|
|
8
|
+
* whole; densities merge token by token; fonts add up. The label is the last one set. `defineTheme()` of `@panneau/ui` merges the same way.
|
|
9
|
+
*/
|
|
10
|
+
export declare function mergeThemes(...themes: readonly PartialTheme[]): Theme;
|
|
11
|
+
//# sourceMappingURL=themes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../src/themes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,mFAAmF;AACnF,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAmE1C;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,KAAK,CAgCrE"}
|
package/dist/themes.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//#region src/themes.ts
|
|
2
|
+
function mergeRecords(first, second) {
|
|
3
|
+
return first === void 0 && second === void 0 ? void 0 : {
|
|
4
|
+
...first,
|
|
5
|
+
...second
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function mergeComponents(first, second) {
|
|
9
|
+
const components = mergeRecords(first, second);
|
|
10
|
+
if (components === void 0) return;
|
|
11
|
+
return Object.fromEntries(Object.keys(components).map((component) => {
|
|
12
|
+
const before = first?.[component];
|
|
13
|
+
const after = second?.[component];
|
|
14
|
+
const variants = mergeRecords(before?.variants, after?.variants);
|
|
15
|
+
return [component, {
|
|
16
|
+
...before,
|
|
17
|
+
...after,
|
|
18
|
+
...variants !== void 0 && { variants: Object.fromEntries(Object.keys(variants).map((name) => [name, {
|
|
19
|
+
...before?.variants?.[name],
|
|
20
|
+
...after?.variants?.[name]
|
|
21
|
+
}])) }
|
|
22
|
+
}];
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
var DENSITIES = [
|
|
26
|
+
"compact",
|
|
27
|
+
"comfortable",
|
|
28
|
+
"touch"
|
|
29
|
+
];
|
|
30
|
+
function mergeDensities(first, second) {
|
|
31
|
+
if (first === void 0 && second === void 0) return;
|
|
32
|
+
const densities = {
|
|
33
|
+
...first,
|
|
34
|
+
...second
|
|
35
|
+
};
|
|
36
|
+
DENSITIES.forEach((density) => {
|
|
37
|
+
if (first?.[density] !== void 0 && second?.[density] !== void 0) densities[density] = {
|
|
38
|
+
...first[density],
|
|
39
|
+
...second[density]
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
return densities;
|
|
43
|
+
}
|
|
44
|
+
function mergeFonts(first, second) {
|
|
45
|
+
if (first === void 0 && second === void 0) return;
|
|
46
|
+
const fonts = [...first ?? [], ...second ?? []];
|
|
47
|
+
return fonts.filter((font, index) => fonts.findIndex((other) => JSON.stringify(other) === JSON.stringify(font)) === index);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Merges themes, in order: each one overrides the tokens, palette colors, tones and variants of
|
|
51
|
+
* those before it. A token a theme sets in `tokens` but not in `dark` applies to both schemes, so it
|
|
52
|
+
* also replaces the dark value of earlier themes. Variants merge token by token; tones are replaced
|
|
53
|
+
* whole; densities merge token by token; fonts add up. The label is the last one set. `defineTheme()` of `@panneau/ui` merges the same way.
|
|
54
|
+
*/
|
|
55
|
+
function mergeThemes(...themes) {
|
|
56
|
+
return themes.reduce((merged, theme) => {
|
|
57
|
+
const tokens = theme.tokens ?? {};
|
|
58
|
+
const dark = mergeRecords(merged.dark !== void 0 ? Object.fromEntries(Object.entries(merged.dark).filter(([name]) => !Object.hasOwn(tokens, name))) : void 0, theme.dark);
|
|
59
|
+
const result = {
|
|
60
|
+
...merged,
|
|
61
|
+
...theme,
|
|
62
|
+
label: theme.label ?? merged.label,
|
|
63
|
+
tokens: {
|
|
64
|
+
...merged.tokens,
|
|
65
|
+
...tokens
|
|
66
|
+
},
|
|
67
|
+
dark: dark !== void 0 && Object.keys(dark).length > 0 ? dark : void 0,
|
|
68
|
+
palette: mergeRecords(merged.palette, theme.palette),
|
|
69
|
+
tones: mergeRecords(merged.tones, theme.tones),
|
|
70
|
+
components: mergeComponents(merged.components, theme.components),
|
|
71
|
+
densities: mergeDensities(merged.densities, theme.densities),
|
|
72
|
+
fonts: mergeFonts(merged.fonts, theme.fonts)
|
|
73
|
+
};
|
|
74
|
+
return Object.fromEntries(Object.entries(result).filter(([, value]) => value !== void 0));
|
|
75
|
+
}, { tokens: {} });
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { mergeThemes };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=themes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themes.js","names":[],"sources":["../src/themes.ts"],"sourcesContent":["import type { Theme } from './schemas/theme';\n\n/** A theme to merge: `tokens` can be left out, as in the theme of a definition. */\nexport type PartialTheme = Partial<Theme>;\n\nfunction mergeRecords<T>(\n first: Record<string, T> | undefined,\n second: Record<string, T> | undefined,\n): Record<string, T> | undefined {\n return first === undefined && second === undefined ? undefined : { ...first, ...second };\n}\n\nfunction mergeComponents(\n first: Theme['components'],\n second: Theme['components'],\n): Theme['components'] {\n const components = mergeRecords(first, second);\n if (components === undefined) {\n return undefined;\n }\n return Object.fromEntries(\n Object.keys(components).map((component) => {\n const before = first?.[component];\n const after = second?.[component];\n const variants = mergeRecords(before?.variants, after?.variants);\n return [\n component,\n {\n ...before,\n ...after,\n ...(variants !== undefined && {\n variants: Object.fromEntries(\n Object.keys(variants).map((name) => [\n name,\n { ...before?.variants?.[name], ...after?.variants?.[name] },\n ]),\n ),\n }),\n },\n ];\n }),\n );\n}\n\nconst DENSITIES = ['compact', 'comfortable', 'touch'] as const;\n\nfunction mergeDensities(first: Theme['densities'], second: Theme['densities']): Theme['densities'] {\n if (first === undefined && second === undefined) {\n return undefined;\n }\n const densities = { ...first, ...second };\n DENSITIES.forEach((density) => {\n if (first?.[density] !== undefined && second?.[density] !== undefined) {\n densities[density] = { ...first[density], ...second[density] };\n }\n });\n return densities;\n}\n\nfunction mergeFonts(first: Theme['fonts'], second: Theme['fonts']): Theme['fonts'] {\n if (first === undefined && second === undefined) {\n return undefined;\n }\n const fonts = [...(first ?? []), ...(second ?? [])];\n return fonts.filter(\n (font, index) =>\n fonts.findIndex((other) => JSON.stringify(other) === JSON.stringify(font)) === index,\n );\n}\n\n/**\n * Merges themes, in order: each one overrides the tokens, palette colors, tones and variants of\n * those before it. A token a theme sets in `tokens` but not in `dark` applies to both schemes, so it\n * also replaces the dark value of earlier themes. Variants merge token by token; tones are replaced\n * whole; densities merge token by token; fonts add up. The label is the last one set. `defineTheme()` of `@panneau/ui` merges the same way.\n */\nexport function mergeThemes(...themes: readonly PartialTheme[]): Theme {\n return themes.reduce<Theme>(\n (merged, theme) => {\n const tokens = theme.tokens ?? {};\n const dark = mergeRecords(\n merged.dark !== undefined\n ? Object.fromEntries(\n Object.entries(merged.dark).filter(\n ([name]) => !Object.hasOwn(tokens, name),\n ),\n )\n : undefined,\n theme.dark,\n );\n const result: Theme = {\n ...merged,\n ...theme,\n label: theme.label ?? merged.label,\n tokens: { ...merged.tokens, ...tokens },\n dark: dark !== undefined && Object.keys(dark).length > 0 ? dark : undefined,\n palette: mergeRecords(merged.palette, theme.palette),\n tones: mergeRecords(merged.tones, theme.tones),\n components: mergeComponents(merged.components, theme.components),\n densities: mergeDensities(merged.densities, theme.densities),\n fonts: mergeFonts(merged.fonts, theme.fonts),\n };\n return Object.fromEntries(\n Object.entries(result).filter(([, value]) => value !== undefined),\n ) as Theme;\n },\n { tokens: {} },\n );\n}\n"],"mappings":";AAKA,SAAS,aACL,OACA,QAC6B;CAC7B,OAAO,UAAU,KAAA,KAAa,WAAW,KAAA,IAAY,KAAA,IAAY;EAAE,GAAG;EAAO,GAAG;CAAO;AAC3F;AAEA,SAAS,gBACL,OACA,QACmB;CACnB,MAAM,aAAa,aAAa,OAAO,MAAM;CAC7C,IAAI,eAAe,KAAA,GACf;CAEJ,OAAO,OAAO,YACV,OAAO,KAAK,UAAU,CAAC,CAAC,KAAK,cAAc;EACvC,MAAM,SAAS,QAAQ;EACvB,MAAM,QAAQ,SAAS;EACvB,MAAM,WAAW,aAAa,QAAQ,UAAU,OAAO,QAAQ;EAC/D,OAAO,CACH,WACA;GACI,GAAG;GACH,GAAG;GACH,GAAI,aAAa,KAAA,KAAa,EAC1B,UAAU,OAAO,YACb,OAAO,KAAK,QAAQ,CAAC,CAAC,KAAK,SAAS,CAChC,MACA;IAAE,GAAG,QAAQ,WAAW;IAAO,GAAG,OAAO,WAAW;GAAM,CAC9D,CAAC,CACL,EACJ;EACJ,CACJ;CACJ,CAAC,CACL;AACJ;AAEA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AM,UAAU;GAC/D,WAAW,eAAe,OAAO,WAAW,MAAM,SAAS;GAC3D,OAAO,WAAW,OAAO,OAAO,MAAM,KAAK;EAC/C;EACA,OAAO,OAAO,YACV,OAAO,QAAQ,MAAM,CAAC,CAAC,QAAQ,GAAG,WAAW,UAAU,KAAA,CAAS,CACpE;CACJ,GACA,EAAE,QAAQ,CAAC,EAAE,CACjB;AACJ"}
|
package/dist/validate.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
|
-
import { Problem } from './schemas/api';
|
|
3
2
|
import { BootConfig } from './schemas/boot';
|
|
4
3
|
import { Definition } from './schemas/definition';
|
|
5
4
|
export interface ValidationIssue {
|
|
@@ -26,6 +25,4 @@ export declare function validateDefinition(input: unknown): ValidationResult<Def
|
|
|
26
25
|
* references between the parts of its inlined definition, if any.
|
|
27
26
|
*/
|
|
28
27
|
export declare function validateBootConfig(input: unknown): ValidationResult<BootConfig>;
|
|
29
|
-
/** Whether a value is a problem details object (an API error). */
|
|
30
|
-
export declare function isProblem(value: unknown): value is Problem;
|
|
31
28
|
//# sourceMappingURL=validate.d.ts.map
|
package/dist/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,WAAW,eAAe;IAC5B,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAC1B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AAE/E,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EACxC,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,OAAO,GACf,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAY9B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAO/E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAU/E"}
|