@directus/themes 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import type { MaybeRef } from 'vue';
3
3
  import type { Theme } from '../schemas/theme.js';
4
4
  export declare const useTheme: (darkMode: MaybeRef<boolean>, themeLight: MaybeRef<string | null>, themeDark: MaybeRef<string | null>, themeLightOverrides: MaybeRef<DeepPartial<Theme['rules']>>, themeDarkOverrides: MaybeRef<DeepPartial<Theme['rules']>>) => {
5
5
  theme: import("vue").ComputedRef<{
6
+ id: string;
6
7
  name: string;
7
8
  appearance: "dark";
8
9
  rules: {
@@ -112,13 +113,17 @@ export declare const useTheme: (darkMode: MaybeRef<boolean>, themeLight: MaybeRe
112
113
  title: {
113
114
  foreground: string;
114
115
  fontFamily: string;
116
+ fontWeight: string;
115
117
  };
116
118
  };
117
119
  form: {
120
+ columnGap: string;
121
+ rowGap: string;
118
122
  field: {
119
123
  label: {
120
124
  foreground: string;
121
125
  fontFamily: string;
126
+ fontWeight: string;
122
127
  };
123
128
  input: {
124
129
  background: string;
@@ -132,6 +137,7 @@ export declare const useTheme: (darkMode: MaybeRef<boolean>, themeLight: MaybeRe
132
137
  boxShadowHover: string;
133
138
  boxShadowFocus: string;
134
139
  height: string;
140
+ padding: string;
135
141
  };
136
142
  };
137
143
  };
@@ -177,6 +183,7 @@ export declare const useTheme: (darkMode: MaybeRef<boolean>, themeLight: MaybeRe
177
183
  boxShadowHover: string;
178
184
  boxShadowFocus: string;
179
185
  height: string;
186
+ padding: string;
180
187
  };
181
188
  };
182
189
  };
@@ -211,6 +218,7 @@ export declare const useTheme: (darkMode: MaybeRef<boolean>, themeLight: MaybeRe
211
218
  boxShadowHover: string;
212
219
  boxShadowFocus: string;
213
220
  height: string;
221
+ padding: string;
214
222
  };
215
223
  };
216
224
  };
@@ -224,6 +232,7 @@ export declare const useTheme: (darkMode: MaybeRef<boolean>, themeLight: MaybeRe
224
232
  };
225
233
  };
226
234
  } | {
235
+ id: string;
227
236
  name: string;
228
237
  appearance: "light";
229
238
  rules: {
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import { computed as v, unref as i, reactive as B, defineComponent as $, toRefs as D, openBlock as T, createBlock as L, Teleport as G, createTextVNode as N, toDisplayString as M } from "vue";
2
- import { useHead as E } from "@unhead/vue";
3
- import { get as W, merge as S, mapKeys as U } from "lodash-es";
4
- import { defineStore as _, storeToRefs as I } from "pinia";
1
+ import { computed as v, unref as i, reactive as B, defineComponent as $, toRefs as D, openBlock as G, createBlock as T, Teleport as _, createTextVNode as L, toDisplayString as M } from "vue";
2
+ import { useHead as N } from "@unhead/vue";
3
+ import { get as W, merge as w, mapKeys as E } from "lodash-es";
4
+ import { defineStore as I, storeToRefs as U } from "pinia";
5
5
  import P from "decamelize";
6
6
  import { flatten as V } from "flat";
7
7
  import { cssVar as z } from "@directus/utils/browser";
8
8
  import { Type as r } from "@sinclair/typebox";
9
9
  const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r.String({ $id: "FontWeight" }), k = r.String({ $id: "Length" }), O = r.String({ $id: "Percentage" }), y = r.String({ $id: "BoxShadow" }), j = r.String({ $id: "Number" }), H = r.String({ $id: "Size" }), b = r.Union([r.String(), r.Literal("thin"), r.Literal("medium"), r.Literal("thick")], {
10
10
  $id: "LineWidth"
11
- }), w = r.Optional(
11
+ }), S = r.Optional(
12
12
  r.Object({
13
13
  columnGap: r.Optional(r.Union([r.Ref(k), r.Ref(O)])),
14
14
  rowGap: r.Optional(r.Union([r.Ref(k), r.Ref(O)])),
@@ -186,7 +186,7 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
186
186
  )
187
187
  })
188
188
  ),
