@gaine/core 0.0.0-stage → 0.0.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 ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 SoTeen Studio
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # Temporary Holding Version
1
+ # @gaine/core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Framework-free core for Gaine (`@gaine/nextjs` and `@gaine/vitepress`), with no React or Vue lock-in.
4
+
5
+ Docs: [https://gaine.soteenstudio.my.id](https://gaine.soteenstudio.my.id)
6
+
7
+ ```ts
8
+ import {
9
+ cn,
10
+ reveal,
11
+ revealInitScript,
12
+ themeInitScript,
13
+ applyTheme,
14
+ toggleTheme,
15
+ defineLocales,
16
+ detectLocale,
17
+ } from "@gaine/core";
18
+ import { gainePreset, gaineContent } from "@gaine/core/tailwind";
19
+ import "@gaine/core/reveal.css";
20
+ ```
21
+
22
+ ## What is inside
23
+
24
+ - **Theme & reveal**: `themeInitScript`, `revealInitScript`, `applyTheme`, `toggleTheme`, and `reveal()` (returns `{ "data-reveal", style }`; pair with `reveal.css`).
25
+ - **Locale & class helpers**: `defineLocales`, `detectLocale`, and `cn`.
26
+ - **Tailwind preset**: `gainePreset()` and `gaineContent` from `@gaine/core/tailwind` (optional `tailwindcss` ^3.4.17 peer dep).
27
+ - **Speed (`@gaine/core/speed`)**: Shared performance and header helpers, Node build checks under `@gaine/core/speed/node` (`measureBuild`, `checkBudget`), and optional stylesheets (`speed.css`, `view-transition.css`).
28
+
29
+ UI components live in the framework packages (`@gaine/nextjs` and `@gaine/vitepress`). Check the root README for full usage details.
30
+
31
+ ## Dev
32
+
33
+ ```bash
34
+ pnpm --filter @gaine/core build && pnpm --filter @gaine/core test
35
+ ```
@@ -0,0 +1,2 @@
1
+ var s=["/api/*","/_next/*","/assets/*"],a=["[rel~=nofollow]","[rel~=external]","[target=_blank]","[download]","[data-no-prefetch]"];function c(e="/"){let t=e.replace(/^\/+|\/+$/g,"");return t?`/${t}`:""}function i(e={}){let t=c(e.base),r=[{href_matches:`${t}/*`}],o=e.exclude??s.map(n=>`${t}${n}`);for(let n of o)r.push({not:{href_matches:n}});for(let n of e.excludeSelectors??a)r.push({not:{selector_matches:n}});return {[e.action??"prerender"]:[{where:{and:r},eagerness:e.eagerness??"moderate"}]}}function l(e={}){return JSON.stringify(i(e)).replace(/</g,"\\u003c")}export{c as a,i as b,l as c};//# sourceMappingURL=chunk-CWFVLSJN.js.map
2
+ //# sourceMappingURL=chunk-CWFVLSJN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/speed/speculation.ts"],"names":["DEFAULT_EXCLUDE","DEFAULT_SELECTORS","normalizeBase","base","trimmed","speculationRules","options","and","exclude","p","pattern","selector","speculationRulesJson"],"mappings":"AAqCA,IAAMA,CAAAA,CAAkB,CAAC,QAAA,CAAU,UAAA,CAAY,WAAW,CAAA,CACpDC,CAAAA,CAAoB,CACxB,iBAAA,CACA,iBAAA,CACA,iBAAA,CACA,YAAA,CACA,oBACF,CAAA,CAEO,SAASC,CAAAA,CAAcC,CAAAA,CAAO,GAAA,CAAa,CAChD,IAAMC,CAAAA,CAAUD,CAAAA,CAAK,OAAA,CAAQ,YAAA,CAAc,EAAE,CAAA,CAC7C,OAAOC,CAAAA,CAAU,CAAA,CAAA,EAAIA,CAAO,CAAA,CAAA,CAAK,EACnC,CAEO,SAASC,CAAAA,CAAiBC,CAAAA,CAA8B,EAAC,CAAqB,CACnF,IAAMH,CAAAA,CAAOD,CAAAA,CAAcI,CAAAA,CAAQ,IAAI,CAAA,CACjCC,CAAAA,CAAmB,CAAC,CAAE,YAAA,CAAc,CAAA,EAAGJ,CAAI,CAAA,EAAA,CAAK,CAAC,CAAA,CACjDK,CAAAA,CAAUF,CAAAA,CAAQ,OAAA,EAAWN,CAAAA,CAAgB,GAAA,CAAKS,CAAAA,EAAM,CAAA,EAAGN,CAAI,CAAA,EAAGM,CAAC,CAAA,CAAE,CAAA,CAC3E,IAAA,IAAWC,CAAAA,IAAWF,CAAAA,CAASD,CAAAA,CAAI,IAAA,CAAK,CAAE,GAAA,CAAK,CAAE,YAAA,CAAcG,CAAQ,CAAE,CAAC,CAAA,CAC1E,IAAA,IAAWC,KAAYL,CAAAA,CAAQ,gBAAA,EAAoBL,CAAAA,CACjDM,CAAAA,CAAI,IAAA,CAAK,CAAE,GAAA,CAAK,CAAE,gBAAA,CAAkBI,CAAS,CAAE,CAAC,CAAA,CAElD,OAAO,CACL,CAACL,EAAQ,MAAA,EAAU,WAAW,EAAG,CAC/B,CAAE,KAAA,CAAO,CAAE,GAAA,CAAAC,CAAI,CAAA,CAAG,SAAA,CAAWD,CAAAA,CAAQ,SAAA,EAAa,UAAW,CAC/D,CACF,CACF,CAEO,SAASM,CAAAA,CAAqBN,CAAAA,CAA8B,EAAC,CAAW,CAC7E,OAAO,IAAA,CAAK,SAAA,CAAUD,CAAAA,CAAiBC,CAAO,CAAC,CAAA,CAAE,OAAA,CAAQ,IAAA,CAAM,SAAS,CAC1E","file":"chunk-CWFVLSJN.js","sourcesContent":["/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type SpeculationEagerness = \"immediate\" | \"eager\" | \"moderate\" | \"conservative\";\n\nexport interface SpeculationOptions {\n action?: \"prefetch\" | \"prerender\";\n eagerness?: SpeculationEagerness;\n base?: string;\n exclude?: readonly string[];\n excludeSelectors?: readonly string[];\n}\n\ntype Condition =\n | { href_matches: string }\n | { selector_matches: string }\n | { not: Condition }\n | { and: Condition[] };\n\nexport type SpeculationRules = Record<\n string,\n Array<{ where: Condition; eagerness: SpeculationEagerness }>\n>;\n\nconst DEFAULT_EXCLUDE = [\"/api/*\", \"/_next/*\", \"/assets/*\"] as const;\nconst DEFAULT_SELECTORS = [\n \"[rel~=nofollow]\",\n \"[rel~=external]\",\n \"[target=_blank]\",\n \"[download]\",\n \"[data-no-prefetch]\",\n] as const;\n\nexport function normalizeBase(base = \"/\"): string {\n const trimmed = base.replace(/^\\/+|\\/+$/g, \"\");\n return trimmed ? `/${trimmed}` : \"\";\n}\n\nexport function speculationRules(options: SpeculationOptions = {}): SpeculationRules {\n const base = normalizeBase(options.base);\n const and: Condition[] = [{ href_matches: `${base}/*` }];\n const exclude = options.exclude ?? DEFAULT_EXCLUDE.map((p) => `${base}${p}`);\n for (const pattern of exclude) and.push({ not: { href_matches: pattern } });\n for (const selector of options.excludeSelectors ?? DEFAULT_SELECTORS) {\n and.push({ not: { selector_matches: selector } });\n }\n return {\n [options.action ?? \"prerender\"]: [\n { where: { and }, eagerness: options.eagerness ?? \"moderate\" },\n ],\n };\n}\n\nexport function speculationRulesJson(options: SpeculationOptions = {}): string {\n return JSON.stringify(speculationRules(options)).replace(/</g, \"\\\\u003c\");\n}\n"]}
@@ -0,0 +1,2 @@
1
+ var c="theme",a=`(function(){try{var d=document.documentElement;d.classList.add("js");var t=localStorage.getItem("${c}");if(t==="dark"||(t!=="light"&&window.matchMedia("(prefers-color-scheme: dark)").matches)){d.classList.add("dark");}}catch(e){}})();`;function s(){let e=document.documentElement,t=null;try{t=localStorage.getItem(c);}catch{}let o=t==="dark"||t!=="light"&&window.matchMedia("(prefers-color-scheme: dark)").matches;e.classList.add("js"),e.classList.toggle("dark",o);}function r(){let e=document.documentElement,t=e.classList.contains("dark")?"light":"dark";e.classList.toggle("dark",t==="dark");try{localStorage.setItem(c,t);}catch{}}export{c as a,a as b,s as c,r as d};//# sourceMappingURL=chunk-P4PP32UI.js.map
2
+ //# sourceMappingURL=chunk-P4PP32UI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/theme/index.ts"],"names":["THEME_STORAGE_KEY","themeInitScript","applyTheme","root","stored","dark","toggleTheme","next"],"mappings":"AAgBO,IAAMA,EAAoB,OAAA,CAEpBC,CAAAA,CAAkB,CAAA,iGAAA,EAAoGD,CAAiB,wIAE7I,SAASE,CAAAA,EAAa,CAC3B,IAAMC,EAAO,QAAA,CAAS,eAAA,CAClBC,CAAAA,CAAwB,IAAA,CAC5B,GAAI,CACFA,CAAAA,CAAS,YAAA,CAAa,OAAA,CAAQJ,CAAiB,EACjD,CAAA,KAAQ,CAAC,CACT,IAAMK,CAAAA,CACJD,CAAAA,GAAW,MAAA,EACVA,CAAAA,GAAW,SAAW,MAAA,CAAO,UAAA,CAAW,8BAA8B,CAAA,CAAE,OAAA,CAC3ED,EAAK,SAAA,CAAU,GAAA,CAAI,IAAI,CAAA,CACvBA,EAAK,SAAA,CAAU,MAAA,CAAO,MAAA,CAAQE,CAAI,EACpC,CAEO,SAASC,CAAAA,EAAc,CAC5B,IAAMH,CAAAA,CAAO,QAAA,CAAS,gBAChBI,CAAAA,CAAOJ,CAAAA,CAAK,UAAU,QAAA,CAAS,MAAM,CAAA,CAAI,OAAA,CAAU,OACzDA,CAAAA,CAAK,SAAA,CAAU,MAAA,CAAO,MAAA,CAAQI,IAAS,MAAM,CAAA,CAC7C,GAAI,CACF,aAAa,OAAA,CAAQP,CAAAA,CAAmBO,CAAI,EAC9C,CAAA,KAAQ,CAAC,CACX","file":"chunk-P4PP32UI.js","sourcesContent":["/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const THEME_STORAGE_KEY = \"theme\";\n\nexport const themeInitScript = `(function(){try{var d=document.documentElement;d.classList.add(\"js\");var t=localStorage.getItem(\"${THEME_STORAGE_KEY}\");if(t===\"dark\"||(t!==\"light\"&&window.matchMedia(\"(prefers-color-scheme: dark)\").matches)){d.classList.add(\"dark\");}}catch(e){}})();`;\n\nexport function applyTheme() {\n const root = document.documentElement;\n let stored: string | null = null;\n try {\n stored = localStorage.getItem(THEME_STORAGE_KEY);\n } catch {}\n const dark =\n stored === \"dark\" ||\n (stored !== \"light\" && window.matchMedia(\"(prefers-color-scheme: dark)\").matches);\n root.classList.add(\"js\");\n root.classList.toggle(\"dark\", dark);\n}\n\nexport function toggleTheme() {\n const root = document.documentElement;\n const next = root.classList.contains(\"dark\") ? \"light\" : \"dark\";\n root.classList.toggle(\"dark\", next === \"dark\");\n try {\n localStorage.setItem(THEME_STORAGE_KEY, next);\n } catch {}\n}\n"]}
@@ -0,0 +1,12 @@
1
+ export interface LocaleKit<L extends string> {
2
+ locales: readonly L[];
3
+ defaultLocale: L;
4
+ localeLabels: Record<L, string>;
5
+ isLocale: (value: string) => value is L;
6
+ }
7
+ export declare function defineLocales<const T extends readonly string[]>(input: {
8
+ locales: T;
9
+ defaultLocale: T[number];
10
+ labels: Record<T[number], string>;
11
+ }): LocaleKit<T[number]>;
12
+ export declare function detectLocale<L extends string>(acceptLanguage: string | null | undefined, locales: readonly L[], defaultLocale: L): L;
@@ -0,0 +1,4 @@
1
+ export { cn } from "./utils/cn.js";
2
+ export { defineLocales, detectLocale, type LocaleKit } from "./i18n/index.js";
3
+ export { THEME_STORAGE_KEY, themeInitScript, applyTheme, toggleTheme } from "./theme/index.js";
4
+ export { reveal, revealInitScript, type RevealVariant } from "./reveal/index.js";
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export{a as THEME_STORAGE_KEY,c as applyTheme,b as themeInitScript,d as toggleTheme}from'./chunk-P4PP32UI.js';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function f(...e){return twMerge(clsx(e))}function L(e){let t=e.locales;return {locales:e.locales,defaultLocale:e.defaultLocale,localeLabels:e.labels,isLocale:r=>t.includes(r)}}function p(e,t,r){let o=t;for(let a of (e??"").split(",")){let l=a.trim().split(";")[0]?.toLowerCase().slice(0,2)??"";if(o.includes(l))return l}return r}function g(e=0,t="up"){return {"data-reveal":t,style:{"--reveal-delay":`${e}ms`}}}var v='(function(){var t=document.querySelectorAll("[data-reveal]:not(.is-visible)"),i;if(!("IntersectionObserver" in window)){for(i=0;i<t.length;i++)t[i].classList.add("is-visible");return}var o=new IntersectionObserver(function(e){for(var j=0;j<e.length;j++){if(!e[j].isIntersecting)continue;e[j].target.classList.add("is-visible");o.unobserve(e[j].target)}},{threshold:0.12,rootMargin:"0px 0px -6% 0px"});for(i=0;i<t.length;i++)o.observe(t[i])})();';export{f as cn,L as defineLocales,p as detectLocale,g as reveal,v as revealInitScript};//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/cn.ts","../src/i18n/index.ts","../src/reveal/index.ts"],"names":["cn","inputs","twMerge","clsx","defineLocales","input","list","value","detectLocale","acceptLanguage","locales","defaultLocale","part","code","reveal","delay","variant","revealInitScript"],"mappings":"2KAmBO,SAASA,CAAAA,CAAAA,GAAMC,CAAAA,CAAsB,CAC1C,OAAOC,QAAQC,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCEO,SAASG,EAAiDC,CAAAA,CAIxC,CACvB,IAAMC,CAAAA,CAAOD,CAAAA,CAAM,OAAA,CACnB,OAAO,CACL,OAAA,CAASA,CAAAA,CAAM,OAAA,CACf,aAAA,CAAeA,CAAAA,CAAM,cACrB,YAAA,CAAcA,CAAAA,CAAM,MAAA,CACpB,QAAA,CAAWE,CAAAA,EAAsCD,CAAAA,CAAK,SAASC,CAAK,CACtE,CACF,CAEO,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACG,CACH,IAAML,CAAAA,CAAOI,CAAAA,CACb,IAAA,IAAWE,MAASH,CAAAA,EAAkB,EAAA,EAAI,KAAA,CAAM,GAAG,CAAA,CAAG,CACpD,IAAMI,CAAAA,CAAOD,CAAAA,CAAK,IAAA,EAAK,CAAE,KAAA,CAAM,GAAG,EAAE,CAAC,CAAA,EAAG,WAAA,EAAY,CAAE,KAAA,CAAM,CAAA,CAAG,CAAC,CAAA,EAAK,EAAA,CACrE,GAAIN,CAAAA,CAAK,QAAA,CAASO,CAAI,CAAA,CAAG,OAAOA,CAClC,CACA,OAAOF,CACT,CC9BO,SAASG,EAAOC,CAAAA,CAAQ,CAAA,CAAGC,CAAAA,CAAyB,IAAA,CAAM,CAC/D,OAAO,CACL,aAAA,CAAeA,CAAAA,CACf,KAAA,CAAO,CAAE,gBAAA,CAAkB,CAAA,EAAGD,CAAK,CAAA,EAAA,CAAK,CAC1C,CACF,CAEO,IAAME,CAAAA,CAAmB","file":"index.js","sourcesContent":["/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface LocaleKit<L extends string> {\n locales: readonly L[];\n defaultLocale: L;\n localeLabels: Record<L, string>;\n isLocale: (value: string) => value is L;\n}\n\nexport function defineLocales<const T extends readonly string[]>(input: {\n locales: T;\n defaultLocale: T[number];\n labels: Record<T[number], string>;\n}): LocaleKit<T[number]> {\n const list = input.locales as readonly string[];\n return {\n locales: input.locales,\n defaultLocale: input.defaultLocale,\n localeLabels: input.labels,\n isLocale: (value: string): value is T[number] => list.includes(value),\n };\n}\n\nexport function detectLocale<L extends string>(\n acceptLanguage: string | null | undefined,\n locales: readonly L[],\n defaultLocale: L,\n): L {\n const list = locales as readonly string[];\n for (const part of (acceptLanguage ?? \"\").split(\",\")) {\n const code = part.trim().split(\";\")[0]?.toLowerCase().slice(0, 2) ?? \"\";\n if (list.includes(code)) return code as L;\n }\n return defaultLocale;\n}\n","/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type RevealVariant = \"up\" | \"left\" | \"right\" | \"scale\" | \"fade\";\n\nexport function reveal(delay = 0, variant: RevealVariant = \"up\") {\n return {\n \"data-reveal\": variant,\n style: { \"--reveal-delay\": `${delay}ms` } as Record<string, string>,\n };\n}\n\nexport const revealInitScript = `(function(){var t=document.querySelectorAll(\"[data-reveal]:not(.is-visible)\"),i;if(!(\"IntersectionObserver\" in window)){for(i=0;i<t.length;i++)t[i].classList.add(\"is-visible\");return}var o=new IntersectionObserver(function(e){for(var j=0;j<e.length;j++){if(!e[j].isIntersecting)continue;e[j].target.classList.add(\"is-visible\");o.unobserve(e[j].target)}},{threshold:0.12,rootMargin:\"0px 0px -6% 0px\"});for(i=0;i<t.length;i++)o.observe(t[i])})();`;\n"]}
@@ -0,0 +1,6 @@
1
+ export type RevealVariant = "up" | "left" | "right" | "scale" | "fade";
2
+ export declare function reveal(delay?: number, variant?: RevealVariant): {
3
+ "data-reveal": RevealVariant;
4
+ style: Record<string, string>;
5
+ };
6
+ export declare const revealInitScript = "(function(){var t=document.querySelectorAll(\"[data-reveal]:not(.is-visible)\"),i;if(!(\"IntersectionObserver\" in window)){for(i=0;i<t.length;i++)t[i].classList.add(\"is-visible\");return}var o=new IntersectionObserver(function(e){for(var j=0;j<e.length;j++){if(!e[j].isIntersecting)continue;e[j].target.classList.add(\"is-visible\");o.unobserve(e[j].target)}},{threshold:0.12,rootMargin:\"0px 0px -6% 0px\"});for(i=0;i<t.length;i++)o.observe(t[i])})();";
@@ -0,0 +1,22 @@
1
+ import { type ResourceHint } from "./hints.js";
2
+ export interface HeaderRule {
3
+ path: string;
4
+ headers: Record<string, string>;
5
+ }
6
+ export interface SpeedHeaderOptions {
7
+ base?: string;
8
+ immutable?: readonly string[];
9
+ security?: boolean;
10
+ preload?: readonly ResourceHint[];
11
+ }
12
+ export declare const IMMUTABLE_CACHE = "public, max-age=31536000, immutable";
13
+ export declare function speedHeaders(options?: SpeedHeaderOptions): HeaderRule[];
14
+ export declare function toHeadersFile(rules: readonly HeaderRule[]): string;
15
+ export interface NextHeaderRule {
16
+ source: string;
17
+ headers: Array<{
18
+ key: string;
19
+ value: string;
20
+ }>;
21
+ }
22
+ export declare function toNextHeaders(rules: readonly HeaderRule[]): NextHeaderRule[];
@@ -0,0 +1,21 @@
1
+ export interface ResourceHint {
2
+ rel: "preload" | "preconnect" | "dns-prefetch" | "prefetch" | "modulepreload";
3
+ href: string;
4
+ as?: "font" | "style" | "script" | "image" | "fetch" | "document";
5
+ type?: string;
6
+ crossorigin?: boolean | "anonymous" | "use-credentials";
7
+ fetchpriority?: "high" | "low" | "auto";
8
+ media?: string;
9
+ }
10
+ export declare function fontPreload(href: string, type?: string): ResourceHint;
11
+ export interface ResourceHintInput {
12
+ preconnect?: readonly string[];
13
+ dnsPrefetch?: readonly string[];
14
+ fonts?: readonly string[];
15
+ styles?: readonly string[];
16
+ images?: readonly string[];
17
+ }
18
+ export declare function resourceHints(input: ResourceHintInput): ResourceHint[];
19
+ export declare function hintAttrs(hint: ResourceHint): Record<string, string>;
20
+ export declare function hintsToHtml(hints: readonly ResourceHint[]): string;
21
+ export declare function hintsToLinkHeader(hints: readonly ResourceHint[]): string;
@@ -0,0 +1,8 @@
1
+ export interface OptimizeHtmlOptions {
2
+ eagerImages?: number;
3
+ lazyImages?: boolean;
4
+ lazyIframes?: boolean;
5
+ head?: string;
6
+ bodyEnd?: string;
7
+ }
8
+ export declare function optimizeHtml(html: string, options?: OptimizeHtmlOptions): string;
@@ -0,0 +1,6 @@
1
+ export { speculationRules, speculationRulesJson, normalizeBase, type SpeculationOptions, type SpeculationRules, type SpeculationEagerness, } from "./speculation.js";
2
+ export { gaineRuntimeScript, type RuntimeOptions } from "./runtime.js";
3
+ export { fontPreload, resourceHints, hintAttrs, hintsToHtml, hintsToLinkHeader, type ResourceHint, type ResourceHintInput, } from "./hints.js";
4
+ export { speedHeaders, toHeadersFile, toNextHeaders, IMMUTABLE_CACHE, type HeaderRule, type NextHeaderRule, type SpeedHeaderOptions, } from "./headers.js";
5
+ export { optimizeHtml, type OptimizeHtmlOptions } from "./html.js";
6
+ export { renderLanguageMenu, renderThemeToggle, type LanguageMenuOptions } from "./menu.js";
@@ -0,0 +1,8 @@
1
+ import {a as a$1}from'../chunk-P4PP32UI.js';import {a}from'../chunk-CWFVLSJN.js';export{a as normalizeBase,b as speculationRules,c as speculationRulesJson}from'../chunk-CWFVLSJN.js';var u=e=>JSON.stringify(e).replace(/</g,"\\u003c"),w=e=>`var K=${u(e)},R=d.documentElement;function ap(){var s;try{s=localStorage.getItem(K)}catch(e){}R.classList.toggle("dark",s==="dark"||(s!=="light"&&w.matchMedia("(prefers-color-scheme: dark)").matches))}d.addEventListener("click",function(e){var t=e.target,b=t&&t.closest&&t.closest("[data-gaine-theme]");if(!b)return;var n=R.classList.contains("dark")?"light":"dark";R.classList.toggle("dark",n==="dark");try{localStorage.setItem(K,n)}catch(e){}});try{w.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",ap)}catch(e){}w.addEventListener("storage",ap);`,H='var S=new WeakSet,io,q=0;function sc(){q=0;var n=d.querySelectorAll("[data-reveal]:not(.is-visible)"),i,el;if(!("IntersectionObserver" in w)){for(i=0;i<n.length;i++)n[i].classList.add("is-visible");return}io=io||new IntersectionObserver(function(es){for(var j=0;j<es.length;j++){if(es[j].isIntersecting){es[j].target.classList.add("is-visible");io.unobserve(es[j].target)}}},{threshold:.12,rootMargin:"0px 0px -6% 0px"});for(i=0;i<n.length;i++){el=n[i];if(!S.has(el)){S.add(el);io.observe(el)}}}function sd(){if(!q){q=1;(w.requestAnimationFrame||setTimeout)(sc)}}sc();if(d.readyState==="loading")d.addEventListener("DOMContentLoaded",sc);if("MutationObserver" in w)new MutationObserver(function(ms){for(var i=0,j,a,x;i<ms.length;i++){a=ms[i].addedNodes;for(j=0;j<a.length;j++){x=a[j];if(x.nodeType===1&&(x.hasAttribute("data-reveal")||x.querySelector("[data-reveal]"))){sd();return}}}}).observe(d.documentElement,{childList:true,subtree:true});',L='function sm(m,o){var t=m.querySelector("[data-gaine-menu-trigger]"),c=m.querySelector("[data-gaine-menu-content]");if(!t||!c)return;c.hidden=!o;t.setAttribute("aria-expanded",o?"true":"false");t.setAttribute("data-state",o?"open":"closed")}d.addEventListener("click",function(e){var t=e.target,m=t&&t.closest&&t.closest("[data-gaine-menu]"),g=m&&t.closest("[data-gaine-menu-trigger]"),a=d.querySelectorAll("[data-gaine-menu]"),i,c;for(i=0;i<a.length;i++){c=a[i].querySelector("[data-gaine-menu-content]");if(a[i]===m&&g&&c)sm(a[i],c.hidden);else sm(a[i],false)}});d.addEventListener("keydown",function(e){if(e.key!=="Escape")return;var a=d.querySelectorAll("[data-gaine-menu]"),i,c;for(i=0;i<a.length;i++){c=a[i].querySelector("[data-gaine-menu-content]");if(c&&!c.hidden){sm(a[i],false);var t=a[i].querySelector("[data-gaine-menu-trigger]");if(t)t.focus()}}});',$=(e,t)=>`var LC=${u(e)},BS=${u(t)};d.addEventListener("click",function(e){var t=e.target,a=t&&t.closest&&t.closest("[data-gaine-locale]");if(!a||e.defaultPrevented||e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;var l=a.getAttribute("data-gaine-locale"),p=w.location.pathname,r=p;if(BS&&(p===BS||p.indexOf(BS+"/")===0))r=p.slice(BS.length)||"/";var s=r.split("/");if(LC.indexOf(s[1])>-1)s[1]=l;else s.splice(1,0,l);e.preventDefault();w.location.assign(BS+s.join("/")+w.location.search+w.location.hash)});`,R=(e,t)=>`var PD=${e},PF=${t?"true":"false"},PS={},PT;var NA=w.HTMLScriptElement&&HTMLScriptElement.supports&&HTMLScriptElement.supports("speculationrules");if(!(PF&&NA)){var pu=function(a){if(!a||!a.href||a.target==="_blank"||a.hasAttribute("download")||a.hasAttribute("data-no-prefetch"))return;var u;try{u=new URL(a.href)}catch(e){return}if(u.origin!==w.location.origin||(u.pathname===w.location.pathname&&u.search===w.location.search))return;u.hash="";return u.href};var pf=function(h){if(!h||PS[h])return;var c=navigator.connection;if(c&&(c.saveData||/2g/.test(c.effectiveType||"")))return;PS[h]=1;var l=d.createElement("link");if(l.relList&&l.relList.supports&&l.relList.supports("prefetch")){l.rel="prefetch";l.href=h;l.as="document";d.head.appendChild(l)}else if(w.fetch){w.fetch(h,{credentials:"same-origin",priority:"low"}).catch(function(){})}};var an=function(e){var t=e.target;return t&&t.closest&&t.closest("a[href]")};d.addEventListener("mouseover",function(e){var h=pu(an(e));if(!h)return;clearTimeout(PT);PT=setTimeout(function(){pf(h)},PD)},{passive:true});d.addEventListener("mouseout",function(){clearTimeout(PT)},{passive:true});d.addEventListener("touchstart",function(e){pf(pu(an(e)))},{passive:true})}`;function S(e={}){let t=[];return e.theme!==false&&t.push(w(a$1)),e.reveal!==false&&t.push(H),e.menu&&t.push(L),e.locales?.length&&t.push($(e.locales,a(e.base))),e.prefetch&&t.push(R(e.prefetch.delay??65,e.prefetch.fallbackOnly??false)),t.length?"(function(w,d){if(w.__gaine)return;w.__gaine=1;"+t.join("")+"})(window,document);":""}function E(e,t){if(/[\r\n<>"\s]/.test(e))throw new Error(`Gaine: invalid ${t}: ${JSON.stringify(e)}`)}function m(e,t="font/woff2"){return {rel:"preload",href:e,as:"font",type:t,crossorigin:"anonymous"}}function O(e){let t=[];for(let r of e.preconnect??[])t.push({rel:"preconnect",href:r,crossorigin:true});for(let r of e.dnsPrefetch??[])t.push({rel:"dns-prefetch",href:r});for(let r of e.fonts??[])t.push(m(r,k(r)));for(let r of e.styles??[])t.push({rel:"preload",href:r,as:"style"});for(let r of e.images??[])t.push({rel:"preload",href:r,as:"image",fetchpriority:"high"});return t}function k(e){let t=e.split(/[?#]/)[0]?.split(".").pop()?.toLowerCase();return t==="woff"?"font/woff":t==="ttf"?"font/ttf":t==="otf"?"font/otf":"font/woff2"}var M=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;");function p(e){E(e.href,"hint href");let t={rel:e.rel,href:e.href};return e.as&&(t.as=e.as),e.type&&(t.type=e.type),e.crossorigin&&(t.crossorigin=e.crossorigin===true?"":e.crossorigin),e.fetchpriority&&(t.fetchpriority=e.fetchpriority),e.media&&(t.media=e.media),t}function T(e){return e.map(t=>{let r=p(t);return `<link ${Object.entries(r).map(([s,a])=>a===""?s:`${s}="${M(a)}"`).join(" ")}>`}).join("")}function f(e){return e.map(t=>{let r=p(t),n=[`rel=${r.rel}`];return r.as&&n.push(`as=${r.as}`),r.type&&n.push(`type="${r.type}"`),r.crossorigin!==void 0&&n.push("crossorigin"),r.fetchpriority&&n.push(`fetchpriority=${r.fetchpriority}`),`<${r.href}>; ${n.join("; ")}`}).join(", ")}var y="public, max-age=31536000, immutable";function j(e={}){let t=a(e.base),r=[],n={};e.security!==false&&(n["X-Content-Type-Options"]="nosniff",n["Referrer-Policy"]="strict-origin-when-cross-origin"),e.preload?.length&&(n.Link=f(e.preload)),Object.keys(n).length&&r.push({path:`${t}/*`,headers:n});for(let s of e.immutable??[]){let a=s.replace(/^\/+|\/+$/g,"");r.push({path:`${t}/${a}/*`,headers:{"Cache-Control":y}});}return r}function A(e){return e.map(t=>`${t.path}
2
+ ${Object.entries(t.headers).map(([r,n])=>` ${r}: ${n}`).join(`
3
+ `)}`).join(`
4
+
5
+ `)+`
6
+ `}function z(e){return e.map(t=>({source:t.path.replace(/\/\*$/,"/:path*"),headers:Object.entries(t.headers).map(([r,n])=>({key:r,value:n}))}))}var P=/<(script|style|textarea|pre)\b[\s\S]*?<\/\1\s*>|<!--[\s\S]*?-->/gi,C=/<img\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi,I=/<iframe\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi,g=(e,t)=>new RegExp(`\\s${t}(?:\\s|=|/|>)`,"i").test(e.replace(/"[^"]*"|'[^']*'/g,'""')),b=(e,t)=>e.replace(/\s*\/?>$/,r=>` ${t}${r.trim()==="/>"?" />":">"}`);function q(e,t={}){let r=[],n=e.replace(P,i=>`\0G${r.push(i)-1}\0`),s=t.eagerImages??2,a=0;return t.lazyImages!==false&&(n=n.replace(C,i=>{a+=1;let c=[];return g(i,"decoding")||c.push('decoding="async"'),a>s&&!g(i,"loading")&&c.push('loading="lazy"'),c.length?b(i,c.join(" ")):i})),t.lazyIframes!==false&&(n=n.replace(I,i=>g(i,"loading")?i:b(i,'loading="lazy"'))),t.head&&(n=n.replace(/<\/head\s*>/i,()=>`${t.head}</head>`)),t.bodyEnd&&(n=n.replace(/<\/body\s*>/i,()=>`${t.bodyEnd}</body>`)),n.replace(/\u0000G(\d+)\u0000/g,(i,c)=>r[Number(c)]??"")}var o=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),d=(e,t)=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="${e}">${t}</svg>`,N=e=>d(e,'<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>'),B=e=>d(e,'<path d="M20 6 9 17l-5-5"/>'),_=e=>d(e,'<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>'),K=e=>d(e,'<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>');function F(e){let t=o(e);return `<button type="button" data-gaine-theme aria-label="${t}" title="${t}" class="inline-flex size-9 items-center justify-center rounded-full border text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring">`+_("hidden size-4 dark:block")+K("size-4 dark:hidden")+"</button>"}function D(e){let t=(e.base??"/").replace(/^\/+|\/+$/g,""),r=t?`/${t}`:"",n=e.trailingSlash?"/":"",s=e.locales.map(a=>{let i=e.path?`${r}/${a}${e.path}`:`${r}/${a}${n}`;return `<a role="menuitem" lang="${o(a)}" href="${o(i)}" data-gaine-locale="${o(a)}" class="flex cursor-pointer select-none flex-row items-center justify-between rounded-xl px-3 py-2.5 text-sm no-underline text-popover-foreground outline-none transition-colors hover:bg-accent focus:bg-accent">`+o(e.labels[a]??a)+(a===e.locale?B("size-4 text-brand"):"")+"</a>"}).join("");return `<div data-gaine-menu class="relative inline-block"><button type="button" data-gaine-menu-trigger aria-label="${o(e.label)}" aria-haspopup="menu" aria-expanded="false" data-state="closed" class="inline-flex h-9 items-center gap-1.5 rounded-full border px-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent">`+N("size-3.5")+o(e.locale)+'</button><div role="menu" data-gaine-menu-content hidden class="absolute right-0 top-full z-50 mt-2.5 min-w-[11rem] overflow-hidden rounded-2xl border bg-popover p-2 text-popover-foreground shadow-xl shadow-black/5">'+s+"</div></div>"}
7
+ export{y as IMMUTABLE_CACHE,m as fontPreload,S as gaineRuntimeScript,p as hintAttrs,T as hintsToHtml,f as hintsToLinkHeader,q as optimizeHtml,D as renderLanguageMenu,F as renderThemeToggle,O as resourceHints,j as speedHeaders,A as toHeadersFile,z as toNextHeaders};//# sourceMappingURL=index.js.map
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/speed/runtime.ts","../../src/speed/hints.ts","../../src/speed/headers.ts","../../src/speed/html.ts","../../src/speed/menu.ts"],"names":["json","value","THEME","key","REVEAL","MENU","LOCALE","locales","base","PREFETCH","delay","fallbackOnly","gaineRuntimeScript","options","parts","THEME_STORAGE_KEY","normalizeBase","assertSafe","what","fontPreload","href","type","resourceHints","input","hints","fontType","ext","esc","s","hintAttrs","hint","attrs","hintsToHtml","k","v","hintsToLinkHeader","params","IMMUTABLE_CACHE","speedHeaders","rules","all","dir","clean","toHeadersFile","r","toNextHeaders","PROTECTED","IMG","IFRAME","hasAttr","tag","name","addAttrs","end","optimizeHtml","html","stash","out","m","eager","seen","add","_","i","svg","cls","body","GLOBE","c","CHECK","SUN","MOON","renderThemeToggle","label","l","renderLanguageMenu","o","prefix","tail","items"],"mappings":"sLA4BA,IAAMA,CAAAA,CAAQC,CAAAA,EAAmB,IA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AAAA,EAAM,CACV,IAAMtD,CAAAA,CAAOwD,EAAE,IAAA,CAAO,CAAA,EAAGC,CAAM,CAAA,CAAA,EAAIH,CAAC,GAAGE,CAAAA,CAAE,IAAI,GAAK,CAAA,EAAGC,CAAM,IAAIH,CAAC,CAAA,EAAGI,CAAI,CAAA,CAAA,CACvE,OACE,CAAA,yBAAA,EAA4BnD,EAAI+C,CAAC,CAAC,WAAW/C,CAAAA,CAAIP,CAAI,CAAC,CAAA,qBAAA,EAAwBO,CAAAA,CAAI+C,CAAC,CAAC,CAAA,mNAAA,CAAA,CACpF/C,EAAIiD,CAAAA,CAAE,MAAA,CAAOF,CAAC,CAAA,EAAKA,CAAC,GACnBA,CAAAA,GAAME,CAAAA,CAAE,MAAA,CAASP,CAAAA,CAAM,mBAAmB,CAAA,CAAI,IAC/C,MAEJ,CAAC,EACA,IAAA,CAAK,EAAE,EACV,OACE,CAAA,6GAAA,EAC6D1C,EAAIiD,CAAAA,CAAE,KAAK,CAAC,CAAA,yVAAA,CAAA,CACzET,CAAAA,CAAM,UAAU,CAAA,CAChBxC,CAAAA,CAAIiD,EAAE,MAAM,CAAA,CACZ,0NAAA,CAEAG,CAAAA,CACA,cAEJ","file":"index.js","sourcesContent":["/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { THEME_STORAGE_KEY } from \"../theme/index.js\";\nimport { normalizeBase } from \"./speculation.js\";\n\nexport interface RuntimeOptions {\n theme?: boolean;\n reveal?: boolean;\n menu?: boolean;\n locales?: readonly string[];\n base?: string;\n prefetch?: false | { delay?: number; fallbackOnly?: boolean };\n}\n\nconst json = (value: unknown) => JSON.stringify(value).replace(/</g, \"\\\\u003c\");\n\nconst THEME = (key: string) =>\n `var K=${json(key)},R=d.documentElement;` +\n `function ap(){var s;try{s=localStorage.getItem(K)}catch(e){}R.classList.toggle(\"dark\",s===\"dark\"||(s!==\"light\"&&w.matchMedia(\"(prefers-color-scheme: dark)\").matches))}` +\n `d.addEventListener(\"click\",function(e){var t=e.target,b=t&&t.closest&&t.closest(\"[data-gaine-theme]\");if(!b)return;` +\n `var n=R.classList.contains(\"dark\")?\"light\":\"dark\";R.classList.toggle(\"dark\",n===\"dark\");try{localStorage.setItem(K,n)}catch(e){}});` +\n `try{w.matchMedia(\"(prefers-color-scheme: dark)\").addEventListener(\"change\",ap)}catch(e){}` +\n `w.addEventListener(\"storage\",ap);`;\n\nconst REVEAL =\n `var S=new WeakSet,io,q=0;` +\n `function sc(){q=0;var n=d.querySelectorAll(\"[data-reveal]:not(.is-visible)\"),i,el;` +\n `if(!(\"IntersectionObserver\" in w)){for(i=0;i<n.length;i++)n[i].classList.add(\"is-visible\");return}` +\n `io=io||new IntersectionObserver(function(es){for(var j=0;j<es.length;j++){if(es[j].isIntersecting){es[j].target.classList.add(\"is-visible\");io.unobserve(es[j].target)}}},{threshold:.12,rootMargin:\"0px 0px -6% 0px\"});` +\n `for(i=0;i<n.length;i++){el=n[i];if(!S.has(el)){S.add(el);io.observe(el)}}}` +\n `function sd(){if(!q){q=1;(w.requestAnimationFrame||setTimeout)(sc)}}` +\n `sc();if(d.readyState===\"loading\")d.addEventListener(\"DOMContentLoaded\",sc);` +\n `if(\"MutationObserver\" in w)new MutationObserver(function(ms){for(var i=0,j,a,x;i<ms.length;i++){a=ms[i].addedNodes;for(j=0;j<a.length;j++){x=a[j];` +\n `if(x.nodeType===1&&(x.hasAttribute(\"data-reveal\")||x.querySelector(\"[data-reveal]\"))){sd();return}}}}).observe(d.documentElement,{childList:true,subtree:true});`;\n\nconst MENU =\n `function sm(m,o){var t=m.querySelector(\"[data-gaine-menu-trigger]\"),c=m.querySelector(\"[data-gaine-menu-content]\");if(!t||!c)return;` +\n `c.hidden=!o;t.setAttribute(\"aria-expanded\",o?\"true\":\"false\");t.setAttribute(\"data-state\",o?\"open\":\"closed\")}` +\n `d.addEventListener(\"click\",function(e){var t=e.target,m=t&&t.closest&&t.closest(\"[data-gaine-menu]\"),g=m&&t.closest(\"[data-gaine-menu-trigger]\"),a=d.querySelectorAll(\"[data-gaine-menu]\"),i,c;` +\n `for(i=0;i<a.length;i++){c=a[i].querySelector(\"[data-gaine-menu-content]\");if(a[i]===m&&g&&c)sm(a[i],c.hidden);else sm(a[i],false)}});` +\n `d.addEventListener(\"keydown\",function(e){if(e.key!==\"Escape\")return;var a=d.querySelectorAll(\"[data-gaine-menu]\"),i,c;` +\n `for(i=0;i<a.length;i++){c=a[i].querySelector(\"[data-gaine-menu-content]\");if(c&&!c.hidden){sm(a[i],false);var t=a[i].querySelector(\"[data-gaine-menu-trigger]\");if(t)t.focus()}}});`;\n\nconst LOCALE = (locales: readonly string[], base: string) =>\n `var LC=${json(locales)},BS=${json(base)};` +\n `d.addEventListener(\"click\",function(e){var t=e.target,a=t&&t.closest&&t.closest(\"[data-gaine-locale]\");` +\n `if(!a||e.defaultPrevented||e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;` +\n `var l=a.getAttribute(\"data-gaine-locale\"),p=w.location.pathname,r=p;` +\n `if(BS&&(p===BS||p.indexOf(BS+\"/\")===0))r=p.slice(BS.length)||\"/\";` +\n `var s=r.split(\"/\");if(LC.indexOf(s[1])>-1)s[1]=l;else s.splice(1,0,l);` +\n `e.preventDefault();w.location.assign(BS+s.join(\"/\")+w.location.search+w.location.hash)});`;\n\nconst PREFETCH = (delay: number, fallbackOnly: boolean) =>\n `var PD=${delay},PF=${fallbackOnly ? \"true\" : \"false\"},PS={},PT;` +\n `var NA=w.HTMLScriptElement&&HTMLScriptElement.supports&&HTMLScriptElement.supports(\"speculationrules\");` +\n `if(!(PF&&NA)){` +\n `var pu=function(a){if(!a||!a.href||a.target===\"_blank\"||a.hasAttribute(\"download\")||a.hasAttribute(\"data-no-prefetch\"))return;var u;try{u=new URL(a.href)}catch(e){return}` +\n `if(u.origin!==w.location.origin||(u.pathname===w.location.pathname&&u.search===w.location.search))return;u.hash=\"\";return u.href};` +\n `var pf=function(h){if(!h||PS[h])return;var c=navigator.connection;if(c&&(c.saveData||/2g/.test(c.effectiveType||\"\")))return;PS[h]=1;var l=d.createElement(\"link\");` +\n `if(l.relList&&l.relList.supports&&l.relList.supports(\"prefetch\")){l.rel=\"prefetch\";l.href=h;l.as=\"document\";d.head.appendChild(l)}else if(w.fetch){w.fetch(h,{credentials:\"same-origin\",priority:\"low\"}).catch(function(){})}};` +\n `var an=function(e){var t=e.target;return t&&t.closest&&t.closest(\"a[href]\")};` +\n `d.addEventListener(\"mouseover\",function(e){var h=pu(an(e));if(!h)return;clearTimeout(PT);PT=setTimeout(function(){pf(h)},PD)},{passive:true});` +\n `d.addEventListener(\"mouseout\",function(){clearTimeout(PT)},{passive:true});` +\n `d.addEventListener(\"touchstart\",function(e){pf(pu(an(e)))},{passive:true})}`;\n\nexport function gaineRuntimeScript(options: RuntimeOptions = {}): string {\n const parts: string[] = [];\n if (options.theme !== false) parts.push(THEME(THEME_STORAGE_KEY));\n if (options.reveal !== false) parts.push(REVEAL);\n if (options.menu) parts.push(MENU);\n if (options.locales?.length) parts.push(LOCALE(options.locales, normalizeBase(options.base)));\n if (options.prefetch) {\n parts.push(PREFETCH(options.prefetch.delay ?? 65, options.prefetch.fallbackOnly ?? false));\n }\n if (!parts.length) return \"\";\n return (\n `(function(w,d){if(w.__gaine)return;w.__gaine=1;` + parts.join(\"\") + `})(window,document);`\n );\n}\n","/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface ResourceHint {\n rel: \"preload\" | \"preconnect\" | \"dns-prefetch\" | \"prefetch\" | \"modulepreload\";\n href: string;\n as?: \"font\" | \"style\" | \"script\" | \"image\" | \"fetch\" | \"document\";\n type?: string;\n crossorigin?: boolean | \"anonymous\" | \"use-credentials\";\n fetchpriority?: \"high\" | \"low\" | \"auto\";\n media?: string;\n}\n\nfunction assertSafe(value: string, what: string) {\n if (/[\\r\\n<>\"\\s]/.test(value))\n throw new Error(`Gaine: invalid ${what}: ${JSON.stringify(value)}`);\n}\n\nexport function fontPreload(href: string, type = \"font/woff2\"): ResourceHint {\n return { rel: \"preload\", href, as: \"font\", type, crossorigin: \"anonymous\" };\n}\n\nexport interface ResourceHintInput {\n preconnect?: readonly string[];\n dnsPrefetch?: readonly string[];\n fonts?: readonly string[];\n styles?: readonly string[];\n images?: readonly string[];\n}\n\nexport function resourceHints(input: ResourceHintInput): ResourceHint[] {\n const hints: ResourceHint[] = [];\n for (const href of input.preconnect ?? [])\n hints.push({ rel: \"preconnect\", href, crossorigin: true });\n for (const href of input.dnsPrefetch ?? []) hints.push({ rel: \"dns-prefetch\", href });\n for (const href of input.fonts ?? []) hints.push(fontPreload(href, fontType(href)));\n for (const href of input.styles ?? []) hints.push({ rel: \"preload\", href, as: \"style\" });\n for (const href of input.images ?? [])\n hints.push({ rel: \"preload\", href, as: \"image\", fetchpriority: \"high\" });\n return hints;\n}\n\nfunction fontType(href: string): string {\n const ext = href.split(/[?#]/)[0]?.split(\".\").pop()?.toLowerCase();\n return ext === \"woff\"\n ? \"font/woff\"\n : ext === \"ttf\"\n ? \"font/ttf\"\n : ext === \"otf\"\n ? \"font/otf\"\n : \"font/woff2\";\n}\n\nconst esc = (s: string) => s.replace(/&/g, \"&amp;\").replace(/\"/g, \"&quot;\").replace(/</g, \"&lt;\");\n\nexport function hintAttrs(hint: ResourceHint): Record<string, string> {\n assertSafe(hint.href, \"hint href\");\n const attrs: Record<string, string> = { rel: hint.rel, href: hint.href };\n if (hint.as) attrs.as = hint.as;\n if (hint.type) attrs.type = hint.type;\n if (hint.crossorigin) attrs.crossorigin = hint.crossorigin === true ? \"\" : hint.crossorigin;\n if (hint.fetchpriority) attrs.fetchpriority = hint.fetchpriority;\n if (hint.media) attrs.media = hint.media;\n return attrs;\n}\n\nexport function hintsToHtml(hints: readonly ResourceHint[]): string {\n return hints\n .map((hint) => {\n const attrs = hintAttrs(hint);\n const body = Object.entries(attrs)\n .map(([k, v]) => (v === \"\" ? k : `${k}=\"${esc(v)}\"`))\n .join(\" \");\n return `<link ${body}>`;\n })\n .join(\"\");\n}\n\nexport function hintsToLinkHeader(hints: readonly ResourceHint[]): string {\n return hints\n .map((hint) => {\n const attrs = hintAttrs(hint);\n const params = [`rel=${attrs.rel}`];\n if (attrs.as) params.push(`as=${attrs.as}`);\n if (attrs.type) params.push(`type=\"${attrs.type}\"`);\n if (attrs.crossorigin !== undefined) params.push(\"crossorigin\");\n if (attrs.fetchpriority) params.push(`fetchpriority=${attrs.fetchpriority}`);\n return `<${attrs.href}>; ${params.join(\"; \")}`;\n })\n .join(\", \");\n}\n","/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { normalizeBase } from \"./speculation.js\";\nimport { hintsToLinkHeader, type ResourceHint } from \"./hints.js\";\n\nexport interface HeaderRule {\n path: string;\n headers: Record<string, string>;\n}\n\nexport interface SpeedHeaderOptions {\n base?: string;\n immutable?: readonly string[];\n security?: boolean;\n preload?: readonly ResourceHint[];\n}\n\nexport const IMMUTABLE_CACHE = \"public, max-age=31536000, immutable\";\n\nexport function speedHeaders(options: SpeedHeaderOptions = {}): HeaderRule[] {\n const base = normalizeBase(options.base);\n const rules: HeaderRule[] = [];\n const all: Record<string, string> = {};\n if (options.security !== false) {\n all[\"X-Content-Type-Options\"] = \"nosniff\";\n all[\"Referrer-Policy\"] = \"strict-origin-when-cross-origin\";\n }\n if (options.preload?.length) all.Link = hintsToLinkHeader(options.preload);\n if (Object.keys(all).length) rules.push({ path: `${base}/*`, headers: all });\n for (const dir of options.immutable ?? []) {\n const clean = dir.replace(/^\\/+|\\/+$/g, \"\");\n rules.push({ path: `${base}/${clean}/*`, headers: { \"Cache-Control\": IMMUTABLE_CACHE } });\n }\n return rules;\n}\n\nexport function toHeadersFile(rules: readonly HeaderRule[]): string {\n return (\n rules\n .map(\n (r) =>\n `${r.path}\\n${Object.entries(r.headers)\n .map(([k, v]) => ` ${k}: ${v}`)\n .join(\"\\n\")}`,\n )\n .join(\"\\n\\n\") + \"\\n\"\n );\n}\n\nexport interface NextHeaderRule {\n source: string;\n headers: Array<{ key: string; value: string }>;\n}\n\nexport function toNextHeaders(rules: readonly HeaderRule[]): NextHeaderRule[] {\n return rules.map((r) => ({\n source: r.path.replace(/\\/\\*$/, \"/:path*\"),\n headers: Object.entries(r.headers).map(([key, value]) => ({ key, value })),\n }));\n}\n","/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface OptimizeHtmlOptions {\n eagerImages?: number;\n lazyImages?: boolean;\n lazyIframes?: boolean;\n head?: string;\n bodyEnd?: string;\n}\n\nconst PROTECTED = /<(script|style|textarea|pre)\\b[\\s\\S]*?<\\/\\1\\s*>|<!--[\\s\\S]*?-->/gi;\nconst IMG = /<img\\b(?:\"[^\"]*\"|'[^']*'|[^'\">])*>/gi;\nconst IFRAME = /<iframe\\b(?:\"[^\"]*\"|'[^']*'|[^'\">])*>/gi;\nconst hasAttr = (tag: string, name: string) =>\n new RegExp(`\\\\s${name}(?:\\\\s|=|/|>)`, \"i\").test(tag.replace(/\"[^\"]*\"|'[^']*'/g, '\"\"'));\nconst addAttrs = (tag: string, attrs: string) =>\n tag.replace(/\\s*\\/?>$/, (end) => ` ${attrs}${end.trim() === \"/>\" ? \" />\" : \">\"}`);\n\nexport function optimizeHtml(html: string, options: OptimizeHtmlOptions = {}): string {\n const stash: string[] = [];\n let out = html.replace(PROTECTED, (m) => `\\u0000G${stash.push(m) - 1}\\u0000`);\n\n const eager = options.eagerImages ?? 2;\n let seen = 0;\n if (options.lazyImages !== false) {\n out = out.replace(IMG, (tag) => {\n seen += 1;\n const add: string[] = [];\n if (!hasAttr(tag, \"decoding\")) add.push('decoding=\"async\"');\n if (seen > eager && !hasAttr(tag, \"loading\")) add.push('loading=\"lazy\"');\n return add.length ? addAttrs(tag, add.join(\" \")) : tag;\n });\n }\n if (options.lazyIframes !== false) {\n out = out.replace(IFRAME, (tag) =>\n hasAttr(tag, \"loading\") ? tag : addAttrs(tag, 'loading=\"lazy\"'),\n );\n }\n if (options.head) out = out.replace(/<\\/head\\s*>/i, () => `${options.head}</head>`);\n if (options.bodyEnd) out = out.replace(/<\\/body\\s*>/i, () => `${options.bodyEnd}</body>`);\n\n return out.replace(/\\u0000G(\\d+)\\u0000/g, (_, i: string) => stash[Number(i)] ?? \"\");\n}\n","/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst esc = (s: string) =>\n s.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\").replace(/\"/g, \"&quot;\");\n\nconst svg = (cls: string, body: string) =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" class=\"${cls}\">${body}</svg>`;\n\nconst GLOBE = (c: string) =>\n svg(\n c,\n '<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\"/><path d=\"M2 12h20\"/>',\n );\nconst CHECK = (c: string) => svg(c, '<path d=\"M20 6 9 17l-5-5\"/>');\nconst SUN = (c: string) =>\n svg(\n c,\n '<circle cx=\"12\" cy=\"12\" r=\"4\"/><path d=\"M12 2v2\"/><path d=\"M12 20v2\"/><path d=\"m4.93 4.93 1.41 1.41\"/><path d=\"m17.66 17.66 1.41 1.41\"/><path d=\"M2 12h2\"/><path d=\"M20 12h2\"/><path d=\"m6.34 17.66-1.41 1.41\"/><path d=\"m19.07 4.93-1.41 1.41\"/>',\n );\nconst MOON = (c: string) => svg(c, '<path d=\"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z\"/>');\n\nexport function renderThemeToggle(label: string): string {\n const l = esc(label);\n return (\n `<button type=\"button\" data-gaine-theme aria-label=\"${l}\" title=\"${l}\" class=\"inline-flex size-9 items-center justify-center rounded-full border text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\">` +\n SUN(\"hidden size-4 dark:block\") +\n MOON(\"size-4 dark:hidden\") +\n `</button>`\n );\n}\n\nexport interface LanguageMenuOptions<L extends string> {\n locale: L;\n label: string;\n locales: readonly L[];\n labels: Record<L, string>;\n base?: string;\n trailingSlash?: boolean;\n path?: string;\n}\n\nexport function renderLanguageMenu<L extends string>(o: LanguageMenuOptions<L>): string {\n const base = (o.base ?? \"/\").replace(/^\\/+|\\/+$/g, \"\");\n const prefix = base ? `/${base}` : \"\";\n const tail = o.trailingSlash ? \"/\" : \"\";\n const items = o.locales\n .map((l) => {\n const href = o.path ? `${prefix}/${l}${o.path}` : `${prefix}/${l}${tail}`;\n return (\n `<a role=\"menuitem\" lang=\"${esc(l)}\" href=\"${esc(href)}\" data-gaine-locale=\"${esc(l)}\" class=\"flex cursor-pointer select-none flex-row items-center justify-between rounded-xl px-3 py-2.5 text-sm no-underline text-popover-foreground outline-none transition-colors hover:bg-accent focus:bg-accent\">` +\n esc(o.labels[l] ?? l) +\n (l === o.locale ? CHECK(\"size-4 text-brand\") : \"\") +\n `</a>`\n );\n })\n .join(\"\");\n return (\n `<div data-gaine-menu class=\"relative inline-block\">` +\n `<button type=\"button\" data-gaine-menu-trigger aria-label=\"${esc(o.label)}\" aria-haspopup=\"menu\" aria-expanded=\"false\" data-state=\"closed\" class=\"inline-flex h-9 items-center gap-1.5 rounded-full border px-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent\">` +\n GLOBE(\"size-3.5\") +\n esc(o.locale) +\n `</button>` +\n `<div role=\"menu\" data-gaine-menu-content hidden class=\"absolute right-0 top-full z-50 mt-2.5 min-w-[11rem] overflow-hidden rounded-2xl border bg-popover p-2 text-popover-foreground shadow-xl shadow-black/5\">` +\n items +\n `</div></div>`\n );\n}\n"]}
@@ -0,0 +1,11 @@
1
+ export declare function renderThemeToggle(label: string): string;
2
+ export interface LanguageMenuOptions<L extends string> {
3
+ locale: L;
4
+ label: string;
5
+ locales: readonly L[];
6
+ labels: Record<L, string>;
7
+ base?: string;
8
+ trailingSlash?: boolean;
9
+ path?: string;
10
+ }
11
+ export declare function renderLanguageMenu<L extends string>(o: LanguageMenuOptions<L>): string;
@@ -0,0 +1,22 @@
1
+ export interface PageWeight {
2
+ page: string;
3
+ html: number;
4
+ js: number;
5
+ css: number;
6
+ inline: number;
7
+ total: number;
8
+ files: string[];
9
+ }
10
+ export interface BudgetLimits {
11
+ js?: number;
12
+ css?: number;
13
+ total?: number;
14
+ }
15
+ export interface BuildReport {
16
+ pages: PageWeight[];
17
+ worst: PageWeight | undefined;
18
+ }
19
+ export declare function measureBuild(outDir: string, options?: {
20
+ base?: string;
21
+ }): Promise<BuildReport>;
22
+ export declare function checkBudget(report: BuildReport, limits: BudgetLimits): string[];
@@ -0,0 +1,3 @@
1
+ import {a}from'../chunk-CWFVLSJN.js';import {readFile,readdir}from'fs/promises';import {relative,sep,join,posix}from'path';import {gzipSync}from'zlib';async function x(n,e=[]){for(let r of await readdir(n,{withFileTypes:true})){let s=join(n,r.name);r.isDirectory()?await x(s,e):e.push(s);}return e}var g=n=>gzipSync(n,{level:9}).length,y=(n,e)=>new RegExp(`\\s${e}=(?:"([^"]*)"|'([^']*)')`,"i").exec(n)?.slice(1).find(Boolean);async function F(n,e={}){let r=a(e.base),s=await x(n),u=new Map,d=async o=>{let t=u.get(o);return t===void 0&&(t=g(await readFile(o)),u.set(o,t)),t},S=o=>{let t=o.split(/[?#]/)[0]??"";if(/^(?:[a-z]+:)?\/\//i.test(t))return;let l=t.startsWith(r+"/")?t.slice(r.length):t;return join(n,...posix.normalize(l).split("/").filter(Boolean))},c=[];for(let o of s.filter(t=>t.endsWith(".html"))){let t=await readFile(o,"utf8"),l=new Set,f=0,p=0,h=0;for(let i of t.match(/<(?:script|link)\b[^>]*>/gi)??[]){let B=/^<script/i.test(i)?y(i,"src"):/rel=["']?(?:stylesheet|modulepreload)/i.test(i)?y(i,"href"):void 0,a=B&&S(B);!a||l.has(a)||!s.includes(a)||(l.add(a),a.endsWith(".css")?p+=await d(a):f+=await d(a));}for(let i of t.matchAll(/<(script|style)\b[^>]*>([\s\S]*?)<\/\1>/gi))i[2]&&!/\ssrc=/i.test(i[0])&&!/type=["']?(?:application\/(?:ld\+)?json|speculationrules)/i.test(i[0])&&(h+=g(i[2]));let m=g(t);c.push({page:"/"+relative(n,o).split(sep).join("/"),html:m,js:f,css:p,inline:h,total:m+f+p,files:[...l].map(i=>"/"+relative(n,i).split(sep).join("/"))});}return c.sort((o,t)=>t.total-o.total),{pages:c,worst:c[0]}}function L(n,e){let r=[];for(let s of n.pages)e.js!==void 0&&s.js>e.js&&r.push(`${s.page}: JS ${s.js} B > ${e.js} B (gzip)`),e.css!==void 0&&s.css>e.css&&r.push(`${s.page}: CSS ${s.css} B > ${e.css} B (gzip)`),e.total!==void 0&&s.total>e.total&&r.push(`${s.page}: total ${s.total} B > ${e.total} B (gzip)`);return r}
2
+ export{L as checkBudget,F as measureBuild};//# sourceMappingURL=node.js.map
3
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/speed/node.ts"],"names":["walk","dir","out","entry","readdir","full","join","gz","buf","gzipSync","ATTR","tag","name","measureBuild","outDir","options","base","normalizeBase","files","cache","sizeOf","abs","size","readFile","resolveAsset","url","path","clean","posix","pages","file","f","html","used","js","css","inline","m","htmlSize","relative","sep","u","a","b","checkBudget","report","limits","problems","p"],"mappings":"uJA0CA,eAAeA,CAAAA,CAAKC,CAAAA,CAAaC,CAAAA,CAAgB,EAAC,CAAsB,CACtE,QAAWC,CAAAA,IAAS,MAAMC,OAAAA,CAAQH,CAAAA,CAAK,CAAE,aAAA,CAAe,IAAK,CAAC,CAAA,CAAG,CAC/D,IAAMI,CAAAA,CAAOC,IAAAA,CAAKL,EAAKE,CAAAA,CAAM,IAAI,CAAA,CAC7BA,CAAAA,CAAM,WAAA,EAAY,CAAG,M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EAAaE,CAAAA,CAAE,EAAA,CAAKF,EAAO,EAAA,EAC3CC,CAAAA,CAAS,IAAA,CAAK,CAAA,EAAGC,CAAAA,CAAE,IAAI,QAAQA,CAAAA,CAAE,EAAE,CAAA,KAAA,EAAQF,CAAAA,CAAO,EAAE,CAAA,SAAA,CAAW,EAC7DA,CAAAA,CAAO,GAAA,GAAQ,MAAA,EAAaE,CAAAA,CAAE,GAAA,CAAMF,CAAAA,CAAO,GAAA,EAC7CC,CAAAA,CAAS,IAAA,CAAK,CAAA,EAAGC,CAAAA,CAAE,IAAI,CAAA,MAAA,EAASA,CAAAA,CAAE,GAAG,CAAA,KAAA,EAAQF,CAAAA,CAAO,GAAG,CAAA,SAAA,CAAW,CAAA,CAChEA,CAAAA,CAAO,QAAU,MAAA,EAAaE,CAAAA,CAAE,KAAA,CAAQF,CAAAA,CAAO,KAAA,EACjDC,CAAAA,CAAS,KAAK,CAAA,EAAGC,CAAAA,CAAE,IAAI,CAAA,QAAA,EAAWA,CAAAA,CAAE,KAAK,CAAA,KAAA,EAAQF,CAAAA,CAAO,KAAK,CAAA,SAAA,CAAW,CAAA,CAE5E,OAAOC,CACT","file":"node.js","sourcesContent":["/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { readdir, readFile } from \"node:fs/promises\";\nimport { join, posix, relative, sep } from \"node:path\";\nimport { gzipSync } from \"node:zlib\";\nimport { normalizeBase } from \"./speculation.js\";\n\nexport interface PageWeight {\n page: string;\n html: number;\n js: number;\n css: number;\n inline: number;\n total: number;\n files: string[];\n}\n\nexport interface BudgetLimits {\n js?: number;\n css?: number;\n total?: number;\n}\n\nexport interface BuildReport {\n pages: PageWeight[];\n worst: PageWeight | undefined;\n}\n\nasync function walk(dir: string, out: string[] = []): Promise<string[]> {\n for (const entry of await readdir(dir, { withFileTypes: true })) {\n const full = join(dir, entry.name);\n if (entry.isDirectory()) await walk(full, out);\n else out.push(full);\n }\n return out;\n}\n\nconst gz = (buf: Buffer | string) => gzipSync(buf, { level: 9 }).length;\nconst ATTR = (tag: string, name: string) =>\n new RegExp(`\\\\s${name}=(?:\"([^\"]*)\"|'([^']*)')`, \"i\").exec(tag)?.slice(1).find(Boolean);\n\nexport async function measureBuild(\n outDir: string,\n options: { base?: string } = {},\n): Promise<BuildReport> {\n const base = normalizeBase(options.base);\n const files = await walk(outDir);\n const cache = new Map<string, number>();\n const sizeOf = async (abs: string) => {\n let size = cache.get(abs);\n if (size === undefined) {\n size = gz(await readFile(abs));\n cache.set(abs, size);\n }\n return size;\n };\n const resolveAsset = (url: string): string | undefined => {\n const path = url.split(/[?#]/)[0] ?? \"\";\n if (/^(?:[a-z]+:)?\\/\\//i.test(path)) return undefined;\n const clean = path.startsWith(base + \"/\") ? path.slice(base.length) : path;\n return join(outDir, ...posix.normalize(clean).split(\"/\").filter(Boolean));\n };\n\n const pages: PageWeight[] = [];\n for (const file of files.filter((f) => f.endsWith(\".html\"))) {\n const html = await readFile(file, \"utf8\");\n const used = new Set<string>();\n let js = 0;\n let css = 0;\n let inline = 0;\n for (const tag of html.match(/<(?:script|link)\\b[^>]*>/gi) ?? []) {\n const url = /^<script/i.test(tag)\n ? ATTR(tag, \"src\")\n : /rel=[\"']?(?:stylesheet|modulepreload)/i.test(tag)\n ? ATTR(tag, \"href\")\n : undefined;\n const abs = url && resolveAsset(url);\n if (!abs || used.has(abs) || !files.includes(abs)) continue;\n used.add(abs);\n if (abs.endsWith(\".css\")) css += await sizeOf(abs);\n else js += await sizeOf(abs);\n }\n for (const m of html.matchAll(/<(script|style)\\b[^>]*>([\\s\\S]*?)<\\/\\1>/gi)) {\n if (\n m[2] &&\n !/\\ssrc=/i.test(m[0]) &&\n !/type=[\"']?(?:application\\/(?:ld\\+)?json|speculationrules)/i.test(m[0])\n ) {\n inline += gz(m[2]);\n }\n }\n const htmlSize = gz(html);\n pages.push({\n page: \"/\" + relative(outDir, file).split(sep).join(\"/\"),\n html: htmlSize,\n js,\n css,\n inline,\n total: htmlSize + js + css,\n files: [...used].map((u) => \"/\" + relative(outDir, u).split(sep).join(\"/\")),\n });\n }\n pages.sort((a, b) => b.total - a.total);\n return { pages, worst: pages[0] };\n}\n\nexport function checkBudget(report: BuildReport, limits: BudgetLimits): string[] {\n const problems: string[] = [];\n for (const p of report.pages) {\n if (limits.js !== undefined && p.js > limits.js)\n problems.push(`${p.page}: JS ${p.js} B > ${limits.js} B (gzip)`);\n if (limits.css !== undefined && p.css > limits.css)\n problems.push(`${p.page}: CSS ${p.css} B > ${limits.css} B (gzip)`);\n if (limits.total !== undefined && p.total > limits.total)\n problems.push(`${p.page}: total ${p.total} B > ${limits.total} B (gzip)`);\n }\n return problems;\n}\n"]}
@@ -0,0 +1,12 @@
1
+ export interface RuntimeOptions {
2
+ theme?: boolean;
3
+ reveal?: boolean;
4
+ menu?: boolean;
5
+ locales?: readonly string[];
6
+ base?: string;
7
+ prefetch?: false | {
8
+ delay?: number;
9
+ fallbackOnly?: boolean;
10
+ };
11
+ }
12
+ export declare function gaineRuntimeScript(options?: RuntimeOptions): string;
@@ -0,0 +1,25 @@
1
+ export type SpeculationEagerness = "immediate" | "eager" | "moderate" | "conservative";
2
+ export interface SpeculationOptions {
3
+ action?: "prefetch" | "prerender";
4
+ eagerness?: SpeculationEagerness;
5
+ base?: string;
6
+ exclude?: readonly string[];
7
+ excludeSelectors?: readonly string[];
8
+ }
9
+ type Condition = {
10
+ href_matches: string;
11
+ } | {
12
+ selector_matches: string;
13
+ } | {
14
+ not: Condition;
15
+ } | {
16
+ and: Condition[];
17
+ };
18
+ export type SpeculationRules = Record<string, Array<{
19
+ where: Condition;
20
+ eagerness: SpeculationEagerness;
21
+ }>>;
22
+ export declare function normalizeBase(base?: string): string;
23
+ export declare function speculationRules(options?: SpeculationOptions): SpeculationRules;
24
+ export declare function speculationRulesJson(options?: SpeculationOptions): string;
25
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { Config } from "tailwindcss";
2
+ export type GaineToken = "background" | "foreground" | "primary" | "primary-foreground" | "secondary" | "secondary-foreground" | "muted" | "muted-foreground" | "accent" | "accent-foreground" | "popover" | "popover-foreground" | "border" | "input" | "ring" | "brand" | "brand-foreground";
3
+ export type GaineTokens = Record<GaineToken, string>;
4
+ export interface GainePresetOptions {
5
+ light?: Partial<GaineTokens>;
6
+ dark?: Partial<GaineTokens>;
7
+ radius?: string;
8
+ }
9
+ export declare const defaultLightTokens: GaineTokens;
10
+ export declare const defaultDarkTokens: GaineTokens;
11
+ export declare const gaineContent: string[];
12
+ export declare function gainePreset(options?: GainePresetOptions): Partial<Config>;
@@ -0,0 +1,2 @@
1
+ import i from'tailwindcss/plugin.js';import u from'tailwindcss-animate';var g={background:"0 0% 100%",foreground:"222 47% 9%",primary:"222 47% 11%","primary-foreground":"0 0% 100%",secondary:"220 14% 96%","secondary-foreground":"222 47% 11%",muted:"220 14% 96%","muted-foreground":"220 9% 38%",accent:"220 14% 95%","accent-foreground":"222 47% 11%",popover:"0 0% 100%","popover-foreground":"222 47% 9%",border:"220 13% 90%",input:"220 13% 90%",ring:"172 66% 36%",brand:"172 66% 38%","brand-foreground":"0 0% 100%"},c={background:"222 47% 6%",foreground:"210 40% 96%",primary:"210 40% 96%","primary-foreground":"222 47% 8%",secondary:"222 30% 12%","secondary-foreground":"210 40% 96%",muted:"222 30% 12%","muted-foreground":"215 18% 68%",accent:"222 30% 15%","accent-foreground":"210 40% 96%",popover:"222 40% 8%","popover-foreground":"210 40% 96%",border:"222 25% 18%",input:"222 25% 18%",ring:"172 66% 45%",brand:"172 66% 45%","brand-foreground":"222 47% 8%"};function a(r){let o={};for(let[e,n]of Object.entries(r))o[`--${e}`]=n;return o}var p=["./node_modules/@gaine/core/dist/**/*.js","./node_modules/@gaine/nextjs/dist/**/*.js","./node_modules/@gaine/vitepress/dist/**/*.js"];function m(r={}){let o={...g,...r.light},e={...c,...r.dark},n=r.radius??"0.875rem",s=i(({addBase:d,addUtilities:t})=>{d({":root":{...a(o),"--radius":n},".dark":{"color-scheme":"dark",...a(e)},"*":{"border-color":"hsl(var(--border))"},html:{"scroll-behavior":"smooth"},body:{"background-color":"hsl(var(--background))","font-family":"var(--font-sans), system-ui, sans-serif",color:"hsl(var(--foreground))","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"},"::selection":{background:"hsl(var(--brand) / 0.2)"},"@media (prefers-reduced-motion: reduce)":{html:{"scroll-behavior":"auto"},"*":{"animation-duration":"0.01ms !important","transition-duration":"0.01ms !important"}}}),t({".bg-dots":{"background-image":"radial-gradient(hsl(var(--foreground) / 0.18) 1px, transparent 1px)","background-size":"14px 14px"}});});return {darkMode:["class"],theme:{extend:{fontFamily:{sans:["var(--font-sans)","system-ui","sans-serif"],display:["var(--font-display)","var(--font-sans)","sans-serif"]},colors:{border:"hsl(var(--border))",input:"hsl(var(--input))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},popover:{DEFAULT:"hsl(var(--popover))",foreground:"hsl(var(--popover-foreground))"},brand:{DEFAULT:"hsl(var(--brand))",foreground:"hsl(var(--brand-foreground))"}},borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"}}},plugins:[u,s]}}export{c as defaultDarkTokens,g as defaultLightTokens,p as gaineContent,m as gainePreset};//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/tailwind/index.ts"],"names":["defaultLightTokens","defaultDarkTokens","toCssVars","tokens","vars","name","value","gaineContent","gainePreset","options","light","dark","radius","base","plugin","addBase","addUtilities","animate"],"mappings":"4EA+CaA,CAAAA,CAAkC,CAC7C,UAAA,CAAY,WAAA,CACZ,WAAY,YAAA,CACZ,OAAA,CAAS,aAAA,CACT,oBAAA,CAAsB,YACtB,SAAA,CAAW,aAAA,CACX,sBAAA,CAAwB,aAAA,CACxB,MAAO,aAAA,CACP,kBAAA,CAAoB,YAAA,CACpB,MAAA,CAAQ,cACR,mBAAA,CAAqB,aAAA,CACrB,OAAA,CAAS,WAAA,CACT,qBAAsB,YAAA,CACtB,MAAA,CAAQ,cACR,KAAA,CAAO,aAAA,CACP,KAAM,aAAA,CACN,KAAA,CAAO,aAAA,CACP,kBAAA,CAAoB,WACtB,CAAA,CAEaC,CAAAA,CAAiC,CAC5C,UAAA,CAAY,aACZ,UAAA,CAAY,aAAA,CACZ,OAAA,CAAS,aAAA,CACT,qBAAsB,YAAA,CACtB,SAAA,CAAW,aAAA,CACX,sBAAA,CAAwB,cACxB,KAAA,CAAO,aAAA,CACP,kBAAA,CAAoB,aAAA,CACpB,OAAQ,aAAA,CACR,mBAAA,CAAqB,aAAA,CACrB,OAAA,CAAS,aACT,oBAAA,CAAsB,aAAA,CACtB,MAAA,CAAQ,aAAA,CACR,MAAO,aAAA,CACP,IAAA,CAAM,cACN,KAAA,CAAO,aAAA,CACP,mBAAoB,YACtB,EAEA,SAASC,CAAAA,CAAUC,EAA6C,CAC9D,IAAMC,CAAAA,CAA+B,GACrC,IAAA,GAAW,CAACC,CAAAA,CAAMC,CAAK,IAAK,MAAA,CAAO,OAAA,CAAQH,CAAM,CAAA,CAAGC,EAAK,CAAA,EAAA,EAAKC,CAAI,CAAA,CAAE,CA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ACN,WAAY,CACV,IAAA,CAAM,CAAC,kBAAA,CAAoB,WAAA,CAAa,YAAY,CAAA,CACpD,QAAS,CAAC,qBAAA,CAAuB,kBAAA,CAAoB,YAAY,CACnE,CAAA,CACA,MAAA,CAAQ,CACN,MAAA,CAAQ,qBACR,KAAA,CAAO,mBAAA,CACP,IAAA,CAAM,kBAAA,CACN,WAAY,wBAAA,CACZ,UAAA,CAAY,wBAAA,CACZ,OAAA,CAAS,CACP,OAAA,CAAS,qBAAA,CACT,UAAA,CAAY,gCACd,EACA,SAAA,CAAW,CACT,OAAA,CAAS,uBAAA,CACT,WAAY,kCACd,CAAA,CACA,MAAO,CACL,OAAA,CAAS,oBACT,UAAA,CAAY,8BACd,CAAA,CACA,MAAA,CAAQ,CACN,OAAA,CAAS,oBAAA,CACT,UAAA,CAAY,+BACd,EACA,OAAA,CAAS,CACP,OAAA,CAAS,qBAAA,CACT,WAAY,gCACd,CAAA,CACA,KAAA,CAAO,CACL,QAAS,mBAAA,CACT,UAAA,CAAY,8BACd,CACF,EACA,YAAA,CAAc,CACZ,EAAA,CAAI,eAAA,CACJ,GAAI,2BAAA,CACJ,EAAA,CAAI,2BACN,CACF,CACF,CAAA,CACA,OAAA,CAAS,CAACC,CAAAA,CAASJ,CAAI,CACzB,CACF","file":"index.js","sourcesContent":["/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Config } from \"tailwindcss\";\nimport plugin from \"tailwindcss/plugin.js\";\nimport animate from \"tailwindcss-animate\";\n\nexport type GaineToken =\n | \"background\"\n | \"foreground\"\n | \"primary\"\n | \"primary-foreground\"\n | \"secondary\"\n | \"secondary-foreground\"\n | \"muted\"\n | \"muted-foreground\"\n | \"accent\"\n | \"accent-foreground\"\n | \"popover\"\n | \"popover-foreground\"\n | \"border\"\n | \"input\"\n | \"ring\"\n | \"brand\"\n | \"brand-foreground\";\n\nexport type GaineTokens = Record<GaineToken, string>;\n\nexport interface GainePresetOptions {\n light?: Partial<GaineTokens>;\n dark?: Partial<GaineTokens>;\n radius?: string;\n}\n\nexport const defaultLightTokens: GaineTokens = {\n background: \"0 0% 100%\",\n foreground: \"222 47% 9%\",\n primary: \"222 47% 11%\",\n \"primary-foreground\": \"0 0% 100%\",\n secondary: \"220 14% 96%\",\n \"secondary-foreground\": \"222 47% 11%\",\n muted: \"220 14% 96%\",\n \"muted-foreground\": \"220 9% 38%\",\n accent: \"220 14% 95%\",\n \"accent-foreground\": \"222 47% 11%\",\n popover: \"0 0% 100%\",\n \"popover-foreground\": \"222 47% 9%\",\n border: \"220 13% 90%\",\n input: \"220 13% 90%\",\n ring: \"172 66% 36%\",\n brand: \"172 66% 38%\",\n \"brand-foreground\": \"0 0% 100%\",\n};\n\nexport const defaultDarkTokens: GaineTokens = {\n background: \"222 47% 6%\",\n foreground: \"210 40% 96%\",\n primary: \"210 40% 96%\",\n \"primary-foreground\": \"222 47% 8%\",\n secondary: \"222 30% 12%\",\n \"secondary-foreground\": \"210 40% 96%\",\n muted: \"222 30% 12%\",\n \"muted-foreground\": \"215 18% 68%\",\n accent: \"222 30% 15%\",\n \"accent-foreground\": \"210 40% 96%\",\n popover: \"222 40% 8%\",\n \"popover-foreground\": \"210 40% 96%\",\n border: \"222 25% 18%\",\n input: \"222 25% 18%\",\n ring: \"172 66% 45%\",\n brand: \"172 66% 45%\",\n \"brand-foreground\": \"222 47% 8%\",\n};\n\nfunction toCssVars(tokens: GaineTokens): Record<string, string> {\n const vars: Record<string, string> = {};\n for (const [name, value] of Object.entries(tokens)) vars[`--${name}`] = value;\n return vars;\n}\n\nexport const gaineContent = [\n \"./node_modules/@gaine/core/dist/**/*.js\",\n \"./node_modules/@gaine/nextjs/dist/**/*.js\",\n \"./node_modules/@gaine/vitepress/dist/**/*.js\",\n];\n\nexport function gainePreset(options: GainePresetOptions = {}): Partial<Config> {\n const light = { ...defaultLightTokens, ...options.light };\n const dark = { ...defaultDarkTokens, ...options.dark };\n const radius = options.radius ?? \"0.875rem\";\n\n const base = plugin(({ addBase, addUtilities }) => {\n addBase({\n \":root\": { ...toCssVars(light), \"--radius\": radius },\n \".dark\": { \"color-scheme\": \"dark\", ...toCssVars(dark) },\n \"*\": { \"border-color\": \"hsl(var(--border))\" },\n html: { \"scroll-behavior\": \"smooth\" },\n body: {\n \"background-color\": \"hsl(var(--background))\",\n \"font-family\": \"var(--font-sans), system-ui, sans-serif\",\n color: \"hsl(var(--foreground))\",\n \"-webkit-font-smoothing\": \"antialiased\",\n \"-moz-osx-font-smoothing\": \"grayscale\",\n },\n \"::selection\": { background: \"hsl(var(--brand) / 0.2)\" },\n \"@media (prefers-reduced-motion: reduce)\": {\n html: { \"scroll-behavior\": \"auto\" },\n \"*\": {\n \"animation-duration\": \"0.01ms !important\",\n \"transition-duration\": \"0.01ms !important\",\n },\n },\n });\n addUtilities({\n \".bg-dots\": {\n \"background-image\": \"radial-gradient(hsl(var(--foreground) / 0.18) 1px, transparent 1px)\",\n \"background-size\": \"14px 14px\",\n },\n });\n });\n\n return {\n darkMode: [\"class\"],\n theme: {\n extend: {\n fontFamily: {\n sans: [\"var(--font-sans)\", \"system-ui\", \"sans-serif\"],\n display: [\"var(--font-display)\", \"var(--font-sans)\", \"sans-serif\"],\n },\n colors: {\n border: \"hsl(var(--border))\",\n input: \"hsl(var(--input))\",\n ring: \"hsl(var(--ring))\",\n background: \"hsl(var(--background))\",\n foreground: \"hsl(var(--foreground))\",\n primary: {\n DEFAULT: \"hsl(var(--primary))\",\n foreground: \"hsl(var(--primary-foreground))\",\n },\n secondary: {\n DEFAULT: \"hsl(var(--secondary))\",\n foreground: \"hsl(var(--secondary-foreground))\",\n },\n muted: {\n DEFAULT: \"hsl(var(--muted))\",\n foreground: \"hsl(var(--muted-foreground))\",\n },\n accent: {\n DEFAULT: \"hsl(var(--accent))\",\n foreground: \"hsl(var(--accent-foreground))\",\n },\n popover: {\n DEFAULT: \"hsl(var(--popover))\",\n foreground: \"hsl(var(--popover-foreground))\",\n },\n brand: {\n DEFAULT: \"hsl(var(--brand))\",\n foreground: \"hsl(var(--brand-foreground))\",\n },\n },\n borderRadius: {\n lg: \"var(--radius)\",\n md: \"calc(var(--radius) - 2px)\",\n sm: \"calc(var(--radius) - 4px)\",\n },\n },\n },\n plugins: [animate, base],\n };\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export declare const THEME_STORAGE_KEY = "theme";
2
+ export declare const themeInitScript = "(function(){try{var d=document.documentElement;d.classList.add(\"js\");var t=localStorage.getItem(\"theme\");if(t===\"dark\"||(t!==\"light\"&&window.matchMedia(\"(prefers-color-scheme: dark)\").matches)){d.classList.add(\"dark\");}}catch(e){}})();";
3
+ export declare function applyTheme(): void;
4
+ export declare function toggleTheme(): void;
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
package/package.json CHANGED
@@ -1,6 +1,73 @@
1
1
  {
2
2
  "name": "@gaine/core",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.0.1",
4
+ "description": "Framework-free core for Gaine, with no React or Vue lock-in",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "sideEffects": [
8
+ "**/*.css"
9
+ ],
10
+ "files": [
11
+ "dist",
12
+ "styles"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "./tailwind": {
21
+ "types": "./dist/tailwind/index.d.ts",
22
+ "import": "./dist/tailwind/index.js",
23
+ "default": "./dist/tailwind/index.js"
24
+ },
25
+ "./reveal.css": "./styles/reveal.css",
26
+ "./speed": {
27
+ "types": "./dist/speed/index.d.ts",
28
+ "import": "./dist/speed/index.js",
29
+ "default": "./dist/speed/index.js"
30
+ },
31
+ "./speed/node": {
32
+ "types": "./dist/speed/node.d.ts",
33
+ "import": "./dist/speed/node.js",
34
+ "default": "./dist/speed/node.js"
35
+ },
36
+ "./speed.css": "./styles/speed.css",
37
+ "./view-transition.css": "./styles/view-transition.css",
38
+ "./package.json": "./package.json"
39
+ },
40
+ "dependencies": {
41
+ "clsx": "^2.1.1",
42
+ "tailwind-merge": "^2.6.0",
43
+ "tailwindcss-animate": "^1.0.7"
44
+ },
45
+ "peerDependencies": {
46
+ "tailwindcss": "^3.4.17"
47
+ },
48
+ "devDependencies": {
49
+ "tailwindcss": "^3.4.17",
50
+ "typescript": "^5.7.2",
51
+ "@types/node": "^22.10.0"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "tailwindcss": {
55
+ "optional": true
56
+ }
57
+ },
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "git+https://github.com/soteenstudio/gaine.git",
61
+ "directory": "packages/core"
62
+ },
63
+ "homepage": "https://github.com/soteenstudio/gaine#readme",
64
+ "bugs": {
65
+ "url": "https://github.com/soteenstudio/gaine/issues"
66
+ },
67
+ "scripts": {
68
+ "build": "tsup && tsc -p tsconfig.json --emitDeclarationOnly --sourceMap false",
69
+ "typecheck": "tsc -p tsconfig.json --noEmit",
70
+ "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
71
+ "test": "node --test"
72
+ }
6
73
  }
@@ -0,0 +1,97 @@
1
+ /*
2
+ * Copyright 2026 SoTeen Studio
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ @keyframes reveal-up {
18
+ from {
19
+ opacity: 0;
20
+ translate: 0 28px;
21
+ }
22
+ to {
23
+ opacity: 1;
24
+ translate: 0 0;
25
+ }
26
+ }
27
+ @keyframes reveal-left {
28
+ from {
29
+ opacity: 0;
30
+ translate: -32px 0;
31
+ }
32
+ to {
33
+ opacity: 1;
34
+ translate: 0 0;
35
+ }
36
+ }
37
+ @keyframes reveal-right {
38
+ from {
39
+ opacity: 0;
40
+ translate: 32px 0;
41
+ }
42
+ to {
43
+ opacity: 1;
44
+ translate: 0 0;
45
+ }
46
+ }
47
+ @keyframes reveal-scale {
48
+ from {
49
+ opacity: 0;
50
+ scale: 0.96;
51
+ }
52
+ to {
53
+ opacity: 1;
54
+ scale: 1;
55
+ }
56
+ }
57
+ @keyframes reveal-fade {
58
+ from {
59
+ opacity: 0;
60
+ }
61
+ to {
62
+ opacity: 1;
63
+ }
64
+ }
65
+
66
+ .js [data-reveal] {
67
+ opacity: 0;
68
+ }
69
+
70
+ .js [data-reveal].is-visible {
71
+ animation-name: reveal-up;
72
+ animation-duration: 0.8s;
73
+ animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
74
+ animation-delay: var(--reveal-delay, 0ms);
75
+ animation-fill-mode: both;
76
+ }
77
+ .js [data-reveal="left"].is-visible {
78
+ animation-name: reveal-left;
79
+ }
80
+ .js [data-reveal="right"].is-visible {
81
+ animation-name: reveal-right;
82
+ }
83
+ .js [data-reveal="scale"].is-visible {
84
+ animation-name: reveal-scale;
85
+ }
86
+ .js [data-reveal="fade"].is-visible {
87
+ animation-name: reveal-fade;
88
+ }
89
+
90
+ @media (prefers-reduced-motion: reduce) {
91
+ .js [data-reveal] {
92
+ opacity: 1;
93
+ }
94
+ .js [data-reveal].is-visible {
95
+ animation: none;
96
+ }
97
+ }
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright 2026 SoTeen Studio
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ .gaine-defer {
18
+ content-visibility: auto;
19
+ contain-intrinsic-size: auto 640px;
20
+ }
21
+ .gaine-defer-sm {
22
+ content-visibility: auto;
23
+ contain-intrinsic-size: auto 320px;
24
+ }
25
+ .gaine-isolate {
26
+ contain: layout paint;
27
+ }
28
+ img,
29
+ video {
30
+ max-width: 100%;
31
+ height: auto;
32
+ }
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright 2026 SoTeen Studio
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ @media (prefers-reduced-motion: no-preference) {
18
+ @view-transition {
19
+ navigation: auto;
20
+ }
21
+ ::view-transition-old(root),
22
+ ::view-transition-new(root) {
23
+ animation-duration: 0.16s;
24
+ }
25
+ }