@sharadox/graphical-user-interface-web-library 0.0.0-stage → 0.1.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.
Files changed (93) hide show
  1. package/LICENCA.md +76 -0
  2. package/LICENSE.md +76 -0
  3. package/NOTICE.md +3 -0
  4. package/README.md +151 -2
  5. package/distribution/box/index.d.ts +14 -0
  6. package/distribution/box/index.d.ts.map +1 -0
  7. package/distribution/box/index.js +49 -0
  8. package/distribution/box/index.js.map +1 -0
  9. package/distribution/box/index.module.css +1 -0
  10. package/distribution/box/index.module.scss +102 -0
  11. package/distribution/box/type.d.ts +51 -0
  12. package/distribution/box/type.d.ts.map +1 -0
  13. package/distribution/box/type.js +2 -0
  14. package/distribution/box/type.js.map +1 -0
  15. package/distribution/box-axis/index.d.ts +24 -0
  16. package/distribution/box-axis/index.d.ts.map +1 -0
  17. package/distribution/box-axis/index.js +114 -0
  18. package/distribution/box-axis/index.js.map +1 -0
  19. package/distribution/box-axis/type.d.ts +15 -0
  20. package/distribution/box-axis/type.d.ts.map +1 -0
  21. package/distribution/box-axis/type.js +2 -0
  22. package/distribution/box-axis/type.js.map +1 -0
  23. package/distribution/button/index.d.ts +15 -0
  24. package/distribution/button/index.d.ts.map +1 -0
  25. package/distribution/button/index.js +42 -0
  26. package/distribution/button/index.js.map +1 -0
  27. package/distribution/button/type.d.ts +37 -0
  28. package/distribution/button/type.d.ts.map +1 -0
  29. package/distribution/button/type.js +2 -0
  30. package/distribution/button/type.js.map +1 -0
  31. package/distribution/button-axis/index.d.ts +13 -0
  32. package/distribution/button-axis/index.d.ts.map +1 -0
  33. package/distribution/button-axis/index.js +13 -0
  34. package/distribution/button-axis/index.js.map +1 -0
  35. package/distribution/choice/index.d.ts +11 -0
  36. package/distribution/choice/index.d.ts.map +1 -0
  37. package/distribution/choice/index.js +35 -0
  38. package/distribution/choice/index.js.map +1 -0
  39. package/distribution/choice/type.d.ts +19 -0
  40. package/distribution/choice/type.d.ts.map +1 -0
  41. package/distribution/choice/type.js +2 -0
  42. package/distribution/choice/type.js.map +1 -0
  43. package/distribution/interface-configuration/index.d.ts +23 -0
  44. package/distribution/interface-configuration/index.d.ts.map +1 -0
  45. package/distribution/interface-configuration/index.js +160 -0
  46. package/distribution/interface-configuration/index.js.map +1 -0
  47. package/distribution/interface-configuration/type.d.ts +83 -0
  48. package/distribution/interface-configuration/type.d.ts.map +1 -0
  49. package/distribution/interface-configuration/type.js +2 -0
  50. package/distribution/interface-configuration/type.js.map +1 -0
  51. package/distribution/interface-style/index.d.ts +11 -0
  52. package/distribution/interface-style/index.d.ts.map +1 -0
  53. package/distribution/interface-style/index.js +14 -0
  54. package/distribution/interface-style/index.js.map +1 -0
  55. package/distribution/interface-style/type.d.ts +6 -0
  56. package/distribution/interface-style/type.d.ts.map +1 -0
  57. package/distribution/interface-style/type.js +2 -0
  58. package/distribution/interface-style/type.js.map +1 -0
  59. package/distribution/interface-styles/index.d.ts +13 -0
  60. package/distribution/interface-styles/index.d.ts.map +1 -0
  61. package/distribution/interface-styles/index.js +37 -0
  62. package/distribution/interface-styles/index.js.map +1 -0
  63. package/distribution/responsive/index.d.ts +10 -0
  64. package/distribution/responsive/index.d.ts.map +1 -0
  65. package/distribution/responsive/index.js +23 -0
  66. package/distribution/responsive/index.js.map +1 -0
  67. package/distribution/responsive/type.d.ts +12 -0
  68. package/distribution/responsive/type.d.ts.map +1 -0
  69. package/distribution/responsive/type.js +2 -0
  70. package/distribution/responsive/type.js.map +1 -0
  71. package/distribution/spinner/index.d.ts +11 -0
  72. package/distribution/spinner/index.d.ts.map +1 -0
  73. package/distribution/spinner/index.js +16 -0
  74. package/distribution/spinner/index.js.map +1 -0
  75. package/distribution/spinner/index.module.css +1 -0
  76. package/distribution/spinner/index.module.scss +41 -0
  77. package/distribution/spinner/type.d.ts +4 -0
  78. package/distribution/spinner/type.d.ts.map +1 -0
  79. package/distribution/spinner/type.js +2 -0
  80. package/distribution/spinner/type.js.map +1 -0
  81. package/distribution/style-sheet/index.d.ts +18 -0
  82. package/distribution/style-sheet/index.d.ts.map +1 -0
  83. package/distribution/style-sheet/index.js +166 -0
  84. package/distribution/style-sheet/index.js.map +1 -0
  85. package/distribution/style-switch/index.d.ts +10 -0
  86. package/distribution/style-switch/index.d.ts.map +1 -0
  87. package/distribution/style-switch/index.js +16 -0
  88. package/distribution/style-switch/index.js.map +1 -0
  89. package/distribution/style-switch/type.d.ts +15 -0
  90. package/distribution/style-switch/type.d.ts.map +1 -0
  91. package/distribution/style-switch/type.js +2 -0
  92. package/distribution/style-switch/type.js.map +1 -0
  93. package/package.json +102 -4
