rimecms 1.1.1 → 1.1.3

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.
Files changed (142) hide show
  1. package/dist/adapter-sqlite/read.server.js +4 -4
  2. package/dist/adapter-sqlite/table.server.d.ts +3 -6
  3. package/dist/adapter-sqlite/table.server.js +3 -6
  4. package/dist/adapter-sqlite/transform.server.d.ts +1 -1
  5. package/dist/adapter-sqlite/transform.server.js +3 -2
  6. package/dist/adapter-sqlite/write.server.d.ts +13 -15
  7. package/dist/adapter-sqlite/write.server.js +15 -17
  8. package/dist/core/adapter.d.ts +19 -33
  9. package/dist/core/adapter.js +0 -12
  10. package/dist/core/auth/augment.js +2 -1
  11. package/dist/core/auth/hooks/augment-fields-password.server.d.ts +2 -2
  12. package/dist/core/auth/hooks/augment-fields-password.server.js +2 -2
  13. package/dist/core/auth/tables.d.ts +2 -5
  14. package/dist/core/auth/tables.js +3 -7
  15. package/dist/core/auth/validate-config.d.ts +3 -8
  16. package/dist/core/auth/validate-config.js +4 -10
  17. package/dist/core/config/types.d.ts +6 -6
  18. package/dist/core/config/validate.server.js +11 -0
  19. package/dist/core/fields/builders/boolean-builder.d.ts +2 -2
  20. package/dist/core/fields/builders/boolean-builder.js +4 -1
  21. package/dist/core/fields/builders/select-builder.d.ts +3 -3
  22. package/dist/core/fields/builders/select-builder.js +4 -2
  23. package/dist/core/fields/complete.d.ts +18 -0
  24. package/dist/core/fields/complete.js +32 -0
  25. package/dist/core/fields/empty.d.ts +14 -0
  26. package/dist/core/fields/empty.js +13 -0
  27. package/dist/core/fields/initial.d.ts +32 -0
  28. package/dist/core/fields/initial.js +47 -0
  29. package/dist/core/fields/util.d.ts +0 -16
  30. package/dist/core/fields/util.js +0 -29
  31. package/dist/core/i18n/en/fields.d.ts +1 -1
  32. package/dist/core/i18n/en/fields.js +1 -1
  33. package/dist/core/i18n/fr/fields.d.ts +1 -1
  34. package/dist/core/i18n/fr/fields.js +1 -1
  35. package/dist/core/pipeline/build-document.server.d.ts +4 -10
  36. package/dist/core/pipeline/build-document.server.js +8 -17
  37. package/dist/core/pipeline/hooks/data-config-map.server.d.ts +1 -1
  38. package/dist/core/pipeline/hooks/data-config-map.server.js +1 -1
  39. package/dist/core/pipeline/hooks/process-document-fields.server.d.ts +3 -2
  40. package/dist/core/pipeline/hooks/process-document-fields.server.js +3 -16
  41. package/dist/core/pipeline/hooks/set-default-values.server.d.ts +15 -4
  42. package/dist/core/pipeline/hooks/set-default-values.server.js +50 -25
  43. package/dist/core/pipeline/hooks/validate-fields.server.js +1 -1
  44. package/dist/core/pipeline/run.server.js +1 -2
  45. package/dist/core/prototype/area/api.server.d.ts +4 -6
  46. package/dist/core/prototype/area/api.server.js +4 -6
  47. package/dist/core/prototype/area/definition.server.js +23 -9
  48. package/dist/core/prototype/area/hooks.server.js +1 -1
  49. package/dist/core/prototype/collection/api.server.d.ts +5 -6
  50. package/dist/core/prototype/collection/api.server.js +5 -6
  51. package/dist/core/prototype/collection/definition.js +3 -8
  52. package/dist/core/prototype/collection/hooks/merge-with-initial.server.d.ts +15 -0
  53. package/dist/core/prototype/collection/hooks/merge-with-initial.server.js +20 -0
  54. package/dist/core/prototype/collection/hooks.server.js +5 -5
  55. package/dist/core/prototype/collection/nested/module.js +1 -1
  56. package/dist/core/prototype/collection/nested/module.server.js +1 -1
  57. package/dist/core/prototype/collection/operations/duplicate.js +4 -8
  58. package/dist/core/prototype/collection/upload/directories/derive.js +2 -2
  59. package/dist/core/prototype/collection/upload/hooks/handle-path-creation.server.js +2 -2
  60. package/dist/core/prototype/define.d.ts +2 -2
  61. package/dist/core/prototype/define.js +4 -4
  62. package/dist/core/prototype/initial.d.ts +23 -0
  63. package/dist/core/prototype/initial.js +19 -0
  64. package/dist/core/prototype/shared/versions/augment.d.ts +2 -4
  65. package/dist/core/prototype/shared/versions/augment.js +4 -6
  66. package/dist/core/prototype/shared/versions/configure.server.js +3 -3
  67. package/dist/core/prototype/shared/versions/hooks/fallback-data-from-original.d.ts +14 -2
  68. package/dist/core/prototype/shared/versions/hooks/fallback-data-from-original.js +28 -22
  69. package/dist/core/prototype/shared/versions/hooks/handle-new-version.server.js +3 -4
  70. package/dist/core/prototype/shared/versions/{blank.d.ts → initial.d.ts} +2 -4
  71. package/dist/core/prototype/shared/versions/{blank.js → initial.js} +2 -4
  72. package/dist/core/prototype/when.d.ts +2 -6
  73. package/dist/core/prototype/when.js +2 -6
  74. package/dist/fields/blocks/component/AddBlockButton.svelte +2 -2
  75. package/dist/fields/blocks/component/focus/BlocksFocus.svelte +16 -10
  76. package/dist/fields/blocks/component/focus/Inspector.svelte +27 -3
  77. package/dist/fields/blocks/component/focus/LayersList.svelte +4 -1
  78. package/dist/fields/blocks/component/focus/Renders.svelte +55 -11
  79. package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +3 -0
  80. package/dist/fields/blocks/component/focus/StageAdd.svelte +42 -0
  81. package/dist/fields/blocks/component/focus/StageAdd.svelte.d.ts +6 -0
  82. package/dist/fields/blocks/component/focus/focus.svelte.d.ts +6 -4
  83. package/dist/fields/blocks/component/focus/focus.svelte.js +34 -8
  84. package/dist/fields/blocks/defaults.d.ts +22 -0
  85. package/dist/fields/blocks/defaults.js +23 -0
  86. package/dist/fields/blocks/index.d.ts +42 -5
  87. package/dist/fields/blocks/index.js +37 -1
  88. package/dist/fields/combobox/index.d.ts +2 -2
  89. package/dist/fields/combobox/index.js +2 -1
  90. package/dist/fields/date/index.d.ts +2 -2
  91. package/dist/fields/date/index.js +2 -1
  92. package/dist/fields/email/index.d.ts +2 -2
  93. package/dist/fields/email/index.js +2 -1
  94. package/dist/fields/group/index.d.ts +1 -0
  95. package/dist/fields/link/index.d.ts +3 -2
  96. package/dist/fields/link/index.js +2 -1
  97. package/dist/fields/number/index.d.ts +3 -2
  98. package/dist/fields/number/index.js +2 -1
  99. package/dist/fields/relation/component/RelationInline.svelte +1 -2
  100. package/dist/fields/relation/component/default/Default.svelte +1 -1
  101. package/dist/fields/relation/component/upload/Create.svelte +1 -1
  102. package/dist/fields/relation/index.d.ts +2 -2
  103. package/dist/fields/relation/index.js +2 -1
  104. package/dist/fields/rich-text/index.d.ts +2 -2
  105. package/dist/fields/rich-text/index.js +2 -1
  106. package/dist/fields/slug/index.d.ts +3 -2
  107. package/dist/fields/slug/index.js +2 -1
  108. package/dist/fields/text/index.d.ts +3 -2
  109. package/dist/fields/text/index.js +2 -1
  110. package/dist/fields/textarea/index.d.ts +3 -2
  111. package/dist/fields/textarea/index.js +2 -1
  112. package/dist/fields/time/index.d.ts +2 -2
  113. package/dist/fields/time/index.js +2 -1
  114. package/dist/fields/toggle/index.d.ts +3 -2
  115. package/dist/fields/toggle/index.js +2 -2
  116. package/dist/fields/tree/component/AddItemButton.svelte +3 -4
  117. package/dist/fields/tree/component/AddItemButton.svelte.d.ts +1 -1
  118. package/dist/fields/tree/defaults.d.ts +21 -0
  119. package/dist/fields/tree/defaults.js +18 -0
  120. package/dist/fields/tree/index.d.ts +17 -3
  121. package/dist/fields/tree/index.js +27 -0
  122. package/dist/fields/types.d.ts +14 -0
  123. package/dist/panel/components/ui/button/button.svelte +2 -3
  124. package/dist/panel/context/blocks-ops.d.ts +0 -1
  125. package/dist/panel/context/blocks-ops.js +1 -2
  126. package/dist/panel/pages/collection-document/load.server.js +1 -1
  127. package/dist/panel/style/index.css +4 -3
  128. package/dist/panel/style/palette.css +3 -3
  129. package/dist/panel/style/scheme.css +1 -0
  130. package/dist/util/object.d.ts +2 -2
  131. package/dist/util/object.js +3 -3
  132. package/dist/util/random.d.ts +2 -0
  133. package/dist/util/random.js +2 -0
  134. package/package.json +1 -1
  135. package/dist/core/fields/blank.d.ts +0 -21
  136. package/dist/core/fields/blank.js +0 -37
  137. package/dist/core/prototype/blank.d.ts +0 -26
  138. package/dist/core/prototype/blank.js +0 -22
  139. package/dist/core/prototype/collection/hooks/merge-with-blank.server.d.ts +0 -9
  140. package/dist/core/prototype/collection/hooks/merge-with-blank.server.js +0 -14
  141. package/dist/fields/blocks/component/focus/StagePlaceholder.svelte +0 -66
  142. package/dist/fields/blocks/component/focus/StagePlaceholder.svelte.d.ts +0 -3
