@sharadox/style-web-library 0.1.0 → 0.2.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/LICENSE.md CHANGED
@@ -1,40 +1,40 @@
1
- # Sharadox Open Source Licence
1
+ # Sharadox Open Source License
2
2
 
3
3
  Version 0.1.0
4
4
 
5
- This is an informative English translation. The Portuguese text (`LICENCA.md`) is the only original and binding text of this licence; if the two differ, the Portuguese text prevails.
5
+ This is an informative English translation. The Portuguese text (`LICENCA.md`) is the only original and binding text of this license; if the two differ, the Portuguese text prevails.
6
6
 
7
7
  ## 1. Definitions
8
8
 
9
- For the purposes of this licence:
9
+ For the purposes of this license:
10
10
 
11
- 1. **"Work"** — the computer program, its documentation and any other content made available by the Licensor under this licence, in source code or in any other form.
11
+ 1. **"Work"** — the computer program, its documentation and any other content made available by the Licensor under this license, in source code or in any other form.
12
12
  2. **"Licensor"** — the copyright holder identified in the copyright notice that accompanies the Work.
13
- 3. **"Licensee"** — any natural or legal person exercising the rights granted by this licence.
13
+ 3. **"Licensee"** — any natural or legal person exercising the rights granted by this license.
14
14
  4. **"Derivative Work"** — any work based on or incorporating the Work, in whole or in part, with or without modifications, including translations, adaptations and programs that integrate it.
15
- 5. **"Notice"** — the Licensor's copyright notice and the statement that the Work is licensed under this licence, including its version.
15
+ 5. **"Notice"** — the Licensor's copyright notice and the statement that the Work is licensed under this license, including its version.
16
16
 
17
17
  ## 2. Grant of rights
18
18
 
19
- 1. Under this licence, the Licensor grants the Licensee a worldwide, royalty-free, non-exclusive licence, for the whole term of copyright protection, to:
19
+ 1. Under this license, the Licensor grants the Licensee a worldwide, royalty-free, non-exclusive license, for the whole term of copyright protection, to:
20
20
  1. use the Work for any purpose, including commercial purposes;
21
21
  2. reproduce the Work, in whole or in part, by any means and in any form;
22
22
  3. modify, translate, adapt and transform the Work and create Derivative Works;
23
23
  4. distribute, publish, communicate to the public, make available, sell and sublicense the Work and Derivative Works.
24
- 2. To the extent the Licensor holds patents necessarily infringed by the Work as made available by it, the Licensor also grants the Licensee, on the same terms, a licence to use those patents in exercising the rights in the previous paragraph.
25
- 3. This licence does not transfer ownership of any rights, which remain with the Licensor.
24
+ 2. To the extent the Licensor holds patents necessarily infringed by the Work as made available by it, the Licensor also grants the Licensee, on the same terms, a license to use those patents in exercising the rights in the previous paragraph.
25
+ 3. This license does not transfer ownership of any rights, which remain with the Licensor.
26
26
 
27
27
  ## 3. Conditions
28
28
 
29
29
  The exercise of the rights granted is subject to the following conditions:
30
30
 
31
- 1. Every copy of the Work, or of substantial parts of it, and every distributed Derivative Work must include the Notice and a copy of this licence or a stable link to its text.
31
+ 1. Every copy of the Work, or of substantial parts of it, and every distributed Derivative Work must include the Notice and a copy of this license or a stable link to its text.
32
32
  2. Anyone distributing a modified version of the Work must state visibly that it has been modified and may not present it as the Licensor's original version.
33
- 3. The Licensee may license their own modifications under other terms, provided the part of the Work included in them remains subject to the conditions of this licence.
33
+ 3. The Licensee may license their own modifications under other terms, provided the part of the Work included in them remains subject to the conditions of this license.
34
34
 
35
35
  ## 4. Names and trademarks
36
36
 
37
- This licence grants no rights to the Licensor's name, trademarks, logos or other distinctive signs, including the name "Sharadox", except as strictly necessary to comply with the duty to include the Notice. Using them to promote or suggest the Licensor's endorsement of Derivative Works or of any products or services without prior written permission is prohibited.
37
+ This license grants no rights to the Licensor's name, trademarks, logos or other distinctive signs, including the name "Sharadox", except as strictly necessary to comply with the duty to include the Notice. Using them to promote or suggest the Licensor's endorsement of Derivative Works or of any products or services without prior written permission is prohibited.
38
38
 