189
- form: w,
189
+ form: S,
190
190
  sidebar: r.Optional(
191
191
  r.Object({
192
192
  background: r.Optional(r.Ref(e)),
@@ -216,7 +216,7 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
216
216
  borderColor: r.Optional(r.Ref(e))
217
217
  })
218
218
  ),
219
- form: w
219
+ form: S
220
220
  })
221
221
  )
222
222
  })
@@ -234,7 +234,7 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
234
234
  speed: r.Optional(r.Ref(j))
235
235
  })
236
236
  ),
237
- form: w
237
+ form: S
238
238
  })
239
239
  ),
240
240
  popover: r.Optional(
@@ -249,6 +249,7 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
249
249
  })
250
250
  )
251
251
  }), Q = r.Object({
252
+ id: r.String(),
252
253
  name: r.String(),
253
254
  appearance: r.Union([r.Literal("light"), r.Literal("dark")]),
254
255
  rules: K
@@ -301,7 +302,8 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
301
302
  return o;
302
303
  }) };
303
304
  }, R = (d) => d, A = R({
304
- name: "Directus Default",
305
+ id: "Directus Default",
306
+ name: "$t:theme_directus_default",
305
307
  appearance: "dark",
306
308
  rules: {
307
309
  borderRadius: "6px",
@@ -409,14 +411,18 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
409
411
  },
410
412
  title: {
411
413
  foreground: "var(--theme--foreground-accent)",
412
- fontFamily: "var(--theme--fonts--display--font-family)"
414
+ fontFamily: "var(--theme--fonts--display--font-family)",
415
+ fontWeight: "var(--theme--fonts--display--font-weight)"
413
416
  }
414
417
  },
415
418
  form: {
419
+ columnGap: "32px",
420
+ rowGap: "40px",
416
421
  field: {
417
422
  label: {
418
423
  foreground: "var(--theme--foreground-accent)",
419
- fontFamily: "var(--theme--fonts--sans--font-family)"
424
+ fontFamily: "var(--theme--fonts--sans--font-family)",
425
+ fontWeight: "600"
420
426
  },
421
427
  input: {
422
428
  background: "var(--theme--background)",
@@ -429,7 +435,8 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
429
435
  boxShadow: "none",
430
436
  boxShadowHover: "none",
431
437
  boxShadowFocus: "0 0 16px -8px var(--theme--primary)",
432
- height: "60px"
438
+ height: "60px",
439
+ padding: "16px"
433
440
  }
434
441
  }
435
442
  },
@@ -474,7 +481,8 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
474
481
  boxShadow: "var(--theme--form--field--input--box-shadow)",
475
482
  boxShadowHover: "var(--theme--form--field--input--box-shadow-hover)",
476
483
  boxShadowFocus: "var(--theme--form--field--input--box-shadow-focus)",
477
- height: "52px"
484
+ height: "52px",
485
+ padding: "12px"
478
486
  }
479
487
  }
480
488
  }
@@ -508,7 +516,8 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
508
516
  boxShadow: "var(--theme--form--field--input--box-shadow)",
509
517
  boxShadowHover: "var(--theme--form--field--input--box-shadow-hover)",
510
518
  boxShadowFocus: "var(--theme--form--field--input--box-shadow-focus)",
511
- height: "var(--theme--form--field--input--height)"
519
+ height: "var(--theme--form--field--input--height)",
520
+ padding: "var(--theme--form--field--input--padding)"
512
521
  }
513
522
  }
514
523
  }
@@ -522,7 +531,8 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
522
531
  }
523
532
  }