@@ -0,0 +1,83 @@
1
+ /** Whether a color style is light or dark; `inherit` follows the device's preference between them. */
2
+ export type ColorScheme = "light" | "dark";
3
+ /** A value for each color style, by the style's name: `{ white: "220 38 38", black: "255 69 58" }`. */
4
+ export type PerColorStyle = Readonly<Record<string, string>>;
5
+ /**
6
+ * A constant color: its RGB channels (`"220 38 38"`) in each color style, the one source of truth every other value
7
+ * of the color is derived from.
8
+ */
9
+ export interface ConstantColor {
10
+ rgb: PerColorStyle;
11
+ /** A gradient that paints the color's fills in each color style (`linear-gradient(…)`); flat by default. */
12
+ gradient?: PerColorStyle;
13
+ /** The color of text placed on a fill of this color; `foreground` by default. */
14
+ on?: string;
15
+ /** The color whose channels its transparent color (hover backgrounds, borders) uses; itself by default. */
16
+ transparent?: string;
17
+ /** The color its text turns on hover (outlined, transparent, inline); itself by default. */
18
+ hover?: string;
19
+ }
20
+ /**
21
+ * A color that is another color: `brand` is `foreground` unless a brand says otherwise. It takes everything from that
22
+ * color (one name for every color style, or one per color style), and may set its own `on`, `transparent` and `hover`.
23
+ */
24
+ export interface ColorReference {
25
+ of: string | PerColorStyle;
26
+ on?: string;
27
+ transparent?: string;
28
+ hover?: string;
29
+ }
30
+ /** A color, constant or a reference to another. */
31
+ export type ColorDefinition = ConstantColor | ColorReference;
32
+ /** A color style (white, black…), light or dark. */
33
+ export interface ColorStyle {
34
+ scheme: ColorScheme;
35
+ }
36
+ /** One interactive size: every value of it, each pointing to a shared value or a length. */
37
+ export type SizeDefinition = Readonly<Record<string, string>>;
38
+ /**
39
+ * Everything the interface is drawn with. Every value has one source: shared values (`values`) point to the scale,
40
+ * colors to their RGB channels, sizes and styles to shared values; components read only these.
41
+ */
42
+ export interface InterfaceConfiguration {
43
+ /** The color styles, by name; `inherit` (the device's preference) is always there too. */
44
+ colorStyles: Readonly<Record<string, ColorStyle>>;
45
+ /** The color style used for each device preference while the choice is `inherit`. */
46
+ inheritColorStyles: Readonly<Record<ColorScheme, string>>;
47
+ /** The color style before the visitor chooses: `inherit` or a color style's name. */
48
+ defaultColorStyle: string;
49
+ /** Every color, by name (`red`, `foreground`, `brand`…). */
50
+ colors: Readonly<Record<string, ColorDefinition>>;
51
+ /** The corner styles: each one's radius (`square: "0px"`). */
52
+ cornerStyles: Readonly<Record<string, string>>;
53
+ defaultCornerStyle: string;
54
+ /** The line styles: each one's CSS border style (`dashed: "dashed"`). */
55
+ lineStyles: Readonly<Record<string, string>>;
56
+ defaultLineStyle: string;
57
+ /** The scale every space, gap, margin, padding and font size is taken from, in pixels. */
58
+ scale: readonly number[];
59
+ /** Widths where a per-breakpoint value starts to apply (mobile first), in pixels. */
60
+ breakpoints: readonly number[];
61
+ /** The interactive sizes (`small`, `medium`, `large`) and their values. */
62
+ sizes: Readonly<Record<string, SizeDefinition>>;
63
+ defaultSize: string;
64
+ /** Every other shared value, without its leading dashes: `"transparent-color-rgb-alpha": "10%"`. */
65
+ values: Readonly<Record<string, string>>;
66
+ }
67
+ /** What a brand changes: any part of the configuration, merged over the defaults one level deep per entry. */
68
+ export interface InterfaceOverrides {
69
+ colorStyles?: Readonly<Record<string, ColorStyle>>;
70
+ inheritColorStyles?: Partial<Record<ColorScheme, string>>;
71
+ defaultColorStyle?: string;
72
+ colors?: Readonly<Record<string, ColorDefinition>>;
73
+ cornerStyles?: Readonly<Record<string, string>>;
74
+ defaultCornerStyle?: string;
75
+ lineStyles?: Readonly<Record<string, string>>;
76
+ defaultLineStyle?: string;
77
+ scale?: readonly number[];
78
+ breakpoints?: readonly number[];
79
+ sizes?: Readonly<Record<string, SizeDefinition>>;
80
+ defaultSize?: string;
81
+ values?: Readonly<Record<string, string>>;
82
+ }
83
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/interface-configuration/type.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,uGAAuG;AACvG,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,aAAa,CAAC;IACnB,4GAA4G;IAC5G,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,iFAAiF;IACjF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2GAA2G;IAC3G,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4FAA4F;IAC5F,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,GAAG,aAAa,CAAC;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,mDAAmD;AACnD,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,cAAc,CAAC;AAE7D,oDAAoD;AACpD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,4FAA4F;AAC5F,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9D;;;GAGG;AACH,MAA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AQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IACnD,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/interface-configuration/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { InterfaceStyleProperties } from "@sharadox/graphical-user-interface-web-library/interface-style/type";
2
+ /**
3
+ * The interface's style sheet, written once into the page (in the root layout's `<head>`): every value, color style,
4
+ * corner, line, size and variant rule, from the brand's configuration. Libraries never import global CSS; this is
5
+ * the one place the interface's shared rules come from.
6
+ *
7
+ * @example
8
+ * <head><StyleScript configuration={STYLES} /><InterfaceStyle configuration={INTERFACE} /></head>
9
+ */
10
+ export declare function InterfaceStyle({ configuration }: InterfaceStyleProperties): import("react").JSX.Element;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/interface-style/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qEAAqE,CAAC;AAEpH;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,aAAa,EAAE,EAAE,wBAAwB,+BAEzE"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { interfaceStyleSheet } from "@sharadox/graphical-user-interface-web-library/style-sheet";
3
+ /**
4
+ * The interface's style sheet, written once into the page (in the root layout's `<head>`): every value, color style,
5
+ * corner, line, size and variant rule, from the brand's configuration. Libraries never import global CSS; this is
6
+ * the one place the interface's shared rules come from.
7
+ *
8
+ * @example
9
+ * <head><StyleScript configuration={STYLES} /><InterfaceStyle configuration={INTERFACE} /></head>
10
+ */
11
+ export function InterfaceStyle({ configuration }) {
12
+ return _jsx("style", { "data-interface-style": "", dangerouslySetInnerHTML: { __html: interfaceStyleSheet(configuration) } });
13
+ }
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/interface-style/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4DAA4D,CAAC;AAGjG;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,aAAa,EAA4B;IACxE,OAAO,wCAA4B,EAAE,EAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,mBAAmB,CAAC,aAAa,CAAC,EAAE,GAAI,CAAC;AACpH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { InterfaceConfiguration } from "@sharadox/graphical-user-interface-web-library/interface-configuration/type";
2
+ export interface InterfaceStyleProperties {
3
+ /** The brand's interface (`defineInterface(…)`). */
4
+ configuration: InterfaceConfiguration;
5
+ }
6
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/interface-style/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6EAA6E,CAAC;AAE1H,MAAM,WAAW,wBAAwB;IACvC,oDAAoD;IACpD,aAAa,EAAE,sBAAsB,CAAC;CACvC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/interface-style/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import type { StyleConfiguration } from "@sharadox/style-web-library/definition/type";
2
+ import type { InterfaceConfiguration } from "@sharadox/graphical-user-interface-web-library/interface-configuration/type";
3
+ /**
4
+ * The interface's styles as `@sharadox/style-web-library` groups (`color`, `corner`, `line`), so the visitor's choice
5
+ * is remembered and applied before the first paint (`StyleScript`) and switched with `useStyle` or `StyleSwitch`.
6
+ * The values come from `InterfaceStyle`; the groups only carry the names. `inherit` is the library's `system`.
7
+ *
8
+ * @example
9
+ * export const STYLES = interfaceStyles(INTERFACE);
10
+ * <head><StyleScript configuration={STYLES} /><InterfaceStyle configuration={INTERFACE} /></head>
11
+ */
12
+ export declare function interfaceStyles(configuration: InterfaceConfiguration): StyleConfiguration;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/interface-styles/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,6CAA6C,CAAC;AAElG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6EAA6E,CAAC;AAI1H;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,sBAAsB,GAAG,kBAAkB,CAuBzF"}
@@ -0,0 +1,37 @@
1
+ import { defineStyles } from "@sharadox/style-web-library/definition";
2
+ import { INHERIT_COLOR_STYLE } from "@sharadox/graphical-user-interface-web-library/interface-configuration";
3
+ const plain = (names) => names.map((name) => ({ name, palette: {} }));
4
+ /**
5
+ * The interface's styles as `@sharadox/style-web-library` groups (`color`, `corner`, `line`), so the visitor's choice
6
+ * is remembered and applied before the first paint (`StyleScript`) and switched with `useStyle` or `StyleSwitch`.
7
+ * The values come from `InterfaceStyle`; the groups only carry the names. `inherit` is the library's `system`.
8
+ *
9
+ * @example
10
+ * export const STYLES = interfaceStyles(INTERFACE);
11
+ * <head><StyleScript configuration={STYLES} /><InterfaceStyle configuration={INTERFACE} /></head>
12
+ */
13
+ export function interfaceStyles(configuration) {
14
+ const { colorStyles, defaultColorStyle, inheritColorStyles } = configuration;
15
+ const color = {
16
+ name: "color",
17
+ defaultChoice: defaultColorStyle === INHERIT_COLOR_STYLE ? "system" : defaultColorStyle,
18
+ systemDefaults: { light: inheritColorStyles.light, dark: inheritColorStyles.dark },
19
+ options: Object.entries(colorStyles).map(([name, style]) => ({ name, scheme: style.scheme, palette: {} })),
20
+ };
21
+ return defineStyles({
22
+ groups: [
23
+ color,
24
+ {
25
+ name: "corner",
26
+ defaultChoice: configuration.defaultCornerStyle,
27
+ options: plain(Object.keys(configuration.cornerStyles)),
28
+ },
29
+ {
30
+ name: "line",
31
+ defaultChoice: configuration.defaultLineStyle,
32
+ options: plain(Object.keys(configuration.lineStyles)),
33
+ },
34
+ ],
35
+ });
36
+ }
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/interface-styles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wEAAwE,CAAC;AAG7G,MAAM,KAAK,GAAG,CAAC,KAAe,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AAEhF;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,aAAqC;IACnE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,GAAG,aAAa,CAAC;IAC7E,MAAM,KAAK,GAAe;QACxB,IAAI,EAAE,OAAO;QACb,aAAa,EAAE,iBAAiB,KAAK,mBAAmB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAiB;QACvF,cAAc,EAAE,EAAE,KAAK,EAAE,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,kBAAkB,CAAC,IAAI,EAAE;QAClF,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;KAC3G,CAAC;IACF,OAAO,YAAY,CAAC;QAClB,MAAM,EAAE;YACN,KAAK;YACL;gBACE,IAAI,EAAE,QAAQ;gBACd,aAAa,EAAE,aAAa,CAAC,kBAAkB;gBAC/C,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;aACxD;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,aAAa,EAAE,aAAa,CAAC,gBAAgB;gBAC7C,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;aACtD;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Responsive } from "@sharadox/graphical-user-interface-web-library/responsive/type";
2
+ /**
3
+ * The attributes that carry a value, or a value per breakpoint, to the interface's style sheet: `data-size` for every
4
+ * width, `data-size-960` from 960 pixels wide. `fallback` is the base when none is given.
5
+ *
6
+ * @example
7
+ * responsiveAttributes("data-size", { base: "small", 960: "large" }); // { "data-size": "small", "data-size-960": "large" }
8
+ */
9
+ export declare function responsiveAttributes<Value extends string | number>(name: string, value: Responsive<Value> | undefined, fallback?: Value): Record<string, string>;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/responsive/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gEAAgE,CAAC;AAEjG;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAChE,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,SAAS,EACpC,QAAQ,CAAC,EAAE,KAAK,GACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYxB"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The attributes that carry a value, or a value per breakpoint, to the interface's style sheet: `data-size` for every
3
+ * width, `data-size-960` from 960 pixels wide. `fallback` is the base when none is given.
4
+ *
5
+ * @example
6
+ * responsiveAttributes("data-size", { base: "small", 960: "large" }); // { "data-size": "small", "data-size-960": "large" }
7
+ */
8
+ export function responsiveAttributes(name, value, fallback) {
9
+ const attributes = {};
10
+ if (value === undefined || typeof value !== "object") {
11
+ const base = value ?? fallback;
12
+ if (base !== undefined)
13
+ attributes[name] = String(base);
14
+ return attributes;
15
+ }
16
+ const { base = fallback, ...breakpoints } = value;
17
+ if (base !== undefined)
18
+ attributes[name] = String(base);
19
+ for (const width of Object.keys(breakpoints).sort((first, second) => Number(first) - Number(second)))
20
+ attributes[`${name}-${width}`] = String(breakpoints[Number(width)]);
21
+ return attributes;
22
+ }
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/responsive/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,KAAoC,EACpC,QAAgB;IAEhB,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,KAAK,IAAI,QAAQ,CAAC;QAC/B,IAAI,IAAI,KAAK,SAAS;YAAE,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACxD,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,MAAM,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK,CAAC;IAClD,IAAI,IAAI,KAAK,SAAS;QAAE,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACxD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAClG,UAAU,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtE,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** A breakpoint a value can start at, in pixels (mobile first). */
2
+ export type Breakpoint = number;
3
+ /**
4
+ * One value for every width, or a value per breakpoint (mobile first): `"small"`, or
5
+ * `{ base: "small", 960: "large" }` (small, then large from 960 pixels wide).
6
+ */
7
+ export type Responsive<Value extends string | number> = Value | ({
8
+ base?: Value;
9
+ } & {
10
+ [width: Breakpoint]: Value;
11
+ });
12
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/responsive/type.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI,KAAK,GAAG,CAAC;IAAE,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAAA;CAAE,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/responsive/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { SpinnerProperties } from "@sharadox/graphical-user-interface-web-library/spinner/type";
2
+ /**
3
+ * The loading spinner: eight bars in a circle, each lighting up one after another clockwise and fading, so it leaves a
4
+ * trail. It is the size of the text around it (`1em`), in its color, and hidden from screen readers (the busy element
5
+ * says it is busy).
6
+ *
7
+ * @example
8
+ * <Spinner />
9
+ */
10
+ export declare function Spinner({ className }: SpinnerProperties): import("react").JSX.Element;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/spinner/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6DAA6D,CAAC;AAKrG;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,EAAE,SAAS,EAAE,EAAE,iBAAiB,+BAQvD"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { classNames } from "@sharadox/web-library/class-name";
3
+ import styles from "./index.module.css";
4
+ const BARS = Array.from({ length: 8 }, (_, bar) => bar);
5
+ /**
6
+ * The loading spinner: eight bars in a circle, each lighting up one after another clockwise and fading, so it leaves a
7
+ * trail. It is the size of the text around it (`1em`), in its color, and hidden from screen readers (the busy element
8
+ * says it is busy).
9
+ *
10
+ * @example
11
+ * <Spinner />
12
+ */
13
+ export function Spinner({ className }) {
14
+ return (_jsx("span", { className: classNames(styles.spinner, className), "data-spinner": "", "aria-hidden": "true", children: BARS.map((bar) => (_jsx("span", { className: styles.bar, style: { "--spinner-bar": String(bar) } }, bar))) }));
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/spinner/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,SAAS,EAAqB;IACtD,OAAO,CACL,eAAM,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,kBAAe,EAAE,iBAAa,MAAM,YACvF,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACjB,eAAgB,SAAS,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,eAAe,EAAE,MAAM,CAAC,GAAG,CAAC,EAAmB,IAApF,GAAG,CAAqF,CACpG,CAAC,GACG,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ :where(.spinner){position:relative;display:inline-block;flex:none;inline-size:1em;block-size:1em;color:inherit}:where(.bar){position:absolute;inset-block-start:0;inset-inline-start:calc(50% - .0625em);inline-size:.125em;block-size:.3em;border-radius:.0625em;background:currentcolor;transform:rotate(calc(var(--spinner-bar) * 45deg));transform-origin:50% .5em;opacity:.15;animation:trail var(--spinner-duration) linear infinite;animation-delay:calc(var(--spinner-bar)*var(--spinner-duration)/8 - var(--spinner-duration))}@keyframes trail{0%{opacity:1}100%{opacity:.15}}@media(prefers-reduced-motion: reduce){:where(.bar){animation-duration:calc(var(--spinner-duration)*2)}}
@@ -0,0 +1,41 @@
1
+ :where(.spinner) {
2
+ position: relative;
3
+ display: inline-block;
4
+ flex: none;
5
+ inline-size: 1em;
6
+ block-size: 1em;
7
+ color: inherit;
8
+ }
9
+
10
+ :where(.bar) {
11
+ position: absolute;
12
+ inset-block-start: 0;
13
+ inset-inline-start: calc(50% - 0.0625em);
14
+ inline-size: 0.125em;
15
+ block-size: 0.3em;
16
+ border-radius: 0.0625em;
17
+ background: currentcolor;
18
+ transform: rotate(calc(var(--spinner-bar) * 45deg));
19
+ transform-origin: 50% 0.5em;
20
+ opacity: 0.15;
21
+ // Each bar starts one eighth of the turn after the one before it: the light runs clockwise and leaves a trail.
22
+ animation: trail var(--spinner-duration) linear infinite;
23
+ animation-delay: calc(var(--spinner-bar) * var(--spinner-duration) / 8 - var(--spinner-duration));
24
+ }
25
+
26
+ @keyframes trail {
27
+ 0% {
28
+ opacity: 1;
29
+ }
30
+
31
+ 100% {
32
+ opacity: 0.15;
33
+ }
34
+ }
35
+
36
+ @media (prefers-reduced-motion: reduce) {
37
+ :where(.bar) {
38
+ // Still moving (it means "busy"), but slower.
39
+ animation-duration: calc(var(--spinner-duration) * 2);
40
+ }
41
+ }
@@ -0,0 +1,4 @@
1
+ export interface SpinnerProperties {
2
+ className?: string;
3
+ }
4
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/spinner/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/spinner/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import type { InterfaceConfiguration } from "@sharadox/graphical-user-interface-web-library/interface-configuration/type";
2
+ /**
3
+ * The whole interface as CSS, from its configuration alone. Each value has one source:
4
+ * - the root holds the shared values, the scale, the breakpoints, every size, corner and line, and the defaults;
5
+ * - each color style (`[data-style-color="black"]`, also on any element, and `inherit`, which follows the device) holds
6
+ * only its sources: the constant colors' channels and the colors it chooses;
7
+ * - every scope derives every value of every color from them (`--red-color`, `--red-transparent-color`,
8
+ * `--red-border-color`, `--red-on-color`, `--red-color-paint`…), so switching a style changes only the sources;
9
+ * - `[data-color="red"]` points a component's `--current-*` values at red, derived on the component, so overriding a
10
+ * shared value (an alpha) on one component changes only that component;
11
+ * - `data-style-corner`, `data-style-line` and `data-size` switch their values the same way;
12
+ * - every attribute has a version per breakpoint (`data-color-960`), mobile first.
13
+ *
14
+ * @example
15
+ * <style>{interfaceStyleSheet(defineInterface({ colors: { brand: { of: "blue" } } }))}</style>
16
+ */
17
+ export declare function interfaceStyleSheet(configuration: InterfaceConfiguration): string;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/style-sheet/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,6EAA6E,CAAC;AA6IrF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,sBAAsB,GAAG,MAAM,CAoDjF"}
@@ -0,0 +1,166 @@
1
+ import { INHERIT_COLOR_STYLE, isReference, } from "@sharadox/graphical-user-interface-web-library/interface-configuration";
2
+ import { BOX_INITIAL_VALUES, boxAxes } from "@sharadox/graphical-user-interface-web-library/box-axis";
3
+ /** The parts of a color that a reference takes from the color it points to, unless it sets them itself. */
4
+ const PARTS = ["transparent", "on", "hover"];
5
+ const block = (selector, declarations) => `${selector}{${declarations.join(";")}}`;
6
+ const media = (query, rules) => `@media ${query}{${rules.join("")}}`;
7
+ const attribute = (name, breakpoint) => (breakpoint ? `${name}-${breakpoint}` : name);
8
+ const select = (name, value, breakpoint) => `[${attribute(name, breakpoint)}="${value}"]`;
9
+ /** The source of a color's part (`on`, `transparent`, `hover`) when the color itself names it. */
10
+ function ownPart(name, color, part) {
11
+ const chosen = color[part];
12
+ if (chosen)
13
+ return `--${name}-${part}-color-rgb:var(--${chosen}-color-rgb)`;
14
+ if (isReference(color))
15
+ return undefined;
16
+ const fallback = { on: "foreground", transparent: name, hover: name }[part];
17
+ return `--${name}-${part}-color-rgb:var(--${fallback}-color-rgb)`;
18
+ }
19
+ /** What a reference takes from the color it points to: its channels, its gradient and every part it doesn't set. */
20
+ function referenceDeclarations(name, color, target) {
21
+ return [
22
+ `--${name}-color-rgb:var(--${target}-color-rgb)`,
23
+ `--${name}-color-gradient:var(--${target}-color-gradient)`,
24
+ ...PARTS.filter((part) => !color[part]).map((part) => `--${name}-${part}-color-rgb:var(--${target}-${part}-color-rgb)`),
25
+ ];
26
+ }
27
+ /** A color style's sources: each constant color's channels and gradient, and the colors chosen per style. */
28
+ function colorStyleDeclarations(configuration, style) {
29
+ const declarations = [`color-scheme:${configuration.colorStyles[style].scheme}`];
30
+ for (const [name, color] of Object.entries(configuration.colors)) {
31
+ if (!isReference(color)) {
32
+ declarations.push(`--${name}-color-rgb:${color.rgb[style]}`);
33
+ if (color.gradient?.[style])
34
+ declarations.push(`--${name}-color-gradient:${color.gradient[style]}`);
35
+ }
36
+ else if (typeof color.of !== "string") {
37
+ declarations.push(...referenceDeclarations(name, color, color.of[style]));
38
+ }
39
+ }
40
+ return declarations;
41
+ }
42
+ /** Every value of a color, derived in each scope from its sources, so a style switched anywhere reaches them all. */
43
+ function derivedDeclarations(name, color) {
44
+ const color_ = `--${name}`;
45
+ const fixedReference = isReference(color) && typeof color.of === "string" ? color.of : undefined;
46
+ return [
47
+ ...(fixedReference ? referenceDeclarations(name, color, fixedReference) : []),
48
+ ...PARTS.map((part) => ownPart(name, color, part)).filter((declaration) => declaration !== undefined),
49
+ `${color_}-color-rgb-alpha:var(--color-rgb-alpha)`,
50
+ `${color_}-color:rgb(var(${color_}-color-rgb) / var(${color_}-color-rgb-alpha))`,
51
+ `${color_}-transparent-color-rgb-alpha:var(--transparent-color-rgb-alpha)`,
52
+ `${color_}-transparent-color:rgb(var(${color_}-transparent-color-rgb) / var(${color_}-transparent-color-rgb-alpha))`,
53
+ ...["hover", "active"].flatMap((state) => [
54
+ `${color_}-transparent-${state}-color-rgb-alpha:var(--transparent-${state}-color-rgb-alpha)`,
55
+ `${color_}-transparent-${state}-color:rgb(var(${color_}-transparent-color-rgb) / var(${color_}-transparent-${state}-color-rgb-alpha))`,
56
+ ]),
57
+ `${color_}-border-color:var(${color_}-transparent-color)`,
58
+ `${color_}-on-color:rgb(var(${color_}-on-color-rgb))`,
59
+ `${color_}-hover-color:rgb(var(${color_}-hover-color-rgb) / var(${color_}-color-rgb-alpha))`,
60
+ `${color_}-color-paint:var(${color_}-color-gradient, linear-gradient(var(${color_}-color), var(${color_}-color)))`,
61
+ ];
62
+ }
63
+ /** The same values for the color a component wears (`--current-*`), derived on the component itself. */
64
+ const CURRENT = derivedDeclarations("current", { rgb: {} }).filter((declaration) => !/^--current-(on|transparent|hover)-color-rgb:/.test(declaration));
65
+ /** Points a component's current values at one color. */
66
+ const currentColor = (name) => [
67
+ `--current-color-rgb:var(--${name}-color-rgb)`,
68
+ `--current-color-gradient:var(--${name}-color-gradient)`,
69
+ ...PARTS.map((part) => `--current-${part}-color-rgb:var(--${name}-${part}-color-rgb)`),
70
+ ];
71
+ const declare = (declarations) => Object.entries(declarations).map(([name, value]) => `--${name}:${value}`);
72
+ /**
73
+ * One axis's rules: each value at rest, then hovered and pressed on interactive boxes, whether the state is real or
74
+ * forced (`data-state="hover"`). Hover and pressed repeat the rest values under theirs, so a breakpoint's value
75
+ * replaces the base value's whole look.
76
+ */
77
+ function axisRules(axis, breakpoint) {
78
+ const rules = [];
79
+ // When any value changes on hover, every value writes its hover rules: a breakpoint's value must beat the base
80
+ // value's hover rules, which are more specific than its own rest rule.
81
+ const stateful = Object.values(axis.values).some((value) => value.hover || value.active);
82
+ for (const [name, value] of Object.entries(axis.values)) {
83
+ const selector = select(axis.attribute, name, breakpoint);
84
+ rules.push(block(selector, declare(value.rest)));
85
+ const hover = declare({ ...value.rest, ...value.hover });
86
+ const active = declare({ ...value.rest, ...value.hover, ...value.active });
87
+ if (!stateful)
88
+ continue;
89
+ rules.push(block(`[data-interactive][data-state="hover"]${selector}`, hover));
90
+ rules.push(media("(hover:hover)", [block(`[data-interactive][data-state="enabled"]:hover${selector}`, hover)]));
91
+ rules.push(block(`[data-interactive][data-state="active"]${selector},[data-interactive][data-state="enabled"]:active${selector}`, active));
92
+ }
93
+ return rules;
94
+ }
95
+ /** The rules that depend on an attribute's value, for the base attribute or one breakpoint's. */
96
+ function attributeRules(configuration, breakpoint) {
97
+ const { colorStyles, inheritColorStyles } = configuration;
98
+ const rules = Object.keys(colorStyles).map((style) => block(select("data-style-color", style, breakpoint), colorStyleDeclarations(configuration, style)));
99
+ const inherit = select("data-style-color", INHERIT_COLOR_STYLE, breakpoint);
100
+ rules.push(block(inherit, colorStyleDeclarations(configuration, inheritColorStyles.light)));
101
+ rules.push(media("(prefers-color-scheme:dark)", [
102
+ block(inherit, colorStyleDeclarations(configuration, inheritColorStyles.dark)),
103
+ ]));
104
+ for (const name of Object.keys(configuration.colors))
105
+ rules.push(block(select("data-color", name, breakpoint), currentColor(name)));
106
+ for (const name of Object.keys(configuration.cornerStyles))
107
+ rules.push(block(select("data-style-corner", name, breakpoint), [`--corner-radius:var(--${name}-corner-radius)`]));
108
+ for (const name of Object.keys(configuration.lineStyles))
109
+ rules.push(block(select("data-style-line", name, breakpoint), [`--line-style:var(--${name}-line-style)`]));
110
+ for (const [name, size] of Object.entries(configuration.sizes))
111
+ rules.push(block(select("data-size", name, breakpoint), Object.keys(size).map((key) => `--current-${key}:var(--${name}-${key})`)));
112
+ for (const axis of boxAxes(configuration.scale))
113
+ rules.push(...axisRules(axis, breakpoint));
114
+ return rules;
115
+ }
116
+ /**
117
+ * The whole interface as CSS, from its configuration alone. Each value has one source:
118
+ * - the root holds the shared values, the scale, the breakpoints, every size, corner and line, and the defaults;
119
+ * - each color style (`[data-style-color="black"]`, also on any element, and `inherit`, which follows the device) holds
120
+ * only its sources: the constant colors' channels and the colors it chooses;
121
+ * - every scope derives every value of every color from them (`--red-color`, `--red-transparent-color`,
122
+ * `--red-border-color`, `--red-on-color`, `--red-color-paint`…), so switching a style changes only the sources;
123
+ * - `[data-color="red"]` points a component's `--current-*` values at red, derived on the component, so overriding a
124
+ * shared value (an alpha) on one component changes only that component;
125
+ * - `data-style-corner`, `data-style-line` and `data-size` switch their values the same way;
126
+ * - every attribute has a version per breakpoint (`data-color-960`), mobile first.
127
+ *
128
+ * @example
129
+ * <style>{interfaceStyleSheet(defineInterface({ colors: { brand: { of: "blue" } } }))}</style>
130
+ */
131
+ export function interfaceStyleSheet(configuration) {
132
+ const { defaultColorStyle, inheritColorStyles, breakpoints } = configuration;
133
+ const root = [
134
+ ...configuration.scale.map((step) => `--scale-${step}:${step}px`),
135
+ ...breakpoints.map((breakpoint) => `--breakpoint-${breakpoint}:${breakpoint}px`),
136
+ ...Object.entries(configuration.values).map(([name, value]) => `--${name}:${value}`),
137
+ ...Object.entries(configuration.cornerStyles).map(([name, radius]) => `--${name}-corner-radius:${radius}`),
138
+ ...Object.entries(configuration.lineStyles).map(([name, style]) => `--${name}-line-style:${style}`),
139
+ ...Object.entries(configuration.sizes).flatMap(([name, size]) => Object.entries(size).map(([key, value]) => `--${name}-${key}:${value}`)),
140
+ `--corner-radius:var(--${configuration.defaultCornerStyle}-corner-radius)`,
141
+ `--line-style:var(--${configuration.defaultLineStyle}-line-style)`,
142
+ ...Object.keys(configuration.sizes[configuration.defaultSize]).map((key) => `--current-${key}:var(--${configuration.defaultSize}-${key})`),
143
+ ];
144
+ const inherit = defaultColorStyle === INHERIT_COLOR_STYLE;
145
+ const starting = inherit ? inheritColorStyles.light : defaultColorStyle;
146
+ const scope = [":root", "[data-style-color]", ...breakpoints.map((breakpoint) => `[data-style-color-${breakpoint}]`)];
147
+ const rules = [
148
+ // A box's values stay on the box: one inside another starts plain, not with its parent's border or background.
149
+ ...Object.entries(BOX_INITIAL_VALUES).map(([name, value]) => `@property --${name}{syntax:"*";inherits:false;initial-value:${value}}`),
150
+ block(":root", root),
151
+ block(`:root,${select("data-style-color", starting)}`, colorStyleDeclarations(configuration, starting)),
152
+ ...attributeRules(configuration).filter((rule) => !rule.startsWith(`${select("data-style-color", starting)}{`)),
153
+ ];
154
+ if (inherit)
155
+ rules.push(media("(prefers-color-scheme:dark)", [
156
+ block(":root:not([data-style-color])", colorStyleDeclarations(configuration, inheritColorStyles.dark)),
157
+ ]));
158
+ rules.push(block(scope.join(","), Object.entries(configuration.colors).flatMap(([name, color]) => derivedDeclarations(name, color))));
159
+ const styleScopes = scope.slice(1);
160
+ rules.push(block(`:root,${styleScopes.map((selector) => `${selector}:not([data-color])`).join(",")}`, currentColor("foreground")));
161
+ rules.push(block([":root", "[data-color]", ...styleScopes].join(","), CURRENT));
162
+ for (const breakpoint of breakpoints)
163
+ rules.push(media(`(min-width:${breakpoint}px)`, attributeRules(configuration, breakpoint)));
164
+ return rules.join("\n");
165
+ }
166
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/style-sheet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,WAAW,GACZ,MAAM,wEAAwE,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,yDAAyD,CAAC;AAOtG,2GAA2G;AAC3G,MAAM,KAAK,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,OAAO,CAAU,CAAC;AAItD,MAAM,KAAK,GAAG,CAAC,QAAgB,EAAE,YAA0B,EAAE,EAAE,CAAC,GAAG,QAAQ,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC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H,CAAC;IACJ,KAAK,CAAC,IAAI,CACR,KAAK,CACH,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EACf,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAClG,CACF,CAAC;IACF,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,KAAK,CAAC,IAAI,CACR,KAAK,CACH,SAAS,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,QAAQ,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EACnF,YAAY,CAAC,YAAY,CAAC,CAC3B,CACF,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAChF,KAAK,MAAM,UAAU,IAAI,WAAW;QAClC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,UAAU,KAAK,EAAE,cAAc,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAC9F,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { StyleSwitchProperties } from "@sharadox/graphical-user-interface-web-library/style-switch/type";
2
+ /**
3
+ * A switch for one style group (color, corner, line…): a `Choice` of its options, the chosen one filled. The choice
4
+ * applies to the whole page at once and is remembered.
5
+ *
6
+ * @example
7
+ * <StyleSwitch configuration={STYLES} group="color" label="Color" labels={{ system: "Inherit", white: "White", black: "Black" }} />
8
+ */
9
+ export declare function StyleSwitch({ configuration, group, label, labels, size, className }: StyleSwitchProperties): import("react").JSX.Element;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/style-switch/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kEAAkE,CAAC;AAE9G;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAW,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,qBAAqB,+BAY/G"}