39
39
  ## 5. Disclaimer of warranties
40
40
 
@@ -43,29 +43,29 @@ The Work is provided "as is" and "as available", without any warranty, express o
43
43
  ## 6. Limitation of liability
44
44
 
45
45
  1. To the maximum extent permitted by applicable law, the Licensor is not liable for any damages, direct or indirect, including loss of profits, loss of data or business interruption, arising from the use of or inability to use the Work, even if advised of the possibility of such damages.
46
- 2. Nothing in this licence excludes or limits the Licensor's liability where such exclusion or limitation is not permitted by law, in particular for acts committed with intent or gross negligence, under article 809 and article 800(2) of the Portuguese Civil Code, nor does it affect rights that the law mandatorily grants to consumers.
46
+ 2. Nothing in this license excludes or limits the Licensor's liability where such exclusion or limitation is not permitted by law, in particular for acts committed with intent or gross negligence, under article 809 and article 800(2) of the Portuguese Civil Code, nor does it affect rights that the law mandatorily grants to consumers.
47
47
 
48
48
  ## 7. Termination
49
49
 
50
- 1. The rights granted by this licence terminate automatically if the Licensee breaches any of its conditions.
50
+ 1. The rights granted by this license terminate automatically if the Licensee breaches any of its conditions.
51
51
  2. The rights are reinstated if the breach is remedied within 30 days of the Licensee becoming aware of it, unless the Licensor has meanwhile objected in writing.
52
- 3. Termination does not affect licences validly granted by the Licensee to third parties who comply with this licence.
52
+ 3. Termination does not affect licenses validly granted by the Licensee to third parties who comply with this license.
53
53
 
54
54
  ## 8. Governing law and jurisdiction
55
55
 
56
- 1. This licence is governed by Portuguese law, in particular the Code of Copyright and Related Rights, approved by Decree-Law no. 63/85 of 14 March, and Decree-Law no. 252/94 of 20 October on the legal protection of computer programs.
57
- 2. The Judicial Court of the District of Faro has jurisdiction over any dispute arising from this licence, without prejudice to applicable mandatory rules of jurisdiction, in particular those protecting consumers.
56
+ 1. This license is governed by Portuguese law, in particular the Code of Copyright and Related Rights, approved by Decree-Law no. 63/85 of 14 March, and Decree-Law no. 252/94 of 20 October on the legal protection of computer programs.
57
+ 2. The Judicial Court of the District of Faro has jurisdiction over any dispute arising from this license, without prejudice to applicable mandatory rules of jurisdiction, in particular those protecting consumers.
58
58
 
59
- ## 9. Licence versions
59
+ ## 9. License versions
60
60
 
61
- The Licensor may publish new versions of this licence, identified by a version number. The Work is subject to the version stated in the Notice. If the Notice allows it, the Licensee may choose any later version.
61
+ The Licensor may publish new versions of this license, identified by a version number. The Work is subject to the version stated in the Notice. If the Notice allows it, the Licensee may choose any later version.
62
62
 
63
63
  ## 10. Final provisions
64
64
 
65
- 1. If any provision of this licence is held invalid or unenforceable, the remaining provisions stay in force, and the affected provision shall be interpreted as closely as possible to its original intent.
66
- 2. Failure to enforce any provision of this licence at any time does not waive the right to enforce it later.
65
+ 1. If any provision of this license is held invalid or unenforceable, the remaining provisions stay in force, and the affected provision shall be interpreted as closely as possible to its original intent.
66
+ 2. Failure to enforce any provision of this license at any time does not waive the right to enforce it later.
67
67
 
68
- ## How to apply this licence
68
+ ## How to apply this license
69
69
 
70
70
  Include in the Work a `LICENCA.md` file with the Portuguese text, this translation as `LICENSE.md`, and the following notice, filling in the year and holder:
71
71
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @sharadox/style-web-library
2
2
 
