@7365admin1/layer-common 3.2.1-staging.65 → 3.2.1-staging.66

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 (2) hide show
  1. package/package.json +1 -1
  2. package/plugins/vuetify.ts +106 -9
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "3.2.1-staging.65",
5
+ "version": "3.2.1-staging.66",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {
@@ -42,6 +42,67 @@ import {
42
42
  } from "vuetify-pro-tiptap";
43
43
  import "vuetify-pro-tiptap/style.css";
44
44
 
45
+ /**
46
+ * Contrast decisions live here rather than inline, because both themes need the
47
+ * same two opacity corrections and a value that differs by accident between
48
+ * light and dark is a bug nobody sees until somebody flips the switch.
49
+ *
50
+ * `disabled-opacity`: Material's 0.38 measures 2.68:1 on white, below the 4.5:1
51
+ * a sentence needs, and disabled fields in this product carry sentences people
52
+ * are expected to read. 0.55 is 4.74:1 on white and 6.21:1 on the dark page -
53
+ * the same value the camera wall settled on, for the same reason.
54
+ *
55
+ * `border-opacity`: 0.12 measures 1.32:1, which is a divider you cannot see.
56
+ * Dark goes to 0.35 (3.22:1) and carries the boundary properly. Light goes to
57
+ * 0.26 (1.88:1) - visible, but short of the 3:1 a component boundary wants.
58
+ * Reaching it on white needs 0.42, which turns every table and card edge into a
59
+ * mid-grey grid across eleven applications; that is a change somebody should
60
+ * look at before it ships, not one to slip in behind a contrast fix.
61
+ */
62
+ const LIGHT_THEME = {
63
+ dark: false,
64
+ colors: {
65
+ primary: "#042134",
66
+ "primary-button": "#1867C0",
67
+ "text-primary": "#052439",
68
+ },
69
+ variables: {
70
+ "disabled-opacity": 0.55,
71
+ "border-opacity": 0.26,
72
+ },
73
+ };
74
+
75
+ /**
76
+ * Only the keys that must differ; Vuetify merges the rest from its stock dark.
77
+ */
78
+ const DARK_THEME = {
79
+ dark: true,
80
+ colors: {
81
+ /**
82
+ * Stock dark's #121212 page and #212121 surface measure 1.16:1 apart, so a
83
+ * card, a dialog and the page behind them were one flat sheet. These are
84
+ * 1.19:1 - elevation on a dark screen is a genuinely small delta - but they
85
+ * are tinted towards the brand navy rather than neutral grey, and the
86
+ * divider opacity above is what actually draws the edges.
87
+ */
88
+ background: "#0E1319",
89
+ surface: "#1B242F",
90
+ /** Stock dark ships a lavender #ccbfd6 here, which is not our product. */
91
+ "surface-bright": "#26313E",
92
+ "surface-light": "#26313E",
93
+ /** The brand navy lifted until the nav drawer is a surface, not a hole. */
94
+ primary: "#17506F",
95
+ /** Unchanged on purpose: it already passes in both themes. */
96
+ "primary-button": "#1867C0",
97
+ /** #052439 on a dark page measures 1.18:1. This is 15.72:1. */
98
+ "text-primary": "#E8ECF1",
99
+ },
100
+ variables: {
101
+ "disabled-opacity": 0.55,
102
+ "border-opacity": 0.35,
103
+ },
104
+ };
105
+
45
106
  export default defineNuxtPlugin((app) => {
46
107
  const vuetify = createVuetify({
47
108
  defaults: {
@@ -69,17 +130,53 @@ export default defineNuxtPlugin((app) => {
69
130
  // hint: "This field is required",
70
131
  // },
71
132
  },
133
+ /**
134
+ * THE PRODUCT HAS TWO THEMES, AND UNTIL NOW ONLY ONE OF THEM WAS OURS.
135
+ *
136
+ * Every app shows a light/dark toggle in the app bar (Layout/Header.vue),
137
+ * and it sets Vuetify's built-in "light" and "dark" themes. Those were left
138
+ * at Vuetify's factory values, so one click on any screen in any of the
139
+ * eleven apps threw the brand away: `primary` stopped being the Seven365
140
+ * navy and became Material blue #2196F3 - and `primary` is the navigation
141
+ * drawer's fill - while `primary-button` and `text-primary`, used in around
142
+ * eighty places across the layer and the apps, do not exist in a stock
143
+ * theme at all, so those components lost their colour to an undefined CSS
144
+ * variable. There was also no way back to the brand: the toggle only ever
145
+ * flipped between the two stock themes.
146
+ *
147
+ * The fix is to make the stock names OURS rather than to add new names.
148
+ * Several components already branch on `theme.global.name === "dark"` (this
149
+ * layer's FormDialog, property-management's facility icons), so a
150
+ * differently-named dark theme would have left every one of them silently
151
+ * on their light branch inside a dark app. Overriding `light` and `dark`
152
+ * means the toggle, `v-theme-provider theme="light"`, the `plain-dark`
153
+ * layout and all of those comparisons keep working, and start being right.
154
+ *
155
+ * Measured, not eyeballed - WCAG 2.1, alpha composited against the surface
156
+ * each value actually sits on:
157
+ *
158
+ * text-primary on the page dark 1.18:1 -> 15.72:1
159
+ * nav drawer fill vs the page dark 1.13:1 -> 2.14:1 (+ a real border)
160
+ * white label in the nav drawer dark 3.12:1 -> 8.70:1
161
+ * primary-button vs the page dark 3.34:1 -> 3.32:1 (unchanged)
162
+ * white label on that button both 5.61:1 -> 5.61:1 (unchanged)
163
+ * disabled text light 2.68:1 -> 4.74:1
164
+ * disabled text dark 3.57:1 -> 6.21:1
165
+ * divider / outline dark 1.38:1 -> 3.22:1
166
+ * divider / outline light 1.32:1 -> 1.88:1
167
+ */
72
168
  theme: {
73
- defaultTheme: "iservice365",
169
+ defaultTheme: "light",
74
170
  themes: {
75
- iservice365: {
76
- dark: false,
77
- colors: {
78
- primary: "#042134",
79
- "primary-button": "#1867C0",
80
- "text-primary": "#052439",
81
- },
82
- },
171
+ light: LIGHT_THEME,
172
+ dark: DARK_THEME,
173
+ /**
174
+ * The name this product booted on before the two above carried the
175
+ * brand. Kept, and identical to `light`, so anything that asks for it
176
+ * by name - in an app that is not in this repository - still gets a
177
+ * theme rather than a blank one.
178
+ */
179
+ iservice365: LIGHT_THEME,
83
180
  },
84
181
  },
85
182
  icons: {