eco-vue-js 0.20.1 → 0.20.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.
@@ -11,7 +11,7 @@ var HeatmapCell_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
11
11
  const tooltipRef = useTemplateRef("tooltip");
12
12
  return (_ctx, _cache) => {
13
13
  return openBlock(), createElementBlock("div", { class: normalizeClass(["group/cell relative rounded-sm p-(--w-chart-heatmap-gap,0.125rem)", __props.opacity !== null ? "cursor-crosshair" : void 0]) }, [createElementVNode("div", {
14
- class: normalizeClass(["size-(--w-chart-heatmap-size,1rem) rounded-sm", __props.empty ? void 0 : __props.opacity !== null ? "bg-current" : "bg-surface-muted/50"]),
14
+ class: normalizeClass(["size-(--w-chart-heatmap-size,1rem) rounded-sm", __props.empty ? void 0 : __props.opacity !== null ? "bg-current" : "bg-surface-subtle"]),
15
15
  style: normalizeStyle(__props.opacity !== null && !__props.empty ? { opacity: __props.opacity } : void 0)
16
16
  }, null, 6), _ctx.$slots.default && __props.opacity !== null ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("div", { class: normalizeClass(["absolute inset-(--w-chart-heatmap-gap,0.125rem) rounded-sm border-current group-hover/cell:border-2", tooltipRef.value?.isOpen ? "border-2" : void 0]) }, null, 2), createVNode(WTooltip_default, {
17
17
  ref: "tooltip",
@@ -150,7 +150,7 @@ var ListItem_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
150
150
  class: ["relative", {
151
151
  [__props.cardWrapperClass ?? ""]: true,
152
152
  "w-ripple-trigger-list": isActionShown.value,
153
- "sm-not:even:bg-surface-muted/50 grid grid-cols-1": __props.card,
153
+ "sm-not:even:bg-surface-subtle grid grid-cols-1": __props.card,
154
154
  "flex": !__props.card,
155
155
  "-mb-px": !__props.card && isOpen.value,
156
156
  "w-hover-checked": __props.allowSelectHover
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/rsmple/eco-vue-js.git"
6
6
  },
7
- "version": "0.20.1",
7
+ "version": "0.20.2",
8
8
  "homepage": "https://rsmple.github.io/eco-vue-js/",
9
9
  "dependencies": {
10
10
  "@stylistic/eslint-plugin": "5.10.0",
@@ -7,6 +7,7 @@
7
7
  * 'border-gray-300 dark:border-gray-700' → 'border-line'
8
8
  * 'text-negative dark:text-negative-dark' → 'tone-negative text-tone'
9
9
  * 'bg-primary/10 dark:bg-primary-dark/10' → 'tone-primary bg-tone-fill/10'
10
+ * 'bg-primary-light dark:bg-primary-darkest' → 'tone-primary bg-tone-soft'
10
11
  *
11
12
  * npx eco-vue-color-roles [--write] [--exact] [--theme <css>] [paths…] default: src
12
13
  *
@@ -37,6 +38,7 @@ const ROLES = [
37
38
  {role: 'text-description', color: 'description', props: TEXT_PROPS, light: 'gray-500', dark: 'gray-400'},
38
39
  {role: 'text-subtle', color: 'subtle', props: TEXT_PROPS, light: 'gray-400', dark: 'gray-600'},
39
40
  {role: 'surface', color: 'surface', props: [...SURFACE_PROPS, 'text'], light: 'default', dark: 'default-dark'},
41
+ {role: 'surface-subtle', color: 'surface-subtle', props: SURFACE_PROPS, light: 'gray-50', dark: 'gray-850'},
40
42
  {role: 'surface-muted', color: 'surface-muted', props: SURFACE_PROPS, light: 'gray-100', dark: 'gray-800'},
41
43
  {role: 'surface-inset', color: 'surface-inset', props: SURFACE_PROPS, light: 'gray-200', dark: 'gray-700'},
42
44
  {role: 'track', color: 'track', props: ['bg', 'fill', 'stroke'], light: 'gray-300', dark: 'gray-700'},
@@ -59,6 +61,11 @@ const NEUTRAL_UNIFIED = {
59
61
  'border:gray-200|gray-800': 'border-line-subtle', // dark 800 → 700
60
62
  // Exactly `line-raised`, but in app code these are card borders, not the edge of a popup.
61
63
  'border:gray-100|gray-800': 'border-line-subtle', // light 100 → 200, dark 800 → 700
64
+ // Half of `surface-muted` over the surface, which is what `gray-850` is in dark mode.
65
+ 'bg:gray-50|gray-800/50': 'bg-surface-subtle',
66
+ 'bg:gray-50|gray-800/40': 'bg-surface-subtle', // dark a bit stronger
67
+ 'bg:gray-100/50|gray-800/50': 'bg-surface-subtle',
68
+ 'bg:gray-50|gray-800': 'bg-surface-muted', // light 50 → 100
62
69
  }
63
70
 
64
71
  /**
@@ -157,11 +164,16 @@ const transformClasses = (value, exact, table) => {
157
164
  } else {
158
165
  const tone = TONES.find(item => lightColor === item && darkColor === item + '-dark' && lightAlpha === darkAlpha)
159
166
  const toneProp = TONE_PROPS[/** @type {keyof typeof TONE_PROPS} */ (light.prop)]
167
+ // `bg-primary-light dark:bg-primary-darkest` is the soft background, which the tone mixes from its fill.
168
+ const soft = light.prop === 'bg' && TONES.find(item => lightColor === item + '-light' && darkColor === item + '-darkest' && lightAlpha === darkAlpha)
160
169
 
161
170
  // A tone is set on the whole string, so only strings with one tone and no state variant on it qualify.
162
171
  if (tone && toneProp && (toneProp.exact || !exact) && !light.variants && tonesInString.size === 1) {
163
172
  next = toneProp.utility + alpha
164
173
  addTone = 'tone-' + tone
174
+ } else if (soft && !exact && !light.variants && tonesInString.size === 1) {
175
+ next = 'bg-tone-soft' + alpha
176
+ addTone = 'tone-' + soft
165
177
  }
166
178
  }
167
179
 
@@ -173,14 +185,19 @@ const transformClasses = (value, exact, table) => {
173
185
  replaced.push(`${ light.raw } ${ dark.raw } → ${ next }`)
174
186
  words[index] = next
175
187
  words[darkIndex] = ''
188
+ // The removed class takes one separator with it: the one before, unless it starts the string or a line. Lines and
189
+ // their indentation stay as they were.
190
+ const before = words[darkIndex - 1]
191
+ const dropAfter = darkIndex === 0 || (before?.includes('\n') && darkIndex + 1 < words.length)
192
+
193
+ words[dropAfter ? darkIndex + 1 : darkIndex - 1] = ''
176
194
  tokens[index] = null
177
195
  tokens[darkIndex] = null
178
196
  })
179
197
 
180
- // Removed classes leave gaps: collapse them, drop spaces left before line breaks, keep the string's own edges.
181
- const lead = value.match(/^\s*/)?.[0] ?? ''
182
- const trail = value.match(/\s*$/)?.[0] ?? ''
183
- let text = lead + words.join('').trim().replace(/[ \t]{2,}/g, ' ').replace(/[ \t]+\n/g, '\n') + trail
198
+ if (!replaced.length) return {text: value, replaced, unmapped, left: tokens.filter(token => token !== null).map(token => token.raw)}
199
+
200
+ let text = words.join('')
184
201
 
185
202
  if (addTone && !text.split(/\s+/).includes(addTone)) text = text.replace(/^(\s*)/, `$1${ addTone } `)
186
203
 
@@ -21,6 +21,8 @@
21
21
 
22
22
  --role-surface: var(--color-default);
23
23
  --role-surface-dark: var(--color-default-dark);
24
+ --role-surface-subtle: var(--color-gray-50);
25
+ --role-surface-subtle-dark: var(--color-gray-850);
24
26
  --role-surface-muted: var(--color-gray-100);
25
27
  --role-surface-muted-dark: var(--color-gray-800);
26
28
  --role-surface-inset: var(--color-gray-200);
@@ -59,6 +61,7 @@
59
61
  --color-subtle: var(--w-text-subtle);
60
62
 
61
63
  --color-surface: var(--w-surface);
64
+ --color-surface-subtle: var(--w-surface-subtle);
62
65
  --color-surface-muted: var(--w-surface-muted);
63
66
  --color-surface-inset: var(--w-surface-inset);
64
67
  --color-overlay: var(--w-overlay);
@@ -112,6 +115,7 @@
112
115
  --w-text-subtle: light-dark(var(--role-text-subtle), var(--role-text-subtle-dark));
113
116
 
114
117
  --w-surface: light-dark(var(--role-surface), var(--role-surface-dark));
118
+ --w-surface-subtle: light-dark(var(--role-surface-subtle), var(--role-surface-subtle-dark));
115
119
  --w-surface-muted: light-dark(var(--role-surface-muted), var(--role-surface-muted-dark));
116
120
  --w-surface-inset: light-dark(var(--role-surface-inset), var(--role-surface-inset-dark));
117
121
  --w-overlay: light-dark(var(--role-overlay), var(--role-overlay-dark));
@@ -14,8 +14,8 @@
14
14
  */
15
15
  --color-primary: oklch(55% 0.17 286.8);
16
16
  --color-primary-dark: var(--color-primary);
17
- --color-primary-light: color-mix(in oklab, var(--color-primary) 10%, var(--color-default));
18
- --color-primary-darkest: color-mix(in oklab, var(--color-primary-dark) 20%, var(--color-default-dark));
17
+ --color-primary-light: color-mix(in oklab, var(--color-primary) 7%, var(--color-default));
18
+ --color-primary-darkest: color-mix(in oklab, var(--color-primary-dark) 10%, var(--color-default-dark));
19
19
 
20
20
  --color-black-default: #333333;
21
21
  --color-black-light: #4f4f4f;