@yuneta/gobj-ui 7.23.17 → 7.23.18

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.
@@ -10080,16 +10080,39 @@ var PRIVATE_DATA$11 = {
10080
10080
  var __gclass__$11 = null;
10081
10081
  var __layout_registered__$1 = false;
10082
10082
  /***************************************************************
10083
- * Type colors matching the original mx_json_viewer
10084
- ***************************************************************/
10085
- var TYPE_COLORS = {
10083
+ * Type colours, ONE EXPLICIT PALETTE PER THEME and not a
10084
+ * derivation, for the same reason the tree keeps two sets of
10085
+ * CSS tokens: a colour that reads on white is not the same
10086
+ * colour lightened, and deriving one from the other made the
10087
+ * two views of one document disagree about what a string is.
10088
+ * These ARE the tree's tokens (`c_yui_json.css`), so the tree
10089
+ * and the graph now say green with the same green.
10090
+ *
10091
+ * The light values are darker than the `mx_json_viewer` ones
10092
+ * they came from, because those could not be read: `#FF8C00`
10093
+ * is mid-luminance, so it reaches at most **2.33:1 against any
10094
+ * background that exists** -- no card colour and no highlight
10095
+ * could have fixed it, only the colour itself. Orange and blue
10096
+ * moved until every type clears 4.5:1 on all five surfaces this
10097
+ * viewer paints (two light cards, the match chip, two dark
10098
+ * cards); red and green were already there.
10099
+ ***************************************************************/
10100
+ var TYPE_COLORS_LIGHT = {
10086
10101
  string: "#006000",
10087
- number: "#EE422E",
10088
- boolean: "#FF8C00",
10089
- null: "#475ED0",
10102
+ number: "#b5330b",
10103
+ boolean: "#8C4D00",
10104
+ null: "#4359C6",
10090
10105
  list: "#4C0099",
10091
10106
  dict: "#4C0099"
10092
10107
  };
10108
+ var TYPE_COLORS_DARK = {
10109
+ string: "#7ec87e",
10110
+ number: "#ff8a65",
10111
+ boolean: "#ffb74d",
10112
+ null: "#90a4f4",
10113
+ list: "#B799D6",
10114
+ dict: "#B799D6"
10115
+ };
10093
10116
  /***************************************************************
10094
10117
  * Group (card) colours. `fill` is the light-theme card; `tint`
10095
10118
  * is the hue that fill hints at, used to derive the dark card —
@@ -10143,21 +10166,15 @@ function json_card_style(group, dark) {
10143
10166
  };
10144
10167
  }
10145
10168
  /***************************************************************
10146
- * A scalar's colour by type. The palette is tuned for a light
10147
- * card; on a dark one every one of them (dark green #006000,
10148
- * blue #475ED0, …) sinks into the background, so brighten it.
10149
- *
10150
- * 60% white and not the 45% it shipped with. The number is a
10151
- * balance measured both ways: brighter reads better on the dark
10152
- * card (the worst type goes from 2.88:1 to 4.74:1) and washes the
10153
- * six types toward one pastel, and past this point red, orange
10154
- * and purple stop being tellable apart, which is the only reason
10155
- * they are coloured at all.
10169
+ * A scalar's colour by type, straight out of the palette for
10170
+ * the theme. It used to be the light colour mixed with white,
10171
+ * which is how a document ended up green in one view and a
10172
+ * paler green in the other, and how the amount of white became
10173
+ * a knob nobody could set: enough of it to read on a dark card
10174
+ * washed the six types into one pastel.
10156
10175
  ***************************************************************/
10157
10176
  function type_color(type, dark) {
10158
- let color = TYPE_COLORS[type] || (dark ? "#e8eaed" : "black");
10159
- if (!dark) return color;
10160
- return `color-mix(in srgb, ${color} 40%, #ffffff)`;
10177
+ return (dark ? TYPE_COLORS_DARK : TYPE_COLORS_LIGHT)[type] || (dark ? "#e8eaed" : "black");
10161
10178
  }
10162
10179
  /******************************
10163
10180
  * Framework Methods
@@ -10075,16 +10075,39 @@ var PRIVATE_DATA$11 = {
10075
10075
  var __gclass__$11 = null;
10076
10076
  var __layout_registered__$1 = false;
10077
10077
  /***************************************************************
10078
- * Type colors matching the original mx_json_viewer
10079
- ***************************************************************/
10080
- var TYPE_COLORS = {
10078
+ * Type colours, ONE EXPLICIT PALETTE PER THEME and not a
10079
+ * derivation, for the same reason the tree keeps two sets of
10080
+ * CSS tokens: a colour that reads on white is not the same
10081
+ * colour lightened, and deriving one from the other made the
10082
+ * two views of one document disagree about what a string is.
10083
+ * These ARE the tree's tokens (`c_yui_json.css`), so the tree
10084
+ * and the graph now say green with the same green.
10085
+ *
10086
+ * The light values are darker than the `mx_json_viewer` ones
10087
+ * they came from, because those could not be read: `#FF8C00`
10088
+ * is mid-luminance, so it reaches at most **2.33:1 against any
10089
+ * background that exists** -- no card colour and no highlight
10090
+ * could have fixed it, only the colour itself. Orange and blue
10091
+ * moved until every type clears 4.5:1 on all five surfaces this
10092
+ * viewer paints (two light cards, the match chip, two dark
10093
+ * cards); red and green were already there.
10094
+ ***************************************************************/
10095
+ var TYPE_COLORS_LIGHT = {
10081
10096
  string: "#006000",
10082
- number: "#EE422E",
10083
- boolean: "#FF8C00",
10084
- null: "#475ED0",
10097
+ number: "#b5330b",
10098
+ boolean: "#8C4D00",
10099
+ null: "#4359C6",
10085
10100
  list: "#4C0099",
10086
10101
  dict: "#4C0099"
10087
10102
  };
10103
+ var TYPE_COLORS_DARK = {
10104
+ string: "#7ec87e",
10105
+ number: "#ff8a65",
10106
+ boolean: "#ffb74d",
10107
+ null: "#90a4f4",
10108
+ list: "#B799D6",
10109
+ dict: "#B799D6"
10110
+ };
10088
10111
  /***************************************************************
10089
10112
  * Group (card) colours. `fill` is the light-theme card; `tint`
10090
10113
  * is the hue that fill hints at, used to derive the dark card —
@@ -10138,21 +10161,15 @@ function json_card_style(group, dark) {
10138
10161
  };
10139
10162
  }
10140
10163
  /***************************************************************
10141
- * A scalar's colour by type. The palette is tuned for a light
10142
- * card; on a dark one every one of them (dark green #006000,
10143
- * blue #475ED0, …) sinks into the background, so brighten it.
10144
- *
10145
- * 60% white and not the 45% it shipped with. The number is a
10146
- * balance measured both ways: brighter reads better on the dark
10147
- * card (the worst type goes from 2.88:1 to 4.74:1) and washes the
10148
- * six types toward one pastel, and past this point red, orange
10149
- * and purple stop being tellable apart, which is the only reason
10150
- * they are coloured at all.
10164
+ * A scalar's colour by type, straight out of the palette for
10165
+ * the theme. It used to be the light colour mixed with white,
10166
+ * which is how a document ended up green in one view and a
10167
+ * paler green in the other, and how the amount of white became
10168
+ * a knob nobody could set: enough of it to read on a dark card
10169
+ * washed the six types into one pastel.
10151
10170
  ***************************************************************/
10152
10171
  function type_color(type, dark) {
10153
- let color = TYPE_COLORS[type] || (dark ? "#e8eaed" : "black");
10154
- if (!dark) return color;
10155
- return `color-mix(in srgb, ${color} 40%, #ffffff)`;
10172
+ return (dark ? TYPE_COLORS_DARK : TYPE_COLORS_LIGHT)[type] || (dark ? "#e8eaed" : "black");
10156
10173
  }
10157
10174
  /******************************
10158
10175
  * Framework Methods
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.17",
3
+ "version": "7.23.18",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -9,11 +9,20 @@
9
9
  * All Rights Reserved.
10
10
  ***********************************************************************/
11
11
 
12
+ /*
13
+ * Light values are darker than a naive orange/blue because they have to
14
+ * be READ, on the card and on the graph view's match chip alike. The
15
+ * ceiling is a fact of the colour, not of the surface: `#FF8C00`, which
16
+ * these came from, is mid-luminance and reaches at most 2.33:1 against
17
+ * ANY background that exists. The graph view carries the same two
18
+ * palettes (`c_yui_json_graph.js`), so one document says green with the
19
+ * same green in all three views.
20
+ */
12
21
  .C_YUI_JSON {
13
22
  --json-string: #006000;
14
23
  --json-number: #b5330b;
15
- --json-boolean: #b36b00;
16
- --json-null: #475ed0;
24
+ --json-boolean: #8C4D00;
25
+ --json-null: #4359C6;
17
26
  --json-key: var(--bulma-text-strong, #1a1a1a);
18
27
  --json-row-hover: rgba(0, 0, 0, 0.05);
19
28
  --json-guide: #b5b5b5;
@@ -197,17 +197,41 @@ let __layout_registered__ = false;
197
197
 
198
198
 
199
199
  /***************************************************************
200
- * Type colors matching the original mx_json_viewer
200
+ * Type colours, ONE EXPLICIT PALETTE PER THEME and not a
201
+ * derivation, for the same reason the tree keeps two sets of
202
+ * CSS tokens: a colour that reads on white is not the same
203
+ * colour lightened, and deriving one from the other made the
204
+ * two views of one document disagree about what a string is.
205
+ * These ARE the tree's tokens (`c_yui_json.css`), so the tree
206
+ * and the graph now say green with the same green.
207
+ *
208
+ * The light values are darker than the `mx_json_viewer` ones
209
+ * they came from, because those could not be read: `#FF8C00`
210
+ * is mid-luminance, so it reaches at most **2.33:1 against any
211
+ * background that exists** -- no card colour and no highlight
212
+ * could have fixed it, only the colour itself. Orange and blue
213
+ * moved until every type clears 4.5:1 on all five surfaces this
214
+ * viewer paints (two light cards, the match chip, two dark
215
+ * cards); red and green were already there.
201
216
  ***************************************************************/
202
- const TYPE_COLORS = {
217
+ const TYPE_COLORS_LIGHT = {
203
218
  string: "#006000", // green
204
- number: "#EE422E", // red
205
- boolean: "#FF8C00", // orange
206
- null: "#475ED0", // blue
219
+ number: "#b5330b", // red
220
+ boolean: "#8C4D00", // orange
221
+ null: "#4359C6", // blue
207
222
  list: "#4C0099", // purple
208
223
  dict: "#4C0099", // purple
209
224
  };
210
225
 
226
+ const TYPE_COLORS_DARK = {
227
+ string: "#7ec87e",
228
+ number: "#ff8a65",
229
+ boolean: "#ffb74d",
230
+ null: "#90a4f4",
231
+ list: "#B799D6",
232
+ dict: "#B799D6",
233
+ };
234
+
211
235
  /***************************************************************
212
236
  * Group (card) colours. `fill` is the light-theme card; `tint`
213
237
  * is the hue that fill hints at, used to derive the dark card —
@@ -260,24 +284,17 @@ function json_card_style(group, dark)
260
284
  }
261
285
 
262
286
  /***************************************************************
263
- * A scalar's colour by type. The palette is tuned for a light
264
- * card; on a dark one every one of them (dark green #006000,
265
- * blue #475ED0, …) sinks into the background, so brighten it.
266
- *
267
- * 60% white and not the 45% it shipped with. The number is a
268
- * balance measured both ways: brighter reads better on the dark
269
- * card (the worst type goes from 2.88:1 to 4.74:1) and washes the
270
- * six types toward one pastel, and past this point red, orange
271
- * and purple stop being tellable apart, which is the only reason
272
- * they are coloured at all.
287
+ * A scalar's colour by type, straight out of the palette for
288
+ * the theme. It used to be the light colour mixed with white,
289
+ * which is how a document ended up green in one view and a
290
+ * paler green in the other, and how the amount of white became
291
+ * a knob nobody could set: enough of it to read on a dark card
292
+ * washed the six types into one pastel.
273
293
  ***************************************************************/
274
294
  function type_color(type, dark)
275
295
  {
276
- let color = TYPE_COLORS[type] || (dark ? "#e8eaed" : "black");
277
- if(!dark) {
278
- return color;
279
- }
280
- return `color-mix(in srgb, ${color} 40%, #ffffff)`;
296
+ let palette = dark? TYPE_COLORS_DARK: TYPE_COLORS_LIGHT;
297
+ return palette[type] || (dark ? "#e8eaed" : "black");
281
298
  }
282
299
 
283
300