@e280/quay 0.0.0-1

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 (206) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +117 -0
  3. package/package.json +57 -0
  4. package/s/cellar/cask.ts +18 -0
  5. package/s/cellar/cellar.test.ts +100 -0
  6. package/s/cellar/cellar.ts +53 -0
  7. package/s/cellar/forklift.ts +9 -0
  8. package/s/cellar/index.ts +7 -0
  9. package/s/cellar/memory-forklift.ts +29 -0
  10. package/s/cellar/opfs-forklift.ts +49 -0
  11. package/s/demo/main.bundle.ts +39 -0
  12. package/s/demo/main.css +126 -0
  13. package/s/dom/components/breadcrumb/component.ts +29 -0
  14. package/s/dom/components/browser/component.ts +75 -0
  15. package/s/dom/components/browser/style.css.ts +118 -0
  16. package/s/dom/components/dropzone/component.ts +33 -0
  17. package/s/dom/components/dropzone/style.css.ts +54 -0
  18. package/s/dom/components/filter/component.ts +44 -0
  19. package/s/dom/components/outliner/component.ts +16 -0
  20. package/s/dom/components/searchbar/component.ts +29 -0
  21. package/s/dom/components/sort/component.ts +48 -0
  22. package/s/dom/components.ts +15 -0
  23. package/s/dom/context.ts +5 -0
  24. package/s/dom/theme.css.ts +11 -0
  25. package/s/dom/utils/find-group-name.ts +12 -0
  26. package/s/dom/utils/find-local-group.ts +9 -0
  27. package/s/dom/views/tree/component.ts +64 -0
  28. package/s/dom/views/tree/style.css.ts +64 -0
  29. package/s/genius/folio.md +29 -0
  30. package/s/genius/parts/hy-tree.ts +142 -0
  31. package/s/genius/quay.md +13 -0
  32. package/s/genius/turbo.md +21 -0
  33. package/s/genius/twig.ts +34 -0
  34. package/s/index.html.ts +89 -0
  35. package/s/index.ts +14 -0
  36. package/s/logic/aspects/codex/codex.ts +46 -0
  37. package/s/logic/aspects/codex/example.ts +65 -0
  38. package/s/logic/aspects/codex/parts/clade.ts +28 -0
  39. package/s/logic/aspects/codex/parts/codex-item.ts +94 -0
  40. package/s/logic/aspects/codex/parts/hierarchy.ts +82 -0
  41. package/s/logic/aspects/codex/parts/taxonomy.ts +18 -0
  42. package/s/logic/aspects/codex/parts/types.ts +23 -0
  43. package/s/logic/aspects/codex/utils/generate-id.ts +7 -0
  44. package/s/logic/aspects/dropzone.ts +77 -0
  45. package/s/logic/aspects/tree-trail.ts +33 -0
  46. package/s/logic/brain.ts +22 -0
  47. package/s/logic/group.ts +104 -0
  48. package/s/logic/permissions.ts +34 -0
  49. package/s/logic/presets/media/group.ts +94 -0
  50. package/s/logic/presets/media/schema.ts +22 -0
  51. package/s/logic/presets/opfs/schema.ts +21 -0
  52. package/s/logic/presets/plain/group.ts +44 -0
  53. package/s/logic/presets/plain/schema.ts +15 -0
  54. package/s/logic/types.ts +33 -0
  55. package/s/tests.test.ts +8 -0
  56. package/x/cellar/cask.d.ts +8 -0
  57. package/x/cellar/cask.js +19 -0
  58. package/x/cellar/cask.js.map +1 -0
  59. package/x/cellar/cellar.d.ts +22 -0
  60. package/x/cellar/cellar.js +47 -0
  61. package/x/cellar/cellar.js.map +1 -0
  62. package/x/cellar/cellar.test.d.ts +11 -0
  63. package/x/cellar/cellar.test.js +79 -0
  64. package/x/cellar/cellar.test.js.map +1 -0
  65. package/x/cellar/forklift.d.ts +7 -0
  66. package/x/cellar/forklift.js +2 -0
  67. package/x/cellar/forklift.js.map +1 -0
  68. package/x/cellar/index.d.ts +5 -0
  69. package/x/cellar/index.js +6 -0
  70. package/x/cellar/index.js.map +1 -0
  71. package/x/cellar/memory-forklift.d.ts +9 -0
  72. package/x/cellar/memory-forklift.js +21 -0
  73. package/x/cellar/memory-forklift.js.map +1 -0
  74. package/x/cellar/opfs-forklift.d.ts +11 -0
  75. package/x/cellar/opfs-forklift.js +44 -0
  76. package/x/cellar/opfs-forklift.js.map +1 -0
  77. package/x/demo/main.bundle.d.ts +1 -0
  78. package/x/demo/main.bundle.js +30 -0
  79. package/x/demo/main.bundle.js.map +1 -0
  80. package/x/demo/main.bundle.min.js +471 -0
  81. package/x/demo/main.css +126 -0
  82. package/x/dom/components/breadcrumb/component.d.ts +1 -0
  83. package/x/dom/components/breadcrumb/component.js +21 -0
  84. package/x/dom/components/breadcrumb/component.js.map +1 -0
  85. package/x/dom/components/browser/component.d.ts +1 -0
  86. package/x/dom/components/browser/component.js +65 -0
  87. package/x/dom/components/browser/component.js.map +1 -0
  88. package/x/dom/components/browser/style.css.d.ts +2 -0
  89. package/x/dom/components/browser/style.css.js +117 -0
  90. package/x/dom/components/browser/style.css.js.map +1 -0
  91. package/x/dom/components/dropzone/component.d.ts +1 -0
  92. package/x/dom/components/dropzone/component.js +27 -0
  93. package/x/dom/components/dropzone/component.js.map +1 -0
  94. package/x/dom/components/dropzone/style.css.d.ts +2 -0
  95. package/x/dom/components/dropzone/style.css.js +53 -0
  96. package/x/dom/components/dropzone/style.css.js.map +1 -0
  97. package/x/dom/components/filter/component.d.ts +1 -0
  98. package/x/dom/components/filter/component.js +40 -0
  99. package/x/dom/components/filter/component.js.map +1 -0
  100. package/x/dom/components/outliner/component.d.ts +1 -0
  101. package/x/dom/components/outliner/component.js +13 -0
  102. package/x/dom/components/outliner/component.js.map +1 -0
  103. package/x/dom/components/searchbar/component.d.ts +1 -0
  104. package/x/dom/components/searchbar/component.js +24 -0
  105. package/x/dom/components/searchbar/component.js.map +1 -0
  106. package/x/dom/components/sort/component.d.ts +1 -0
  107. package/x/dom/components/sort/component.js +44 -0
  108. package/x/dom/components/sort/component.js.map +1 -0
  109. package/x/dom/components.d.ts +18 -0
  110. package/x/dom/components.js +13 -0
  111. package/x/dom/components.js.map +1 -0
  112. package/x/dom/context.d.ts +2 -0
  113. package/x/dom/context.js +3 -0
  114. package/x/dom/context.js.map +1 -0
  115. package/x/dom/theme.css.d.ts +2 -0
  116. package/x/dom/theme.css.js +11 -0
  117. package/x/dom/theme.css.js.map +1 -0
  118. package/x/dom/utils/find-group-name.d.ts +1 -0
  119. package/x/dom/utils/find-group-name.js +9 -0
  120. package/x/dom/utils/find-group-name.js.map +1 -0
  121. package/x/dom/utils/find-local-group.d.ts +1 -0
  122. package/x/dom/utils/find-local-group.js +7 -0
  123. package/x/dom/utils/find-local-group.js.map +1 -0
  124. package/x/dom/views/tree/component.d.ts +7 -0
  125. package/x/dom/views/tree/component.js +52 -0
  126. package/x/dom/views/tree/component.js.map +1 -0
  127. package/x/dom/views/tree/style.css.d.ts +2 -0
  128. package/x/dom/views/tree/style.css.js +63 -0
  129. package/x/dom/views/tree/style.css.js.map +1 -0
  130. package/x/genius/folio.md +29 -0
  131. package/x/genius/parts/hy-tree.d.ts +44 -0
  132. package/x/genius/parts/hy-tree.js +116 -0
  133. package/x/genius/parts/hy-tree.js.map +1 -0
  134. package/x/genius/quay.md +13 -0
  135. package/x/genius/turbo.md +21 -0
  136. package/x/genius/twig.d.ts +34 -0
  137. package/x/genius/twig.js +2 -0
  138. package/x/genius/twig.js.map +1 -0
  139. package/x/importmap.json +47 -0
  140. package/x/index.d.ts +11 -0
  141. package/x/index.html +170 -0
  142. package/x/index.html.d.ts +3 -0
  143. package/x/index.html.js +87 -0
  144. package/x/index.html.js.map +1 -0
  145. package/x/index.js +9 -0
  146. package/x/index.js.map +1 -0
  147. package/x/logic/aspects/codex/codex.d.ts +17 -0
  148. package/x/logic/aspects/codex/codex.js +39 -0
  149. package/x/logic/aspects/codex/codex.js.map +1 -0
  150. package/x/logic/aspects/codex/example.d.ts +13 -0
  151. package/x/logic/aspects/codex/example.js +42 -0
  152. package/x/logic/aspects/codex/example.js.map +1 -0
  153. package/x/logic/aspects/codex/parts/clade.d.ts +16 -0
  154. package/x/logic/aspects/codex/parts/clade.js +23 -0
  155. package/x/logic/aspects/codex/parts/clade.js.map +1 -0
  156. package/x/logic/aspects/codex/parts/codex-item.d.ts +33 -0
  157. package/x/logic/aspects/codex/parts/codex-item.js +74 -0
  158. package/x/logic/aspects/codex/parts/codex-item.js.map +1 -0
  159. package/x/logic/aspects/codex/parts/hierarchy.d.ts +23 -0
  160. package/x/logic/aspects/codex/parts/hierarchy.js +69 -0
  161. package/x/logic/aspects/codex/parts/hierarchy.js.map +1 -0
  162. package/x/logic/aspects/codex/parts/taxonomy.d.ts +7 -0
  163. package/x/logic/aspects/codex/parts/taxonomy.js +13 -0
  164. package/x/logic/aspects/codex/parts/taxonomy.js.map +1 -0
  165. package/x/logic/aspects/codex/parts/types.d.ts +22 -0
  166. package/x/logic/aspects/codex/parts/types.js +2 -0
  167. package/x/logic/aspects/codex/parts/types.js.map +1 -0
  168. package/x/logic/aspects/codex/utils/generate-id.d.ts +1 -0
  169. package/x/logic/aspects/codex/utils/generate-id.js +5 -0
  170. package/x/logic/aspects/codex/utils/generate-id.js.map +1 -0
  171. package/x/logic/aspects/dropzone.d.ts +16 -0
  172. package/x/logic/aspects/dropzone.js +60 -0
  173. package/x/logic/aspects/dropzone.js.map +1 -0
  174. package/x/logic/aspects/tree-trail.d.ts +8 -0
  175. package/x/logic/aspects/tree-trail.js +24 -0
  176. package/x/logic/aspects/tree-trail.js.map +1 -0
  177. package/x/logic/brain.d.ts +11 -0
  178. package/x/logic/brain.js +17 -0
  179. package/x/logic/brain.js.map +1 -0
  180. package/x/logic/group.d.ts +51 -0
  181. package/x/logic/group.js +79 -0
  182. package/x/logic/group.js.map +1 -0
  183. package/x/logic/permissions.d.ts +18 -0
  184. package/x/logic/permissions.js +26 -0
  185. package/x/logic/permissions.js.map +1 -0
  186. package/x/logic/presets/media/group.d.ts +7 -0
  187. package/x/logic/presets/media/group.js +75 -0
  188. package/x/logic/presets/media/group.js.map +1 -0
  189. package/x/logic/presets/media/schema.d.ts +18 -0
  190. package/x/logic/presets/media/schema.js +2 -0
  191. package/x/logic/presets/media/schema.js.map +1 -0
  192. package/x/logic/presets/opfs/schema.d.ts +18 -0
  193. package/x/logic/presets/opfs/schema.js +2 -0
  194. package/x/logic/presets/opfs/schema.js.map +1 -0
  195. package/x/logic/presets/plain/group.d.ts +7 -0
  196. package/x/logic/presets/plain/group.js +33 -0
  197. package/x/logic/presets/plain/group.js.map +1 -0
  198. package/x/logic/presets/plain/schema.d.ts +12 -0
  199. package/x/logic/presets/plain/schema.js +2 -0
  200. package/x/logic/presets/plain/schema.js.map +1 -0
  201. package/x/logic/types.d.ts +20 -0
  202. package/x/logic/types.js +11 -0
  203. package/x/logic/types.js.map +1 -0
  204. package/x/tests.test.d.ts +1 -0
  205. package/x/tests.test.js +6 -0
  206. package/x/tests.test.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hierarchy.js","sourceRoot":"","sources":["../../../../../s/logic/aspects/codex/parts/hierarchy.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAG9B;;;;;GAKG;AACH,MAAM,OAAO,SAAS;IACrB,SAAS,GAAG,IAAI,IAAI,EAAe,CAAA;IACnC,QAAQ,GAAG,IAAI,IAAI,EAAU,CAAA;IAE7B,GAAG,CAAC,EAAM;QACT,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC9B,CAAC;IAED,WAAW,CAAC,EAAM;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAClC,CAAC;IAED,SAAS,CAAC,EAAM;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC7B,CAAC;IAED,8EAA8E;IAC9E,aAAa,CAAC,IAAQ;QACrB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC,CAAA;IACpC,CAAC;IAED,mCAAmC;IACnC,MAAM,CAAC,MAAU,EAAE,GAAG,QAAc;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;QACzC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAChC,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;gBAC1B,MA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,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,EAAG,CAAA;YAChC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC;gBAAE,SAAQ;YAClD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YAEZ,MAAM,CAAC,EAAE,EAAE,IAAI,CAAe,CAAA;YAE9B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;gBACzC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;QACrC,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,7 @@