3
- Styles (what other projects call themes) for websites, with **several independent style groups at once**: colour (Black, White, Midnight…), corners (sharp, rounded), font family, and so on. Each group has its own options, its default, an optional **System** choice that follows the device's light or dark setting, and a remembered manual choice. Everything is applied before the first paint, so the page never flashes the wrong style.
3
+ Styles (what other projects call themes) for websites, with **several independent style groups at once**: color (Black, White, Midnight…), corners (sharp, rounded), font family, and so on. Each group has its own options, its default, an optional **System** choice that follows the device's light or dark setting, and a remembered manual choice. Everything is applied before the first paint, so the page never flashes the wrong style.
4
4
 
5
5
  ## Install
6
6
 
@@ -57,14 +57,14 @@ CSS uses each palette's keys as variables (`var(--background)`, `var(--radius)`)
57
57
 
58
58
  ## API
59
59
 
60
- | Import | Export |
61
- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
62
- | `…/definition` | `defineStyles(configuration)` (validated), `resolveOption`, `findGroup`, `findOption`, `SYSTEM_STYLE`, `styleAttribute`, `styleChoiceAttribute`, `styleStorageKey` |
63
- | `…/style-script` | `<StyleScript configuration>`, `styleScript(configuration)` (the inline script) |
64
- | `…/style-sheet` | `styleSheet(configuration)` (the CSS) |
65
- | `…/use-style` | `useStyle(configuration, group)` → `{ choice, style, choices, choose }` |
66
- | `…/style-choice` | `styleChoices(group)`: switch order (light options, System, dark options) |
67
- | `…/apply` | `applyStyles`, `styleApplyData` (used by the script) |
60
+ | Import | Export |
61
+ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
62
+ | `…/definition` | `defineStyles(configuration)` (validated), `resolveOption`, `findGroup`, `findOption`, `SYSTEM_STYLE`, `styleAttribute`, `styleChoiceAttribute`, `styleStorageKey` |
63
+ | `…/style-script` | `<StyleScript configuration>`, `styleScript(configuration)` (the inline script); it also renders `StyleKeeper`, so styles survive navigations that replace `<html>` (switching language) |
64
+ | `…/style-sheet` | `styleSheet(configuration)` (the CSS) |
65
+ | `…/use-style` | `useStyle(configuration, group)` → `{ choice, style, choices, choose }` |
66
+ | `…/style-choice` | `styleChoices(group)`: switch order (light options, System, dark options) |
67
+ | `…/apply` | `applyStyles`, `styleApplyData` (used by the script) |
68
68
 
69
69
  **Choosing:**
70
70
 
@@ -76,6 +76,6 @@ CSS uses each palette's keys as variables (`var(--background)`, `var(--radius)`)
76
76
 
77
77
  `pnpm verify` runs formatting, lint, type-check, tests with 100% coverage and the build. Branches follow `<feature>.development` → `development` → `index`, and releases are `v<version>` tags on `index`.
78
78
 
79
- ## Licence
79
+ ## License
80
80
 
81
81
  Licença Sharadox de Código Aberto, versão 0.1.0. See [português](LICENCA.md) (the binding text) and the [English translation](LICENSE.md).
@@ -1,17 +1,17 @@
1
1
  /** Whether a style is dark or light; the device's preference (`prefers-color-scheme`) is one of these. */
2
2
  export type ColorScheme = "dark" | "light";
3
- /** One option of a style group, for example the colour style "black" or the corner style "rounded". */
3
+ /** One option of a style group, for example the color style "black" or the corner style "rounded". */
4
4
  export interface StyleOption {
5
5
  /** Lower-case identifier, stored and written to `<html data-style-<group>>`. */
6
6
  name: string;
7
- /** For colour-like groups: the option's scheme, which also sets CSS `color-scheme`. */
7
+ /** For color-like groups: the option's scheme, which also sets CSS `color-scheme`. */
8
8
  scheme?: ColorScheme;
9
9
  /** CSS custom properties without the leading dashes: `{ background: "#000" }` → `--background: #000`. */
10
10
  palette: Readonly<Record<string, string>>;
11
11
  }
12
12
  /**
13
13
  * An independent style group: its own options, default, remembered choice and `<html>` attribute. A site can
14
- * have several at once (colour, corner, font family…).
14
+ * have several at once (color, corner, font family…).
15
15
  */
