vunor 0.4.0 → 0.4.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.
package/README.md CHANGED
@@ -366,6 +366,12 @@ export default defineConfig({
366
366
  reverseDark: false,
367
367
  reverseLight: false,
368
368
  },
369
+
370
+ // -- Page-level element styles --
371
+ // body / figcaption / h1–h6 typography (including a level's `font` and
372
+ // `css` above) and scrollbars. Set false to use only the classes and
373
+ // theme: variables stay, element rules go.
374
+ baseStyles: true,
369
375
  }),
370
376
  ],
371
377
  shortcuts: [vunorShortcuts()],
package/dist/Select.mjs CHANGED
@@ -103,6 +103,7 @@ var Select_default = /* @__PURE__ */ defineComponent({
103
103
  }
104
104
  return (_ctx, _cache) => {
105
105
  return openBlock(), createBlock(VuSelectBase, mergeProps(unref(rootProps), {
106
+ multiple: __props.multiple,
106
107
  modelValue: modelValue.value,
107
108
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
108
109
  open: open.value,
@@ -183,6 +184,7 @@ var Select_default = /* @__PURE__ */ defineComponent({
183
184
  ]))]),
184
185
  _: 1
185
186
  }, 16, [
187
+ "multiple",
186
188
  "modelValue",
187
189
  "open",
188
190
  "disabled-values",
package/dist/theme.d.mts CHANGED
@@ -29,6 +29,14 @@ interface TVunorUnoPresetOpts {
29
29
  xl?: string;
30
30
  };
31
31
  baseRadius?: string;
32
+ /**
33
+ * Page-level element styles: the body, figcaption and h1–h6 typography rules
34
+ * (size, weight, line-height, letter-spacing, plus a level's `font` and `css`
35
+ * from `typography`) and scrollbar styling. Default `true`. Set `false` when
36
+ * the app styles its own page; theme variables, shortcuts and classes are
37
+ * unaffected.
38
+ */
39
+ baseStyles?: boolean;
32
40
  animation?: {
33
41
  durations?: Record<string, string>;
34
42
  animation?: Record<string, string>;
package/dist/theme.mjs CHANGED
@@ -1980,17 +1980,16 @@ function unitBy(input, factor, roundTo = 3) {
1980
1980
  }
1981
1981
  //#endregion
1982
1982
  //#region src/theme/preflights.ts
1983
- const fontsPreflights = { getCSS: ({ theme }) => `${renderFontCss("body", theme.fontSize.body) + renderFontCss("figcaption", theme.fontSize.caption) + renderFontCss("h1", theme.fontSize.h1) + renderFontCss("h2", theme.fontSize.h2) + renderFontCss("h3", theme.fontSize.h3) + renderFontCss("h4", theme.fontSize.h4) + renderFontCss("h5", theme.fontSize.h5) + renderFontCss("h6", theme.fontSize.h6)}
1984
- :root {
1985
- --un-border-opacity: 0.25;
1986
- --un-default-border-color: rgb(150 150 150 / var(--un-border-opacity));
1987
- --scope-black: 0 0 0;
1988
- --scope-white: 255 255 255;
1989
- --scope-hl: var(--scope-color-500);
1990
- --v-fingertip: ${theme.spacing["fingertip-m"] || "3em"};
1991
- --v-fingertip-half: ${unitBy(theme.spacing["fingertip-m"] || "3em", .5)};
1992
- ${renderDefaultScope(theme)}}
1993
-
1983
+ /**
1984
+ * `:root` theme variables always; page-level element styles only with `baseStyles`.
1985
+ * Off, `body` keeps the body level's `--font-*` variables for `text-mt-*` / `font-$bold`.
1986
+ */
1987
+ function vunorPreflights(baseStyles) {
1988
+ return { getCSS: ({ theme }) => baseStyles ? renderBaseStyles(theme) : renderRootVars(theme) + renderFontVarsCss("body", theme.fontSize.body) };
1989
+ }
1990
+ function renderBaseStyles(theme) {
1991
+ return `${renderFontCss("body", theme.fontSize.body) + renderFontCss("figcaption", theme.fontSize.caption) + renderFontCss("h1", theme.fontSize.h1) + renderFontCss("h2", theme.fontSize.h2) + renderFontCss("h3", theme.fontSize.h3) + renderFontCss("h4", theme.fontSize.h4) + renderFontCss("h5", theme.fontSize.h5) + renderFontCss("h6", theme.fontSize.h6)}
1992
+ ${renderRootVars(theme)}
1994
1993
 
1995
1994
  ::-webkit-scrollbar {
1996
1995
  width: 10px;
@@ -2025,7 +2024,20 @@ ${renderDefaultScope(theme)}}
2025
2024
  .dark ::-webkit-scrollbar-thumb:hover {
2026
2025
  background-color: rgba(255,255,255,0.3);
2027
2026
  }
2028
- ` };
2027
+ `;
2028
+ }
2029
+ function renderRootVars(theme) {
2030
+ return `:root {
2031
+ --un-border-opacity: 0.25;
2032
+ --un-default-border-color: rgb(150 150 150 / var(--un-border-opacity));
2033
+ --scope-black: 0 0 0;
2034
+ --scope-white: 255 255 255;
2035
+ --scope-hl: var(--scope-color-500);
2036
+ --v-fingertip: ${theme.spacing["fingertip-m"] || "3em"};
2037
+ --v-fingertip-half: ${unitBy(theme.spacing["fingertip-m"] || "3em", .5)};
2038
+ ${renderDefaultScope(theme)}}
2039
+ `;
2040
+ }
2029
2041
  function renderDefaultScope(theme) {
2030
2042
  const vars = getScopeCssVars("neutral", theme);
2031
2043
  if (!vars) return "";
@@ -2034,6 +2046,10 @@ function renderDefaultScope(theme) {
2034
2046
  function renderFontCss(selector, font) {
2035
2047
  return `${selector} { font-size: ${font[0]}; ${Object.entries(font[1]).map((e) => `${e[0]}: ${e[1]};`).join(" ")} }\n`;
2036
2048
  }
2049
+ /** Only a level's `--font-*` variables: a rule that styles nothing. */
2050
+ function renderFontVarsCss(selector, font) {
2051
+ return `${selector} { ${Object.entries(font[1]).filter(([k]) => k.startsWith("--")).map(([k, v]) => `${k}: ${v};`).join(" ")} }\n`;
2052
+ }
2037
2053
  //#endregion
2038
2054
  //#region src/theme/rules/i8-rules.ts
2039
2055
  const i8Rules = [
@@ -2414,6 +2430,7 @@ const defaultOptions = {
2414
2430
  xl: `4em`
2415
2431
  },
2416
2432
  baseRadius: `${round(1 / 1.618, 3)}em`,
2433
+ baseStyles: true,
2417
2434
  animation: {
2418
2435
  durations: {
2419
2436
  "slide-down-and-fade": ".15s",
@@ -2485,7 +2502,7 @@ const presetVunor = (_opts) => {
2485
2502
  const opts = defu(_opts, defaultOptions);
2486
2503
  const wind = getFixedWind();
2487
2504
  if (!wind.preflights) wind.preflights = [];
2488
- wind.preflights.push(fontsPreflights);
2505
+ wind.preflights.push(vunorPreflights(opts.baseStyles));
2489
2506
  if (!wind.rules) wind.rules = [];
2490
2507
  wind.rules.push(...rules);
2491
2508
  const paletteShortcuts = getPaletteShortcuts();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vunor",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],