@happyvertical/smrt-svelte 0.55.10 → 0.55.11
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/AGENTS.md +1 -0
- package/agents/cookbook-shell.md +176 -0
- package/agents/overview-presentation.md +8 -0
- package/agents/overview-surfaces.md +11 -0
- package/agents/screens.md +5 -0
- package/dist/components/cookbook/CookbookApp.svelte +236 -0
- package/dist/components/cookbook/CookbookApp.svelte.d.ts +5 -0
- package/dist/components/cookbook/CookbookApp.svelte.d.ts.map +1 -0
- package/dist/components/cookbook/CookbookSectionOverview.svelte +71 -0
- package/dist/components/cookbook/CookbookSectionOverview.svelte.d.ts +20 -0
- package/dist/components/cookbook/CookbookSectionOverview.svelte.d.ts.map +1 -0
- package/dist/components/cookbook/CookbookSectionPage.svelte +133 -0
- package/dist/components/cookbook/CookbookSectionPage.svelte.d.ts +5 -0
- package/dist/components/cookbook/CookbookSectionPage.svelte.d.ts.map +1 -0
- package/dist/components/cookbook/brand-theme.d.ts +11 -0
- package/dist/components/cookbook/brand-theme.d.ts.map +1 -0
- package/dist/components/cookbook/brand-theme.js +24 -0
- package/dist/components/cookbook/build.d.ts +8 -0
- package/dist/components/cookbook/build.d.ts.map +1 -0
- package/dist/components/cookbook/build.js +277 -0
- package/dist/components/cookbook/catalog.d.ts +37 -0
- package/dist/components/cookbook/catalog.d.ts.map +1 -0
- package/dist/components/cookbook/catalog.js +99 -0
- package/dist/components/cookbook/context.d.ts +23 -0
- package/dist/components/cookbook/context.d.ts.map +1 -0
- package/dist/components/cookbook/context.js +15 -0
- package/dist/components/cookbook/index.d.ts +22 -0
- package/dist/components/cookbook/index.d.ts.map +1 -0
- package/dist/components/cookbook/index.js +20 -0
- package/dist/components/cookbook/page.d.ts +23 -0
- package/dist/components/cookbook/page.d.ts.map +1 -0
- package/dist/components/cookbook/page.js +32 -0
- package/dist/components/cookbook/registry.d.ts +37 -0
- package/dist/components/cookbook/registry.d.ts.map +1 -0
- package/dist/components/cookbook/registry.js +38 -0
- package/dist/components/cookbook/sections.d.ts +60 -0
- package/dist/components/cookbook/sections.d.ts.map +1 -0
- package/dist/components/cookbook/sections.js +88 -0
- package/dist/components/cookbook/server.d.ts +61 -0
- package/dist/components/cookbook/server.d.ts.map +1 -0
- package/dist/components/cookbook/server.js +108 -0
- package/dist/components/cookbook/theme.d.ts +21 -0
- package/dist/components/cookbook/theme.d.ts.map +1 -0
- package/dist/components/cookbook/theme.js +53 -0
- package/dist/components/cookbook/types.d.ts +204 -0
- package/dist/components/cookbook/types.d.ts.map +1 -0
- package/dist/components/cookbook/types.js +1 -0
- package/dist/components/overview/OverviewGrid.svelte +5 -2
- package/dist/components/overview/OverviewGrid.svelte.d.ts.map +1 -1
- package/dist/components/overview/grid-types.d.ts +6 -2
- package/dist/components/overview/grid-types.d.ts.map +1 -1
- package/dist/i18n/strings.overview.d.ts +3 -0
- package/dist/i18n/strings.overview.d.ts.map +1 -1
- package/dist/i18n/strings.overview.js +4 -0
- package/package.json +25 -14
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inputs and outputs of the cookbook app shell (#3749).
|
|
3
|
+
*
|
|
4
|
+
* Everything here is plain data: the builder takes a cookbook plus a recipe
|
|
5
|
+
* catalog and returns shell configuration; nothing imports Svelte or the DOM.
|
|
6
|
+
*/
|
|
7
|
+
import type { Cookbook, CookbookPolicyRow, RecipeDefinition, RecipeShellSlot, RecipeWidgetSurface } from '@happyvertical/smrt-types';
|
|
8
|
+
import type { ComponentProps } from 'svelte';
|
|
9
|
+
import type AppShell from '../app/AppShell.svelte';
|
|
10
|
+
import type { RecipeExportResolver } from '../overview/recipe-widgets.js';
|
|
11
|
+
import type { OverviewDefinition } from '../overview/types.js';
|
|
12
|
+
import type { CoreWidgetLoaders } from '../overview/widgets/core.js';
|
|
13
|
+
import type { ShellLayout } from '../workspace/admin-shell/layout.js';
|
|
14
|
+
import type { ShellNavGroup } from '../workspace/admin-shell/types.js';
|
|
15
|
+
/**
|
|
16
|
+
* The part of a recipe the shell reads. A manifest `RecipeDefinition` fits;
|
|
17
|
+
* hosts may drop `help`, `synonyms` and other bulk before serializing.
|
|
18
|
+
*/
|
|
19
|
+
export type CookbookRecipe = Pick<RecipeDefinition, 'id' | 'label' | 'nav' | 'models'> & Partial<Pick<RecipeDefinition, 'group' | 'section' | 'surfaces' | 'requires' | 'requiresAny'>>;
|
|
20
|
+
/** What the shell needs to know about one model. */
|
|
21
|
+
export interface CookbookModelInfo {
|
|
22
|
+
/** Qualified name, `@scope/pkg:Class`. */
|
|
23
|
+
id: string;
|
|
24
|
+
/** Class name, e.g. `Order`. */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Package id used in item ids and routes: `commerce` for `@happyvertical/smrt-commerce`. */
|
|
27
|
+
packageId: string;
|
|
28
|
+
/** The model's own description, for an entry with no description of its own. */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Has an API, MCP or CLI surface; only exposed models get a feature entry. */
|
|
31
|
+
exposed?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** Recipes plus the models they point at: the catalog a cookbook resolves against. */
|
|
34
|
+
export interface CookbookCatalog {
|
|
35
|
+
recipes: readonly CookbookRecipe[];
|
|
36
|
+
models: readonly CookbookModelInfo[];
|
|
37
|
+
}
|
|
38
|
+
/** One navigation entry: a layout item id and the model page it opens. */
|
|
39
|
+
export interface CookbookEntry {
|
|
40
|
+
/** Layout item id: `item:<package>:<Model>` or `item:<package>:<Model>:<key>`. */
|
|
41
|
+
id: string;
|
|
42
|
+
label: string;
|
|
43
|
+
icon: string;
|
|
44
|
+
description: string;
|
|
45
|
+
model: CookbookModelInfo;
|
|
46
|
+
/** In-app path of the entry's page, without any host base. */
|
|
47
|
+
path: string;
|
|
48
|
+
/** Link the nav uses (`path` through `entryHref`). */
|
|
49
|
+
href: string;
|
|
50
|
+
/** Explicit noun for the New button. */
|
|
51
|
+
noun?: string;
|
|
52
|
+
/** Row filter of a keyed entry. */
|
|
53
|
+
filter?: {
|
|
54
|
+
field: string;
|
|
55
|
+
value: string;
|
|
56
|
+
};
|
|
57
|
+
/** Recipe that contributed the entry; `null` for a feature model. */
|
|
58
|
+
recipeId: string | null;
|
|
59
|
+
}
|
|
60
|
+
/** A suggested navigation section and what it holds. */
|
|
61
|
+
export interface CookbookSection {
|
|
62
|
+
/** Layout id: `section:<id>`. */
|
|
63
|
+
id: string;
|
|
64
|
+
label: string;
|
|
65
|
+
icon?: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
/** Entry ids, in recipe order. */
|
|
68
|
+
entryIds: string[];
|
|
69
|
+
/** Ids of the recipes that suggest the section. */
|
|
70
|
+
recipeIds: string[];
|
|
71
|
+
/** In-app path of the section page. */
|
|
72
|
+
path: string;
|
|
73
|
+
}
|
|
74
|
+
/** A recipe surface placed into a shell slot. */
|
|
75
|
+
export interface CookbookShellWidget {
|
|
76
|
+
recipeId: string;
|
|
77
|
+
slot: RecipeShellSlot;
|
|
78
|
+
/** `'<module specifier>#<ExportName>'`; the host resolves it. */
|
|
79
|
+
export: `${string}#${string}`;
|
|
80
|
+
label: string;
|
|
81
|
+
icon?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface CookbookRouteSurface {
|
|
84
|
+
recipeId: string;
|
|
85
|
+
path: string;
|
|
86
|
+
export: `${string}#${string}`;
|
|
87
|
+
label: string;
|
|
88
|
+
}
|
|
89
|
+
export interface CookbookSettingsPanel {
|
|
90
|
+
recipeId: string;
|
|
91
|
+
export: `${string}#${string}`;
|
|
92
|
+
label: string;
|
|
93
|
+
}
|
|
94
|
+
/** The theme as the shell applies it; a brand colour is registered by the component. */
|
|
95
|
+
export interface ResolvedCookbookTheme {
|
|
96
|
+
/** Preset id: a built-in smrt-ui preset, or the brand theme's id. */
|
|
97
|
+
preset: string;
|
|
98
|
+
colorScheme: 'light' | 'dark' | 'system';
|
|
99
|
+
/** Present when the cookbook names a brand colour (it wins over `preset`). */
|
|
100
|
+
brand?: {
|
|
101
|
+
primary: string;
|
|
102
|
+
fontFamily?: string;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/** One section page: its overview definition and the cookbook's saved override. */
|
|
106
|
+
export interface CookbookOverviewPage {
|
|
107
|
+
definition: OverviewDefinition;
|
|
108
|
+
/** The cookbook's stored override for this page, if any (untrusted JSON). */
|
|
109
|
+
override: unknown;
|
|
110
|
+
}
|
|
111
|
+
export interface BuildCookbookShellOptions {
|
|
112
|
+
cookbook: Cookbook;
|
|
113
|
+
/** Recipes and models, usually from {@link catalogFromManifests}. */
|
|
114
|
+
catalog: CookbookCatalog;
|
|
115
|
+
/** The app name shown in the shell brand. */
|
|
116
|
+
title?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Recipe order, when it differs from the cookbook's (the cookbook lists ids
|
|
119
|
+
* sorted). Recipes it does not list follow in cookbook order. Section order
|
|
120
|
+
* follows the first recipe of each section, then the cookbook layout.
|
|
121
|
+
*/
|
|
122
|
+
recipeOrder?: readonly string[];
|
|
123
|
+
/** In-app path of a model entry; default `/m/<package>/<Model>/[key/]`. */
|
|
124
|
+
entryPath?: (entry: {
|
|
125
|
+
packageId: string;
|
|
126
|
+
modelName: string;
|
|
127
|
+
key?: string;
|
|
128
|
+
}) => string;
|
|
129
|
+
/** In-app path of a section page; default `/s/<slug>/`. */
|
|
130
|
+
sectionPath?: (sectionId: string) => string;
|
|
131
|
+
/** Prefix for every generated href (`/app` or an app query helper). */
|
|
132
|
+
href?: (path: string) => string;
|
|
133
|
+
/**
|
|
134
|
+
* Put a record count and the latest records on every section page. They need
|
|
135
|
+
* `metric` and `records` loaders on the host; without them leave this off
|
|
136
|
+
* and the page shows the entries as shortcut cards only.
|
|
137
|
+
*/
|
|
138
|
+
dataWidgets?: boolean;
|
|
139
|
+
/** Where the app's settings page lives; passed through to the shell. */
|
|
140
|
+
settingsHref?: string;
|
|
141
|
+
}
|
|
142
|
+
/** Everything `AppShell` and the section pages need, derived from a cookbook. */
|
|
143
|
+
export interface CookbookShell {
|
|
144
|
+
title: string;
|
|
145
|
+
navMode: 'sections';
|
|
146
|
+
/** Sections as the shell takes them (layout is applied by the shell). */
|
|
147
|
+
navGroups: ShellNavGroup[];
|
|
148
|
+
/** The cookbook's layout, or `null` when it has none. */
|
|
149
|
+
layout: ShellLayout | null;
|
|
150
|
+
/** Suggested sections in order, whether or not the layout hides them. */
|
|
151
|
+
sections: CookbookSection[];
|
|
152
|
+
/** Every entry by layout item id. */
|
|
153
|
+
entries: ReadonlyMap<string, CookbookEntry>;
|
|
154
|
+
theme: ResolvedCookbookTheme;
|
|
155
|
+
/** Section page overviews by section id (`section:sales`, `custom:shop`). */
|
|
156
|
+
overviews: Record<string, CookbookOverviewPage>;
|
|
157
|
+
/** Recipe `shell-widget` surfaces, for the host to resolve into `slotItems`. */
|
|
158
|
+
shellWidgets: CookbookShellWidget[];
|
|
159
|
+
routes: CookbookRouteSurface[];
|
|
160
|
+
settingsPanels: CookbookSettingsPanel[];
|
|
161
|
+
/** Recipe `widget` surfaces, for `registerRecipeWidgets`. */
|
|
162
|
+
widgets: Array<Pick<RecipeDefinition, 'id'> & {
|
|
163
|
+
surfaces: RecipeWidgetSurface[];
|
|
164
|
+
}>;
|
|
165
|
+
/** The cookbook's app-scope field policy rows, applied by the runtime. */
|
|
166
|
+
policies: CookbookPolicyRow[];
|
|
167
|
+
settingsHref?: string;
|
|
168
|
+
/** Layout id to section page path (the shell's `sectionHref`). */
|
|
169
|
+
sectionPath: (sectionId: string) => string;
|
|
170
|
+
/** Problems that did not stop the build (unknown recipes, models, ...). */
|
|
171
|
+
issues: string[];
|
|
172
|
+
}
|
|
173
|
+
/** Props of `CookbookSectionPage`. */
|
|
174
|
+
export interface CookbookSectionPageProps {
|
|
175
|
+
/** The layout id (`section:sales`, `custom:shop`). */
|
|
176
|
+
sectionId?: string;
|
|
177
|
+
/** The route slug (`section-sales`); used when `sectionId` is absent. */
|
|
178
|
+
slug?: string;
|
|
179
|
+
/** Extra content under the overview. */
|
|
180
|
+
children?: import('svelte').Snippet;
|
|
181
|
+
}
|
|
182
|
+
/** Props of `CookbookApp`; anything else is passed to `AppShell` unchanged. */
|
|
183
|
+
export interface CookbookAppProps extends Omit<ComponentProps<typeof AppShell>, 'navGroups' | 'nav' | 'navMode' | 'layout' | 'onlayoutchange' | 'preset' | 'colorScheme' | 'sectionHref' | 'title' | 'children'>, Pick<BuildCookbookShellOptions, 'recipeOrder' | 'entryPath' | 'sectionPath' | 'href' | 'title'> {
|
|
184
|
+
cookbook: Cookbook;
|
|
185
|
+
catalog: CookbookCatalog;
|
|
186
|
+
/**
|
|
187
|
+
* Data loaders for the `metric`, `records` and `chart` widgets. With
|
|
188
|
+
* `metric` and `records`, section pages also show a record count and the
|
|
189
|
+
* latest records of the section's lead model.
|
|
190
|
+
*/
|
|
191
|
+
loaders?: Omit<CoreWidgetLoaders, 'shortcuts'>;
|
|
192
|
+
/** Host capabilities handed to widget loaders that run in the browser. */
|
|
193
|
+
widgetContext?: () => Record<string, unknown>;
|
|
194
|
+
/**
|
|
195
|
+
* Turns a recipe export reference (`'@acme/shop/svelte#SalesTotal'`) into
|
|
196
|
+
* the export: a static map of dynamic imports in a bundled app. Without it,
|
|
197
|
+
* recipe `widget` and `shell-widget` surfaces are ignored.
|
|
198
|
+
*/
|
|
199
|
+
resolveExport?: RecipeExportResolver;
|
|
200
|
+
/** Called with the cookbook after a layout or overview edit. */
|
|
201
|
+
oncookbookchange?: (cookbook: Cookbook) => void;
|
|
202
|
+
children: import('svelte').Snippet;
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/cookbook/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EACV,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAC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W,GAAG,aAAa,GAAG,MAAM,GAAG,OAAO,CAC/D;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,eAAe,CAAC;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;IAC/C,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C;;;;OAIG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IAChD,QAAQ,EAAE,OAAO,QAAQ,EAAE,OAAO,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -41,6 +41,8 @@ let {
|
|
|
41
41
|
editing: editingProp,
|
|
42
42
|
label,
|
|
43
43
|
headingLevel = 2,
|
|
44
|
+
heading,
|
|
45
|
+
presentation = 'card',
|
|
44
46
|
models,
|
|
45
47
|
iconComponent,
|
|
46
48
|
}: OverviewGridProps = $props();
|
|
@@ -348,7 +350,7 @@ const headingTag = $derived(`h${headingLevel}`);
|
|
|
348
350
|
{#snippet body(row: Row)}
|
|
349
351
|
{@const Widget = components?.get(row.widget.type) ?? row.def?.component}
|
|
350
352
|
<article class="smrt-overview__widget" aria-labelledby="{uid}-title-{row.widget.id}">
|
|
351
|
-
<svelte:element this={headingTag} class="smrt-overview__title" id="{uid}-title-{row.widget.id}">{row.title}</svelte:element>
|
|
353
|
+
<svelte:element this={headingTag} class="smrt-overview__title" id="{uid}-title-{row.widget.id}">{#if heading}{@render heading(row.widget, row.title)}{:else}{row.title}{/if}</svelte:element>
|
|
352
354
|
<div class="smrt-overview__content" aria-busy={row.status === 'loading'}>
|
|
353
355
|
{#if !row.def}
|
|
354
356
|
<p class="smrt-overview__state">{t(M['ui.overview.unavailable'])}</p>
|
|
@@ -376,7 +378,7 @@ const headingTag = $derived(`h${headingLevel}`);
|
|
|
376
378
|
</article>
|
|
377
379
|
{/snippet}
|
|
378
380
|
|
|
379
|
-
<div class="smrt-overview" bind:this={rootEl} data-editing={editing ? '' : undefined}>
|
|
381
|
+
<div class="smrt-overview" bind:this={rootEl} data-editing={editing ? '' : undefined} data-presentation={presentation}>
|
|
380
382
|
{#if editing}
|
|
381
383
|
<div class="smrt-overview__toolbar" role="toolbar" aria-label={t(M['ui.overview.toolbar'])}>
|
|
382
384
|
<ShellIconButton
|
|
@@ -547,6 +549,7 @@ const headingTag = $derived(`h${headingLevel}`);
|
|
|
547
549
|
.smrt-overview__item[data-drop='before']::before { inset-inline-start: 0; }
|
|
548
550
|
.smrt-overview__item[data-drop='after']::before { inset-inline-end: 0; }
|
|
549
551
|
.smrt-overview__tile { position: relative; block-size: 100%; box-sizing: border-box; padding: var(--smrt-spacing-3); border: 1px solid var(--smrt-color-outline-variant); border-radius: var(--smrt-radius-large, var(--smrt-radius-medium)); background: var(--smrt-color-surface); color: var(--smrt-color-on-surface); }
|
|
552
|
+
[data-presentation='plain']:not([data-editing]) .smrt-overview__tile { padding: 0; border: 0; border-radius: 0; background: transparent; }
|
|
550
553
|
[data-editing] .smrt-overview__tile { border-style: dashed; }
|
|
551
554
|
.smrt-overview__widget { display: grid; gap: var(--smrt-spacing-2); align-content: start; min-inline-size: 0; }
|
|
552
555
|
.smrt-overview__title { margin: 0; color: var(--smrt-color-on-surface-variant); font-size: var(--smrt-typography-title-small-size, 0.875rem); font-weight: var(--smrt-typography-weight-medium, 500); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverviewGrid.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/overview/OverviewGrid.svelte.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"OverviewGrid.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/overview/OverviewGrid.svelte.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AA4bzD,QAAA,MAAM,YAAY,uDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Component } from 'svelte';
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
2
|
import type { OverviewController } from './controller.svelte.js';
|
|
3
|
-
import type { OverviewOptions, RegisteredWidget, WidgetComponentProps } from './types.js';
|
|
3
|
+
import type { OverviewOptions, OverviewWidget, RegisteredWidget, WidgetComponentProps } from './types.js';
|
|
4
4
|
/** A model the option editor offers for `model` fields. */
|
|
5
5
|
export interface OverviewModelChoice {
|
|
6
6
|
value: string;
|
|
@@ -25,6 +25,10 @@ export interface OverviewGridProps {
|
|
|
25
25
|
label?: string;
|
|
26
26
|
/** Heading level of widget titles (default 2). */
|
|
27
27
|
headingLevel?: 2 | 3 | 4;
|
|
28
|
+
/** Optional title content; the grid retains the heading element and accessible id. */
|
|
29
|
+
heading?: Snippet<[widget: OverviewWidget, title: string]>;
|
|
30
|
+
/** Tile presentation outside edit mode (default card). Editing retains its frame. */
|
|
31
|
+
presentation?: 'card' | 'plain';
|
|
28
32
|
/** Models offered by `model` option fields (else a text box). */
|
|
29
33
|
models?: readonly OverviewModelChoice[];
|
|
30
34
|
/** Host renderer for icon names that are not built in. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-types.d.ts","sourceRoot":"","sources":["../../../src/components/overview/grid-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"grid-types.d.ts","sourceRoot":"","sources":["../../../src/components/overview/grid-types.ts"],"names":[],"mappings":"AAAA,OAAO,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AU,EAAE,gBAAgB,CAAC;IAC7B,+DAA+D;IAC/D,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACxC,+DAA+D;IAC/D,MAAM,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,iBAAiB,EAAE,GAAG,IAAI,CAAC;IACjE,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB"}
|
|
@@ -102,5 +102,8 @@ export declare const M: {
|
|
|
102
102
|
readonly 'ui.overview.records.view_all': "ui.overview.records.view_all";
|
|
103
103
|
readonly 'ui.overview.records.total': "ui.overview.records.total";
|
|
104
104
|
readonly 'ui.overview.shortcuts.empty': "ui.overview.shortcuts.empty";
|
|
105
|
+
readonly 'ui.cookbook.menu_entries': "ui.cookbook.menu_entries";
|
|
106
|
+
readonly 'ui.cookbook.section_not_found': "ui.cookbook.section_not_found";
|
|
107
|
+
readonly 'ui.cookbook.section_not_found_hint': "ui.cookbook.section_not_found_hint";
|
|
105
108
|
};
|
|
106
109
|
//# sourceMappingURL=strings.overview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.overview.d.ts","sourceRoot":"","sources":["../../src/i18n/strings.overview.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,CAAC
|
|
1
|
+
{"version":3,"file":"strings.overview.d.ts","sourceRoot":"","sources":["../../src/i18n/strings.overview.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmIZ,CAAC"}
|
|
@@ -111,4 +111,8 @@ export const M = defineMessages({
|
|
|
111
111
|
'ui.overview.records.view_all': 'View all',
|
|
112
112
|
'ui.overview.records.total': '{count} in total',
|
|
113
113
|
'ui.overview.shortcuts.empty': 'No pages to show.',
|
|
114
|
+
// Cookbook section page
|
|
115
|
+
'ui.cookbook.menu_entries': 'Menu entries',
|
|
116
|
+
'ui.cookbook.section_not_found': 'Section not found',
|
|
117
|
+
'ui.cookbook.section_not_found_hint': 'This section is not in your app.',
|
|
114
118
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-svelte",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.11",
|
|
4
4
|
"smrtJsdoc": "strict",
|
|
5
5
|
"description": "Svelte 5 components for SMRT user management - auth, users, tenants, roles, permissions, groups",
|
|
6
6
|
"type": "module",
|
|
@@ -63,6 +63,17 @@
|
|
|
63
63
|
"import": "./dist/components/overview/index.js",
|
|
64
64
|
"default": "./dist/components/overview/index.js"
|
|
65
65
|
},
|
|
66
|
+
"./cookbook": {
|
|
67
|
+
"types": "./dist/components/cookbook/index.d.ts",
|
|
68
|
+
"svelte": "./dist/components/cookbook/index.js",
|
|
69
|
+
"import": "./dist/components/cookbook/index.js",
|
|
70
|
+
"default": "./dist/components/cookbook/index.js"
|
|
71
|
+
},
|
|
72
|
+
"./cookbook/server": {
|
|
73
|
+
"types": "./dist/components/cookbook/server.d.ts",
|
|
74
|
+
"import": "./dist/components/cookbook/server.js",
|
|
75
|
+
"default": "./dist/components/cookbook/server.js"
|
|
76
|
+
},
|
|
66
77
|
"./overview/server": {
|
|
67
78
|
"types": "./dist/components/overview/server.d.ts",
|
|
68
79
|
"import": "./dist/components/overview/server.js",
|
|
@@ -194,11 +205,11 @@
|
|
|
194
205
|
},
|
|
195
206
|
"dependencies": {
|
|
196
207
|
"@happyvertical/logger": "^0.103.1",
|
|
197
|
-
"@happyvertical/smrt-languages": "0.55.
|
|
198
|
-
"@happyvertical/smrt-mcp-apps": "0.55.
|
|
199
|
-
"@happyvertical/smrt-types": "0.55.
|
|
200
|
-
"@happyvertical/smrt-ui": "0.55.
|
|
201
|
-
"@happyvertical/smrt-web": "0.55.
|
|
208
|
+
"@happyvertical/smrt-languages": "0.55.11",
|
|
209
|
+
"@happyvertical/smrt-mcp-apps": "0.55.11",
|
|
210
|
+
"@happyvertical/smrt-types": "0.55.11",
|
|
211
|
+
"@happyvertical/smrt-ui": "0.55.11",
|
|
212
|
+
"@happyvertical/smrt-web": "0.55.11",
|
|
202
213
|
"@tanstack/db": "^0.6.14",
|
|
203
214
|
"@tanstack/svelte-db": "^0.1.91",
|
|
204
215
|
"esm-env": "^1.2.2"
|
|
@@ -233,14 +244,14 @@
|
|
|
233
244
|
}
|
|
234
245
|
},
|
|
235
246
|
"devDependencies": {
|
|
236
|
-
"@happyvertical/smrt-agents": "0.55.
|
|
237
|
-
"@happyvertical/smrt-chat": "0.55.
|
|
238
|
-
"@happyvertical/smrt-content": "0.55.
|
|
239
|
-
"@happyvertical/smrt-core": "0.55.
|
|
240
|
-
"@happyvertical/smrt-reports": "0.55.
|
|
241
|
-
"@happyvertical/smrt-scanner": "0.55.
|
|
242
|
-
"@happyvertical/smrt-tenancy": "0.55.
|
|
243
|
-
"@happyvertical/smrt-users": "0.55.
|
|
247
|
+
"@happyvertical/smrt-agents": "0.55.11",
|
|
248
|
+
"@happyvertical/smrt-chat": "0.55.11",
|
|
249
|
+
"@happyvertical/smrt-content": "0.55.11",
|
|
250
|
+
"@happyvertical/smrt-core": "0.55.11",
|
|
251
|
+
"@happyvertical/smrt-reports": "0.55.11",
|
|
252
|
+
"@happyvertical/smrt-scanner": "0.55.11",
|
|
253
|
+
"@happyvertical/smrt-tenancy": "0.55.11",
|
|
254
|
+
"@happyvertical/smrt-users": "0.55.11",
|
|
244
255
|
"@happyvertical/speech": "^0.103.1",
|
|
245
256
|
"@sveltejs/package": "^2.5.8",
|
|
246
257
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|