@@ -64,6 +64,8 @@ export type FormField = Field & {
64
64
  table?: FieldPanelTableConfig;
65
65
  hooks?: FieldHooks;
66
66
  defaultValue?: DefaultValueFn<any> | unknown;
67
+ /** When the default fills the field. Set by `defaultValue(value, { fill })`. */
68
+ defaultFill?: DefaultFill;
67
69
  isEmpty: (value: unknown) => boolean;
68
70
  /** Kept on the base row of a versioned config, shared by every version. Set by `$root()`. */
69
71
  root?: boolean;
@@ -73,6 +75,18 @@ export type FormField = Field & {
73
75
  export type DefaultValueFn<T> = ({ event }: {
74
76
  event?: RequestEvent;
75
77
  }) => T;
78
+ /**
79
+ * When a default fills its field.
80
+ *
81
+ * ```ts
82
+ * text('title').defaultValue('Untitled') // 'create': a new document starts with it
83
+ * text('title').defaultValue('Untitled', { fill: 'save' }) // 'save': and a save never leaves it empty
84
+ * ```
85
+ */
86
+ export type DefaultFill = 'create' | 'save';
87
+ export type DefaultOptions = {
88
+ fill?: DefaultFill;
89
+ };
76
90
  export type FieldHookContext<T extends FormField = FormField> = {
77
91
  event: RequestEvent;
78
92
  /** The document Id being processed */
@@ -103,7 +103,7 @@
103
103
  --rz-button-ghost-fg: var(--rz-fg);
104
104
 
105
105
  /* Secondary variant */
106
- --rz-button-secondary-bg: var(--rz-bg-raised);
106
+ --rz-button-secondary-bg: oklch(from var(--rz-bg-inverse) l c h / 0.032);
107
107
  --rz-button-secondary-fg: var(--rz-fg);
108
108
 
109
109
  /* Link variant */
@@ -129,8 +129,7 @@
129
129
  font-variation-settings: 'wght' 500;
130
130
  font-weight: 500;
131
131
  transition-property:
132
- box-shadow, color, background-color, border-color, text-decoration-color, fill, stroke,
133
- filter;
132
+ box-shadow, color, background-color, border-color, text-decoration-color, fill, stroke, filter;
134
133
  transition-duration: 0.25s;
135
134
  gap: var(--rz-size-2);
136
135
  fill: currentColor;
@@ -24,7 +24,6 @@ export type BlockClipboardData = {
24
24
  block: GenericBlock;
25
25
  };
26
26
  export declare const CLIPBOARD_KIND = "block";
27
- export declare const tempId: () => string;
28
27
  /** `sections.0.items.2` -> `{ list: 'sections.0.items', index: 2 }` */
29
28
  export declare const parseBlockPath: (path: string) => BlockAt;
30
29
  export declare const blockPath: (at: BlockAt) => string;
@@ -1,9 +1,8 @@
1
1
  import { getValueAtPath, isObjectLiteral, setValueAtPath } from '../../util/object.js';
2
2
  import { normalizeFieldPath } from '../../util/string.js';
3
- import { randomId } from '../../util/random.js';
3
+ import { tempId } from '../../util/random.js';
4
4
  import cloneDeep from 'clone-deep';
5
5
  export const CLIPBOARD_KIND = 'block';
6
- export const tempId = () => `temp-${randomId(8)}`;
7
6
  /** `sections.0.items.2` -> `{ list: 'sections.0.items', index: 2 }` */
8
7
  export const parseBlockPath = (path) => {
9
8
  const normalized = normalizeFieldPath(path);
@@ -30,7 +30,7 @@ export async function documentLoad(event) {
30
30
  if (!authorized) {
31
31
  throw handleError(new RimeError(RimeError.UNAUTHORIZED), { context: ERROR_CONTEXT.LOAD });
32
32
  }
33
- doc = collection.blank();
33
+ doc = collection.initial();
34
34
  }
35
35
  else {
36
36
  /** Check for authorizations */
@@ -520,9 +520,9 @@ video {
520
520
  --rz-gray-10: oklch(0.625 var(--rz-gray-chroma) var(--rz-gray-hue));
521
521
  --rz-gray-11: oklch(0.69 var(--rz-gray-chroma) var(--rz-gray-hue));
522
522
  --rz-gray-12: oklch(0.755 var(--rz-gray-chroma) var(--rz-gray-hue));
523
- --rz-gray-13: oklch(0.815 var(--rz-gray-chroma) var(--rz-gray-hue));
524
- --rz-gray-14: oklch(0.865 var(--rz-gray-chroma) var(--rz-gray-hue));
525
- --rz-gray-15: oklch(0.905 var(--rz-gray-chroma) var(--rz-gray-hue));
523
+ --rz-gray-13: oklch(0.845 var(--rz-gray-chroma) var(--rz-gray-hue));
524
+ --rz-gray-14: oklch(0.885 var(--rz-gray-chroma) var(--rz-gray-hue));
525
+ --rz-gray-15: oklch(0.915 var(--rz-gray-chroma) var(--rz-gray-hue));
526
526
  --rz-gray-16: oklch(0.94 var(--rz-gray-chroma) var(--rz-gray-hue));
527
527
  --rz-gray-17: oklch(0.968 var(--rz-gray-chroma) var(--rz-gray-hue));
528
528
  --rz-gray-18: oklch(0.986 var(--rz-gray-chroma) var(--rz-gray-hue));
@@ -547,6 +547,7 @@ video {
547
547
  */
548
548
  :root {
549
549
  color-scheme: light dark;
550
+ scrollbar-color: var(--rz-border-strong) transparent; /* thumb track */
550
551
 
551
552
  /* levels */
552
553
  --rz-bg-base: var(--rz-gray-15);
@@ -18,9 +18,9 @@
18
18
  --rz-gray-10: oklch(0.625 var(--rz-gray-chroma) var(--rz-gray-hue));
19
19
  --rz-gray-11: oklch(0.69 var(--rz-gray-chroma) var(--rz-gray-hue));
20
20
  --rz-gray-12: oklch(0.755 var(--rz-gray-chroma) var(--rz-gray-hue));
21
- --rz-gray-13: oklch(0.815 var(--rz-gray-chroma) var(--rz-gray-hue));
22
- --rz-gray-14: oklch(0.865 var(--rz-gray-chroma) var(--rz-gray-hue));
23
- --rz-gray-15: oklch(0.905 var(--rz-gray-chroma) var(--rz-gray-hue));
21
+ --rz-gray-13: oklch(0.845 var(--rz-gray-chroma) var(--rz-gray-hue));
22
+ --rz-gray-14: oklch(0.885 var(--rz-gray-chroma) var(--rz-gray-hue));
23
+ --rz-gray-15: oklch(0.915 var(--rz-gray-chroma) var(--rz-gray-hue));
24
24
  --rz-gray-16: oklch(0.94 var(--rz-gray-chroma) var(--rz-gray-hue));
25
25
  --rz-gray-17: oklch(0.968 var(--rz-gray-chroma) var(--rz-gray-hue));
26
26
  --rz-gray-18: oklch(0.986 var(--rz-gray-chroma) var(--rz-gray-hue));
@@ -6,6 +6,7 @@
6
6
  */
7
7
  :root {
8
8
  color-scheme: light dark;
9
+ scrollbar-color: var(--rz-border-strong) transparent; /* thumb track */
9
10
 
10
11
  /* levels */
11
12
  --rz-bg-base: var(--rz-gray-15);
@@ -40,11 +40,11 @@ export declare const omitId: <T extends {
40
40
  * Anything the object holds is the object's — `null` included, an array as it is.
41
41
  *
42
42
  * ```
43
- * withDefaults({ title: 'T', seo: { og: null } }, { title: null, body: null, seo: { og: null, meta: null } })
43
+ * withDefaultValues({ title: 'T', seo: { og: null } }, { title: null, body: null, seo: { og: null, meta: null } })
44
44
  * // { title: 'T', seo: { og: null, meta: null }, body: null }
45
45
  * ```
46
46
  */
47
- export declare const withDefaults: <T extends Dic>(obj: T, defaults: Dic) => T;
47
+ export declare const withDefaultValues: <T extends Dic>(obj: T, defaults: Dic) => T;
48
48
  /**
49
49
  * Type guard to check if an object has all the specified properties.
50
50
  *
@@ -59,18 +59,18 @@ export const omitId = (obj) => omit(['id'], obj);
59
59
  * Anything the object holds is the object's — `null` included, an array as it is.
60
60
  *
61
61
  * ```
62
- * withDefaults({ title: 'T', seo: { og: null } }, { title: null, body: null, seo: { og: null, meta: null } })
62
+ * withDefaultValues({ title: 'T', seo: { og: null } }, { title: null, body: null, seo: { og: null, meta: null } })
63
63
  * // { title: 'T', seo: { og: null, meta: null }, body: null }
64
64
  * ```
65
65
  */
66
- export const withDefaults = (obj, defaults) => {
66
+ export const withDefaultValues = (obj, defaults) => {
67
67
  const out = { ...obj };
68
68
  for (const key of Object.keys(defaults)) {
69
69
  const value = obj[key];
70
70
  if (value === undefined)
71
71
  out[key] = defaults[key];
72
72
  else if (isObjectLiteral(value) && isObjectLiteral(defaults[key])) {
73
- out[key] = withDefaults(value, defaults[key]);
73
+ out[key] = withDefaultValues(value, defaults[key]);
74
74
  }
75
75
  }
76
76
  return out;
@@ -8,6 +8,8 @@
8
8
  * // Result example: "a7bF9cD3eZ"
9
9
  */
10
10
  export declare const randomId: (length: number) => string;
11
+ /** The id of a row not saved yet: a save adds it and gives it a real one. `temp-3f9aK2bQ` */
12
+ export declare const tempId: () => string;
11
13
  /**
12
14
  * Generate a secure random password with uppercase, lowercase, numbers and symbols
13
15
  *
@@ -27,6 +27,8 @@ export const randomId = (length) => {
27
27
  }
28
28
  return result;
29
29
  };
30
+ /** The id of a row not saved yet: a save adds it and gives it a real one. `temp-3f9aK2bQ` */
31
+ export const tempId = () => `temp-${randomId(8)}`;
30
32
  /**
31
33
  * Generate a secure random password with uppercase, lowercase, numbers and symbols
32
34
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rimecms",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "homepage": "https://github.com/bienbiendev/rime",
5
5
  "packageManager": "bun@1.3.0",
6
6
  "scripts": {
@@ -1,21 +0,0 @@
1
- import type { FieldBuilder } from './builders/field-builder.js';
2
- import type { Field } from '../../fields/types.js';
3
- import type { Dic } from '../../util/types.js';
4
- import type { RequestEvent } from '@sveltejs/kit';
5
- /** What a field is handed to build its blank value. The event is a default's, and boot has none. */
6
- export type BlankContext = {
7
- event?: RequestEvent;
8
- };
9
- /**
10
- * A list of fields as a blank object, each field contributing its own members.
11
- *
12
- * A branch opens an object, a leaf holds its default, and a repeater holds its own — `#` in a
13
- * segment means only a document can name the children.
14
- *
15
- * ```
16
- * group('attributes').fields(text('title')) -> { attributes: { title: null } }
17
- * tabs(tab('meta').fields(text('title'))) -> { meta: { title: null } }
18
- * blocks('layout', [...]) -> { layout: [] }
19
- * ```
20
- */
21
- export declare const blankFields: (fields: FieldBuilder<Field>[], context?: BlankContext) => Dic;
@@ -1,37 +0,0 @@
1
- import { isFormField } from './util.js';
2
- /**
3
- * A list of fields as a blank object, each field contributing its own members.
4
- *
5
- * A branch opens an object, a leaf holds its default, and a repeater holds its own — `#` in a
6
- * segment means only a document can name the children.
7
- *
8
- * ```
9
- * group('attributes').fields(text('title')) -> { attributes: { title: null } }
10
- * tabs(tab('meta').fields(text('title'))) -> { meta: { title: null } }
11
- * blocks('layout', [...]) -> { layout: [] }
12
- * ```
13
- */
14
- export const blankFields = (fields, context = {}) => {
15
- const doc = {};
16
- for (const field of fields) {
17
- try {
18
- const nodes = field.use.nodes();
19
- if (!nodes.length || nodes.some((node) => node.segment.includes('#'))) {
20
- if (isFormField(field))
21
- doc[field.name] = field.use.defaultValue(context) ?? null;
22
- continue;
23
- }
24
- // Its name opens an object, or it has none and its branches land on this one.
25
- const target = field.name ? (doc[field.name] = {}) : doc;
26
- for (const node of nodes) {
27
- const bucket = node.segment ? (target[node.segment] = {}) : target;
28
- Object.assign(bucket, blankFields(node.fields, context));
29
- }
30
- }
31
- catch (err) {
32
- console.error(`Building the blank value of ${field.type} field "${field.name}" failed.`);
33
- throw err;
34
- }
35
- }
36
- return doc;
37
- };
@@ -1,26 +0,0 @@
1
- import type { FieldBuilder } from '../fields/builders/field-builder.js';
2
- import type { GenericDoc } from './types.js';
3
- import type { Field } from '../../fields/types.js';
4
- import type { RequestEvent } from '@sveltejs/kit';
5
- /** What `blank` reads off the config it is a method of. */
6
- type BlankOwner = {
7
- fields: FieldBuilder<Field>[];
8
- slug: string;
9
- type: string;
10
- };
11
- /**
12
- * A document of this config's shape with every default applied, and no id.
13
- *
14
- * ```ts
15
- * const page = config.getCollection('pages').blank();
16
- * ```
17
- *
18
- * Written as a standalone function so every config carries the same one — `definePrototype.create`
19
- * for an authored config, and the three derivations that build a config by hand. The event is a
20
- * field default's; boot has none, and a default that reads it gets `undefined` there.
21
- *
22
- * Nothing feature-shaped lands here: a feature adds to a blank document through
23
- * `FeatureDefinition.blank`, which the local API folds.
24
- */
25
- export declare function blank(this: BlankOwner, event?: RequestEvent): GenericDoc;
26
- export {};
@@ -1,22 +0,0 @@
1
- import { blankFields } from '../fields/blank.js';
2
- /**
3
- * A document of this config's shape with every default applied, and no id.
4
- *
5
- * ```ts
6
- * const page = config.getCollection('pages').blank();
7
- * ```
8
- *
9
- * Written as a standalone function so every config carries the same one — `definePrototype.create`
10
- * for an authored config, and the three derivations that build a config by hand. The event is a
11
- * field default's; boot has none, and a default that reads it gets `undefined` there.
12
- *
13
- * Nothing feature-shaped lands here: a feature adds to a blank document through
14
- * `FeatureDefinition.blank`, which the local API folds.
15
- */
16
- export function blank(event) {
17
- return {
18
- ...blankFields(this.fields, { event }),
19
- _type: this.slug,
20
- _prototype: this.type
21
- };
22
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Fills the incoming data from a blank document, so a create starts from every field the config
3
- * declares rather than only the ones the caller sent.
4
- *
5
- * What the caller sent is kept as sent: an upload's `File` is not a plain object and is not
6
- * walked, a key no field declares has no blank to fill from. The data's own nested objects are
7
- * shared with the caller's payload from here on, not copied.
8
- */
9
- export declare const mergeWithBlankDocument: import("../../../pipeline/types").Hook<"raw", "create", "before">;
@@ -1,14 +0,0 @@
1
- import { Hooks } from '../../../pipeline/define-hook.js';
2
- import { withDefaults } from '../../../../util/object.js';
3
- /**
4
- * Fills the incoming data from a blank document, so a create starts from every field the config
5
- * declares rather than only the ones the caller sent.
6
- *
7
- * What the caller sent is kept as sent: an upload's `File` is not a plain object and is not
8
- * walked, a key no field declares has no blank to fill from. The data's own nested objects are
9
- * shared with the caller's payload from here on, not copied.
10
- */
11
- export const mergeWithBlankDocument = Hooks.beforeCreate(async function mergeWithBlankDocument(args) {
12
- const blank = args.config.blank(args.event);
13
- return { ...args, data: withDefaults(args.data, blank) };
14
- });
@@ -1,66 +0,0 @@
1
- <script lang="ts">
2
- import { t__ } from '../../../../core/i18n/index.js';
3
- import Kbd from '../../../../panel/components/ui/kbd/Kbd.svelte';
4
- import { getBlocksFocusContext } from './focus.svelte.js';
5
-
6
- const focus = getBlocksFocusContext()!;
7
-
8
- /** "Type $1 to add a block", cut around the key. */
9
- const KEY = '\u0000';
10
- const [before, after] = $derived(t__('fields.type_to_add_block', KEY).split(KEY));
11
-
12
- /** Adds at the end of the open list: the root selected, then the picker, as `/` opens. */
13
- function add(event: MouseEvent) {
14
- event.stopPropagation();
15
- focus.selectRoot();
16
- focus.pick();
17
- }
18
- </script>
19
-
20
- <!-- Under the blocks: the key that adds one, and a click that does the same. -->
21
- <button type="button" class="rz-stage-placeholder" onclick={add}>
22
- {before}<Kbd keys="/" />{after}
23
- </button>
24
-
25
- <style>/* A level: its fill, a hairline, and its shadow when it has one. raised has none, float does. */
26
-
27
- /* A well: an input, a track, a dropzone. Its edge shows on hover. */
28
-
29
- /* The hover tint, laid over the element's own fill. */
30
-
31
- /* The picked item of a segmented control. */
32
-
33
- /* The primary button's face: black on light, white on dark. */
34
-
35
- /* Keyboard focus on a button, a tab, a link. */
36
-
37
- /* A focused input: an accent edge and a soft halo. */
38
-
39
- /* An input with an error. */
40
- .rz-stage-placeholder {
41
- display: block;
42
- width: 100%;
43
- padding: var(--rz-size-1) var(--rz-size-1-5);
44
- border-radius: var(--rz-radius-lg);
45
- color: var(--rz-fg-subtle);
46
- font-size: var(--rz-text-xl);
47
- text-align: left;
48
- cursor: text;
49
- transition: color 0.15s;
50
-
51
- &:hover {
52
- color: var(--rz-fg-muted);
53
- }
54
- &:focus-visible {
55
- outline: 2px solid var(--rz-accent-border);
56
- outline-offset: 2px;
57
- }
58
-
59
- :global(.rz-kbd) {
60
- margin-inline: var(--rz-size-0-5);
61
- color: var(--rz-fg-muted);
62
- font-size: var(--rz-text-sm);
63
- vertical-align: text-bottom;
64
- }
65
- }
66
- </style>
@@ -1,3 +0,0 @@
1
- declare const StagePlaceholder: import("svelte").Component<Record<string, never>, {}, "">;
2
- type StagePlaceholder = ReturnType<typeof StagePlaceholder>;
3
- export default StagePlaceholder;