16
16
  export interface StyleGroup {
17
17
  /** Lower-case identifier, for example "color"; the attribute is `data-style-<name>`. */
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/definition/type.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3C,uGAAuG;AACvG,MAAM,WAAW,WAAW;IAC1B,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,uFAAuF;IACvF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,yGAAyG;IACzG,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IAChC;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,qFAAqF;IACrF,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,mCAAmC;AACnC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;CAC/B"}
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/definition/type.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3C,sGAAsG;AACtG,MAAM,WAAW,WAAW;IAC1B,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,sFAAsF;IACtF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,yGAAyG;IACzG,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IAChC;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,qFAAqF;IACrF,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,mCAAmC;AACnC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;CAC/B"}
@@ -0,0 +1,11 @@
1
+ import type { StyleKeeperProperties } from "@sharadox/style-web-library/style-keeper/type";
2
+ /**
3
+ * Applies every group's remembered style again whenever it mounts, before the browser paints. Navigating between
4
+ * pages with different root layout parameters (for example `/en` → `/pt`) replaces `<html>`, which drops the
5
+ * attributes the inline script set on the first load; this puts them back without a flash. `StyleScript` renders it.
6
+ *
7
+ * @example
8
+ * <StyleKeeper groups={styleApplyData(STYLES)} />
9
+ */
10
+ export declare function StyleKeeper({ groups }: StyleKeeperProperties): null;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/style-keeper/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAE3F;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,qBAAqB,QAG5D"}
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { useLayoutEffect } from "react";
3
+ import { applyStyles } from "@sharadox/style-web-library/apply";
4
+ /**
5
+ * Applies every group's remembered style again whenever it mounts, before the browser paints. Navigating between
6
+ * pages with different root layout parameters (for example `/en` → `/pt`) replaces `<html>`, which drops the
7
+ * attributes the inline script set on the first load; this puts them back without a flash. `StyleScript` renders it.
8
+ *
9
+ * @example
10
+ * <StyleKeeper groups={styleApplyData(STYLES)} />
11
+ */
12
+ export function StyleKeeper({ groups }) {
13
+ useLayoutEffect(() => applyStyles(groups), [groups]);
14
+ return null;
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/style-keeper/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGhE;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,MAAM,EAAyB;IAC3D,eAAe,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACrD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { StyleGroupData } from "@sharadox/style-web-library/apply/type";
2
+ export interface StyleKeeperProperties {
3
+ /** The style groups, from `styleApplyData(configuration)`. */
4
+ groups: StyleGroupData[];
5
+ }
6
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/style-keeper/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAE7E,MAAM,WAAW,qBAAqB;IACpC,8DAA8D;IAC9D,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/style-keeper/type.ts"],"names":[],"mappings":""}
@@ -7,7 +7,8 @@ import type { StyleScriptProperties } from "@sharadox/style-web-library/style-sc
7
7
  export declare function styleScript(configuration: StyleConfiguration): string;
8
8
  /**
9
9
  * Put in `<head>` (and add `suppressHydrationWarning` to `<html>`): the CSS custom properties of every style, and
10
- * the script that picks each group's style before the first paint.
10
+ * the script that picks each group's style before the first paint, and `StyleKeeper`, which picks it again when a
11
+ * navigation replaces `<html>` (for example switching language).
11
12
  *
12
13
  * @example
13
14
  * <html lang="en" suppressHydrationWarning><head><StyleScript configuration={STYLES} /></head>…</html>
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/style-script/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAE3F;;;GAGG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,kBAAkB,GAAG,MAAM,CAGrE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,aAAa,EAAE,EAAE,qBAAqB,+BAOnE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/style-script/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAE3F;;;GAGG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,kBAAkB,GAAG,MAAM,CAGrE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAAE,aAAa,EAAE,EAAE,qBAAqB,+BAQnE"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { applyStyles, styleApplyData } from "@sharadox/style-web-library/apply";
3
+ import { StyleKeeper } from "@sharadox/style-web-library/style-keeper";
3
4
  import { styleSheet } from "@sharadox/style-web-library/style-sheet";
4
5
  /**
5
6
  * The inline script: applies every group's remembered style before the first paint, then follows the device (for
@@ -11,12 +12,13 @@ export function styleScript(configuration) {
11
12
  }
12
13
  /**
13
14
  * Put in `<head>` (and add `suppressHydrationWarning` to `<html>`): the CSS custom properties of every style, and
14
- * the script that picks each group's style before the first paint.
15
+ * the script that picks each group's style before the first paint, and `StyleKeeper`, which picks it again when a
16
+ * navigation replaces `<html>` (for example switching language).
15
17
  *
16
18
  * @example
17
19
  * <html lang="en" suppressHydrationWarning><head><StyleScript configuration={STYLES} /></head>…</html>
18
20
  */
19
21
  export function StyleScript({ configuration }) {
20
- return (_jsxs(_Fragment, { children: [_jsx("style", { dangerouslySetInnerHTML: { __html: styleSheet(configuration) } }), _jsx("script", { dangerouslySetInnerHTML: { __html: styleScript(configuration) } })] }));
22
+ return (_jsxs(_Fragment, { children: [_jsx("style", { dangerouslySetInnerHTML: { __html: styleSheet(configuration) } }), _jsx("script", { dangerouslySetInnerHTML: { __html: styleScript(configuration) } }), _jsx(StyleKeeper, { groups: styleApplyData(configuration) })] }));
21
23
  }
22
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/style-script/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAIrE;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,aAAiC;IAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACpF,OAAO,yBAAyB,WAAW,CAAC,QAAQ,EAAE,eAAe,IAAI,0RAA0R,CAAC;AACtW,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,aAAa,EAAyB;IAClE,OAAO,CACL,8BACE,gBAAO,uBAAuB,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,aAAa,CAAC,EAAE,GAAI,EACzE,iBAAQ,uBAAuB,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,aAAa,CAAC,EAAE,GAAI,IAC1E,CACJ,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/style-script/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAIrE;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,aAAiC;IAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACpF,OAAO,yBAAyB,WAAW,CAAC,QAAQ,EAAE,eAAe,IAAI,0RAA0R,CAAC;AACtW,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,aAAa,EAAyB;IAClE,OAAO,CACL,8BACE,gBAAO,uBAAuB,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,aAAa,CAAC,EAAE,GAAI,EACzE,iBAAQ,uBAAuB,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,aAAa,CAAC,EAAE,GAAI,EAC3E,KAAC,WAAW,IAAC,MAAM,EAAE,cAAc,CAAC,aAAa,CAAC,GAAI,IACrD,CACJ,CAAC;AACJ,CAAC"}
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # @sharadox/style-web-library
2
2
 
3
- > Multi-group styles (themes) for React/Next.js: each group (colour, corner, font…) has options with CSS-variable palettes, a default, optional "system" (prefers-color-scheme), and a remembered choice; applied pre-paint.
3
+ > Multi-group styles (themes) for React/Next.js: each group (color, corner, font…) has options with CSS-variable palettes, a default, optional "system" (prefers-color-scheme), and a remembered choice; applied pre-paint.
4
4
 
5
5
  - defineStyles({ groups: [{ name, defaultChoice, options: [{ name, scheme?, palette }], systemDefaults?: { dark, light }, fallbackScheme?, storageKey? }] }) from `/definition` (validates)
6
6
  - <StyleScript configuration={STYLES} /> in <head>, with <html suppressHydrationWarning>
@@ -8,4 +8,5 @@
8
8
  - styleChoices(group): order light options, "system", dark options (for switches)
9
9
  - html attributes: data-style-<group>, data-style-<group>-choice; color-scheme set for groups with schemes
10
10
  - Storage: localStorage "style-<group>" (or storageKey); choosing the default removes it
11
- - Licence: Sharadox Open Source Licence 0.1.0
11
+ - License: Sharadox Open Source License 0.1.0
12
+ - /style-keeper StyleKeeper({ groups }) client component re-applying remembered styles on mount (rendered by StyleScript; fixes styles lost when a navigation replaces <html>, e.g. switching locale)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sharadox/style-web-library",
3
- "version": "0.1.0",
4
- "description": "Styles (themes) for websites: several independent style groups (colour, corners, fonts…), each with options, a default, System following the device and a remembered choice, applied before the first paint.",
3
+ "version": "0.2.1",
4
+ "description": "Styles (themes) for websites: several independent style groups (color, corners, fonts…), each with options, a default, System following the device and a remembered choice, applied before the first paint.",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENCA.md",
7
7
  "author": "Sharadox <contact@sharadox.com>",
@@ -31,7 +31,7 @@
31
31
  "**/*.css"
32
32
  ],
33
33
  "engines": {
34
- "node": ">=24"
34
+ "node": ">=26"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"