524
533
  }), J = R({
525
- name: "Directus Color Match",
534
+ id: "Directus Color Match",
535
+ name: "$t:theme_directus_colormatch",
526
536
  appearance: "light",
527
537
  rules: {
528
538
  background: "color-mix(in srgb, #FFFFFF, var(--theme--primary) 7%)",
@@ -606,7 +616,8 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
606
616
  }
607
617
  }
608
618
  }), C = R({
609
- name: "Directus Default",
619
+ id: "Directus Default",
620
+ name: "$t:theme_directus_default",
610
621
  appearance: "light",
611
622
  rules: {
612
623
  borderRadius: "6px",
@@ -696,7 +707,7 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
696
707
  background: "transparent",
697
708
  backgroundHover: "var(--theme--navigation--background-accent)",
698
709
  backgroundActive: "var(--theme--navigation--background-accent)",
699
- fontFamily: "var(--theme--font-family-sans-serif)",
710
+ fontFamily: "var(--theme--fonts--sans--font-family)",
700
711
  divider: {
701
712
  borderColor: "var(--theme--border-color-accent)",
702
713
  borderWidth: "var(--theme--border-width)"
@@ -710,7 +721,7 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
710
721
  boxShadow: "0 4px 7px -4px rgb(0 0 0 / 0.2)",
711
722
  headline: {
712
723
  foreground: "var(--theme--foreground-subdued)",
713
- fontFamily: "var(--theme--font-family-sans-serif)"
724
+ fontFamily: "var(--theme--fonts--sans--font-family)"
714
725
  },
715
726
  title: {
716
727
  foreground: "var(--theme--foreground-accent)",
@@ -724,7 +735,7 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
724
735
  field: {
725
736
  label: {
726
737
  foreground: "var(--theme--foreground-accent)",
727
- fontFamily: "var(--theme--font-family-sans-serif)",
738
+ fontFamily: "var(--theme--fonts--sans--font-family)",
728
739
  fontWeight: "600"
729
740
  },
730
741
  input: {
@@ -746,7 +757,7 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
746
757
  sidebar: {
747
758
  background: "var(--theme--background-normal)",
748
759
  foreground: "var(--theme--foreground-subdued)",
749
- fontFamily: "var(--theme--font-family-sans-serif)",
760
+ fontFamily: "var(--theme--fonts--sans--font-family)",
750
761
  borderColor: "transparent",
751
762
  borderWidth: "0px",
752
763
  section: {
@@ -762,7 +773,7 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
762
773
  background: "var(--theme--background-accent)",
763
774
  backgroundHover: "var(--theme--sidebar--section--toggle--background)",
764
775
  backgroundActive: "var(--theme--sidebar--section--toggle--background)",
765
- fontFamily: "var(--theme--font-family-sans-serif)",
776
+ fontFamily: "var(--theme--fonts--sans--font-family)",
766
777
  borderColor: "transparent",
767
778
  borderWidth: "0px"
768
779
  },
@@ -834,7 +845,8 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
834
845
  }
835
846
  }
836
847
  }), X = R({
837
- name: "Directus Minimal",
848
+ id: "Directus Minimal",
849
+ name: "$t:theme_directus_minimal",
838
850
  appearance: "light",
839
851
  rules: {
840
852
  borderWidth: "1px",
@@ -925,7 +937,6 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
925
937
  }
926
938
  }
927
939
  },
928
- fontFamilyDisplay: "system-ui",
929
940
  public: {
930
941
  art: {
931
942
  background: "color-mix(in srgb, #FFFFFF, var(--project-color) 10%)",
@@ -942,22 +953,27 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
942
953
  primaryAccent: "#E2E8F0",
943
954
  secondaryAccent: "#E2E8F0",
944
955
  secondaryBackground: "#F1F5F9",
945
- secondarySubdued: "#F8FAFC"
956
+ secondarySubdued: "#F8FAFC",
957
+ fonts: {
958
+ display: {
959
+ fontFamily: "system-ui"
960
+ }
961
+ }
946
962
  }
947
- }), Y = [A], Z = [C, X, J], rr = _("🎨 Themes", () => {
963
+ }), Y = [A], Z = [C, X, J], rr = I("🎨 Themes", () => {
948
964
  const d = B({ light: Z, dark: Y });
949
965
  return { themes: d, registerTheme: (f) => {
950
966
  f.appearance === "light" ? d.light.push(f) : d.dark.push(f);
951
967
  } };
952
968
  }), er = (d, s, f, p, o) => {
953
- const { themes: c } = I(rr());
969
+ const { themes: c } = U(rr());
954
970
  return { theme: v(() => {
955
- const a = i(d) ? i(f) : i(s), t = i(d) ? A : C, n = i(d) ? i(o) : i(p), h = i(c)[i(d) ? "dark" : "light"].find((l) => l.name === a);
956
- return h ? n ? S({}, t, h, { rules: n }) : S(t, h) : (a && a !== t.name && console.warn(`Theme "${a}" doesn't exist.`), n ? S({}, t, { rules: n }) : t);
971
+ const a = i(d) ? i(f) : i(s), t = i(d) ? A : C, n = i(d) ? i(o) : i(p), h = i(c)[i(d) ? "dark" : "light"].find((l) => l.id === a);
972
+ return h ? n ? w({}, t, h, { rules: n }) : w(t, h) : (a && a !== t.id && console.warn(`Theme "${a}" doesn't exist.`), n ? w({}, t, { rules: n }) : t);
957
973
  }) };
958
974
  }, or = (d) => {
959
975
  const s = V(d, { delimiter: "--" }), f = (p) => `--theme--${P(p, { separator: "-" })}`;
960
- return U(s, (p, o) => f(o));
976
+ return E(s, (p, o) => f(o));
961
977
  }, gr = /* @__PURE__ */ $({
962
978
  __name: "theme-provider",
963
979
  props: {
@@ -969,7 +985,7 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
969
985
  },
970
986
  setup(d) {
971
987
  const s = d, { darkMode: f, themeLight: p, themeDark: o, themeLightOverrides: c, themeDarkOverrides: m } = D(s), { theme: a } = er(f, p, o, c, m), t = v(() => or(i(a).rules)), { googleFonts: n } = q(a);
972
- E({
988
+ N({
973
989
  link: v(() => {
974
990
  let l = "";
975
991
  if (n.value.length > 0) {
@@ -986,8 +1002,8 @@ const e = r.String({ $id: "Color" }), u = r.String({ $id: "FamilyName" }), F = r
986
1002
  })
987
1003
  });
988
1004
  const h = v(() => `:root {${Object.entries(i(t)).map(([g, x]) => `${g}: ${x};`).join(" ")}}`);
989
- return (l, g) => (T(), L(G, { to: "#theme" }, [
990
- N(M(h.value), 1)
1005
+ return (l, g) => (G(), T(_, { to: "#theme" }, [
1006
+ L(M(h.value), 1)
991
1007
  ]));
992
1008
  }
993
1009
  });
@@ -1,5 +1,6 @@
1
1
  import type { Static } from '@sinclair/typebox';
2
2
  export declare const ThemeSchema: import("@sinclair/typebox").TObject<{
3
+ id: import("@sinclair/typebox").TString;
3
4
  name: import("@sinclair/typebox").TString;
4
5
  appearance: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"dark">]>;
5
6
  rules: import("@sinclair/typebox").TObject<{
@@ -2,6 +2,7 @@ import type { Theme } from '../schemas/theme.js';
2
2
  export declare const useThemeStore: import("pinia").StoreDefinition<"🎨 Themes", import("pinia")._UnwrapAll<Pick<{
3
3
  themes: {
4
4
  light: {
5
+ id: string;
5
6
  name: string;
6
7
  appearance: "light" | "dark";
7
8
  rules: {
@@ -235,6 +236,7 @@ export declare const useThemeStore: import("pinia").StoreDefinition<"🎨 Themes
235
236
  };
236
237
  }[];
237
238
  dark: {
239
+ id: string;
238
240
  name: string;
239
241
  appearance: "light" | "dark";
240
242
  rules: {
@@ -472,6 +474,7 @@ export declare const useThemeStore: import("pinia").StoreDefinition<"🎨 Themes
472
474
  }, "themes">>, Pick<{
473
475
  themes: {
474
476
  light: {
477
+ id: string;
475
478
  name: string;
476
479
  appearance: "light" | "dark";
477
480
  rules: {
@@ -705,6 +708,7 @@ export declare const useThemeStore: import("pinia").StoreDefinition<"🎨 Themes
705
708
  };
706
709
  }[];
707
710
  dark: {
711
+ id: string;
708
712
  name: string;
709
713
  appearance: "light" | "dark";
710
714
  rules: {
@@ -942,6 +946,7 @@ export declare const useThemeStore: import("pinia").StoreDefinition<"🎨 Themes
942
946
  }, never>, Pick<{
943
947
  themes: {
944
948
  light: {
949
+ id: string;
945
950
  name: string;
946
951
  appearance: "light" | "dark";
947
952
  rules: {
@@ -1175,6 +1180,7 @@ export declare const useThemeStore: import("pinia").StoreDefinition<"🎨 Themes
1175
1180
  };
1176
1181
  }[];
1177
1182
  dark: {
1183
+ id: string;
1178
1184
  name: string;
1179
1185
  appearance: "light" | "dark";
1180
1186
  rules: {
@@ -1,4 +1,5 @@
1
1
  declare const _default: {
2
+ id: string;
2
3
  name: string;
3
4
  appearance: "dark";
4
5
  rules: {
@@ -108,13 +109,17 @@ declare const _default: {
108
109
  title: {
109
110
  foreground: string;
110
111
  fontFamily: string;
112
+ fontWeight: string;
111
113
  };
112
114
  };
113
115
  form: {
116
+ columnGap: string;
117
+ rowGap: string;
114
118
  field: {
115
119
  label: {
116
120
  foreground: string;
117
121
  fontFamily: string;
122
+ fontWeight: string;
118
123
  };
119
124
  input: {
120
125
  background: string;
@@ -128,6 +133,7 @@ declare const _default: {
128
133
  boxShadowHover: string;
129
134
  boxShadowFocus: string;
130
135
  height: string;
136
+ padding: string;
131
137
  };
132
138
  };
133
139
  };
@@ -173,6 +179,7 @@ declare const _default: {
173
179
  boxShadowHover: string;
174
180
  boxShadowFocus: string;
175
181
  height: string;
182
+ padding: string;
176
183
  };
177
184
  };
178
185
  };
@@ -207,6 +214,7 @@ declare const _default: {
207
214
  boxShadowHover: string;
208
215
  boxShadowFocus: string;
209
216
  height: string;
217
+ padding: string;
210
218
  };
211
219
  };
212
220
  };
@@ -1,4 +1,5 @@
1
1
  declare const _default: {
2
+ id: string;
2
3
  name: string;
3
4
  appearance: "light";
4
5
  rules: {
@@ -1,4 +1,5 @@
1
1
  declare const _default: {
2
+ id: string;
2
3
  name: string;
3
4
  appearance: "light";
4
5
  rules: {
@@ -1,4 +1,5 @@
1
1
  declare const _default: {
2
+ id: string;
2
3
  name: string;
3
4
  appearance: "light";
4
5
  rules: {
@@ -90,7 +91,6 @@ declare const _default: {
90
91
  };
91
92
  };
92
93
  };
93
- fontFamilyDisplay: string;
94
94
  public: {
95
95
  art: {
96
96
  background: string;
@@ -108,6 +108,11 @@ declare const _default: {
108
108
  secondaryAccent: string;
109
109
  secondaryBackground: string;
110
110
  secondarySubdued: string;
111
+ fonts: {
112
+ display: {
113
+ fontFamily: string;
114
+ };
115
+ };
111
116
  };
112
117
  };
113
118
  export default _default;
@@ -1,4 +1,5 @@
1
1
  export declare const defineTheme: <T extends {
2
+ id: string;
2
3
  name: string;
3
4
  appearance: "light" | "dark";
4
5
  rules: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directus/themes",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Themes for Directus",
5
5
  "homepage": "https://directus.io",
6
6
  "repository": {
@@ -22,26 +22,26 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@sinclair/typebox": "0.31.17",
26
- "@unhead/vue": "1.1.30",
25
+ "@sinclair/typebox": "0.31.28",
27
26
  "decamelize": "6.0.0",
28
27
  "flat": "6.0.1",
29
28
  "lodash-es": "4.17.21",
30
- "@directus/utils": "11.0.2"
29
+ "@directus/utils": "11.0.3"
31
30
  },
32
31
  "devDependencies": {
33
- "@types/lodash-es": "4.17.9",
34
- "@vitejs/plugin-vue": "4.4.0",
32
+ "@types/lodash-es": "4.17.12",
33
+ "@vitejs/plugin-vue": "4.5.2",
35
34
  "rollup-plugin-node-externals": "6.1.2",
36
- "typescript": "5.2.2",
37
- "vite": "4.4.11",
38
- "vite-plugin-dts": "3.6.0",
39
- "@directus/types": "11.0.2",
40
- "@directus/tsconfig": "1.0.1"
35
+ "typescript": "5.3.3",
36
+ "vite": "5.0.10",
37
+ "vite-plugin-dts": "3.6.4",
38
+ "@directus/tsconfig": "1.0.1",
39
+ "@directus/types": "11.0.3"
41
40
  },
42
41
  "peerDependencies": {
42
+ "@unhead/vue": "1.8.9",
43
43
  "pinia": "2.1.7",
44
- "vue": "3.3.4"
44
+ "vue": "3.3.13"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "vite build",