alinea 1.7.0-preview.8 → 1.7.0

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 (83) hide show
  1. package/dist/.init/content/pages/welcome.json +1 -1
  2. package/dist/LICENSES.md +62 -62
  3. package/dist/adapter/next/handler.js +1 -1
  4. package/dist/backend/api/OAuth2.d.ts +6 -0
  5. package/dist/backend/api/OAuth2.js +35 -13
  6. package/dist/backend/router/Router.d.ts +15 -0
  7. package/dist/backend/router/Router.js +3 -0
  8. package/dist/backend/util/ExecGit.d.ts +2 -2
  9. package/dist/bundled.d.ts +297 -235
  10. package/dist/chunks/{chunk-VE4QBNQR.js → chunk-2X5P2RZV.js} +10 -5
  11. package/dist/chunks/{chunk-POPX5CXB.js → chunk-WKC37UOZ.js} +12 -6
  12. package/dist/cli/Serve.js +1 -1
  13. package/dist/cli/bin.js +1 -1
  14. package/dist/cli/serve/CreateLocalServer.js +34 -4
  15. package/dist/cloud/CloudRemote.d.ts +2 -2
  16. package/dist/cloud/CloudRemote.js +8 -2
  17. package/dist/core/Graph.d.ts +1 -1
  18. package/dist/core/Type.d.ts +2 -0
  19. package/dist/core/db/EntryIndex.d.ts +3 -1
  20. package/dist/core/db/EntryIndex.js +15 -3
  21. package/dist/core/db/LocalDB.d.ts +1 -1
  22. package/dist/core/db/Operation.js +3 -1
  23. package/dist/core/db/WriteableGraph.d.ts +1 -1
  24. package/dist/core/media/IsImage.d.ts +1 -1
  25. package/dist/core/media/MediaTypes.d.ts +1 -1
  26. package/dist/core/media/Summary.d.ts +2 -2
  27. package/dist/core/shape/ListShape.d.ts +1 -1
  28. package/dist/core/source/FSSource.d.ts +2 -2
  29. package/dist/core/source/Source.d.ts +2 -2
  30. package/dist/core/source/Tree.d.ts +3 -3
  31. package/dist/core/source/Utils.js +4 -1
  32. package/dist/core/util/ArrayBuffers.d.ts +1 -1
  33. package/dist/core/util/BufferToBase64.d.ts +2 -2
  34. package/dist/core/util/JWT.d.ts +11 -2
  35. package/dist/core/util/JWT.js +16 -12
  36. package/dist/dashboard/DashboardNav.d.ts +8 -8
  37. package/dist/dashboard/Routes.d.ts +25 -25
  38. package/dist/dashboard/atoms/DbAtoms.d.ts +1 -1
  39. package/dist/dashboard/atoms/Edits.d.ts +3 -3
  40. package/dist/dashboard/atoms/EntryEditorAtoms.d.ts +27 -27
  41. package/dist/dashboard/atoms/EntryEditorAtoms.js +3 -1
  42. package/dist/dashboard/atoms/EntrySummaryAtoms.d.ts +1 -1
  43. package/dist/dashboard/atoms/NavigationAtoms.d.ts +9 -9
  44. package/dist/dashboard/atoms/PreferencesAtoms.d.ts +1 -1
  45. package/dist/dashboard/atoms/RouterAtoms.d.ts +1 -1
  46. package/dist/dashboard/boot/LoadWorker.js +3 -2
  47. package/dist/dashboard/editor/DefaultViews.d.ts +1 -1
  48. package/dist/dashboard/editor/UseField.js +8 -1
  49. package/dist/dashboard/hook/UseNav.d.ts +4 -4
  50. package/dist/dashboard/hook/UseRoot.d.ts +2 -2
  51. package/dist/dashboard/hook/UseWorkspace.d.ts +3 -3
  52. package/dist/dashboard/util/Loader.d.ts +1 -1
  53. package/dist/dashboard/view/InputLabel.d.ts +1 -1
  54. package/dist/dashboard/view/explorer/ExplorerRow.d.ts +1 -1
  55. package/dist/field/link/EntryLink.d.ts +1 -1
  56. package/dist/field/link/FileLink.d.ts +2 -2
  57. package/dist/field/link/LinkField.view.js +18 -0
  58. package/dist/field/link/UrlLink.d.ts +1 -1
  59. package/dist/field/richtext/Extensions.d.ts +1 -0
  60. package/dist/field/richtext/Extensions.js +118 -9
  61. package/dist/field/richtext/Toolbar.d.ts +6 -0
  62. package/dist/field/richtext/Toolbar.js +7 -0
  63. package/dist/index.css +4 -0
  64. package/dist/picker/url/UrlPicker.js +1 -1
  65. package/dist/query.d.ts +85 -85
  66. package/dist/test/example.d.ts +58 -58
  67. package/dist/test/schema/DemoHome.d.ts +17 -17
  68. package/dist/test/schema/DemoRecipe.d.ts +10 -10
  69. package/dist/test/schema/DemoRecipes.d.ts +2 -2
  70. package/dist/ui/Button.stories.d.ts +1 -1
  71. package/dist/ui/Ellipsis.d.ts +1 -1
  72. package/dist/ui/Stack.d.ts +4 -4
  73. package/dist/ui/Typo.d.ts +2 -2
  74. package/dist/ui/icons/IcRoundAttachFile.d.ts +2 -0
  75. package/dist/ui/icons/IcRoundAttachFile.js +10 -0
  76. package/dist/ui/icons/IcRoundFormatPaint.d.ts +2 -0
  77. package/dist/ui/icons/IcRoundFormatPaint.js +10 -0
  78. package/dist/ui/icons/IcRoundPanorama.d.ts +2 -0
  79. package/dist/ui/icons/IcRoundPanorama.js +10 -0
  80. package/dist/ui/util/CreateTypo.d.ts +2 -2
  81. package/llms-full.txt +4278 -0
  82. package/package.json +10 -5
  83. package/readme.md +4 -0
