rimecms 1.4.0 → 1.4.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.
@@ -20,8 +20,10 @@ function logResponse(event, status) {
20
20
  function createCMSHandler(rime) {
21
21
  const handleCMS = async ({ event, resolve }) => {
22
22
  event.locals.rime = rime.createRimeContext(event);
23
- // Once per process: every `$url` page missing an address gets one.
24
- if (!building)
23
+ // Once per process: every `$url` page missing an address gets one. A sub-request, an
24
+ // `event.fetch` of one of the app's own routes, skips it: it runs inside a request that is
25
+ // already awaiting it, so a `beforeRead` hook that fetches would otherwise wait on itself.
26
+ if (!building && !event.isSubRequest)
25
27
  await ensureAddresses(event);
26
28
  const response = await resolve(event).catch((err) => {
27
29
  // Thrown by a later handle step, as handleAuth does: SvelteKit answers it
@@ -0,0 +1,131 @@
1
+ import { FieldBuilder, type FieldNode, type ValueNode } from '../../core/fields/builders/field-builder.js';
2
+ import { FormFieldBuilder, type FormFieldUse } from '../../core/fields/builders/form-field-builder.js';
3
+ import type { CompletesDefault } from '../../core/fields/complete.js';
4
+ import type { DefaultOptions, DefaultValueFn, Field, FormField } from '../types.js';
5
+ import type { Dic } from '../../util/types.js';
6
+ import type { Component } from 'svelte';
7
+ import { type TreeItemDefault } from './defaults.js';
8
+ /** A list of items that nest: each item has the fields, and its own items in `_children`. */
9
+ export declare const tree: (name: string) => TreeBuilder;
10
+ export declare class TreeBuilder extends FormFieldBuilder<TreeField> {
11
+ constructor(name: string);
12
+ get component(): Component<import("./component/props.js").TreeProps, {}, "">;
13
+ get cell(): Component<{
14
+ value: any;
15
+ }>;
16
+ /** The fields of every item. The hidden `path` and `position` stay before them. */
17
+ fields(...fields: FieldBuilder<Field>[]): this;
18
+ /** The text of the button that adds an item at the root. */
19
+ addItemLabel(label: string): this;
20
+ /**
21
+ * The title of an item's card: `position` is its place, `1.2` for the second item of the first.
22
+ */
23
+ renderTitle(render: TreeFieldBlockRenderTitle): this;
24
+ /**
25
+ * How many levels may sit under a first-level item: `0` keeps the tree flat, `1` lets a
26
+ * first-level item hold items that hold none. 8 by default.
27
+ */
28
+ maxDepth(n: number): this;
29
+ /**
30
+ * The items a new document starts with. Each names the values it starts with and its own
31
+ * `_children`; the rest comes from the tree's fields.
32
+ *
33
+ * ```ts
34
+ * tree('nav').fields(text('label')).defaultValue([{ label: 'Home', _children: [{ label: 'About' }] }]);
35
+ * ```
36
+ */
37
+ defaultValue(value: TreeItemDefault[] | DefaultValueFn<TreeItemDefault[]>, options?: DefaultOptions): this;
38
+ /** The default completed as a document holds it — see `completeTree`. */
39
+ get use(): FormFieldUse<TreeField> & CompletesDefault<TreeItemDefault>;
40
+ /**
41
+ * The tree and its items' content fields localized, whichever of `fields()` and this comes
42
+ * first. `path`, `position` and `locale` stay as they are.
43
+ */
44
+ localized(): this;
45
+ /** The config as the panel and the server read it, the items' fields compiled too. */
46
+ compile(): {
47
+ fields: ({
48
+ name: string;
49
+ type: string;
50
+ live?: boolean | undefined;
51
+ condition?: ((doc: any, siblings: any) => boolean) | undefined;
52
+ width?: import("../types.js").FieldWidth | undefined;
53
+ className?: string | undefined;
54
+ component: Component<any>;
55
+ cell: Component<any> | undefined;
56
+ access: {
57
+ create: import("../types.js").FieldAccess;
58
+ read: import("../types.js").FieldAccess;
59
+ update: import("../types.js").FieldAccess;
60
+ };
61
+ } & {
62
+ component: Component<any>;
63
+ cell?: Component<{
64
+ value: any;
65
+ }> | null;
66
+ })[];
67
+ name: string;
68
+ type: "tree";
69
+ live?: boolean;
70
+ condition?: (doc: any, siblings: any) => boolean;
71
+ width?: import("../types.js").FieldWidth;
72
+ className?: string;
73
+ component: Component<any>;
74
+ cell: Component<any> | undefined;
75
+ access: {
76
+ create: import("../types.js").FieldAccess;
77
+ read: import("../types.js").FieldAccess;
78
+ update: import("../types.js").FieldAccess;
79
+ };
80
+ hidden?: boolean;
81
+ validate?: import("../types.js").FieldValidationFunc<any>;
82
+ required?: boolean;
83
+ localized?: boolean;
84
+ label?: string;
85
+ hint?: string;
86
+ table?: import("../../types.js").FieldPanelTableConfig;
87
+ hooks?: {
88
+ beforeRead?: import("../types.js").FieldHook[];
89
+ beforeSave?: import("../types.js").FieldHook[];
90
+ beforeValidate?: import("../types.js").FieldHookShared[];
91
+ beforeDuplicate?: import("../types.js").FieldHookDuplicate[];
92
+ onChange?: import("../types.js").FieldHookClient[];
93
+ };
94
+ defaultValue?: DefaultValueFn<any> | unknown;
95
+ defaultFill?: import("../types.js").DefaultFill;
96
+ isEmpty: (value: unknown) => boolean;
97
+ root?: boolean;
98
+ index?: boolean;
99
+ notNull?: {
100
+ default: string | number | boolean;
101
+ };
102
+ maxDepth: number;
103
+ renderTitle?: TreeFieldBlockRenderTitle;
104
+ addItemLabel: string;
105
+ };
106
+ /** A shared item type, `TreeNav`, holding its own `_children`, then `nav: Array<TreeNav>`. */
107
+ protected generateType(): string;
108
+ /** One branch, nesting into itself through `_children`, in a table of its own. */
109
+ protected nodes(): FieldNode[];
110
+ private get storage();
111
+ /**
112
+ * The rows a value has, the nesting flattened into the segment.
113
+ *
114
+ * ```
115
+ * [{ label: 'a', _children: [{ label: 'b' }] }] -> 0 · 0._children.0
116
+ * ```
117
+ */
118
+ protected nodesFor(value: unknown): ValueNode[];
119
+ }
120
+ /****************************************************/
121
+ export type TreeField = FormField & {
122
+ type: 'tree';
123
+ maxDepth: number;
124
+ renderTitle?: TreeFieldBlockRenderTitle;
125
+ fields: FieldBuilder<Field>[];
126
+ addItemLabel: string;
127
+ };
128
+ export type TreeFieldBlockRenderTitle = (args: {
129
+ position: string;
130
+ values: Dic;
131
+ }) => string;
@@ -0,0 +1,7 @@
1
+ import { Tooltip as TooltipPrimitive } from 'bits-ui';
2
+ import Content from './tooltip-content.svelte';
3
+ declare const Root: typeof TooltipPrimitive.Root;
4
+ declare const Portal: import("svelte").Component<TooltipPrimitive.PortalProps, {}, "">;
5
+ declare const Trigger: typeof TooltipPrimitive.Trigger;
6
+ declare const Provider: import("svelte").Component<TooltipPrimitive.ProviderProps, {}, "">;
7
+ export { Root, Portal, Trigger, Content, Provider };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rimecms",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "homepage": "https://github.com/bienbiendev/rime",
5
5
  "packageManager": "bun@1.3.0",
6
6
  "scripts": {