theme-vir 25.6.0
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/LICENSE-CC0 +121 -0
- package/LICENSE-MIT +21 -0
- package/README.md +3 -0
- package/dist/color/color-css.d.ts +9 -0
- package/dist/color/color-css.js +13 -0
- package/dist/color/color-theme-override.d.ts +37 -0
- package/dist/color/color-theme-override.js +90 -0
- package/dist/color/color-theme.d.ts +74 -0
- package/dist/color/color-theme.js +93 -0
- package/dist/create-theme/create-theme.d.ts +3 -0
- package/dist/create-theme/create-theme.js +9 -0
- package/dist/create-theme/define-theme-elements.d.ts +3 -0
- package/dist/create-theme/define-theme-elements.js +119 -0
- package/dist/create-theme/font-css.d.ts +4 -0
- package/dist/create-theme/font-css.js +20 -0
- package/dist/create-theme/internal-theme.d.ts +3 -0
- package/dist/create-theme/internal-theme.js +5 -0
- package/dist/create-theme/theme-options.d.ts +36 -0
- package/dist/create-theme/theme-options.js +62 -0
- package/dist/create-theme/theme.d.ts +13 -0
- package/dist/create-theme/theme.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/theme-book/theme-book-pages.d.ts +3 -0
- package/dist/theme-book/theme-book-pages.js +56 -0
- package/dist/theme-book/vir-theme-book-app.element.d.ts +3 -0
- package/dist/theme-book/vir-theme-book-app.element.js +34 -0
- package/package.json +76 -0
package/LICENSE-CC0
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
CC0 1.0 Universal
|
|
2
|
+
|
|
3
|
+
Creative Commons Legal Code
|
|
4
|
+
|
|
5
|
+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
6
|
+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
7
|
+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
8
|
+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
9
|
+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
10
|
+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
11
|
+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
12
|
+
HEREUNDER.
|
|
13
|
+
|
|
14
|
+
Statement of Purpose
|
|
15
|
+
|
|
16
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
17
|
+
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
18
|
+
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
19
|
+
authorship and/or a database (each, a "Work").
|
|
20
|
+
|
|
21
|
+
Certain owners wish to permanently relinquish those rights to a Work for
|
|
22
|
+
the purpose of contributing to a commons of creative, cultural and
|
|
23
|
+
scientific works ("Commons") that the public can reliably and without fear
|
|
24
|
+
of later claims of infringement build upon, modify, incorporate in other
|
|
25
|
+
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
26
|
+
and for any purposes, including without limitation commercial purposes.
|
|
27
|
+
These owners may contribute to the Commons to promote the ideal of a free
|
|
28
|
+
culture and the further production of creative, cultural and scientific
|
|
29
|
+
works, or to gain reputation or greater distribution for their Work in
|
|
30
|
+
part through the use and efforts of others.
|
|
31
|
+
|
|
32
|
+
For these and/or other purposes and motivations, and without any
|
|
33
|
+
expectation of additional consideration or compensation, the person
|
|
34
|
+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
35
|
+
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
36
|
+
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
37
|
+
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
38
|
+
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
39
|
+
|
|
40
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
41
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
|
42
|
+
Related Rights"). Copyright and Related Rights include, but are not
|
|
43
|
+
limited to, the following:
|
|
44
|
+
|
|
45
|
+
i. the right to reproduce, adapt, distribute, perform, display,
|
|
46
|
+
communicate, and translate a Work;
|
|
47
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
48
|
+
iii. publicity and privacy rights pertaining to a person's image or
|
|
49
|
+
likeness depicted in a Work;
|
|
50
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
|
51
|
+
subject to the limitations in paragraph 4(a), below;
|
|
52
|
+
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
53
|
+
in a Work;
|
|
54
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
55
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
56
|
+
protection of databases, and under any national implementation
|
|
57
|
+
thereof, including any amended or successor version of such
|
|
58
|
+
directive); and
|
|
59
|
+
vii. other similar, equivalent or corresponding rights throughout the
|
|
60
|
+
world based on applicable law or treaty, and any national
|
|
61
|
+
implementations thereof.
|
|
62
|
+
|
|
63
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
64
|
+
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
65
|
+
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
66
|
+
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
67
|
+
of action, whether now known or unknown (including existing as well as
|
|
68
|
+
future claims and causes of action), in the Work (i) in all territories
|
|
69
|
+
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
70
|
+
treaty (including future time extensions), (iii) in any current or future
|
|
71
|
+
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
72
|
+
including without limitation commercial, advertising or promotional
|
|
73
|
+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
74
|
+
member of the public at large and to the detriment of Affirmer's heirs and
|
|
75
|
+
successors, fully intending that such Waiver shall not be subject to
|
|
76
|
+
revocation, rescission, cancellation, termination, or any other legal or
|
|
77
|
+
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
78
|
+
as contemplated by Affirmer's express Statement of Purpose.
|
|
79
|
+
|
|
80
|
+
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
81
|
+
be judged legally invalid or ineffective under applicable law, then the
|
|
82
|
+
Waiver shall be preserved to the maximum extent permitted taking into
|
|
83
|
+
account Affirmer's express Statement of Purpose. In addition, to the
|
|
84
|
+
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
85
|
+
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
86
|
+
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
87
|
+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
88
|
+
maximum duration provided by applicable law or treaty (including future
|
|
89
|
+
time extensions), (iii) in any current or future medium and for any number
|
|
90
|
+
of copies, and (iv) for any purpose whatsoever, including without
|
|
91
|
+
limitation commercial, advertising or promotional purposes (the
|
|
92
|
+
"License"). The License shall be deemed effective as of the date CC0 was
|
|
93
|
+
applied by Affirmer to the Work. Should any part of the License for any
|
|
94
|
+
reason be judged legally invalid or ineffective under applicable law, such
|
|
95
|
+
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
96
|
+
of the License, and in such case Affirmer hereby affirms that he or she
|
|
97
|
+
will not (i) exercise any of his or her remaining Copyright and Related
|
|
98
|
+
Rights in the Work or (ii) assert any associated claims and causes of
|
|
99
|
+
action with respect to the Work, in either case contrary to Affirmer's
|
|
100
|
+
express Statement of Purpose.
|
|
101
|
+
|
|
102
|
+
4. Limitations and Disclaimers.
|
|
103
|
+
|
|
104
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
105
|
+
surrendered, licensed or otherwise affected by this document.
|
|
106
|
+
b. Affirmer offers the Work as-is and makes no representations or
|
|
107
|
+
warranties of any kind concerning the Work, express, implied,
|
|
108
|
+
statutory or otherwise, including without limitation warranties of
|
|
109
|
+
title, merchantability, fitness for a particular purpose, non
|
|
110
|
+
infringement, or the absence of latent or other defects, accuracy, or
|
|
111
|
+
the present or absence of errors, whether or not discoverable, all to
|
|
112
|
+
the greatest extent permissible under applicable law.
|
|
113
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
114
|
+
that may apply to the Work or any use thereof, including without
|
|
115
|
+
limitation any person's Copyright and Related Rights in the Work.
|
|
116
|
+
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
117
|
+
consents, permissions or other rights required for any use of the
|
|
118
|
+
Work.
|
|
119
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
120
|
+
party to this document and has no duty or obligation with respect to
|
|
121
|
+
this CC0 or use of the Work.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 electrovir
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CSSResult } from 'element-vir';
|
|
2
|
+
import { type ColorThemeColor } from './color-theme.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates foreground and background CSS code. The foreground color is applied to the CSS `color`
|
|
5
|
+
* property and the background color is applied to the CSS `background-color` property.
|
|
6
|
+
*
|
|
7
|
+
* @category Color Theme
|
|
8
|
+
*/
|
|
9
|
+
export declare function colorCss(color: Readonly<ColorThemeColor>): CSSResult;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { css } from 'element-vir';
|
|
2
|
+
/**
|
|
3
|
+
* Creates foreground and background CSS code. The foreground color is applied to the CSS `color`
|
|
4
|
+
* property and the background color is applied to the CSS `background-color` property.
|
|
5
|
+
*
|
|
6
|
+
* @category Color Theme
|
|
7
|
+
*/
|
|
8
|
+
export function colorCss(color) {
|
|
9
|
+
return css `
|
|
10
|
+
color: ${color.foreground.value};
|
|
11
|
+
background-color: ${color.background.value};
|
|
12
|
+
`;
|
|
13
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type CssVarName } from 'lit-css-vars';
|
|
2
|
+
import { type RequireAtLeastOne } from 'type-fest';
|
|
3
|
+
import { type ColorInit, type ColorTheme } from './color-theme.js';
|
|
4
|
+
/**
|
|
5
|
+
* Input for {@link defineColorThemeOverride} color overrides.
|
|
6
|
+
*
|
|
7
|
+
* @category Internal
|
|
8
|
+
*/
|
|
9
|
+
export type ColorThemeOverrideInit<Theme extends ColorTheme = ColorTheme> = Omit<Partial<{
|
|
10
|
+
[ColorName in keyof Theme]: ColorInit;
|
|
11
|
+
}>, 'default'>;
|
|
12
|
+
/**
|
|
13
|
+
* Output of {@link defineColorThemeOverride}.
|
|
14
|
+
*
|
|
15
|
+
* @category Internal
|
|
16
|
+
*/
|
|
17
|
+
export type ColorThemeOverrides = Record<CssVarName, string>;
|
|
18
|
+
/**
|
|
19
|
+
* Define a color theme override. Use this to define multiple theme variations, like light mode vs
|
|
20
|
+
* dark mode.
|
|
21
|
+
*
|
|
22
|
+
* @category Color Theme
|
|
23
|
+
*/
|
|
24
|
+
export declare function defineColorThemeOverride<const Theme extends ColorTheme>(originalTheme: Theme, { defaultOverride, colorOverrides, }: RequireAtLeastOne<{
|
|
25
|
+
/** Override the default foreground and/or background colors. */
|
|
26
|
+
defaultOverride: ColorInit;
|
|
27
|
+
colorOverrides: ColorThemeOverrideInit<Theme>;
|
|
28
|
+
}>): ColorThemeOverrides;
|
|
29
|
+
/**
|
|
30
|
+
* Set all color theme CSS vars on the given element. If no override is given, the theme color
|
|
31
|
+
* default values are assigned.
|
|
32
|
+
*
|
|
33
|
+
* @category Color Theme
|
|
34
|
+
*/
|
|
35
|
+
export declare function applyColorTheme<const Theme extends ColorTheme>(
|
|
36
|
+
/** This should usually be the top-level `html` element. */
|
|
37
|
+
element: HTMLElement, fullTheme: Theme, themeOverride?: ColorThemeOverrides | undefined): void;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { getObjectTypedEntries, getObjectTypedKeys, getObjectTypedValues } from '@augment-vir/common';
|
|
2
|
+
import { setCssVarValue } from 'lit-css-vars';
|
|
3
|
+
import { createColorCssVarDefault, } from './color-theme.js';
|
|
4
|
+
function applyCssVarOverride({ originalTheme, layerKey, themeColor, override, overrideValues, }) {
|
|
5
|
+
const layerOverride = override?.[layerKey];
|
|
6
|
+
if (!layerOverride) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
overrideValues[String(themeColor[layerKey].name)] = String(createColorCssVarDefault(layerKey, layerOverride, originalTheme));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Define a color theme override. Use this to define multiple theme variations, like light mode vs
|
|
13
|
+
* dark mode.
|
|
14
|
+
*
|
|
15
|
+
* @category Color Theme
|
|
16
|
+
*/
|
|
17
|
+
export function defineColorThemeOverride(originalTheme, { defaultOverride, colorOverrides, }) {
|
|
18
|
+
const defaultValues = {};
|
|
19
|
+
if (defaultOverride) {
|
|
20
|
+
getObjectTypedKeys(defaultOverride).forEach((layerKey) => {
|
|
21
|
+
applyCssVarOverride({
|
|
22
|
+
originalTheme,
|
|
23
|
+
layerKey,
|
|
24
|
+
override: defaultOverride,
|
|
25
|
+
themeColor: originalTheme.default,
|
|
26
|
+
overrideValues: defaultValues,
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const colorValues = {};
|
|
31
|
+
if (colorOverrides) {
|
|
32
|
+
getObjectTypedEntries(colorOverrides).forEach(([colorName, override,]) => {
|
|
33
|
+
const themeColor = originalTheme[colorName];
|
|
34
|
+
if (!themeColor) {
|
|
35
|
+
throw new Error(`Override color name '${String(colorName)}' does not exist in the theme being overridden.`);
|
|
36
|
+
}
|
|
37
|
+
applyCssVarOverride({
|
|
38
|
+
originalTheme,
|
|
39
|
+
layerKey: 'foreground',
|
|
40
|
+
override,
|
|
41
|
+
themeColor,
|
|
42
|
+
overrideValues: colorValues,
|
|
43
|
+
});
|
|
44
|
+
applyCssVarOverride({
|
|
45
|
+
originalTheme,
|
|
46
|
+
layerKey: 'background',
|
|
47
|
+
override,
|
|
48
|
+
themeColor,
|
|
49
|
+
overrideValues: colorValues,
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
...defaultValues,
|
|
55
|
+
...colorValues,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Set all color theme CSS vars on the given element. If no override is given, the theme color
|
|
60
|
+
* default values are assigned.
|
|
61
|
+
*
|
|
62
|
+
* @category Color Theme
|
|
63
|
+
*/
|
|
64
|
+
export function applyColorTheme(
|
|
65
|
+
/** This should usually be the top-level `html` element. */
|
|
66
|
+
element, fullTheme, themeOverride) {
|
|
67
|
+
getObjectTypedValues(fullTheme).forEach((themeColor) => {
|
|
68
|
+
applyIndividualThemeColorValue({
|
|
69
|
+
element,
|
|
70
|
+
layerKey: 'background',
|
|
71
|
+
themeColor,
|
|
72
|
+
themeOverride,
|
|
73
|
+
});
|
|
74
|
+
applyIndividualThemeColorValue({
|
|
75
|
+
element,
|
|
76
|
+
layerKey: 'foreground',
|
|
77
|
+
themeColor,
|
|
78
|
+
themeOverride,
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function applyIndividualThemeColorValue({ element, layerKey, themeOverride, themeColor, }) {
|
|
83
|
+
const override = themeOverride?.[String(themeColor[layerKey].name)];
|
|
84
|
+
const value = override || themeColor[layerKey].default;
|
|
85
|
+
setCssVarValue({
|
|
86
|
+
forCssVar: themeColor[layerKey],
|
|
87
|
+
onElement: element,
|
|
88
|
+
toValue: value,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type RequiredAndNotNull } from '@augment-vir/common';
|
|
2
|
+
import { type CSSResult } from 'element-vir';
|
|
3
|
+
import { type CssVarName, type SingleCssVarDefinition } from 'lit-css-vars';
|
|
4
|
+
import { type RequireAtLeastOne } from 'type-fest';
|
|
5
|
+
/**
|
|
6
|
+
* Reference another color from this same definition inside {@link ColorInitValue}
|
|
7
|
+
*
|
|
8
|
+
* @category Internal
|
|
9
|
+
*/
|
|
10
|
+
export type ColorInitReference = RequireAtLeastOne<{
|
|
11
|
+
refForeground: CssVarName;
|
|
12
|
+
refBackground: CssVarName;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* All possible types for {@link ColorInit}.
|
|
16
|
+
*
|
|
17
|
+
* @category Internal
|
|
18
|
+
*/
|
|
19
|
+
export type ColorInitValue = string | number | CSSResult | ColorInitReference;
|
|
20
|
+
/**
|
|
21
|
+
* An individual theme color init.
|
|
22
|
+
*
|
|
23
|
+
* @category Internal
|
|
24
|
+
*/
|
|
25
|
+
export type ColorInit = RequireAtLeastOne<{
|
|
26
|
+
foreground: ColorInitValue;
|
|
27
|
+
background: ColorInitValue;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* A defined individual color from a color theme.
|
|
31
|
+
*
|
|
32
|
+
* @category Internal
|
|
33
|
+
*/
|
|
34
|
+
export type ColorThemeColor<Init extends ColorInit = ColorInit, Name extends CssVarName = CssVarName> = {
|
|
35
|
+
foreground: SingleCssVarDefinition;
|
|
36
|
+
background: SingleCssVarDefinition;
|
|
37
|
+
name: Name;
|
|
38
|
+
init: Init;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Base input type for the type parameter in {@link defineColorTheme}.
|
|
42
|
+
*
|
|
43
|
+
* @category Internal
|
|
44
|
+
*/
|
|
45
|
+
export type ColorThemeInit = Record<CssVarName, ColorInit>;
|
|
46
|
+
/**
|
|
47
|
+
* A finalized color theme, output from {@link defineColorTheme}.
|
|
48
|
+
*
|
|
49
|
+
* @category Internal
|
|
50
|
+
*/
|
|
51
|
+
export type ColorTheme<Init extends ColorThemeInit = ColorThemeInit> = {
|
|
52
|
+
[ColorName in keyof Init as ColorName extends CssVarName ? ColorName : never]: ColorName extends CssVarName ? Init[ColorName] extends ColorInit ? ColorThemeColor<Init[ColorName], ColorName> : never : never;
|
|
53
|
+
} & {
|
|
54
|
+
[themeDefaultKey]: Omit<ColorThemeColor, 'name'>;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Handles a color init value.
|
|
58
|
+
*
|
|
59
|
+
* @category Internal
|
|
60
|
+
*/
|
|
61
|
+
export declare function createColorCssVarDefault(fromName: string, init: ColorInitValue, fullInit: Record<string, unknown>): Exclude<ColorInitValue, ColorInitReference>;
|
|
62
|
+
/**
|
|
63
|
+
* Default foreground/background color theme used in {@link ColorTheme}. Do not define a theme color
|
|
64
|
+
* with this name!
|
|
65
|
+
*
|
|
66
|
+
* @category Internal
|
|
67
|
+
*/
|
|
68
|
+
export declare const themeDefaultKey = "default";
|
|
69
|
+
/**
|
|
70
|
+
* Define a color theme.
|
|
71
|
+
*
|
|
72
|
+
* @category Color Theme
|
|
73
|
+
*/
|
|
74
|
+
export declare function defineColorTheme<const Init extends ColorThemeInit>(defaultInit: RequiredAndNotNull<ColorInit>, allColorsInit: Init): ColorTheme<Init>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { assert, check } from '@augment-vir/assert';
|
|
2
|
+
import { getObjectTypedEntries, mapObjectValues, } from '@augment-vir/common';
|
|
3
|
+
import { defineCssVars, } from 'lit-css-vars';
|
|
4
|
+
/**
|
|
5
|
+
* Handles a color init value.
|
|
6
|
+
*
|
|
7
|
+
* @category Internal
|
|
8
|
+
*/
|
|
9
|
+
export function createColorCssVarDefault(fromName, init, fullInit) {
|
|
10
|
+
if (check.hasKey(init, 'refBackground')) {
|
|
11
|
+
if (!(init.refBackground in fullInit)) {
|
|
12
|
+
throw new Error(`Color theme background reference '${init.refBackground}' does not exist. (Referenced from '${fromName}'.)`);
|
|
13
|
+
}
|
|
14
|
+
return `var(--${init.refBackground}-bg)`;
|
|
15
|
+
}
|
|
16
|
+
else if (check.hasKey(init, 'refForeground')) {
|
|
17
|
+
if (!(init.refForeground in fullInit)) {
|
|
18
|
+
throw new Error(`Color theme foreground reference '${init.refForeground}' does not exist. (Referenced from '${fromName}'.)`);
|
|
19
|
+
}
|
|
20
|
+
return `var(--${init.refForeground}-fg)`;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return init;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Default foreground/background color theme used in {@link ColorTheme}. Do not define a theme color
|
|
28
|
+
* with this name!
|
|
29
|
+
*
|
|
30
|
+
* @category Internal
|
|
31
|
+
*/
|
|
32
|
+
export const themeDefaultKey = 'default';
|
|
33
|
+
/**
|
|
34
|
+
* Define a color theme.
|
|
35
|
+
*
|
|
36
|
+
* @category Color Theme
|
|
37
|
+
*/
|
|
38
|
+
export function defineColorTheme(defaultInit, allColorsInit) {
|
|
39
|
+
if (themeDefaultKey in allColorsInit) {
|
|
40
|
+
throw new Error(`Cannot define theme color by name '${themeDefaultKey}', it is used internally.`);
|
|
41
|
+
}
|
|
42
|
+
const defaultColors = defineCssVars({
|
|
43
|
+
'default-bg': createColorCssVarDefault('default-bg', defaultInit.background, allColorsInit),
|
|
44
|
+
'default-fg': createColorCssVarDefault('default-fg', defaultInit.foreground, allColorsInit),
|
|
45
|
+
});
|
|
46
|
+
const cssVarsSetup = getObjectTypedEntries(allColorsInit).reduce((accum, [colorName, colorInit,]) => {
|
|
47
|
+
accum[(colorName + '-fg')] = colorInit.foreground
|
|
48
|
+
? createColorCssVarDefault([
|
|
49
|
+
colorName,
|
|
50
|
+
'foreground',
|
|
51
|
+
].join(' '), colorInit.foreground, allColorsInit)
|
|
52
|
+
: `var(${defaultColors['default-fg'].name}, ${defaultColors['default-fg'].default})`;
|
|
53
|
+
accum[(colorName + '-bg')] = colorInit.background
|
|
54
|
+
? createColorCssVarDefault([
|
|
55
|
+
colorName,
|
|
56
|
+
'background',
|
|
57
|
+
].join(' '), colorInit.background, allColorsInit)
|
|
58
|
+
: `var(${defaultColors['default-bg'].name}, ${defaultColors['default-bg'].default})`;
|
|
59
|
+
return accum;
|
|
60
|
+
}, {});
|
|
61
|
+
/**
|
|
62
|
+
* This has multiple `as` casts because `defineCssVars` complains that `cssVarsSetup` is too
|
|
63
|
+
* generic. That is indeed true, but in this use case we do not care because the resulting
|
|
64
|
+
* `cssVars` object is not directly exposed.
|
|
65
|
+
*/
|
|
66
|
+
const cssVars = defineCssVars(cssVarsSetup);
|
|
67
|
+
const colors = mapObjectValues(allColorsInit, (colorName, colorInit) => {
|
|
68
|
+
assert.isString(colorName);
|
|
69
|
+
const names = {
|
|
70
|
+
foreground: (colorName + '-fg'),
|
|
71
|
+
background: (colorName + '-bg'),
|
|
72
|
+
};
|
|
73
|
+
const background = cssVars[names.background];
|
|
74
|
+
const foreground = cssVars[names.foreground];
|
|
75
|
+
assert.isDefined(background);
|
|
76
|
+
assert.isDefined(foreground);
|
|
77
|
+
return {
|
|
78
|
+
background,
|
|
79
|
+
foreground,
|
|
80
|
+
init: colorInit,
|
|
81
|
+
name: colorName,
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
const defaults = {
|
|
85
|
+
foreground: defaultColors['default-fg'],
|
|
86
|
+
background: defaultColors['default-bg'],
|
|
87
|
+
init: defaultInit,
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
...colors,
|
|
91
|
+
default: defaults,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { mergeDeep } from '@augment-vir/common';
|
|
2
|
+
import { defineThemeElements } from './define-theme-elements.js';
|
|
3
|
+
import { createDefaultThemeOptions, } from './theme-options.js';
|
|
4
|
+
export function createTheme(options) {
|
|
5
|
+
const fullOptions = mergeDeep(createDefaultThemeOptions(), options);
|
|
6
|
+
return {
|
|
7
|
+
elements: defineThemeElements(fullOptions),
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type AllThemeOptions } from './theme-options.js';
|
|
2
|
+
import { type Theme } from './theme.js';
|
|
3
|
+
export declare function defineThemeElements<TagPrefix extends string>(options: Pick<AllThemeOptions<TagPrefix>, 'elementTagPrefix' | 'font'>): Theme<TagPrefix>['elements'];
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { getEnumValues, getObjectTypedValues, typedObjectFromEntries } from '@augment-vir/common';
|
|
2
|
+
import { css, defineElement, defineElementNoInputs, html, unsafeCSS, } from 'element-vir';
|
|
3
|
+
import { createFontStyleCss } from './font-css.js';
|
|
4
|
+
import { HeadingLevel } from './theme-options.js';
|
|
5
|
+
export function defineThemeElements(options) {
|
|
6
|
+
const themeElements = {
|
|
7
|
+
bold: defineElementNoInputs({
|
|
8
|
+
tagName: `${options.elementTagPrefix}-b`,
|
|
9
|
+
styles: css `
|
|
10
|
+
:host {
|
|
11
|
+
display: inline;
|
|
12
|
+
${createFontStyleCss(options.font.bold)}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
b {
|
|
16
|
+
all: inherit;
|
|
17
|
+
}
|
|
18
|
+
`,
|
|
19
|
+
render() {
|
|
20
|
+
return html `
|
|
21
|
+
<b><slot></slot></b>
|
|
22
|
+
`;
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
monospace: defineElementNoInputs({
|
|
26
|
+
tagName: `${options.elementTagPrefix}-monospace`,
|
|
27
|
+
styles: css `
|
|
28
|
+
:host {
|
|
29
|
+
display: inline;
|
|
30
|
+
${createFontStyleCss(options.font.monospace)}
|
|
31
|
+
}
|
|
32
|
+
`,
|
|
33
|
+
render() {
|
|
34
|
+
return html `
|
|
35
|
+
<slot></slot>
|
|
36
|
+
`;
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
code: defineElementNoInputs({
|
|
40
|
+
tagName: `${options.elementTagPrefix}-code`,
|
|
41
|
+
styles: css `
|
|
42
|
+
:host {
|
|
43
|
+
display: inline;
|
|
44
|
+
${createFontStyleCss(options.font.monospace)}
|
|
45
|
+
}
|
|
46
|
+
`,
|
|
47
|
+
render() {
|
|
48
|
+
return html `
|
|
49
|
+
<code><slot></slot></code>
|
|
50
|
+
`;
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
paragraph: defineElementNoInputs({
|
|
54
|
+
tagName: `${options.elementTagPrefix}-p`,
|
|
55
|
+
styles: css `
|
|
56
|
+
:host {
|
|
57
|
+
display: block;
|
|
58
|
+
${createFontStyleCss(options.font.bold)}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
p {
|
|
62
|
+
all: inherit;
|
|
63
|
+
}
|
|
64
|
+
`,
|
|
65
|
+
render() {
|
|
66
|
+
return html `
|
|
67
|
+
<p><slot></slot></p>
|
|
68
|
+
`;
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
heading: defineHeadingElement(options),
|
|
72
|
+
};
|
|
73
|
+
return themeElements;
|
|
74
|
+
}
|
|
75
|
+
function defineHeadingElement(options) {
|
|
76
|
+
const headingTag = `${options.elementTagPrefix}-heading`;
|
|
77
|
+
const headingSelectors = unsafeCSS(getEnumValues(HeadingLevel).join(', '));
|
|
78
|
+
return defineElement()({
|
|
79
|
+
tagName: headingTag,
|
|
80
|
+
hostClasses: typedObjectFromEntries(getEnumValues(HeadingLevel).map((headingLevel) => {
|
|
81
|
+
return [
|
|
82
|
+
`${headingTag}-${headingLevel}`,
|
|
83
|
+
({ inputs }) => inputs.headingLevel === headingLevel,
|
|
84
|
+
];
|
|
85
|
+
})),
|
|
86
|
+
styles: ({ hostClasses }) => {
|
|
87
|
+
const hostClassValues = getObjectTypedValues(hostClasses);
|
|
88
|
+
return css `
|
|
89
|
+
:host {
|
|
90
|
+
display: block;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
${unsafeCSS(hostClassValues
|
|
94
|
+
.map((hostClass) => {
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
96
|
+
const headingLevel = String(hostClass.name)
|
|
97
|
+
.split('-')
|
|
98
|
+
.slice(-1)[0];
|
|
99
|
+
return css `
|
|
100
|
+
${hostClass.selector} {
|
|
101
|
+
${createFontStyleCss(options.font.headings[headingLevel])}
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
})
|
|
105
|
+
.join('\n'))}
|
|
106
|
+
|
|
107
|
+
${headingSelectors} {
|
|
108
|
+
all: inherit;
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
},
|
|
112
|
+
render({ inputs }) {
|
|
113
|
+
const headingTag = inputs.headingLevel;
|
|
114
|
+
return html `
|
|
115
|
+
<${headingTag}><slot></slot></${headingTag}>
|
|
116
|
+
`;
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type CSSResult } from 'element-vir';
|
|
2
|
+
import { type FontSize, type FontStyle } from './theme-options.js';
|
|
3
|
+
export declare function createFontSizeCssValue(fontSize: Readonly<FontSize>): CSSResult;
|
|
4
|
+
export declare function createFontStyleCss(fontStyle: Readonly<FontStyle>): CSSResult;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { css, unsafeCSS } from 'element-vir';
|
|
2
|
+
export function createFontSizeCssValue(fontSize) {
|
|
3
|
+
if ('pixels' in fontSize) {
|
|
4
|
+
return unsafeCSS(`${fontSize.pixels}px`);
|
|
5
|
+
}
|
|
6
|
+
else if ('ratio' in fontSize) {
|
|
7
|
+
return unsafeCSS(`${fontSize.ratio}em`);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
throw new Error(`Invalid fontSize given: '${JSON.stringify(fontSize)}'`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function createFontStyleCss(fontStyle) {
|
|
14
|
+
return css `
|
|
15
|
+
font-family: ${unsafeCSS(fontStyle.family)};
|
|
16
|
+
font-size: ${createFontSizeCssValue(fontStyle.size)};
|
|
17
|
+
line-height: ${createFontSizeCssValue(fontStyle.lineHeight)};
|
|
18
|
+
font-weight: ${fontStyle.weight};
|
|
19
|
+
`;
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare enum HeadingLevel {
|
|
2
|
+
H1 = "h1",
|
|
3
|
+
H2 = "h2",
|
|
4
|
+
H3 = "h3",
|
|
5
|
+
H4 = "h4",
|
|
6
|
+
H5 = "h5",
|
|
7
|
+
H6 = "h6"
|
|
8
|
+
}
|
|
9
|
+
export type FontSize = {
|
|
10
|
+
pixels: number;
|
|
11
|
+
} | {
|
|
12
|
+
ratio: number;
|
|
13
|
+
};
|
|
14
|
+
export type FontStyle = {
|
|
15
|
+
weight: number;
|
|
16
|
+
family: string;
|
|
17
|
+
lineHeight: FontSize;
|
|
18
|
+
size: FontSize;
|
|
19
|
+
};
|
|
20
|
+
export type RequiredThemeOptions<TagPrefix extends string> = {
|
|
21
|
+
elementTagPrefix: TagPrefix;
|
|
22
|
+
};
|
|
23
|
+
export type OptionalThemeOptions = {
|
|
24
|
+
font?: {
|
|
25
|
+
default: FontStyle;
|
|
26
|
+
bold: FontStyle;
|
|
27
|
+
monospace: FontStyle;
|
|
28
|
+
headings: Record<HeadingLevel, FontStyle>;
|
|
29
|
+
};
|
|
30
|
+
colors?: {
|
|
31
|
+
error: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export type ThemeOptions<TagPrefix extends string> = Required<RequiredThemeOptions<TagPrefix>> & Partial<OptionalThemeOptions>;
|
|
35
|
+
export type AllThemeOptions<TagPrefix extends string> = Required<RequiredThemeOptions<TagPrefix>> & Required<OptionalThemeOptions>;
|
|
36
|
+
export declare function createDefaultThemeOptions(): AllThemeOptions<any>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export var HeadingLevel;
|
|
2
|
+
(function (HeadingLevel) {
|
|
3
|
+
HeadingLevel["H1"] = "h1";
|
|
4
|
+
HeadingLevel["H2"] = "h2";
|
|
5
|
+
HeadingLevel["H3"] = "h3";
|
|
6
|
+
HeadingLevel["H4"] = "h4";
|
|
7
|
+
HeadingLevel["H5"] = "h5";
|
|
8
|
+
HeadingLevel["H6"] = "h6";
|
|
9
|
+
})(HeadingLevel || (HeadingLevel = {}));
|
|
10
|
+
export function createDefaultThemeOptions() {
|
|
11
|
+
const defaultFont = {
|
|
12
|
+
family: 'sans-serif',
|
|
13
|
+
lineHeight: { ratio: 1.1 },
|
|
14
|
+
size: { pixels: 14 },
|
|
15
|
+
weight: 400,
|
|
16
|
+
};
|
|
17
|
+
const bold = {
|
|
18
|
+
...defaultFont,
|
|
19
|
+
weight: 700,
|
|
20
|
+
};
|
|
21
|
+
const allThemeOptions = {
|
|
22
|
+
elementTagPrefix: 'vir',
|
|
23
|
+
colors: {
|
|
24
|
+
error: 'red',
|
|
25
|
+
},
|
|
26
|
+
font: {
|
|
27
|
+
default: defaultFont,
|
|
28
|
+
bold,
|
|
29
|
+
monospace: {
|
|
30
|
+
...defaultFont,
|
|
31
|
+
family: 'monospace',
|
|
32
|
+
size: { ratio: 1.2 },
|
|
33
|
+
},
|
|
34
|
+
headings: {
|
|
35
|
+
h1: {
|
|
36
|
+
...bold,
|
|
37
|
+
size: { ratio: 2 },
|
|
38
|
+
},
|
|
39
|
+
h2: {
|
|
40
|
+
...bold,
|
|
41
|
+
size: { ratio: 1.5 },
|
|
42
|
+
},
|
|
43
|
+
h3: {
|
|
44
|
+
...bold,
|
|
45
|
+
size: { ratio: 1.17 },
|
|
46
|
+
},
|
|
47
|
+
h4: {
|
|
48
|
+
...bold,
|
|
49
|
+
},
|
|
50
|
+
h5: {
|
|
51
|
+
...bold,
|
|
52
|
+
size: { ratio: 0.83 },
|
|
53
|
+
},
|
|
54
|
+
h6: {
|
|
55
|
+
...bold,
|
|
56
|
+
size: { ratio: 0.67 },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
return allThemeOptions;
|
|
62
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type DeclarativeElementDefinition } from 'element-vir';
|
|
2
|
+
import { type HeadingLevel } from './theme-options.js';
|
|
3
|
+
export type Theme<TagPrefix extends string> = {
|
|
4
|
+
elements: {
|
|
5
|
+
bold: DeclarativeElementDefinition<`${TagPrefix}-b`>;
|
|
6
|
+
monospace: DeclarativeElementDefinition<`${TagPrefix}-monospace`>;
|
|
7
|
+
paragraph: DeclarativeElementDefinition<`${TagPrefix}-p`>;
|
|
8
|
+
code: DeclarativeElementDefinition<`${TagPrefix}-code`>;
|
|
9
|
+
heading: DeclarativeElementDefinition<`${TagPrefix}-heading`, {
|
|
10
|
+
headingLevel: HeadingLevel;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { check } from '@augment-vir/assert';
|
|
2
|
+
import { getEnumValues, getObjectTypedKeys } from '@augment-vir/common';
|
|
3
|
+
import { defineBookPage } from 'element-book';
|
|
4
|
+
import { html } from 'element-vir';
|
|
5
|
+
import { HeadingLevel } from '../create-theme/theme-options.js';
|
|
6
|
+
export function createThemeBookPages(theme) {
|
|
7
|
+
const elementsBookPage = defineBookPage({
|
|
8
|
+
title: 'elements',
|
|
9
|
+
parent: undefined,
|
|
10
|
+
});
|
|
11
|
+
const fontEntries = getObjectTypedKeys(theme.elements)
|
|
12
|
+
.map((elementKey) => {
|
|
13
|
+
if (elementKey === 'heading') {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const themeElement = theme.elements[elementKey];
|
|
17
|
+
return defineBookPage({
|
|
18
|
+
title: themeElement.tagName,
|
|
19
|
+
parent: elementsBookPage,
|
|
20
|
+
defineExamples({ defineExample }) {
|
|
21
|
+
defineExample({
|
|
22
|
+
title: 'basic',
|
|
23
|
+
render() {
|
|
24
|
+
return html `
|
|
25
|
+
<${themeElement}>This is ${elementKey}</${themeElement}>
|
|
26
|
+
`;
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
})
|
|
32
|
+
.filter(check.isTruthy);
|
|
33
|
+
return [
|
|
34
|
+
defineBookPage({
|
|
35
|
+
title: theme.elements.heading.tagName,
|
|
36
|
+
parent: elementsBookPage,
|
|
37
|
+
defineExamples({ defineExample }) {
|
|
38
|
+
getEnumValues(HeadingLevel).forEach((headingLevel) => {
|
|
39
|
+
defineExample({
|
|
40
|
+
title: headingLevel,
|
|
41
|
+
render() {
|
|
42
|
+
return html `
|
|
43
|
+
<${theme.elements.heading.assign({
|
|
44
|
+
headingLevel,
|
|
45
|
+
})}>
|
|
46
|
+
This is heading ${headingLevel}
|
|
47
|
+
</${theme.elements.heading}>
|
|
48
|
+
`;
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
...fontEntries,
|
|
55
|
+
].sort((a, b) => a.title.localeCompare(b.title));
|
|
56
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ElementBookApp } from 'element-book';
|
|
2
|
+
import { css, defineElementNoInputs, html } from 'element-vir';
|
|
3
|
+
import { createTheme } from '../create-theme/create-theme.js';
|
|
4
|
+
import { createThemeBookPages } from './theme-book-pages.js';
|
|
5
|
+
export const VirThemeBookApp = defineElementNoInputs({
|
|
6
|
+
tagName: 'vir-theme-book-app',
|
|
7
|
+
styles: css `
|
|
8
|
+
:host {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: 32px;
|
|
12
|
+
min-height: 100%;
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
${ElementBookApp} {
|
|
17
|
+
flex-grow: 1;
|
|
18
|
+
}
|
|
19
|
+
`,
|
|
20
|
+
state() {
|
|
21
|
+
return {
|
|
22
|
+
theme: createTheme({
|
|
23
|
+
elementTagPrefix: 'vir',
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
render({ state }) {
|
|
28
|
+
return html `
|
|
29
|
+
<${ElementBookApp.assign({
|
|
30
|
+
pages: createThemeBookPages(state.theme),
|
|
31
|
+
})}></${ElementBookApp}>
|
|
32
|
+
`;
|
|
33
|
+
},
|
|
34
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "theme-vir",
|
|
3
|
+
"version": "25.6.0",
|
|
4
|
+
"description": "Create an entire web theme.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"design",
|
|
7
|
+
"system",
|
|
8
|
+
"vir",
|
|
9
|
+
"color",
|
|
10
|
+
"theme",
|
|
11
|
+
"elements",
|
|
12
|
+
"custom",
|
|
13
|
+
"components",
|
|
14
|
+
"web",
|
|
15
|
+
"element-vir"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://electrovir.github.io/element-vir/theme-vir",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/electrovir/element-vir/issues"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/electrovir/element-vir.git"
|
|
24
|
+
},
|
|
25
|
+
"license": "(MIT or CC0 1.0)",
|
|
26
|
+
"author": {
|
|
27
|
+
"name": "electrovir",
|
|
28
|
+
"url": "https://github.com/electrovir"
|
|
29
|
+
},
|
|
30
|
+
"type": "module",
|
|
31
|
+
"main": "dist/index.js",
|
|
32
|
+
"module": "dist/index.js",
|
|
33
|
+
"types": "dist/index.d.ts",
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "npm run docs",
|
|
36
|
+
"compile": "virmator compile",
|
|
37
|
+
"docs": "virmator docs",
|
|
38
|
+
"start": "virmator frontend",
|
|
39
|
+
"test": "virmator test web",
|
|
40
|
+
"test:coverage": "npm run test coverage",
|
|
41
|
+
"test:docs": "virmator docs check"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@augment-vir/assert": "^31.20.0",
|
|
45
|
+
"@augment-vir/common": "^31.20.0",
|
|
46
|
+
"lit-css-vars": "^3.0.11",
|
|
47
|
+
"type-fest": "^4.41.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@augment-vir/test": "^31.20.0",
|
|
51
|
+
"@web/dev-server-esbuild": "^1.0.4",
|
|
52
|
+
"@web/test-runner": "^0.20.2",
|
|
53
|
+
"@web/test-runner-commands": "^0.9.0",
|
|
54
|
+
"@web/test-runner-playwright": "^0.11.0",
|
|
55
|
+
"@web/test-runner-visual-regression": "^0.10.0",
|
|
56
|
+
"element-book": "^25.6.0",
|
|
57
|
+
"element-vir": "^25.6.0",
|
|
58
|
+
"esbuild": "^0.25.4",
|
|
59
|
+
"istanbul-smart-text-reporter": "^1.1.5",
|
|
60
|
+
"markdown-code-example-inserter": "^3.0.3",
|
|
61
|
+
"typedoc": "^0.28.4",
|
|
62
|
+
"typescript": "5.8.3",
|
|
63
|
+
"vite": "^6.3.5",
|
|
64
|
+
"vite-tsconfig-paths": "^5.1.4"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"element-book": ">=17",
|
|
68
|
+
"element-vir": ">=17"
|
|
69
|
+
},
|
|
70
|
+
"engines": {
|
|
71
|
+
"node": ">=22"
|
|
72
|
+
},
|
|
73
|
+
"publishConfig": {
|
|
74
|
+
"access": "public"
|
|
75
|
+
}
|
|
76
|
+
}
|