1
+ import { Kind, Schema, Taxons } from "./types.js";
2
+ /** Defines the static details about each "kind" of data */
3
+ export declare class Taxonomy<Sc extends Schema> {
4
+ #private;
5
+ constructor(taxons: Taxons<Sc>);
6
+ taxon<K extends Kind<Sc>>(kind: K): Sc["taxon"];
7
+ }
@@ -0,0 +1,13 @@
1
+ import { MapG } from "@e280/stz";
2
+ /** Defines the static details about each "kind" of data */
3
+ export class Taxonomy {
4
+ #taxons = new MapG();
5
+ constructor(taxons) {
6
+ for (const [kind, taxon] of Object.entries(taxons))
7
+ this.#taxons.set(kind, taxon);
8
+ }
9
+ taxon(kind) {
10
+ return this.#taxons.require(kind);
11
+ }
12
+ }
13
+ //# sourceMappingURL=taxonomy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taxonomy.js","sourceRoot":"","sources":["../../../../../s/logic/aspects/codex/parts/taxonomy.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAG9B,2DAA2D;AAC3D,MAAM,OAAO,QAAQ;IACpB,OAAO,GAAG,IAAI,IAAI,EAAyB,CAAA;IAE3C,YAAY,MAAkB;QAC7B,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;YACjD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAC/B,CAAC;IAED,KAAK,CAAqB,IAAO;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAgB,CAAA;IACjD,CAAC;CACD"}
@@ -0,0 +1,22 @@
1
+ import { Content } from "@benev/slate";
2
+ export type Id = string;
3
+ export type Taxon = {
4
+ icon: Content;
5
+ };
6
+ export type Specimen = {
7
+ label: string;
8
+ };
9
+ export type Specimens = {
10
+ [key: string]: Specimen;
11
+ };
12
+ export type AsSpecimens<S extends Specimens> = S;
13
+ export type Schema = {
14
+ taxon: Taxon;
15
+ specimens: Specimens;
16
+ };
17
+ export type AsSchema<Sc extends Schema> = Sc;
18
+ export type Kind<Sc extends Schema> = keyof Sc["specimens"];
19
+ export type Taxons<Sc extends Schema> = {
20
+ [K in Kind<Sc>]: Sc["taxon"];
21
+ };
22
+ export type AnySpecimen<Sc extends Schema> = Sc["specimens"][Kind<Sc>];
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../s/logic/aspects/codex/parts/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export declare function generateId(): string;
@@ -0,0 +1,5 @@
1
+ import { Hex } from "@e280/stz";
2
+ export function generateId() {
3
+ return Hex.random();
4
+ }
5
+ //# sourceMappingURL=generate-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-id.js","sourceRoot":"","sources":["../../../../../s/logic/aspects/codex/utils/generate-id.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAA;AAE7B,MAAM,UAAU,UAAU;IACzB,OAAO,GAAG,CAAC,MAAM,EAAE,CAAA;AACpB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Group } from "../group.js";
2
+ import { CodexItem } from "./codex/parts/codex-item.js";
3
+ export declare class Dropzone {
4
+ #private;
5
+ private group;
6
+ constructor(group: Group);
7
+ get grabbed(): CodexItem<any, string | number | symbol> | undefined;
8
+ get hovering(): CodexItem<any, string | number | symbol> | undefined;
9
+ dragenter: (e: DragEvent, target?: CodexItem) => void;
10
+ dragleave: (e: DragEvent) => void;
11
+ dragstart: (e: DragEvent, n: CodexItem) => void;
12
+ dragover: (e: DragEvent, n: CodexItem) => void;
13
+ dragend: (e: DragEvent) => void;
14
+ drop: (e: DragEvent, target: CodexItem) => void;
15
+ change: (e: DragEvent, targetFolder: CodexItem) => void;
16
+ }
@@ -0,0 +1,60 @@
1
+ import { ShockDragDrop, signal } from "@benev/slate";
2
+ export class Dropzone {
3
+ group;
4
+ #drag_drop = new ShockDragDrop({
5
+ handle_drop: (_e, grabbed, hovering) => this.group.move(grabbed, hovering)
6
+ });
7
+ constructor(group) {
8
+ this.group = group;
9
+ }
10
+ // to make drop file to import ui work
11
+ #hovering = signal(undefined);
12
+ get grabbed() {
13
+ return this.#drag_drop.grabbed;
14
+ }
15
+ get hovering() {
16
+ return this.#drag_drop.hovering ?? this.#hovering.value;
17
+ }
18
+ dragenter = (e, target) => {
19
+ e.preventDefault();
20
+ this.#drag_drop.dropzone.dragenter()(e);
21
+ this.#hovering.value = target;
22
+ };
23
+ dragleave = (e) => {
24
+ this.#drag_drop.dropzone.dragleave()(e);
25
+ this.#hovering.value = undefined;
26
+ };
27
+ dragstart = (e, n) => {
28
+ e.stopPropagation();
29
+ this.#drag_drop.dragzone.dragstart(n)(e);
30
+ };
31
+ dragover = (e, n) => {
32
+ e.preventDefault();
33
+ this.#drag_drop.dropzone.dragover(n)(e);
34
+ };
35
+ dragend = (e) => {
36
+ this.#drag_drop.dragzone.dragend()(e);
37
+ this.#hovering.value = undefined;
38
+ };
39
+ drop = (e, target) => {
40
+ e.preventDefault();
41
+ const files = Array.from(e.dataTransfer?.files || []);
42
+ if (files.length) {
43
+ this.group.upload(files, target);
44
+ }
45
+ const same = this.grabbed?.id === this.hovering?.id;
46
+ const child = this.grabbed?.children.some(c => this.hovering?.id === c.id);
47
+ const parent = this.grabbed?.parent?.id === this.hovering?.id;
48
+ if (!same && !child && !parent)
49
+ this.#drag_drop.dropzone.drop(target)(e);
50
+ this.#hovering.value = undefined;
51
+ };
52
+ change = (e, targetFolder) => {
53
+ const input = e.currentTarget;
54
+ const files = Array.from(input.files ?? []);
55
+ if (files.length) {
56
+ this.group.upload(files, targetFolder);
57
+ }
58
+ };
59
+ }
60
+ //# sourceMappingURL=dropzone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropzone.js","sourceRoot":"","sources":["../../../s/logic/aspects/dropzone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,MAAM,EAAC,MAAM,cAAc,CAAA;AAKlD,MAAM,OAAO,QAAQ;IAKA;IAJpB,UAAU,GAAG,IAAI,aAAa,CAAuB;QACpD,WAAW,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC1E,CAAC,CAAA;IAEF,YAAoB,KAAY;QAAZ,UAAK,GAAL,KAAK,CAAO;IAAG,CAAC;IAEpC,sCAAsC;IACtC,SAAS,GAAG,MAAM,CAAwB,SAAS,CAAC,CAAA;IAEpD,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAA;IAC/B,CAAC;IAED,IAAI,QAAQ;QACX,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;IACxD,CAAC;IAED,SAAS,GAAG,CAAC,CAAY,EAAE,MAAkB,EAAE,EAAE;QAChD,CAAC,CAAC,c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AC,KAAK,EAAE,MAAM,CAAC,CAAA;QACjC,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAA;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAA;QAC1E,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAA;QAE7D,IAAG,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM;YAC5B,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QAEzC,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,SAAS,CAAA;IACjC,CAAC,CAAA;IAED,MAAM,GAAG,CAAC,CAAY,EAAE,YAAuB,EAAE,EAAE;QAClD,MAAM,KAAK,GAAG,CAAC,CAAC,aAAiC,CAAA;QACjD,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;QAE3C,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YAClB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;QACvC,CAAC;IACF,CAAC,CAAA;CACD"}
@@ -0,0 +1,8 @@
1
+ import { Schema } from "./codex/parts/types.js";
2
+ import { CodexItem } from "./codex/parts/codex-item.js";
3
+ export declare class TreeTrail<Sc extends Schema> {
4
+ readonly signal: import("@benev/slate").Signal<CodexItem<Sc, keyof Sc["specimens"]>[]>;
5
+ constructor(root: CodexItem<Sc>);
6
+ setTrail(e: Event, item: CodexItem<Sc>): void;
7
+ get currentFolder(): CodexItem<Sc, keyof Sc["specimens"]>[];
8
+ }
@@ -0,0 +1,24 @@
1
+ import { signal } from "@benev/slate";
2
+ export class TreeTrail {
3
+ signal = signal([]);
4
+ constructor(root) {
5
+ this.signal.value = [root];
6
+ }
7
+ setTrail(e, item) {
8
+ if (e.target !== e.currentTarget)
9
+ return;
10
+ const trail = [];
11
+ let cur = item.kind === "folder"
12
+ ? item
13
+ : item.parent;
14
+ while (cur) {
15
+ trail.unshift(cur);
16
+ cur = cur.parent;
17
+ }
18
+ this.signal.value = trail;
19
+ }
20
+ get currentFolder() {
21
+ return this.signal.value.at(-1)?.children ?? [];
22
+ }
23
+ }
24
+ //# sourceMappingURL=tree-trail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-trail.js","sourceRoot":"","sources":["../../../s/logic/aspects/tree-trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAA;AAInC,MAAM,OAAO,SAAS;IACZ,MAAM,GAAG,MAAM,CAAkB,EAAE,CAAC,CAAA;IAE7C,YAAY,IAAmB;QAC9B,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC;IAED,QAAQ,CAAC,CAAQ,EAAE,IAAmB;QACrC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,aAAa;YAAE,OAAM;QAExC,MAAM,KAAK,GAAoB,EAAE,CAAA;QAEjC,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,KAAK,QAAQ;YAC/B,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,IAAI,CAAC,MAAM,CAAA;QAEd,OAAO,GAAG,EAAE,CAAC;YACZ,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;YAClB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAA;QACjB,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;IAC1B,CAAC;IAED,IAAI,aAAa;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,IAAI,EAAE,CAAA;IAChD,CAAC;CACD"}
@@ -0,0 +1,11 @@
1
+ import { Group } from "./group.js";
2
+ /**
3
+ * Quay's global state
4
+ * - manages groups
5
+ * - each group is a different hierarchy, which can have unique types and stuff
6
+ */
7
+ export declare class Brain {
8
+ #private;
9
+ setGroup<G extends Group>(name: string, group: G): G;
10
+ getGroup<G extends Group>(name: string): G;
11
+ }
@@ -0,0 +1,17 @@
1
+ import { MapG } from "@e280/stz";
2
+ /**
3
+ * Quay's global state
4
+ * - manages groups
5
+ * - each group is a different hierarchy, which can have unique types and stuff
6
+ */
7
+ export class Brain {
8
+ #groups = new MapG();
9
+ setGroup(name, group) {
10
+ this.#groups.set(name, group);
11
+ return group;
12
+ }
13
+ getGroup(name) {
14
+ return this.#groups.require(name);
15
+ }
16
+ }
17
+ //# sourceMappingURL=brain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brain.js","sourceRoot":"","sources":["../../s/logic/brain.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAG9B;;;;GAIG;AACH,MAAM,OAAO,KAAK;IACjB,OAAO,GAAG,IAAI,IAAI,EAAiB,CAAA;IAEnC,QAAQ,CAAkB,IAAY,EAAE,KAAQ;QAC/C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QAC7B,OAAO,KAAK,CAAA;IACb,CAAC;IAED,QAAQ,CAAkB,IAAY;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAM,CAAA;IACvC,CAAC;CACD"}
@@ -0,0 +1,51 @@
1
+ import { Permission } from "./permissions.js";
2
+ import { Dropzone } from "./aspects/dropzone.js";
3
+ import { TreeTrail } from "./aspects/tree-trail.js";
4
+ import { Schema } from "./aspects/codex/parts/types.js";
5
+ import { GroupConfig, SearchFn, SortFn } from "./types.js";
6
+ import { CodexItem } from "./aspects/codex/parts/codex-item.js";
7
+ export declare class Group<Sc extends Schema = any> {
8
+ config: GroupConfig<Sc>;
9
+ trail: TreeTrail<Sc>;
10
+ dropzone: Dropzone;
11
+ searchText: import("@benev/slate").Signal<string>;
12
+ selectedFilter: import("@benev/slate").Signal<string>;
13
+ selectedSort: import("@benev/slate").Signal<string>;
14
+ on: {
15
+ newFolder: import("@e280/stz").Sub<[{
16
+ parent: CodexItem<Sc>;
17
+ }]>;
18
+ move: import("@e280/stz").Sub<[{
19
+ item: CodexItem<Sc>;
20
+ target: CodexItem<Sc>;
21
+ }]>;
22
+ delete: import("@e280/stz").Sub<[{
23
+ item: CodexItem<Sc>;
24
+ }]>;
25
+ rename: import("@e280/stz").Sub<[{
26
+ item: CodexItem<Sc>;
27
+ newName: string;
28
+ }]>;
29
+ upload: import("@e280/stz").Sub<[{
30
+ files: File[];
31
+ target: CodexItem<Sc>;
32
+ }]>;
33
+ search: import("@e280/stz").Sub<[{
34
+ terms: string[];
35
+ }]>;
36
+ refresh: import("@e280/stz").Sub<[{}]>;
37
+ };
38
+ constructor(config: GroupConfig<Sc>);
39
+ get permissions(): (item: CodexItem) => Permission;
40
+ getFilterFn(filterKey: string): SearchFn<Sc>;
41
+ getSearchFn(searchText: string): SearchFn<Sc>;
42
+ getSortFn(sortKey: string): SortFn<Sc>;
43
+ sort(items: CodexItem<Sc>[]): CodexItem<Sc>[];
44
+ matches(item: CodexItem<Sc>): boolean;
45
+ move(item: CodexItem<Sc>, target: CodexItem<Sc>): void;
46
+ delete(item: CodexItem<Sc>): void;
47
+ rename(item: CodexItem<Sc>, newName: string): void;
48
+ upload(files: File[], folder: CodexItem<Sc>): void;
49
+ addFolder(parent: CodexItem<Sc>): void;
50
+ components: () => () => /*elided*/ any;
51
+ }
@@ -0,0 +1,79 @@
1
+ import { sub } from "@e280/stz";
2
+ import { signal } from "@benev/slate";
3
+ import { Dropzone } from "./aspects/dropzone.js";
4
+ import { TreeTrail } from "./aspects/tree-trail.js";
5
+ export class Group {
6
+ config;
7
+ trail;
8
+ dropzone = new Dropzone(this);
9
+ searchText = signal("");
10
+ selectedFilter = signal("");
11
+ selectedSort = signal("");
12
+ on = {
13
+ newFolder: sub(),
14
+ move: sub(),
15
+ delete: sub(),
16
+ rename: sub(),
17
+ upload: sub(),
18
+ search: sub(),
19
+ refresh: sub(),
20
+ };
21
+ constructor(config) {
22
+ this.config = config;
23
+ this.selectedFilter.value = config.defaultFilter;
24
+ this.selectedSort.value = config.defaultSort;
25
+ this.trail = new TreeTrail(config.root);
26
+ }
27
+ get permissions() {
28
+ return this.config.permissions;
29
+ }
30
+ getFilterFn(filterKey) {
31
+ return this.config.filters.get(filterKey) ?? (() => true);
32
+ }
33
+ getSearchFn(searchText) {
34
+ const terms = searchText.trim().toLowerCase().split(/\s+/);
35
+ return item => this.config.search(terms, item);
36
+ }
37
+ getSortFn(sortKey) {
38
+ return this.config.sorts?.get(sortKey) ?? (() => 0);
39
+ }
40
+ sort(items) {
41
+ const sortFn = this.getSortFn(this.selectedSort.value);
42
+ return [...items].sort(sortFn);
43
+ }
44
+ matches(item) {
45
+ const filterFn = this.getFilterFn(this.selectedFilter.value);
46
+ const searchFn = this.getSearchFn(this.searchText.value);
47
+ return filterFn(item) && searchFn(item);
48
+ }
49
+ move(item, target) {
50
+ if (!this.permissions(item).move)
51
+ throw new Error("move permission not granted");
52
+ item.detach();
53
+ target.attach(item);
54
+ this.on.move.pub({ item, target });
55
+ }
56
+ delete(item) {
57
+ if (!this.permissions(item).delete)
58
+ throw new Error("delete permission not granted");
59
+ item.destroy();
60
+ this.on.delete.pub({ item });
61
+ }
62
+ rename(item, newName) {
63
+ if (!this.permissions(item).rename)
64
+ throw new Error("rename permission not granted");
65
+ this.on.rename.pub({ item, newName });
66
+ }
67
+ upload(files, folder) {
68
+ if (!this.permissions(folder).upload)
69
+ throw new Error("upload permission not granted");
70
+ this.on.upload.pub({ files, target: folder });
71
+ }
72
+ addFolder(parent) {
73
+ if (!this.permissions(parent).newFolder)
74
+ throw new Error("add folder permission not granted");
75
+ this.on.newFolder.pub({ parent });
76
+ }
77
+ components = () => this.components;
78
+ }
79
+ //# sourceMappingURL=group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.js","sourceRoot":"","sources":["../../s/logic/group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAA;AAC7B,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAA;AAGnC,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAA;AAKjD,MAAM,OAAO,KAAK;IAiBE;IAhBnB,KAAK,CAAe;IACpB,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC7B,UAAU,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;IACvB,cAAc,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;IAC3B,YAAY,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;IAEzB,EAAE,GAAG;QACJ,SAAS,EAAE,GAAG,EAA6B;QAC3C,IAAI,EAAE,GAAG,EAAkD;QAC3D,MAAM,EAAE,GAAG,EAA2B;QACtC,MAAM,EAAE,GAAG,EAA4C;QACvD,MAAM,EAAE,GAAG,EAA4C;QACvD,MAAM,EAAE,GAAG,EAAuB;QAClC,OAAO,EAAE,GAAG,EAAQ;KACpB,CAAA;IAED,YAAmB,MAAuB;QAAvB,WAAM,GAAN,MAAM,CAAiB;QACzC,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,MAAM,CAAC,aAAa,CAAA;QAChD,IAAI,CAAC,YAAY,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,CAAA;QAC5C,IAAI,CAAC,KAAK,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,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CAAA;QAErD,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,EAAC,MAAM,EAAC,CAAC,CAAA;IAChC,CAAC;IAED,UAAU,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAA;CAClC"}
@@ -0,0 +1,18 @@
1
+ declare enum PermissionKey {
2
+ rename = "rename",
3
+ move = "move",
4
+ delete = "delete",
5
+ refresh = "refresh",
6
+ newFolder = "newFolder",
7
+ search = "search",
8
+ upload = "upload"
9
+ }
10
+ export type Permission = {
11
+ [K in PermissionKey]: boolean;
12
+ };
13
+ export declare const Permissions: {
14
+ all: Permission;
15
+ readOnly: Permission;
16
+ none: Permission;
17
+ };
18
+ export {};
@@ -0,0 +1,26 @@
1
+ var PermissionKey;
2
+ (function (PermissionKey) {
3
+ PermissionKey["rename"] = "rename";
4
+ PermissionKey["move"] = "move";
5
+ PermissionKey["delete"] = "delete";
6
+ PermissionKey["refresh"] = "refresh";
7
+ PermissionKey["newFolder"] = "newFolder";
8
+ PermissionKey["search"] = "search";
9
+ PermissionKey["upload"] = "upload";
10
+ })(PermissionKey || (PermissionKey = {}));
11
+ const ALL_KEYS = Object.values(PermissionKey);
12
+ function makePermissions(defaultValue, overrides = {}) {
13
+ const perms = {};
14
+ for (const key of ALL_KEYS)
15
+ perms[key] = key in overrides ? overrides[key] : defaultValue;
16
+ return perms;
17
+ }
18
+ export const Permissions = {
19
+ all: makePermissions(true),
20
+ readOnly: makePermissions(false, {
21
+ [PermissionKey.refresh]: true,
22
+ [PermissionKey.search]: true,
23
+ }),
24
+ none: makePermissions(false),
25
+ };
26
+ //# sourceMappingURL=permissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../s/logic/permissions.ts"],"names":[],"mappings":"AAAA,IAAK,aAQJ;AARD,WAAK,aAAa;IACjB,kCAAiB,CAAA;IACjB,8BAAa,CAAA;IACb,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;IACnB,wCAAuB,CAAA;IACvB,kCAAiB,CAAA;IACjB,kCAAiB,CAAA;AAClB,CAAC,EARI,aAAa,KAAb,aAAa,QAQjB;AAMD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAoB,CAAA;AAEhE,SAAS,eAAe,CACvB,YAAqB,EACrB,YAAiC,EAAE;IAEnC,MAAM,KAAK,GAAG,EAAgB,CAAA;IAC9B,KAAK,MAAM,GAAG,IAAI,QAAQ;QACzB,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAE,CAAC,CAAC,CAAC,YAAY,CAAA;IAC/D,OAAO,KAAK,CAAA;AACb,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,GAAG,EAAE,eAAe,CAAC,IAAI,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE;QAChC,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,IAAI;QAC7B,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,IAAI;KAC5B,CAAC;IACF,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC;CAC5B,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { Group } from "../../group.js";
2
+ import { MediaSchema } from "./schema.js";
3
+ import { GroupConfig } from "../../types.js";
4
+ export declare class MediaGroup extends Group<MediaSchema> implements Group {
5
+ static config: () => GroupConfig<MediaSchema>;
6
+ constructor();
7
+ }
@@ -0,0 +1,75 @@
1
+ import { MapG } from "@e280/stz";
2
+ import { html } from "@benev/slate";
3
+ import Quay from "../../../index.js";
4
+ import { Group } from "../../group.js";
5
+ import { Codex } from "../../aspects/codex/codex.js";
6
+ export class MediaGroup extends Group {
7
+ static config = () => {
8
+ const formatIcons = new MapG()
9
+ .set("audio", html `<sl-icon name=music-note-beamed></sl-icon>`)
10
+ .set("video", html `<sl-icon name=film></sl-icon>`)
11
+ .set("image", html `<sl-icon name=image></sl-icon>`)
12
+ .set("other", html `<sl-icon name=file-earmark></sl-icon>`);
13
+ const filters = new Map()
14
+ .set("all", () => true)
15
+ .set("video", item => item.isKind("folder") || (item.isKind("file") && item.specimen.format === "video"))
16
+ .set("audio", item => item.isKind("folder") || (item.isKind("file") && item.specimen.format === "audio"));
17
+ const sorts = new Map()
18
+ .set("label", (a, b) => a.specimen.label.localeCompare(b.specimen.label))
19
+ .set("format", (a, b) => {
20
+ if (a.isKind("file") && b.isKind("file"))
21
+ return a.specimen.format.localeCompare(b.specimen.format);
22
+ if (a.isKind("file"))
23
+ return -1;
24
+ if (b.isKind("file"))
25
+ return 1;
26
+ return 0;
27
+ });
28
+ const search = (terms, item) => {
29
+ const query = terms.join(" ").trim().toLowerCase();
30
+ if (query === "")
31
+ return true;
32
+ if (item.kind === "folder") {
33
+ return item.children.some(child => search(terms, child));
34
+ }
35
+ return item.specimen.label.toLowerCase().includes(query);
36
+ };
37
+ const codex = Codex.setup({
38
+ folder: { icon: html `<sl-icon name="folder"></sl-icon>` },
39
+ file: { icon: html `<sl-icon name="file"></sl-icon>` },
40
+ });
41
+ const root = codex.root(codex.create("folder", { label: "project" }));
42
+ const renderIcon = (item, opened) => {
43
+ return item.isKind("file")
44
+ ? formatIcons.require(item.specimen.format)
45
+ : opened ? html `<sl-icon name="folder2-open"></sl-icon>` : item.taxon.icon;
46
+ };
47
+ return {
48
+ codex,
49
+ root,
50
+ sorts,
51
+ filters: filters,
52
+ defaultFilter: "all",
53
+ defaultSort: "label",
54
+ search: (terms, item) => {
55
+ return terms.some(term => (item.kind.includes(term) ||
56
+ item.id.includes(term) ||
57
+ item.specimen.label.includes(term))) || search(terms, item);
58
+ },
59
+ renderIcon,
60
+ renderLabel: item => item.specimen.label,
61
+ renderPreview: (item) => {
62
+ return (item.isKind("file") && item.specimen.previewUrl)
63
+ ? html `<img src=${item.specimen.previewUrl}>`
64
+ : renderIcon(item, false);
65
+ // // TODO icons
66
+ // : html`<sl-icon name=${item.taxon.icon}></sl-icon>`
67
+ },
68
+ permissions: item => Quay.permissions.all,
69
+ };
70
+ };
71
+ constructor() {
72
+ super(MediaGroup.config());
73
+ }
74
+ }
75
+ //# sourceMappingURL=group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.js","sourceRoot":"","sources":["../../../../s/logic/presets/media/group.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAU,IAAI,EAAC,MAAM,cAAc,CAAA;AAE1C,OAAO,IAAI,MAAM,mBAAmB,CAAA;AACpC,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAC,KAAK,EAAC,MAAM,8BAA8B,CAAA;AAKlD,MAAM,OAAO,UAAW,SAAQ,KAAkB;IACjD,MAAM,CAAC,MAAM,GAAG,GAA6B,EAAE;QAC9C,MAAM,WAAW,GAAG,IAAI,IAAI,EAAwB;aAClD,GAAG,CAAC,OAAO,EAAE,IAAI,CAAA,4CAA4C,CAAC;aAC9D,GAAG,CAAC,OAAO,EAAE,IAAI,CAAA,+BAA+B,CAAC;aACjD,GAAG,CAAC,OAAO,EAAE,IAAI,CAAA,gCAAgC,CAAC;aAClD,GAAG,CAAC,OAAO,EAAE,IAAI,CAAA,uCAAuC,CAAC,CAAA;QAE3D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAiC;aACtD,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC;aACtB,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC;aACxG,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,I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W,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK;YACxC,aAAa,EAAE,CAAC,IAA4B,EAAE,EAAE;gBAC/C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;oBACvD,CAAC,CAAC,IAAI,CAAA,YAAY,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG;oBAC7C,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;gBACzB,gBAAgB;gBAChB,sDAAsD;YACxD,CAAC;YACD,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG;SACzC,CAAA;IACF,CAAC,CAAA;IAED;QACC,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAA;IAC3B,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { Content } from "@benev/slate";
2
+ import { AsSchema } from "../../aspects/codex/parts/types.js";
3
+ export type MediaFormat = "video" | "image" | "audio" | "other";
4
+ export type MediaSchema = AsSchema<{
5
+ taxon: {
6
+ icon: Content;
7
+ };
8
+ specimens: {
9
+ folder: {
10
+ label: string;
11
+ };
12
+ file: {
13
+ label: string;
14
+ format: MediaFormat;
15
+ previewUrl: string | null;
16
+ };
17
+ };
18
+ }>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../s/logic/presets/media/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { Content } from "@benev/slate";
2
+ import { AsSchema } from "../../aspects/codex/parts/types.js";
3
+ export type OpfsSchema = AsSchema<{
4
+ taxon: {
5
+ icon: Content;
6
+ };
7
+ specimens: {
8
+ directory: {
9
+ label: string;
10
+ };
11
+ file: {
12
+ label: string;
13
+ size: string;
14
+ type: string;
15
+ lastModified: number;
16
+ };
17
+ };
18
+ }>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../s/logic/presets/opfs/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { Group } from "../../group.js";
2
+ import { PlainSchema } from "./schema.js";
3
+ import { GroupConfig } from "../../types.js";
4
+ export declare class PlainGroup extends Group<PlainSchema> {
5
+ static config: () => GroupConfig<PlainSchema>;
6
+ constructor();
7
+ }
@@ -0,0 +1,33 @@
1
+ import Quay from "../../../index.js";
2
+ import { Group } from "../../group.js";
3
+ import { Codex } from "../../aspects/codex/codex.js";
4
+ export class PlainGroup extends Group {
5
+ static config = () => {
6
+ const codex = Codex.setup({
7
+ item: { icon: "📄" },
8
+ });
9
+ const root = codex.root(codex.create("item", { label: "root" }));
10
+ return {
11
+ codex,
12
+ root,
13
+ defaultSort: "id",
14
+ sorts: new Map()
15
+ .set("label", (a, b) => a.id.localeCompare(b.id)),
16
+ defaultFilter: "all",
17
+ filters: new Map()
18
+ .set("all", () => true),
19
+ search: (terms, item) => {
20
+ return terms.some(term => (item.kind.includes(term) ||
21
+ item.id.includes(term)));
22
+ },
23
+ renderLabel: item => item.id,
24
+ renderIcon: item => item.taxon.icon,
25
+ renderPreview: () => null,
26
+ permissions: item => Quay.permissions.all,
27
+ };
28
+ };
29
+ constructor() {
30
+ super(PlainGroup.config());
31
+ }
32
+ }
33
+ //# sourceMappingURL=group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.js","sourceRoot":"","sources":["../../../../s/logic/presets/plain/group.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,mBAAmB,CAAA;AACpC,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAA;AAGpC,OAAO,EAAC,KAAK,EAAC,MAAM,8BAA8B,CAAA;AAElD,MAAM,OAAO,UAAW,SAAQ,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CAAC,CAAA;IAC3B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Content } from "@benev/slate";
2
+ import { AsSchema } from "../../aspects/codex/parts/types.js";
3
+ export type PlainSchema = AsSchema<{
4
+ taxon: {
5
+ icon: Content;
6
+ };
7
+ specimens: {
8
+ item: {
9
+ label: string;
10
+ };
11
+ };
12
+ }>;