@@ -1,5 +1,5 @@
1
1
  export declare const dbAtom: import("jotai").Atom<import("../boot/WorkerDB.js").WorkerDB>;
2
2
  export declare const dbMetaAtom: import("jotai").Atom<Promise<string>>;
3
3
  export declare const pendingAtom: import("jotai").WritableAtom<number, [], () => void>;
4
- export declare const entryRevisionAtoms: import("jotai/vanilla/utils/atomFamily.js").AtomFamily<string, import("jotai").WritableAtom<number, [], void>>;
4
+ export declare const entryRevisionAtoms: import("jotai/vanilla/utils/atomFamily").AtomFamily<string, import("jotai").WritableAtom<number, [], void>>;
5
5
  export declare function useDbUpdater(everySeconds?: number): void;
@@ -18,14 +18,14 @@ export declare class Edits {
18
18
  resetChanges: import("jotai").WritableAtom<null, [], void> & {
19
19
  init: null;
20
20
  };
21
- yUpdate: import("jotai").Atom<Uint8Array>;
21
+ yUpdate: import("jotai").Atom<Uint8Array<ArrayBufferLike>>;
22
22
  constructor(type: Type, entry: Entry);
23
23
  hasData(): boolean;
24
24
  /** A Y.js update that contains our own edits */
25
- getLocalUpdate(): Uint8Array;
25
+ getLocalUpdate(): Uint8Array<ArrayBufferLike>;
26
26
  /** Update entry field data */
27
27
  applyEntryData(entryData: Record<string, any>): void;
28
28
  /** The field data */
29
29
  getEntryData(type: Type): Record<string, any>;
30
30
  }
31
- export declare const entryEditsAtoms: import("jotai/vanilla/utils/atomFamily.js").AtomFamily<Entry<Record<string, unknown>>, import("jotai").Atom<Edits>>;
31
+ export declare const entryEditsAtoms: import("jotai/vanilla/utils/atomFamily").AtomFamily<Entry<Record<string, unknown>>, import("jotai").Atom<Edits>>;
@@ -28,7 +28,28 @@ export declare enum EntryTransition {
28
28
  DeleteFile = 9,
29
29
  DeleteEntry = 10
30
30
  }
31
- export declare const entryEditorAtoms: import("jotai/vanilla/utils/atomFamily.js").AtomFamily<EntryEditorParams, import("jotai").Atom<Promise<{
31
+ export declare const entryEditorAtoms: import("jotai/vanilla/utils/atomFamily").AtomFamily<EntryEditorParams, import("jotai").Atom<Promise<{
32
+ parents: Array<{
33
+ id: string;
34
+ path: string;
35
+ status: EntryStatus;
36
+ main: boolean;
37
+ }>;
38
+ client: Connection;
39
+ config: Config;
40
+ entryId: string;
41
+ versions: Array<Version>;
42
+ statuses: Record<EntryStatus, Version>;
43
+ availableStatuses: Array<EntryStatus>;
44
+ translations: Array<{
45
+ locale: string;
46
+ entryId: string;
47
+ }>;
48
+ untranslated: boolean;
49
+ canPublish: boolean;
50
+ canDelete: boolean;
51
+ parentNeedsTranslation: boolean;
52
+ edits: Edits;
32
53
  transition: import("jotai").PrimitiveAtom<EntryTransition | undefined> & {
33
54
  init: EntryTransition | undefined;
34
55
  };
@@ -106,6 +127,8 @@ export declare const entryEditorAtoms: import("jotai/vanilla/utils/atomFamily.js
106
127
  view: import("alinea/core/View.js").View<import("../view/EntryEdit.js").EntryEditProps & {
107
128
  type: Type;
108
129
  }> | undefined;
130
+ } | undefined>>>;
131
+ export interface EntryData {
109
132
  parents: Array<{
110
133
  id: string;
111
134
  path: string;
@@ -127,8 +150,9 @@ export declare const entryEditorAtoms: import("jotai/vanilla/utils/atomFamily.js
127
150
  canDelete: boolean;
128
151
  parentNeedsTranslation: boolean;
129
152
  edits: Edits;
130
- } | undefined>>>;
131
- export interface EntryData {
153
+ }
154
+ export type EntryEditor = ReturnType<typeof createEntryEditor>;
155
+ export declare function createEntryEditor(entryData: EntryData): {
132
156
  parents: Array<{
133
157
  id: string;
134
158
  path: string;
@@ -150,9 +174,6 @@ export interface EntryData {
150
174
  canDelete: boolean;
151
175
  parentNeedsTranslation: boolean;
152
176
  edits: Edits;
153
- }
154
- export type EntryEditor = ReturnType<typeof createEntryEditor>;
155
- export declare function createEntryEditor(entryData: EntryData): {
156
177
  transition: import("jotai").PrimitiveAtom<EntryTransition | undefined> & {
157
178
  init: EntryTransition | undefined;
158
179
  };
@@ -230,26 +251,5 @@ export declare function createEntryEditor(entryData: EntryData): {
230
251
  view: import("alinea/core/View.js").View<import("../view/EntryEdit.js").EntryEditProps & {
231
252
  type: Type;
232
253
  }> | undefined;
233
- parents: Array<{
234
- id: string;
235
- path: string;
236
- status: EntryStatus;
237
- main: boolean;
238
- }>;
239
- client: Connection;
240
- config: Config;
241
- entryId: string;
242
- versions: Array<Version>;
243
- statuses: Record<EntryStatus, Version>;
244
- availableStatuses: Array<EntryStatus>;
245
- translations: Array<{
246
- locale: string;
247
- entryId: string;
248
- }>;
249
- untranslated: boolean;
250
- canPublish: boolean;
251
- canDelete: boolean;
252
- parentNeedsTranslation: boolean;
253
- edits: Edits;
254
254
  };
255
255
  export {};
@@ -486,7 +486,9 @@ function createEntryEditor(entryData) {
486
486
  locale,
487
487
  path,
488
488
  status,
489
- parentPaths
489
+ parentPaths,
490
+ workspace: activeVersion.workspace,
491
+ root: activeVersion.root
490
492
  };
491
493
  const url = entryUrl(type, urlMeta);
492
494
  return createEntryRow(
@@ -17,5 +17,5 @@ interface EntryKeys {
17
17
  id: string;
18
18
  locale: string | null;
19
19
  }
20
- export declare const entrySummaryAtoms: import("jotai/vanilla/utils/atomFamily.js").AtomFamily<EntryKeys, import("jotai").Atom<Promise<EntrySummary | undefined>>>;
20
+ export declare const entrySummaryAtoms: import("jotai/vanilla/utils/atomFamily").AtomFamily<EntryKeys, import("jotai").Atom<Promise<EntrySummary | undefined>>>;
21
21
  export {};
@@ -1,16 +1,16 @@
1
1
  import { type EntryLocation } from '../DashboardNav.js';
2
2
  export declare const workspaceAtom: import("jotai").Atom<{
3
- label: string;
4
- color: string;
5
- roots: import("alinea/core/Workspace").RootsDefinition;
6
3
  source: string;
7
4
  mediaDir?: string;
8
5
  icon?: import("react").ComponentType;
9
6
  preview?: import("alinea/core/Preview.js").Preview;
7
+ roots: import("alinea/core/Workspace").RootsDefinition;
8
+ label: string;
9
+ color: string;
10
10
  name: string;
11
11
  }>;
12
12
  export declare const rootAtom: import("jotai").Atom<{
13
- label: string;
13
+ name: string;
14
14
  contains?: Array<string | import("alinea").Type>;
15
15
  orderChildrenBy?: import("alinea/core/OrderBy.js").OrderBy | Array<import("alinea/core/OrderBy.js").OrderBy>;
16
16
  icon?: import("react").ComponentType;
@@ -20,16 +20,16 @@ export declare const rootAtom: import("jotai").Atom<{
20
20
  }>;
21
21
  isMediaRoot?: boolean;
22
22
  preview?: import("alinea/core/Preview.js").Preview;
23
- name: string;
23
+ label: string;
24
24
  }>;
25
25
  export declare const preferredLanguageAtom: import("jotai").WritableAtom<string | null, [string | typeof import("jotai/utils").RESET | ((prev: string | null) => string | typeof import("jotai/utils").RESET | null) | null], void>;
26
26
  export declare const localeAtom: import("jotai").Atom<string | null>;
27
27
  export declare const entryLocationAtom: import("jotai").Atom<EntryLocation>;
28
28
  export declare const navAtom: import("jotai").Atom<{
29
- matchEntry: "/entry/*";
30
- matchEntryId: "/:action/:workspace/:root?/:id?";
31
- matchWorkspace: "/:action/:workspace";
32
- matchRoot: "/:action/:workspace/:root";
29
+ matchEntry: '/entry/*';
30
+ matchEntryId: '/:action/:workspace/:root?/:id?';
31
+ matchWorkspace: '/:action/:workspace';
32
+ matchRoot: '/:action/:workspace/:root';
33
33
  root: ({ id, ...location }: EntryLocation) => string;
34
34
  entry: (location: EntryLocation) => string;
35
35
  draft: (location: EntryLocation) => string;
@@ -6,7 +6,7 @@ export interface Preferences {
6
6
  size: number;
7
7
  language: Language;
8
8
  }
9
- export declare const preferencesAtom: import("jotai").WritableAtom<Preferences, [Preferences | typeof import("jotai/utils").RESET | ((prev: Preferences) => Preferences | typeof import("jotai/utils").RESET)], void>;
9
+ export declare const preferencesAtom: import("jotai").WritableAtom<Preferences, [typeof import("jotai/utils").RESET | Preferences | ((prev: Preferences) => typeof import("jotai/utils").RESET | Preferences)], void>;
10
10
  export declare const schemePreferenceAtom: import("jotai").WritableAtom<ColorScheme, [scheme: ColorScheme], void>;
11
11
  export declare const toggleSchemePreferenceAtom: import("jotai").WritableAtom<null, [], void> & {
12
12
  init: null;
@@ -38,7 +38,7 @@ export declare class Router {
38
38
  cancelled: PrimitiveAtom<boolean> & {
39
39
  init: boolean;
40
40
  };
41
- match: import("jotai").WritableAtom<Match | Promise<Match>, [Promise<Match>, Match], void>;
41
+ match: import("jotai").WritableAtom<Promise<Match> | Match, [Promise<Match>, Match], void>;
42
42
  }
43
43
  export interface RouterProviderProps {
44
44
  router: Router;
@@ -10,7 +10,8 @@ import { DashboardWorker } from "./DashboardWorker.js";
10
10
  async function loadWorker(gen) {
11
11
  const source = new IndexedDBSource(globalThis.indexedDB, "alinea");
12
12
  const worker = new DashboardWorker(source);
13
- globalThis.onconnect = (event) => {
13
+ addEventListener("connect", (event) => {
14
+ if (!(event instanceof MessageEvent)) return;
14
15
  console.info("Worker connected");
15
16
  const port = event.ports[0];
16
17
  expose(worker, port);
@@ -22,7 +23,7 @@ async function loadWorker(gen) {
22
23
  }
23
24
  };
24
25
  worker.addEventListener(IndexEvent.type, listen);
25
- };
26
+ });
26
27
  for await (const batch of gen) {
27
28
  await worker.load(batch.revision, batch.config, batch.client);
28
29
  }
@@ -15,5 +15,5 @@ import { MediaExplorer } from '../view/MediaExplorer.js';
15
15
  import { FileEntry } from '../view/media/FileEntry.js';
16
16
  import { FileSummaryRow } from '../view/media/FileSummary.js';
17
17
  export declare const defaultViews: {
18
- [x: string]: typeof CheckInput | typeof CodeInput | typeof SingleLinkInput | typeof MultipleLinksInput | typeof ListInput | typeof MetadataInput | typeof NumberInput | typeof ObjectInput | typeof PathInput | typeof RichTextInput | typeof SelectInput | typeof TabsView | typeof TextInput | typeof TimeInput | typeof MediaExplorer | typeof FileEntry | typeof FileSummaryRow;
18
+ [x: string]: typeof TabsView | typeof CheckInput | typeof CodeInput | typeof SingleLinkInput | typeof MultipleLinksInput | typeof ListInput | typeof MetadataInput | typeof NumberInput | typeof ObjectInput | typeof PathInput | typeof RichTextInput | typeof SelectInput | typeof TextInput | typeof TimeInput | typeof MediaExplorer | typeof FileEntry | typeof FileSummaryRow;
19
19
  };
@@ -43,7 +43,14 @@ function useFieldOptions(field) {
43
43
  const scope = getScope(editor.config);
44
44
  const fieldName = scope.nameOf(field);
45
45
  if (!fieldName) return options;
46
- const resource = { type: editor.activeVersion.type, field: fieldName };
46
+ const resource = {
47
+ workspace: editor.activeVersion.workspace,
48
+ root: editor.activeVersion.root,
49
+ id: editor.activeVersion.id,
50
+ parents: editor.activeVersion.parents,
51
+ type: editor.activeVersion.type,
52
+ field: fieldName
53
+ };
47
54
  const read = policy.canRead(resource);
48
55
  const update = policy.canUpdate(resource);
49
56
  return {
@@ -1,8 +1,8 @@
1
1
  export declare const useNav: () => {
2
- matchEntry: "/entry/*";
3
- matchEntryId: "/:action/:workspace/:root?/:id?";
4
- matchWorkspace: "/:action/:workspace";
5
- matchRoot: "/:action/:workspace/:root";
2
+ matchEntry: '/entry/*';
3
+ matchEntryId: '/:action/:workspace/:root?/:id?';
4
+ matchWorkspace: '/:action/:workspace';
5
+ matchRoot: '/:action/:workspace/:root';
6
6
  root: ({ id, ...location }: import("../DashboardNav.js").EntryLocation) => string;
7
7
  entry: (location: import("../DashboardNav.js").EntryLocation) => string;
8
8
  draft: (location: import("../DashboardNav.js").EntryLocation) => string;
@@ -1,5 +1,5 @@
1
1
  export declare const useRoot: () => {
2
- label: string;
2
+ name: string;
3
3
  contains?: Array<string | import("alinea").Type>;
4
4
  orderChildrenBy?: import("alinea/core/OrderBy.js").OrderBy | Array<import("alinea/core/OrderBy.js").OrderBy>;
5
5
  icon?: import("react").ComponentType;
@@ -9,5 +9,5 @@ export declare const useRoot: () => {
9
9
  }>;
10
10
  isMediaRoot?: boolean;
11
11
  preview?: import("alinea/core/Preview.js").Preview;
12
- name: string;
12
+ label: string;
13
13
  };
@@ -1,10 +1,10 @@
1
1
  export declare const useWorkspace: () => {
2
- label: string;
3
- color: string;
4
- roots: import("alinea/core/Workspace.js").RootsDefinition;
5
2
  source: string;
6
3
  mediaDir?: string;
7
4
  icon?: import("react").ComponentType;
8
5
  preview?: import("alinea/core/Preview.js").Preview;
6
+ roots: import("alinea/core/Workspace.js").RootsDefinition;
7
+ label: string;
8
+ color: string;
9
9
  name: string;
10
10
  };
@@ -6,7 +6,7 @@ export interface LoaderState<T> {
6
6
  isLoading: boolean;
7
7
  isSuccess: boolean;
8
8
  }
9
- export declare function loader<Value>(asynAtom: Atom<Promise<Value>>): import("jotai").WritableAtom<(get: <Value_1>(atom: Atom<Value_1>) => Value_1, { setSelf }: {
9
+ export declare function loader<Value>(asynAtom: Atom<Promise<Value>>): import("jotai").WritableAtom<(get: <Value>(atom: Atom<Value>) => Value, { setSelf }: {
10
10
  readonly signal: AbortSignal;
11
11
  readonly setSelf: <A extends unknown[]>(...args: A) => unknown;
12
12
  }) => LoaderState<Value>, [value: Value], void> & {
@@ -12,7 +12,7 @@ export type LabelHeaderProps = {
12
12
  isFolded?: boolean;
13
13
  toggleFold?: () => void;
14
14
  };
15
- export declare const LabelHeader: import("react").NamedExoticComponent<LabelHeaderProps>;
15
+ export declare const LabelHeader: import("react").MemoExoticComponent<({ label, help, size, focused, shared, readOnly, required, error, isFolded, toggleFold }: LabelHeaderProps) => import("react/jsx-runtime").JSX.Element>;
16
16
  export interface InputLabelProps extends PropsWithChildren {
17
17
  label?: ReactNode;
18
18
  asLabel?: boolean;
@@ -12,4 +12,4 @@ export type ExplorerRowProps = {
12
12
  summaryView: 'summaryRow' | 'summaryThumb';
13
13
  defaultView: ComponentType<SummaryProps>;
14
14
  };
15
- export declare const ExplorerRow: import("react").NamedExoticComponent<ExplorerRowProps>;
15
+ export declare const ExplorerRow: import("react").MemoExoticComponent<({ schema, query, batchSize, amount, from, summaryView, defaultView }: ExplorerRowProps) => import("react/jsx-runtime").JSX.Element>;
@@ -24,7 +24,7 @@ export declare namespace EntryLink {
24
24
  }
25
25
  interface EntryOptions<Fields> extends LinkFieldOptions<EntryReference & InferStoredValue<Fields>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
26
26
  }
27
- export declare function entry<Fields = undefined>(label: Label, options?: WithoutLabel<EntryOptions<Fields>>): import("alinea/field/link/LinkField").LinkField<EntryReference & InferStoredValue<Fields>, EntryLink<{ [K_1 in keyof Fields as Fields[K_1] extends import("alinea/core/Expr").Expr<any> ? K_1 : never]: Fields[K_1] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: { [K_1 in keyof Fields as Fields[K_1] extends import("alinea/core/Expr").Expr<any> ? K_1 : never]: Fields[K_1] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; }[K]; } : never>>;
27
+ export declare function entry<Fields = undefined>(label: Label, options?: WithoutLabel<EntryOptions<Fields>>): import("alinea/field/link/LinkField").LinkField<EntryReference & InferStoredValue<Fields>, EntryLink<{ [K in keyof Fields as Fields[K] extends import("alinea/core/Expr").Expr<any> ? K : never]: Fields[K] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: T[K]; } : never>>;
28
28
  export declare namespace entry {
29
29
  type EntryRow<Fields> = EntryLink<Type.Infer<Fields>> & ListRow;
30
30
  interface EntryOptions<Fields> extends LinkFieldOptions<Array<EntryReference & ListRow & InferStoredValue<Fields>>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
@@ -22,9 +22,9 @@ export declare namespace FileLink {
22
22
  export declare function filePicker<Fields>(multiple: boolean, options: Omit<EntryPickerOptions<Fields>, 'selection'>): import("alinea/core/Picker").Picker<EntryReference, EntryPickerOptions<Fields>>;
23
23
  export interface FileOptions<Fields> extends LinkFieldOptions<EntryReference & InferStoredValue<Fields>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
24
24
  }
25
- export declare function file<Fields = undefined>(label: Label, options?: WithoutLabel<FileOptions<Fields>>): import("alinea/field/link/LinkField").LinkField<EntryReference & InferStoredValue<Fields>, FileLink<{ [K_1 in keyof Fields as Fields[K_1] extends import("alinea/core/Expr").Expr<any> ? K_1 : never]: Fields[K_1] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: { [K_1 in keyof Fields as Fields[K_1] extends import("alinea/core/Expr").Expr<any> ? K_1 : never]: Fields[K_1] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; }[K]; } : never>>;
25
+ export declare function file<Fields = undefined>(label: Label, options?: WithoutLabel<FileOptions<Fields>>): import("alinea/field/link/LinkField").LinkField<EntryReference & InferStoredValue<Fields>, FileLink<{ [K in keyof Fields as Fields[K] extends import("alinea/core/Expr").Expr<any> ? K : never]: Fields[K] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: T[K]; } : never>>;
26
26
  export declare namespace file {
27
27
  interface FilesOptions<Fields> extends LinkFieldOptions<Array<EntryReference & ListRow & InferStoredValue<Fields>>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
28
28
  }
29
- function multiple<Fields = undefined>(label: Label, options?: WithoutLabel<FilesOptions<Fields>>): import("alinea/field/link/LinkField").LinksField<EntryReference & ListRow & InferStoredValue<Fields>, FileLink<{ [K_1 in keyof Fields as Fields[K_1] extends import("alinea/core/Expr").Expr<any> ? K_1 : never]: Fields[K_1] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: { [K_1 in keyof Fields as Fields[K_1] extends import("alinea/core/Expr").Expr<any> ? K_1 : never]: Fields[K_1] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; }[K]; } : never>>;
29
+ function multiple<Fields = undefined>(label: Label, options?: WithoutLabel<FilesOptions<Fields>>): import("alinea/field/link/LinkField").LinksField<EntryReference & ListRow & InferStoredValue<Fields>, FileLink<{ [K in keyof Fields as Fields[K] extends import("alinea/core/Expr").Expr<any> ? K : never]: Fields[K] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: T[K]; } : never>>;
30
30
  }
@@ -38,11 +38,13 @@ import { InputLabel } from "alinea/dashboard/view/InputLabel";
38
38
  import { EntryReference } from "alinea/picker/entry/EntryReference";
39
39
  import { UrlReference } from "alinea/picker/url/UrlPicker";
40
40
  import { TextLabel } from "alinea/ui";
41
+ import { IcRoundAttachFile } from "alinea/ui/icons/IcRoundAttachFile";
41
42
  import { IcRoundClose } from "alinea/ui/icons/IcRoundClose";
42
43
  import IcRoundDragHandle from "alinea/ui/icons/IcRoundDragHandle";
43
44
  import { IcRoundEdit } from "alinea/ui/icons/IcRoundEdit";
44
45
  import { IcRoundLink } from "alinea/ui/icons/IcRoundLink";
45
46
  import { IcRoundOpenInNew } from "alinea/ui/icons/IcRoundOpenInNew";
47
+ import { IcRoundPanorama } from "alinea/ui/icons/IcRoundPanorama";
46
48
  import { Sink } from "alinea/ui/Sink";
47
49
  import {
48
50
  Suspense,
@@ -69,6 +71,20 @@ var LinkField_module_default = {
69
71
  // src/field/link/LinkField.view.tsx
70
72
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
71
73
  var styles = dist_default(LinkField_module_default);
74
+ function getLinkIcon(name) {
75
+ switch (name) {
76
+ case "entry":
77
+ return IcRoundLink;
78
+ case "url":
79
+ return IcRoundOpenInNew;
80
+ case "file":
81
+ return IcRoundAttachFile;
82
+ case "image":
83
+ return IcRoundPanorama;
84
+ default:
85
+ return void 0;
86
+ }
87
+ }
72
88
  function SingleLinkInput({ field }) {
73
89
  const { options, value, mutator, error } = useField(field);
74
90
  const { readOnly } = options;
@@ -114,6 +130,7 @@ function SingleLinkInput({ field }) {
114
130
  if (readOnly) return;
115
131
  setPickFrom(name);
116
132
  },
133
+ icon: getLinkIcon(name),
117
134
  children: /* @__PURE__ */ jsx(TextLabel, { label: picker2.label })
118
135
  },
119
136
  name
@@ -224,6 +241,7 @@ function MultipleLinksInput({ field }) {
224
241
  Create.Button,
225
242
  {
226
243
  onClick: () => setPickFrom({ [Reference.type]: name }),
244
+ icon: getLinkIcon(name),
227
245
  children: /* @__PURE__ */ jsx(TextLabel, { label: picker2.label })
228
246
  },
229
247
  name
@@ -15,7 +15,7 @@ export declare namespace UrlLink {
15
15
  }
16
16
  export interface UrlOptions<Fields> extends LinkFieldOptions<UrlReference & InferStoredValue<Fields>>, UrlPickerOptions<Fields> {
17
17
  }
18
- export declare function url<Fields>(label: Label, options?: WithoutLabel<UrlOptions<Fields>>): import("alinea/field/link/LinkField").LinkField<UrlReference & InferStoredValue<Fields>, UrlLink<{ [K_1 in keyof Fields as Fields[K_1] extends import("alinea/core/Expr").Expr<any> ? K_1 : never]: Fields[K_1] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: { [K_1 in keyof Fields as Fields[K_1] extends import("alinea/core/Expr").Expr<any> ? K_1 : never]: Fields[K_1] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; }[K]; } : never>>;
18
+ export declare function url<Fields>(label: Label, options?: WithoutLabel<UrlOptions<Fields>>): import("alinea/field/link/LinkField").LinkField<UrlReference & InferStoredValue<Fields>, UrlLink<{ [K in keyof Fields as Fields[K] extends import("alinea/core/Expr").Expr<any> ? K : never]: Fields[K] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: T[K]; } : never>>;
19
19
  export declare namespace url {
20
20
  type UrlRows<Fields> = UrlLink<Type.Infer<Fields>> & ListRow;
21
21
  export interface UrlOptions<Fields> extends LinkFieldOptions<Array<UrlReference & ListRow & InferStoredValue<Fields>>>, UrlPickerOptions<Fields> {
@@ -24,4 +24,5 @@ export declare const extensions: {
24
24
  TableCell: import("@tiptap/core").Node<import("@tiptap/extension-table-cell").TableCellOptions, any>;
25
25
  TableHeader: import("@tiptap/core").Node<import("@tiptap/extension-table-header").TableHeaderOptions, any>;
26
26
  TableRow: import("@tiptap/core").Node<import("@tiptap/extension-table-row").TableRowOptions, any>;
27
+ Highlight: import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any>;
27
28
  };
@@ -734,6 +734,109 @@ var Heading = Node.create({
734
734
  }
735
735
  });
736
736
 
737
+ // node_modules/@tiptap/extension-highlight/dist/index.js
738
+ var inputRegex3 = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/;
739
+ var pasteRegex = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g;
740
+ var Highlight = Mark.create({
741
+ name: "highlight",
742
+ addOptions() {
743
+ return {
744
+ multicolor: false,
745
+ HTMLAttributes: {}
746
+ };
747
+ },
748
+ addAttributes() {
749
+ if (!this.options.multicolor) {
750
+ return {};
751
+ }
752
+ return {
753
+ color: {
754
+ default: null,
755
+ parseHTML: (element) => element.getAttribute("data-color") || element.style.backgroundColor,
756
+ renderHTML: (attributes) => {
757
+ if (!attributes.color) {
758
+ return {};
759
+ }
760
+ return {
761
+ "data-color": attributes.color,
762
+ style: `background-color: ${attributes.color}; color: inherit`
763
+ };
764
+ }
765
+ }
766
+ };
767
+ },
768
+ parseHTML() {
769
+ return [
770
+ {
771
+ tag: "mark"
772
+ }
773
+ ];
774
+ },
775
+ renderHTML({ HTMLAttributes }) {
776
+ return ["mark", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
777
+ },
778
+ renderMarkdown: (node, h) => {
779
+ return `==${h.renderChildren(node)}==`;
780
+ },
781
+ parseMarkdown: (token, h) => {
782
+ return h.applyMark("highlight", h.parseInline(token.tokens || []));
783
+ },
784
+ markdownTokenizer: {
785
+ name: "highlight",
786
+ level: "inline",
787
+ start: (src) => src.indexOf("=="),
788
+ tokenize(src, _, h) {
789
+ const rule = /^(==)([^=]+)(==)/;
790
+ const match = rule.exec(src);
791
+ if (match) {
792
+ const innerContent = match[2].trim();
793
+ const children = h.inlineTokens(innerContent);
794
+ return {
795
+ type: "highlight",
796
+ raw: match[0],
797
+ text: innerContent,
798
+ tokens: children
799
+ };
800
+ }
801
+ }
802
+ },
803
+ addCommands() {
804
+ return {
805
+ setHighlight: (attributes) => ({ commands }) => {
806
+ return commands.setMark(this.name, attributes);
807
+ },
808
+ toggleHighlight: (attributes) => ({ commands }) => {
809
+ return commands.toggleMark(this.name, attributes);
810
+ },
811
+ unsetHighlight: () => ({ commands }) => {
812
+ return commands.unsetMark(this.name);
813
+ }
814
+ };
815
+ },
816
+ addKeyboardShortcuts() {
817
+ return {
818
+ "Mod-Shift-h": () => this.editor.commands.toggleHighlight()
819
+ };
820
+ },
821
+ addInputRules() {
822
+ return [
823
+ markInputRule({
824
+ find: inputRegex3,
825
+ type: this.type
826
+ })
827
+ ];
828
+ },
829
+ addPasteRules() {
830
+ return [
831
+ markPasteRule({
832
+ find: pasteRegex,
833
+ type: this.type
834
+ })
835
+ ];
836
+ }
837
+ });
838
+ var index_default = Highlight;
839
+
737
840
  // node_modules/@tiptap/extension-horizontal-rule/dist/index.js
738
841
  var HorizontalRule = Node.create({
739
842
  name: "horizontalRule",
@@ -918,7 +1021,7 @@ var ListItem = Node.create({
918
1021
  // node_modules/@tiptap/extension-ordered-list/dist/index.js
919
1022
  var ListItemName2 = "listItem";
920
1023
  var TextStyleName2 = "textStyle";
921
- var inputRegex3 = /^(\d+)\.\s$/;
1024
+ var inputRegex4 = /^(\d+)\.\s$/;
922
1025
  var OrderedList = Node.create({
923
1026
  name: "orderedList",
924
1027
  addOptions() {
@@ -975,14 +1078,14 @@ var OrderedList = Node.create({
975
1078
  },
976
1079
  addInputRules() {
977
1080
  let inputRule = wrappingInputRule({
978
- find: inputRegex3,
1081
+ find: inputRegex4,
979
1082
  type: this.type,
980
1083
  getAttributes: (match) => ({ start: +match[1] }),
981
1084
  joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1]
982
1085
  });
983
1086
  if (this.options.keepMarks || this.options.keepAttributes) {
984
1087
  inputRule = wrappingInputRule({
985
- find: inputRegex3,
1088
+ find: inputRegex4,
986
1089
  type: this.type,
987
1090
  keepMarks: this.options.keepMarks,
988
1091
  keepAttributes: this.options.keepAttributes,
@@ -1031,8 +1134,8 @@ var Paragraph = Node.create({
1031
1134
  });
1032
1135
 
1033
1136
  // node_modules/@tiptap/extension-strike/dist/index.js
1034
- var inputRegex4 = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
1035
- var pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
1137
+ var inputRegex5 = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
1138
+ var pasteRegex2 = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
1036
1139
  var Strike = Mark.create({
1037
1140
  name: "strike",
1038
1141
  addOptions() {
@@ -1082,7 +1185,7 @@ var Strike = Mark.create({
1082
1185
  addInputRules() {
1083
1186
  return [
1084
1187
  markInputRule({
1085
- find: inputRegex4,
1188
+ find: inputRegex5,
1086
1189
  type: this.type
1087
1190
  })
1088
1191
  ];
@@ -1090,7 +1193,7 @@ var Strike = Mark.create({
1090
1193
  addPasteRules() {
1091
1194
  return [
1092
1195
  markPasteRule({
1093
- find: pasteRegex,
1196
+ find: pasteRegex2,
1094
1197
  type: this.type
1095
1198
  })
1096
1199
  ];
@@ -3961,7 +4064,8 @@ var Extensions_module_default = {
3961
4064
  "blockquote": "alinea-Extensions-blockquote",
3962
4065
  "table": "alinea-Extensions-table",
3963
4066
  "td": "alinea-Extensions-td",
3964
- "th": "alinea-Extensions-th"
4067
+ "th": "alinea-Extensions-th",
4068
+ "highlight": "alinea-Extensions-highlight"
3965
4069
  };
3966
4070
 
3967
4071
  // src/field/richtext/Extensions.ts
@@ -4035,7 +4139,12 @@ var extensions = {
4035
4139
  class: styles.th()
4036
4140
  }
4037
4141
  }),
4038
- TableRow
4142
+ TableRow,
4143
+ Highlight: index_default.configure({
4144
+ HTMLAttributes: {
4145
+ class: styles.highlight()
4146
+ }
4147
+ })
4039
4148
  };
4040
4149
  export {
4041
4150
  extensions
@@ -81,6 +81,12 @@ export declare const formatting: {
81
81
  active: ({ editor }: import("./RichTextToolbar.js").RichTextToolbarContext) => boolean;
82
82
  onSelect: ({ exec }: import("./RichTextToolbar.js").RichTextToolbarContext) => boolean;
83
83
  };
84
+ highlight: {
85
+ icon: () => import("react/jsx-runtime").JSX.Element;
86
+ title: string;
87
+ active: ({ editor }: import("./RichTextToolbar.js").RichTextToolbarContext) => boolean;
88
+ onSelect: ({ exec }: import("./RichTextToolbar.js").RichTextToolbarContext) => boolean;
89
+ };
84
90
  };
85
91
  };
86
92
  export declare const alignment: {
@@ -10,6 +10,7 @@ import { IcRoundFormatClear } from "alinea/ui/icons/IcRoundFormatClear";
10
10
  import { IcRoundFormatItalic } from "alinea/ui/icons/IcRoundFormatItalic";
11
11
  import { IcRoundFormatListBulleted } from "alinea/ui/icons/IcRoundFormatListBulleted";
12
12
  import { IcRoundFormatListNumbered } from "alinea/ui/icons/IcRoundFormatListNumbered";
13
+ import { IcRoundFormatPaint } from "alinea/ui/icons/IcRoundFormatPaint";
13
14
  import { IcRoundHorizontalRule } from "alinea/ui/icons/IcRoundHorizontalRule";
14
15
  import { IcRoundLink } from "alinea/ui/icons/IcRoundLink";
15
16
  import { IcRoundQuote } from "alinea/ui/icons/IcRoundQuote";
@@ -213,6 +214,12 @@ var formatting = {
213
214
  title: "Superscript",
214
215
  active: ({ editor }) => editor.isActive("superscript"),
215
216
  onSelect: ({ exec }) => exec().toggleSuperscript().run()
217
+ },
218
+ highlight: {
219
+ icon: () => /* @__PURE__ */ jsx(IcRoundFormatPaint, {}),
220
+ title: "Highlight",
221
+ active: ({ editor }) => editor.isActive("highlight"),
222
+ onSelect: ({ exec }) => exec().toggleHighlight().run()
216
223
  }
217
224
  }
218
225
  };
package/dist/index.css CHANGED
@@ -3219,6 +3219,10 @@ h3.alinea-Extensions-heading:not(:last-child) {
3219
3219
  text-align: left;
3220
3220
  font-weight: 700;
3221
3221
  }
3222
+ .alinea-Extensions-highlight {
3223
+ background: var(--alinea-variant-info-action);
3224
+ color: var(--alinea-variant-info-foreground);
3225
+ }
3222
3226
 
3223
3227
  /* src/field/richtext/PickLink.module.scss */
3224
3228
  .alinea-PickLink {