@timbenniks/contentstack-platform-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.cjs +607 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +108 -0
- package/dist/auth/index.d.ts +108 -0
- package/dist/auth/index.mjs +25 -0
- package/dist/auth/index.mjs.map +1 -0
- package/dist/brandkit/index.cjs +525 -0
- package/dist/brandkit/index.cjs.map +1 -0
- package/dist/brandkit/index.d.cts +95 -0
- package/dist/brandkit/index.d.ts +95 -0
- package/dist/brandkit/index.mjs +11 -0
- package/dist/brandkit/index.mjs.map +1 -0
- package/dist/chunk-3C6J2BDB.mjs +84 -0
- package/dist/chunk-3C6J2BDB.mjs.map +1 -0
- package/dist/chunk-3KE63N3I.mjs +64 -0
- package/dist/chunk-3KE63N3I.mjs.map +1 -0
- package/dist/chunk-4CJ4IVPJ.mjs +212 -0
- package/dist/chunk-4CJ4IVPJ.mjs.map +1 -0
- package/dist/chunk-4JFUI7MJ.mjs +368 -0
- package/dist/chunk-4JFUI7MJ.mjs.map +1 -0
- package/dist/chunk-7VFGD32I.mjs +26 -0
- package/dist/chunk-7VFGD32I.mjs.map +1 -0
- package/dist/chunk-ARPJDW3A.mjs +44 -0
- package/dist/chunk-ARPJDW3A.mjs.map +1 -0
- package/dist/chunk-AVJHCFRK.mjs +52 -0
- package/dist/chunk-AVJHCFRK.mjs.map +1 -0
- package/dist/chunk-BK2IBTQS.mjs +131 -0
- package/dist/chunk-BK2IBTQS.mjs.map +1 -0
- package/dist/chunk-BUZ6CQHE.mjs +75 -0
- package/dist/chunk-BUZ6CQHE.mjs.map +1 -0
- package/dist/chunk-CKMAOWBQ.mjs +379 -0
- package/dist/chunk-CKMAOWBQ.mjs.map +1 -0
- package/dist/chunk-DJQLN4TR.mjs +1 -0
- package/dist/chunk-DJQLN4TR.mjs.map +1 -0
- package/dist/chunk-DMERADWM.mjs +67 -0
- package/dist/chunk-DMERADWM.mjs.map +1 -0
- package/dist/chunk-EREPKWTW.mjs +926 -0
- package/dist/chunk-EREPKWTW.mjs.map +1 -0
- package/dist/chunk-FQP4PB5X.mjs +88 -0
- package/dist/chunk-FQP4PB5X.mjs.map +1 -0
- package/dist/chunk-GNPQJBFX.mjs +144 -0
- package/dist/chunk-GNPQJBFX.mjs.map +1 -0
- package/dist/chunk-GOSB24M6.mjs +87 -0
- package/dist/chunk-GOSB24M6.mjs.map +1 -0
- package/dist/chunk-JL2E3EOT.mjs +255 -0
- package/dist/chunk-JL2E3EOT.mjs.map +1 -0
- package/dist/chunk-JYGZBKTH.mjs +222 -0
- package/dist/chunk-JYGZBKTH.mjs.map +1 -0
- package/dist/chunk-JZE2W7VW.mjs +52 -0
- package/dist/chunk-JZE2W7VW.mjs.map +1 -0
- package/dist/chunk-K76DKSHJ.mjs +18 -0
- package/dist/chunk-K76DKSHJ.mjs.map +1 -0
- package/dist/chunk-KLVIROVU.mjs +232 -0
- package/dist/chunk-KLVIROVU.mjs.map +1 -0
- package/dist/chunk-LPVVA5J3.mjs +18 -0
- package/dist/chunk-LPVVA5J3.mjs.map +1 -0
- package/dist/chunk-NKLOZ5VI.mjs +112 -0
- package/dist/chunk-NKLOZ5VI.mjs.map +1 -0
- package/dist/chunk-QGA4WBDC.mjs +7 -0
- package/dist/chunk-QGA4WBDC.mjs.map +1 -0
- package/dist/chunk-QW7TVYOA.mjs +56 -0
- package/dist/chunk-QW7TVYOA.mjs.map +1 -0
- package/dist/chunk-SU5QEKYW.mjs +83 -0
- package/dist/chunk-SU5QEKYW.mjs.map +1 -0
- package/dist/chunk-T5A2E2RI.mjs +654 -0
- package/dist/chunk-T5A2E2RI.mjs.map +1 -0
- package/dist/chunk-T5OIJQK7.mjs +116 -0
- package/dist/chunk-T5OIJQK7.mjs.map +1 -0
- package/dist/chunk-VW7DD6HV.mjs +253 -0
- package/dist/chunk-VW7DD6HV.mjs.map +1 -0
- package/dist/chunk-XH7NLHGW.mjs +133 -0
- package/dist/chunk-XH7NLHGW.mjs.map +1 -0
- package/dist/client-DJ5haQGd.d.cts +22 -0
- package/dist/client-DwVGVSQz.d.ts +22 -0
- package/dist/cma/index.cjs +1349 -0
- package/dist/cma/index.cjs.map +1 -0
- package/dist/cma/index.d.cts +22 -0
- package/dist/cma/index.d.ts +22 -0
- package/dist/cma/index.mjs +70 -0
- package/dist/cma/index.mjs.map +1 -0
- package/dist/errors-CAw-IRCP.d.cts +65 -0
- package/dist/errors-CAw-IRCP.d.ts +65 -0
- package/dist/generative-ai/index.cjs +401 -0
- package/dist/generative-ai/index.cjs.map +1 -0
- package/dist/generative-ai/index.d.cts +31 -0
- package/dist/generative-ai/index.d.ts +31 -0
- package/dist/generative-ai/index.mjs +10 -0
- package/dist/generative-ai/index.mjs.map +1 -0
- package/dist/images/index.cjs +185 -0
- package/dist/images/index.cjs.map +1 -0
- package/dist/images/index.d.cts +27 -0
- package/dist/images/index.d.ts +27 -0
- package/dist/images/index.mjs +8 -0
- package/dist/images/index.mjs.map +1 -0
- package/dist/index.cjs +2909 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +30 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.mjs +153 -0
- package/dist/index.mjs.map +1 -0
- package/dist/knowledge-vault/index.cjs +413 -0
- package/dist/knowledge-vault/index.cjs.map +1 -0
- package/dist/knowledge-vault/index.d.cts +49 -0
- package/dist/knowledge-vault/index.d.ts +49 -0
- package/dist/knowledge-vault/index.mjs +10 -0
- package/dist/knowledge-vault/index.mjs.map +1 -0
- package/dist/launch/index.cjs +624 -0
- package/dist/launch/index.cjs.map +1 -0
- package/dist/launch/index.d.cts +169 -0
- package/dist/launch/index.d.ts +169 -0
- package/dist/launch/index.mjs +11 -0
- package/dist/launch/index.mjs.map +1 -0
- package/dist/react/auth/index.cjs +113 -0
- package/dist/react/auth/index.cjs.map +1 -0
- package/dist/react/auth/index.d.cts +33 -0
- package/dist/react/auth/index.d.ts +33 -0
- package/dist/react/auth/index.mjs +13 -0
- package/dist/react/auth/index.mjs.map +1 -0
- package/dist/react/content/index.cjs +113 -0
- package/dist/react/content/index.cjs.map +1 -0
- package/dist/react/content/index.d.cts +25 -0
- package/dist/react/content/index.d.ts +25 -0
- package/dist/react/content/index.mjs +7 -0
- package/dist/react/content/index.mjs.map +1 -0
- package/dist/react/hooks/index.cjs +2097 -0
- package/dist/react/hooks/index.cjs.map +1 -0
- package/dist/react/hooks/index.d.cts +77 -0
- package/dist/react/hooks/index.d.ts +77 -0
- package/dist/react/hooks/index.mjs +46 -0
- package/dist/react/hooks/index.mjs.map +1 -0
- package/dist/react/index.cjs +2307 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +16 -0
- package/dist/react/index.d.ts +16 -0
- package/dist/react/index.mjs +67 -0
- package/dist/react/index.mjs.map +1 -0
- package/dist/react/provider/index.cjs +83 -0
- package/dist/react/provider/index.cjs.map +1 -0
- package/dist/react/provider/index.d.cts +30 -0
- package/dist/react/provider/index.d.ts +30 -0
- package/dist/react/provider/index.mjs +11 -0
- package/dist/react/provider/index.mjs.map +1 -0
- package/dist/regions/index.cjs +171 -0
- package/dist/regions/index.cjs.map +1 -0
- package/dist/regions/index.d.cts +55 -0
- package/dist/regions/index.d.ts +55 -0
- package/dist/regions/index.mjs +13 -0
- package/dist/regions/index.mjs.map +1 -0
- package/dist/request-builders-BxeolQIw.d.ts +735 -0
- package/dist/request-builders-C2IG1LUo.d.cts +735 -0
- package/dist/rte/index.cjs +683 -0
- package/dist/rte/index.cjs.map +1 -0
- package/dist/rte/index.d.cts +33 -0
- package/dist/rte/index.d.ts +33 -0
- package/dist/rte/index.mjs +17 -0
- package/dist/rte/index.mjs.map +1 -0
- package/dist/server/index.cjs +917 -0
- package/dist/server/index.cjs.map +1 -0
- package/dist/server/index.d.cts +6 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.mjs +45 -0
- package/dist/server/index.mjs.map +1 -0
- package/dist/server/middleware/index.cjs +614 -0
- package/dist/server/middleware/index.cjs.map +1 -0
- package/dist/server/middleware/index.d.cts +77 -0
- package/dist/server/middleware/index.d.ts +77 -0
- package/dist/server/middleware/index.mjs +27 -0
- package/dist/server/middleware/index.mjs.map +1 -0
- package/dist/server/proxy/index.cjs +329 -0
- package/dist/server/proxy/index.cjs.map +1 -0
- package/dist/server/proxy/index.d.cts +143 -0
- package/dist/server/proxy/index.d.ts +143 -0
- package/dist/server/proxy/index.mjs +29 -0
- package/dist/server/proxy/index.mjs.map +1 -0
- package/dist/server/webhooks/index.cjs +131 -0
- package/dist/server/webhooks/index.cjs.map +1 -0
- package/dist/server/webhooks/index.d.cts +230 -0
- package/dist/server/webhooks/index.d.ts +230 -0
- package/dist/server/webhooks/index.mjs +23 -0
- package/dist/server/webhooks/index.mjs.map +1 -0
- package/dist/types-6D9VR7pT.d.cts +26 -0
- package/dist/types-AelT0rFJ.d.cts +21 -0
- package/dist/types-AelT0rFJ.d.ts +21 -0
- package/dist/types-Bu5yCgmw.d.ts +26 -0
- package/dist/types-DgixK-ll.d.cts +23 -0
- package/dist/types-DgixK-ll.d.ts +23 -0
- package/dist/types-DrMwdlH9.d.cts +245 -0
- package/dist/types-DrMwdlH9.d.ts +245 -0
- package/dist/ui/css/index.cjs +31 -0
- package/dist/ui/css/index.cjs.map +1 -0
- package/dist/ui/css/index.d.cts +15 -0
- package/dist/ui/css/index.d.ts +15 -0
- package/dist/ui/css/index.mjs +7 -0
- package/dist/ui/css/index.mjs.map +1 -0
- package/dist/ui/index.cjs +368 -0
- package/dist/ui/index.cjs.map +1 -0
- package/dist/ui/index.d.cts +4 -0
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.mjs +33 -0
- package/dist/ui/index.mjs.map +1 -0
- package/dist/ui/theme/index.cjs +105 -0
- package/dist/ui/theme/index.cjs.map +1 -0
- package/dist/ui/theme/index.d.cts +33 -0
- package/dist/ui/theme/index.d.ts +33 -0
- package/dist/ui/theme/index.mjs +15 -0
- package/dist/ui/theme/index.mjs.map +1 -0
- package/dist/ui/tokens/index.cjs +286 -0
- package/dist/ui/tokens/index.cjs.map +1 -0
- package/dist/ui/tokens/index.d.cts +54 -0
- package/dist/ui/tokens/index.d.ts +54 -0
- package/dist/ui/tokens/index.mjs +17 -0
- package/dist/ui/tokens/index.mjs.map +1 -0
- package/dist/ui/tokens.css +408 -0
- package/dist/vue/auth/index.cjs +141 -0
- package/dist/vue/auth/index.cjs.map +1 -0
- package/dist/vue/auth/index.d.cts +78 -0
- package/dist/vue/auth/index.d.ts +78 -0
- package/dist/vue/auth/index.mjs +13 -0
- package/dist/vue/auth/index.mjs.map +1 -0
- package/dist/vue/composables/index.cjs +2108 -0
- package/dist/vue/composables/index.cjs.map +1 -0
- package/dist/vue/composables/index.d.cts +78 -0
- package/dist/vue/composables/index.d.ts +78 -0
- package/dist/vue/composables/index.mjs +46 -0
- package/dist/vue/composables/index.mjs.map +1 -0
- package/dist/vue/content/index.cjs +142 -0
- package/dist/vue/content/index.cjs.map +1 -0
- package/dist/vue/content/index.d.cts +47 -0
- package/dist/vue/content/index.d.ts +47 -0
- package/dist/vue/content/index.mjs +7 -0
- package/dist/vue/content/index.mjs.map +1 -0
- package/dist/vue/index.cjs +2389 -0
- package/dist/vue/index.cjs.map +1 -0
- package/dist/vue/index.d.cts +16 -0
- package/dist/vue/index.d.ts +16 -0
- package/dist/vue/index.mjs +69 -0
- package/dist/vue/index.mjs.map +1 -0
- package/dist/vue/provider/index.cjs +97 -0
- package/dist/vue/provider/index.cjs.map +1 -0
- package/dist/vue/provider/index.d.cts +90 -0
- package/dist/vue/provider/index.d.ts +90 -0
- package/dist/vue/provider/index.mjs +13 -0
- package/dist/vue/provider/index.mjs.map +1 -0
- package/package.json +195 -0
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/ui/index.ts
|
|
21
|
+
var ui_exports = {};
|
|
22
|
+
__export(ui_exports, {
|
|
23
|
+
CSS_TOKENS_PATH: () => CSS_TOKENS_PATH,
|
|
24
|
+
colorVar: () => colorVar,
|
|
25
|
+
colors: () => colors,
|
|
26
|
+
fontVar: () => fontVar,
|
|
27
|
+
getEffectiveTheme: () => getEffectiveTheme,
|
|
28
|
+
getTheme: () => getTheme,
|
|
29
|
+
initTheme: () => initTheme,
|
|
30
|
+
onThemeChange: () => onThemeChange,
|
|
31
|
+
setTheme: () => setTheme,
|
|
32
|
+
spaceVar: () => spaceVar,
|
|
33
|
+
spacing: () => spacing,
|
|
34
|
+
typography: () => typography
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(ui_exports);
|
|
37
|
+
|
|
38
|
+
// src/ui/tokens/colors.ts
|
|
39
|
+
var colors = {
|
|
40
|
+
brand: {
|
|
41
|
+
primary: {
|
|
42
|
+
base: "#6c5ce7",
|
|
43
|
+
medium: "#9387ed",
|
|
44
|
+
dark: "#3e3871",
|
|
45
|
+
darker: "#5d50bf",
|
|
46
|
+
light: "#efedfc"
|
|
47
|
+
},
|
|
48
|
+
secondary: {
|
|
49
|
+
lightest: "#dde3ee",
|
|
50
|
+
lighter: "#edf1f7",
|
|
51
|
+
light: "#a9b6cb",
|
|
52
|
+
base: "#647696",
|
|
53
|
+
medium: "#c7d0e1",
|
|
54
|
+
dark: "#475161"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
status: {
|
|
58
|
+
success: {
|
|
59
|
+
base: "#007a52",
|
|
60
|
+
dark: "#00472f",
|
|
61
|
+
light: "#f5fffc"
|
|
62
|
+
},
|
|
63
|
+
warning: {
|
|
64
|
+
base: "#d62400",
|
|
65
|
+
dark: "#701300",
|
|
66
|
+
light: "#ffeeeb",
|
|
67
|
+
medium: "#eb5646"
|
|
68
|
+
},
|
|
69
|
+
attention: {
|
|
70
|
+
base: "#ffae0a",
|
|
71
|
+
dark: "#704b00",
|
|
72
|
+
light: "#fff8eb"
|
|
73
|
+
},
|
|
74
|
+
info: {
|
|
75
|
+
base: "#00b9e0",
|
|
76
|
+
dark: "#003b47",
|
|
77
|
+
light: "#f5fdff"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
base: {
|
|
81
|
+
purple: {
|
|
82
|
+
5: "#6c5ce7",
|
|
83
|
+
10: "#3e3871",
|
|
84
|
+
15: "#efedfc",
|
|
85
|
+
20: "#9387ed",
|
|
86
|
+
25: "#5d50bf"
|
|
87
|
+
},
|
|
88
|
+
gray: {
|
|
89
|
+
5: "#edf1f7",
|
|
90
|
+
10: "#a9b6cb",
|
|
91
|
+
15: "#647696",
|
|
92
|
+
20: "#475161",
|
|
93
|
+
25: "rgba(160, 174, 192, 0.5)",
|
|
94
|
+
30: "#f5f5f5",
|
|
95
|
+
35: "#c7d0e1",
|
|
96
|
+
40: "#dde3ee"
|
|
97
|
+
},
|
|
98
|
+
green: {
|
|
99
|
+
5: "#007a52",
|
|
100
|
+
10: "#00472f",
|
|
101
|
+
15: "#f5fffc"
|
|
102
|
+
},
|
|
103
|
+
orange: {
|
|
104
|
+
5: "#d62400",
|
|
105
|
+
10: "#701300",
|
|
106
|
+
15: "#ffeeeb",
|
|
107
|
+
20: "#eb5646"
|
|
108
|
+
},
|
|
109
|
+
blue: {
|
|
110
|
+
5: "#00b9e0",
|
|
111
|
+
10: "#003b47",
|
|
112
|
+
15: "#f5fdff"
|
|
113
|
+
},
|
|
114
|
+
yellow: {
|
|
115
|
+
5: "#ffae0a",
|
|
116
|
+
10: "#704b00",
|
|
117
|
+
15: "#fff8eb"
|
|
118
|
+
},
|
|
119
|
+
black: {
|
|
120
|
+
5: "#222222"
|
|
121
|
+
},
|
|
122
|
+
white: {
|
|
123
|
+
5: "#ffffff",
|
|
124
|
+
10: "#f7f9fc",
|
|
125
|
+
15: "#f5f5f5",
|
|
126
|
+
20: "#f7f9fc"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
font: {
|
|
130
|
+
base: "#475161",
|
|
131
|
+
secondary: "#647696",
|
|
132
|
+
tertiary: "#a9b6cb",
|
|
133
|
+
quaternary: "#edf1f7",
|
|
134
|
+
link: "#6c5ce7",
|
|
135
|
+
active: "#647696",
|
|
136
|
+
warning: "#d62400",
|
|
137
|
+
attention: "#ffae0a",
|
|
138
|
+
success: "#007a52",
|
|
139
|
+
info: "#00b9e0",
|
|
140
|
+
disabled: "rgba(160, 174, 192, 0.5)",
|
|
141
|
+
white: "#ffffff",
|
|
142
|
+
black: "#222222",
|
|
143
|
+
sonicSilver: "#767676",
|
|
144
|
+
tarmacGrey: "#475161",
|
|
145
|
+
gray900: "#212121",
|
|
146
|
+
jetBlack: "#000000",
|
|
147
|
+
purpleGray: "#6e6b86"
|
|
148
|
+
},
|
|
149
|
+
border: {
|
|
150
|
+
lighter: "#f5f5f5",
|
|
151
|
+
light: "#a9b6cb",
|
|
152
|
+
base: "#647696",
|
|
153
|
+
dark: "#475161",
|
|
154
|
+
link: "#6c5ce7",
|
|
155
|
+
focus: "#edf1f7",
|
|
156
|
+
warning: "#d62400",
|
|
157
|
+
success: "#007a52"
|
|
158
|
+
},
|
|
159
|
+
bg: {
|
|
160
|
+
lavender: "#f8f6ff",
|
|
161
|
+
dolphinGrey: "#dde3ee",
|
|
162
|
+
pureWhite: "#ffffff",
|
|
163
|
+
milkybarWhite: "#f7f9fc",
|
|
164
|
+
hibiscus: "#ffeeeb",
|
|
165
|
+
cashew: "#fff8eb",
|
|
166
|
+
algae: "#f5fffc",
|
|
167
|
+
sky: "#f5fdff",
|
|
168
|
+
tulipPurple: "#f9f8ff",
|
|
169
|
+
lavenderBlue: "#fadeff"
|
|
170
|
+
},
|
|
171
|
+
accent: {
|
|
172
|
+
purple50: "#b6aef3",
|
|
173
|
+
mediumOrchid: "#bd59fa",
|
|
174
|
+
blueChalk: "#edebff",
|
|
175
|
+
paleAqua: "#bad4fb",
|
|
176
|
+
pastelBlue: "#43b7c2",
|
|
177
|
+
bottleGreen: "#003a25",
|
|
178
|
+
aquaDeep: "#00593b",
|
|
179
|
+
mint: "#47b0aa",
|
|
180
|
+
summerGreen: "#90bba5",
|
|
181
|
+
bean: "#4f0800",
|
|
182
|
+
rustOrange: "#ba5800",
|
|
183
|
+
salmonPink: "#e57872",
|
|
184
|
+
crayola: "#ffce6c",
|
|
185
|
+
sundown: "#fdafa3",
|
|
186
|
+
butterscotch: "#ffad48"
|
|
187
|
+
},
|
|
188
|
+
statusAccent: {
|
|
189
|
+
poppy: "#a31b00",
|
|
190
|
+
mango: "#ffae0a",
|
|
191
|
+
spinach: "#007a52",
|
|
192
|
+
aqua: "#0469e3",
|
|
193
|
+
maximumBluePurple: "#ada4f4"
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
function colorVar(name) {
|
|
197
|
+
return `var(--cs-color-${name})`;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// src/ui/tokens/typography.ts
|
|
201
|
+
var typography = {
|
|
202
|
+
fontFamily: {
|
|
203
|
+
primary: "Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif"
|
|
204
|
+
},
|
|
205
|
+
fontSize: {
|
|
206
|
+
tiny: "0.6875rem",
|
|
207
|
+
small: "0.75rem",
|
|
208
|
+
medium: "0.8125rem",
|
|
209
|
+
large: "0.875rem",
|
|
210
|
+
xl: "1rem",
|
|
211
|
+
"2xl": "1.125rem",
|
|
212
|
+
"3xl": "1.375rem",
|
|
213
|
+
"4xl": "1.875rem",
|
|
214
|
+
"5xl": "2.25rem",
|
|
215
|
+
"6xl": "2.625rem"
|
|
216
|
+
},
|
|
217
|
+
fontSizeV2: {
|
|
218
|
+
small: "0.75rem",
|
|
219
|
+
medium: "0.875rem",
|
|
220
|
+
large: "1rem",
|
|
221
|
+
xl: "1.25rem",
|
|
222
|
+
"2xl": "1.75rem",
|
|
223
|
+
"3xl": "2.125rem"
|
|
224
|
+
},
|
|
225
|
+
fontWeight: {
|
|
226
|
+
regular: 400,
|
|
227
|
+
medium: 500,
|
|
228
|
+
semiBold: 600,
|
|
229
|
+
bold: 700,
|
|
230
|
+
extraBold: 800
|
|
231
|
+
},
|
|
232
|
+
lineHeight: {
|
|
233
|
+
default: 1.5,
|
|
234
|
+
condensed: 1.25,
|
|
235
|
+
reset: 1
|
|
236
|
+
},
|
|
237
|
+
letterSpacing: {
|
|
238
|
+
tight: "0.01em",
|
|
239
|
+
normal: "0.02em"
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
function fontVar(name) {
|
|
243
|
+
return `var(--cs-${name})`;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// src/ui/tokens/spacing.ts
|
|
247
|
+
var spacing = {
|
|
248
|
+
2: "0.125rem",
|
|
249
|
+
4: "0.25rem",
|
|
250
|
+
5: "0.3125rem",
|
|
251
|
+
6: "0.375rem",
|
|
252
|
+
8: "0.5rem",
|
|
253
|
+
10: "0.625rem",
|
|
254
|
+
12: "0.75rem",
|
|
255
|
+
14: "0.875rem",
|
|
256
|
+
15: "0.9375rem",
|
|
257
|
+
16: "1rem",
|
|
258
|
+
18: "1.125rem",
|
|
259
|
+
20: "1.25rem",
|
|
260
|
+
22: "1.375rem",
|
|
261
|
+
24: "1.5rem",
|
|
262
|
+
25: "1.5625rem",
|
|
263
|
+
26: "1.625rem",
|
|
264
|
+
28: "1.75rem",
|
|
265
|
+
30: "1.875rem",
|
|
266
|
+
32: "2rem",
|
|
267
|
+
34: "2.125rem",
|
|
268
|
+
35: "2.1875rem",
|
|
269
|
+
36: "2.25rem",
|
|
270
|
+
38: "2.375rem",
|
|
271
|
+
40: "2.5rem",
|
|
272
|
+
50: "3.125rem",
|
|
273
|
+
60: "3.75rem",
|
|
274
|
+
64: "4rem",
|
|
275
|
+
80: "5rem",
|
|
276
|
+
100: "6.25rem",
|
|
277
|
+
120: "7.5rem",
|
|
278
|
+
160: "10rem"
|
|
279
|
+
};
|
|
280
|
+
function spaceVar(size) {
|
|
281
|
+
return `var(--cs-space-${size})`;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// src/ui/theme/theme.ts
|
|
285
|
+
var STORAGE_KEY = "cs-theme";
|
|
286
|
+
var DATA_ATTR = "data-theme";
|
|
287
|
+
function getTheme() {
|
|
288
|
+
if (typeof document === "undefined") return "system";
|
|
289
|
+
const attr = document.documentElement.getAttribute(DATA_ATTR);
|
|
290
|
+
if (attr === "light" || attr === "dark") return attr;
|
|
291
|
+
return "system";
|
|
292
|
+
}
|
|
293
|
+
function setTheme(theme) {
|
|
294
|
+
if (typeof document === "undefined") return;
|
|
295
|
+
if (theme === "system") {
|
|
296
|
+
document.documentElement.removeAttribute(DATA_ATTR);
|
|
297
|
+
} else {
|
|
298
|
+
document.documentElement.setAttribute(DATA_ATTR, theme);
|
|
299
|
+
}
|
|
300
|
+
try {
|
|
301
|
+
if (typeof localStorage !== "undefined") {
|
|
302
|
+
localStorage.setItem(STORAGE_KEY, theme);
|
|
303
|
+
}
|
|
304
|
+
} catch {
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
function initTheme() {
|
|
308
|
+
try {
|
|
309
|
+
if (typeof localStorage === "undefined") return;
|
|
310
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
311
|
+
if (stored === "light" || stored === "dark" || stored === "system") {
|
|
312
|
+
setTheme(stored);
|
|
313
|
+
}
|
|
314
|
+
} catch {
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
function onThemeChange(callback) {
|
|
318
|
+
if (typeof window === "undefined") return () => {
|
|
319
|
+
};
|
|
320
|
+
const observer = new MutationObserver(() => {
|
|
321
|
+
callback(getTheme());
|
|
322
|
+
});
|
|
323
|
+
observer.observe(document.documentElement, {
|
|
324
|
+
attributes: true,
|
|
325
|
+
attributeFilter: [DATA_ATTR]
|
|
326
|
+
});
|
|
327
|
+
let mediaQuery;
|
|
328
|
+
const mediaHandler = () => {
|
|
329
|
+
if (getTheme() === "system") {
|
|
330
|
+
callback("system");
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
if (typeof window.matchMedia === "function") {
|
|
334
|
+
mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
335
|
+
mediaQuery.addEventListener("change", mediaHandler);
|
|
336
|
+
}
|
|
337
|
+
return () => {
|
|
338
|
+
observer.disconnect();
|
|
339
|
+
mediaQuery?.removeEventListener("change", mediaHandler);
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function getEffectiveTheme() {
|
|
343
|
+
const theme = getTheme();
|
|
344
|
+
if (theme !== "system") return theme;
|
|
345
|
+
if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
|
|
346
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
347
|
+
}
|
|
348
|
+
return "light";
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// src/ui/css/index.ts
|
|
352
|
+
var CSS_TOKENS_PATH = "@timbenniks/contentstack-platform-sdk/ui/tokens.css";
|
|
353
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
354
|
+
0 && (module.exports = {
|
|
355
|
+
CSS_TOKENS_PATH,
|
|
356
|
+
colorVar,
|
|
357
|
+
colors,
|
|
358
|
+
fontVar,
|
|
359
|
+
getEffectiveTheme,
|
|
360
|
+
getTheme,
|
|
361
|
+
initTheme,
|
|
362
|
+
onThemeChange,
|
|
363
|
+
setTheme,
|
|
364
|
+
spaceVar,
|
|
365
|
+
spacing,
|
|
366
|
+
typography
|
|
367
|
+
});
|
|
368
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/index.ts","../../src/ui/tokens/colors.ts","../../src/ui/tokens/typography.ts","../../src/ui/tokens/spacing.ts","../../src/ui/theme/theme.ts","../../src/ui/css/index.ts"],"sourcesContent":["export * from \"./tokens/index.js\"\nexport * from \"./theme/index.js\"\nexport { CSS_TOKENS_PATH } from \"./css/index.js\"\n","import type { ColorTokens } from \"./types.js\"\n\n/**\n * Contentstack Venus design system color tokens (light theme).\n * Values sourced from `@contentstack/venus-components` token definitions.\n */\nexport const colors: ColorTokens = {\n brand: {\n primary: {\n base: \"#6c5ce7\",\n medium: \"#9387ed\",\n dark: \"#3e3871\",\n darker: \"#5d50bf\",\n light: \"#efedfc\",\n },\n secondary: {\n lightest: \"#dde3ee\",\n lighter: \"#edf1f7\",\n light: \"#a9b6cb\",\n base: \"#647696\",\n medium: \"#c7d0e1\",\n dark: \"#475161\",\n },\n },\n status: {\n success: {\n base: \"#007a52\",\n dark: \"#00472f\",\n light: \"#f5fffc\",\n },\n warning: {\n base: \"#d62400\",\n dark: \"#701300\",\n light: \"#ffeeeb\",\n medium: \"#eb5646\",\n },\n attention: {\n base: \"#ffae0a\",\n dark: \"#704b00\",\n light: \"#fff8eb\",\n },\n info: {\n base: \"#00b9e0\",\n dark: \"#003b47\",\n light: \"#f5fdff\",\n },\n },\n base: {\n purple: {\n 5: \"#6c5ce7\",\n 10: \"#3e3871\",\n 15: \"#efedfc\",\n 20: \"#9387ed\",\n 25: \"#5d50bf\",\n },\n gray: {\n 5: \"#edf1f7\",\n 10: \"#a9b6cb\",\n 15: \"#647696\",\n 20: \"#475161\",\n 25: \"rgba(160, 174, 192, 0.5)\",\n 30: \"#f5f5f5\",\n 35: \"#c7d0e1\",\n 40: \"#dde3ee\",\n },\n green: {\n 5: \"#007a52\",\n 10: \"#00472f\",\n 15: \"#f5fffc\",\n },\n orange: {\n 5: \"#d62400\",\n 10: \"#701300\",\n 15: \"#ffeeeb\",\n 20: \"#eb5646\",\n },\n blue: {\n 5: \"#00b9e0\",\n 10: \"#003b47\",\n 15: \"#f5fdff\",\n },\n yellow: {\n 5: \"#ffae0a\",\n 10: \"#704b00\",\n 15: \"#fff8eb\",\n },\n black: {\n 5: \"#222222\",\n },\n white: {\n 5: \"#ffffff\",\n 10: \"#f7f9fc\",\n 15: \"#f5f5f5\",\n 20: \"#f7f9fc\",\n },\n },\n font: {\n base: \"#475161\",\n secondary: \"#647696\",\n tertiary: \"#a9b6cb\",\n quaternary: \"#edf1f7\",\n link: \"#6c5ce7\",\n active: \"#647696\",\n warning: \"#d62400\",\n attention: \"#ffae0a\",\n success: \"#007a52\",\n info: \"#00b9e0\",\n disabled: \"rgba(160, 174, 192, 0.5)\",\n white: \"#ffffff\",\n black: \"#222222\",\n sonicSilver: \"#767676\",\n tarmacGrey: \"#475161\",\n gray900: \"#212121\",\n jetBlack: \"#000000\",\n purpleGray: \"#6e6b86\",\n },\n border: {\n lighter: \"#f5f5f5\",\n light: \"#a9b6cb\",\n base: \"#647696\",\n dark: \"#475161\",\n link: \"#6c5ce7\",\n focus: \"#edf1f7\",\n warning: \"#d62400\",\n success: \"#007a52\",\n },\n bg: {\n lavender: \"#f8f6ff\",\n dolphinGrey: \"#dde3ee\",\n pureWhite: \"#ffffff\",\n milkybarWhite: \"#f7f9fc\",\n hibiscus: \"#ffeeeb\",\n cashew: \"#fff8eb\",\n algae: \"#f5fffc\",\n sky: \"#f5fdff\",\n tulipPurple: \"#f9f8ff\",\n lavenderBlue: \"#fadeff\",\n },\n accent: {\n purple50: \"#b6aef3\",\n mediumOrchid: \"#bd59fa\",\n blueChalk: \"#edebff\",\n paleAqua: \"#bad4fb\",\n pastelBlue: \"#43b7c2\",\n bottleGreen: \"#003a25\",\n aquaDeep: \"#00593b\",\n mint: \"#47b0aa\",\n summerGreen: \"#90bba5\",\n bean: \"#4f0800\",\n rustOrange: \"#ba5800\",\n salmonPink: \"#e57872\",\n crayola: \"#ffce6c\",\n sundown: \"#fdafa3\",\n butterscotch: \"#ffad48\",\n },\n statusAccent: {\n poppy: \"#a31b00\",\n mango: \"#ffae0a\",\n spinach: \"#007a52\",\n aqua: \"#0469e3\",\n maximumBluePurple: \"#ada4f4\",\n },\n} as const\n\n/**\n * Returns a CSS `var()` reference for a color token.\n *\n * @example\n * ```ts\n * colorVar(\"brand-primary-base\") // \"var(--cs-color-brand-primary-base)\"\n * colorVar(\"font-link\") // \"var(--cs-color-font-link)\"\n * ```\n */\nexport function colorVar(name: string): string {\n return `var(--cs-color-${name})`\n}\n","import type { TypographyTokens } from \"./types.js\"\n\n/**\n * Contentstack Venus design system typography tokens.\n * Values sourced from `@contentstack/venus-components` token definitions.\n */\nexport const typography: TypographyTokens = {\n fontFamily: {\n primary: \"Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif\",\n },\n fontSize: {\n tiny: \"0.6875rem\",\n small: \"0.75rem\",\n medium: \"0.8125rem\",\n large: \"0.875rem\",\n xl: \"1rem\",\n \"2xl\": \"1.125rem\",\n \"3xl\": \"1.375rem\",\n \"4xl\": \"1.875rem\",\n \"5xl\": \"2.25rem\",\n \"6xl\": \"2.625rem\",\n },\n fontSizeV2: {\n small: \"0.75rem\",\n medium: \"0.875rem\",\n large: \"1rem\",\n xl: \"1.25rem\",\n \"2xl\": \"1.75rem\",\n \"3xl\": \"2.125rem\",\n },\n fontWeight: {\n regular: 400,\n medium: 500,\n semiBold: 600,\n bold: 700,\n extraBold: 800,\n },\n lineHeight: {\n default: 1.5,\n condensed: 1.25,\n reset: 1,\n },\n letterSpacing: {\n tight: \"0.01em\",\n normal: \"0.02em\",\n },\n} as const\n\n/**\n * Returns a CSS `var()` reference for a typography token.\n *\n * @example\n * ```ts\n * fontVar(\"size-font-large\") // \"var(--cs-size-font-large)\"\n * fontVar(\"font-weight-bold\") // \"var(--cs-font-weight-bold)\"\n * fontVar(\"font-family-primary\") // \"var(--cs-font-family-primary)\"\n * ```\n */\nexport function fontVar(name: string): string {\n return `var(--cs-${name})`\n}\n","import type { SpacingTokens } from \"./types.js\"\n\n/**\n * Contentstack Venus design system spacing tokens.\n * Values sourced from `@contentstack/venus-components` token definitions.\n * Names represent pixel values, values are in rem.\n */\nexport const spacing: SpacingTokens = {\n 2: \"0.125rem\",\n 4: \"0.25rem\",\n 5: \"0.3125rem\",\n 6: \"0.375rem\",\n 8: \"0.5rem\",\n 10: \"0.625rem\",\n 12: \"0.75rem\",\n 14: \"0.875rem\",\n 15: \"0.9375rem\",\n 16: \"1rem\",\n 18: \"1.125rem\",\n 20: \"1.25rem\",\n 22: \"1.375rem\",\n 24: \"1.5rem\",\n 25: \"1.5625rem\",\n 26: \"1.625rem\",\n 28: \"1.75rem\",\n 30: \"1.875rem\",\n 32: \"2rem\",\n 34: \"2.125rem\",\n 35: \"2.1875rem\",\n 36: \"2.25rem\",\n 38: \"2.375rem\",\n 40: \"2.5rem\",\n 50: \"3.125rem\",\n 60: \"3.75rem\",\n 64: \"4rem\",\n 80: \"5rem\",\n 100: \"6.25rem\",\n 120: \"7.5rem\",\n 160: \"10rem\",\n} as const\n\n/**\n * Returns a CSS `var()` reference for a spacing token.\n *\n * @example\n * ```ts\n * spaceVar(16) // \"var(--cs-space-16)\"\n * spaceVar(4) // \"var(--cs-space-4)\"\n * ```\n */\nexport function spaceVar(size: number): string {\n return `var(--cs-space-${size})`\n}\n","import type { Theme } from \"../tokens/types.js\"\n\nconst STORAGE_KEY = \"cs-theme\"\nconst DATA_ATTR = \"data-theme\"\n\n/**\n * Get the current theme setting.\n * Returns `\"light\"`, `\"dark\"`, or `\"system\"` (when no `data-theme` attribute is set).\n */\nexport function getTheme(): Theme {\n if (typeof document === \"undefined\") return \"system\"\n const attr = document.documentElement.getAttribute(DATA_ATTR)\n if (attr === \"light\" || attr === \"dark\") return attr\n return \"system\"\n}\n\n/**\n * Set the theme. Applies `data-theme` attribute to `<html>` and\n * persists the choice to `localStorage`.\n *\n * - `\"light\"` or `\"dark\"` sets the attribute explicitly.\n * - `\"system\"` removes the attribute, deferring to `prefers-color-scheme`.\n */\nexport function setTheme(theme: Theme): void {\n if (typeof document === \"undefined\") return\n\n if (theme === \"system\") {\n document.documentElement.removeAttribute(DATA_ATTR)\n } else {\n document.documentElement.setAttribute(DATA_ATTR, theme)\n }\n\n try {\n if (typeof localStorage !== \"undefined\") {\n localStorage.setItem(STORAGE_KEY, theme)\n }\n } catch {\n // localStorage may be unavailable (e.g., iframe sandboxing)\n }\n}\n\n/**\n * Initialize the theme from `localStorage` on page load.\n * Call this early (e.g., in a `<script>` tag or app init) to\n * prevent a flash of wrong theme.\n */\nexport function initTheme(): void {\n try {\n if (typeof localStorage === \"undefined\") return\n const stored = localStorage.getItem(STORAGE_KEY)\n if (stored === \"light\" || stored === \"dark\" || stored === \"system\") {\n setTheme(stored)\n }\n } catch {\n // localStorage may be unavailable\n }\n}\n\n/**\n * Subscribe to theme changes (both programmatic and OS-level).\n * Returns an unsubscribe function.\n */\nexport function onThemeChange(callback: (theme: Theme) => void): () => void {\n if (typeof window === \"undefined\") return () => {}\n\n const observer = new MutationObserver(() => {\n callback(getTheme())\n })\n\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [DATA_ATTR],\n })\n\n let mediaQuery: MediaQueryList | undefined\n const mediaHandler = () => {\n if (getTheme() === \"system\") {\n callback(\"system\")\n }\n }\n\n if (typeof window.matchMedia === \"function\") {\n mediaQuery = window.matchMedia(\"(prefers-color-scheme: dark)\")\n mediaQuery.addEventListener(\"change\", mediaHandler)\n }\n\n return () => {\n observer.disconnect()\n mediaQuery?.removeEventListener(\"change\", mediaHandler)\n }\n}\n\n/**\n * Get the resolved effective theme (never `\"system\"`).\n * Useful when you need to know the actual visual appearance.\n */\nexport function getEffectiveTheme(): \"light\" | \"dark\" {\n const theme = getTheme()\n if (theme !== \"system\") return theme\n\n if (typeof window !== \"undefined\" && typeof window.matchMedia === \"function\") {\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\"\n }\n return \"light\"\n}\n","/**\n * Import path for the CSS tokens file.\n *\n * @example\n * ```ts\n * // In a bundler that supports CSS imports:\n * import \"@timbenniks/contentstack-platform-sdk/ui/tokens.css\"\n *\n * // Or reference the path programmatically:\n * import { CSS_TOKENS_PATH } from \"@timbenniks/contentstack-platform-sdk/ui/css\"\n * ```\n */\nexport const CSS_TOKENS_PATH = \"@timbenniks/contentstack-platform-sdk/ui/tokens.css\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMO,IAAM,SAAsB;AAAA,EACjC,OAAO;AAAA,IACL,SAAS;AAAA,MACP,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,OAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,MACT,UAAU;AAAA,MACV,SAAS;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,QAAQ;AAAA,IACN,SAAS;AAAA,MACP,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,IACA,WAAW;AAAA,MACT,MAAM;AAAA,MACN,MAAM;AAAA,M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;AACT;;;AC5FO,IAAM,kBAAkB;","names":[]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { A as AccentColors, B as BaseColorBlack, a as BaseColorGray, b as BaseColorOrange, c as BaseColorPurple, d as BaseColorTriple, e as BaseColorWhite, f as BaseColors, g as BgColors, h as BorderColors, i as BrandPrimaryColors, j as BrandSecondaryColors, C as ColorTokens, F as FontColors, S as SpacingTokens, k as StatusAccentColors, l as StatusColorScale, m as StatusColors, T as Theme, n as TypographyTokens, W as WarningColors } from '../types-DrMwdlH9.cjs';
|
|
2
|
+
export { colorVar, colors, fontVar, spaceVar, spacing, typography } from './tokens/index.cjs';
|
|
3
|
+
export { getEffectiveTheme, getTheme, initTheme, onThemeChange, setTheme } from './theme/index.cjs';
|
|
4
|
+
export { CSS_TOKENS_PATH } from './css/index.cjs';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { A as AccentColors, B as BaseColorBlack, a as BaseColorGray, b as BaseColorOrange, c as BaseColorPurple, d as BaseColorTriple, e as BaseColorWhite, f as BaseColors, g as BgColors, h as BorderColors, i as BrandPrimaryColors, j as BrandSecondaryColors, C as ColorTokens, F as FontColors, S as SpacingTokens, k as StatusAccentColors, l as StatusColorScale, m as StatusColors, T as Theme, n as TypographyTokens, W as WarningColors } from '../types-DrMwdlH9.js';
|
|
2
|
+
export { colorVar, colors, fontVar, spaceVar, spacing, typography } from './tokens/index.js';
|
|
3
|
+
export { getEffectiveTheme, getTheme, initTheme, onThemeChange, setTheme } from './theme/index.js';
|
|
4
|
+
export { CSS_TOKENS_PATH } from './css/index.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
colorVar,
|
|
3
|
+
colors,
|
|
4
|
+
fontVar,
|
|
5
|
+
spaceVar,
|
|
6
|
+
spacing,
|
|
7
|
+
typography
|
|
8
|
+
} from "../chunk-JL2E3EOT.mjs";
|
|
9
|
+
import {
|
|
10
|
+
CSS_TOKENS_PATH
|
|
11
|
+
} from "../chunk-QGA4WBDC.mjs";
|
|
12
|
+
import {
|
|
13
|
+
getEffectiveTheme,
|
|
14
|
+
getTheme,
|
|
15
|
+
initTheme,
|
|
16
|
+
onThemeChange,
|
|
17
|
+
setTheme
|
|
18
|
+
} from "../chunk-BUZ6CQHE.mjs";
|
|
19
|
+
export {
|
|
20
|
+
CSS_TOKENS_PATH,
|
|
21
|
+
colorVar,
|
|
22
|
+
colors,
|
|
23
|
+
fontVar,
|
|
24
|
+
getEffectiveTheme,
|
|
25
|
+
getTheme,
|
|
26
|
+
initTheme,
|
|
27
|
+
onThemeChange,
|
|
28
|
+
setTheme,
|
|
29
|
+
spaceVar,
|
|
30
|
+
spacing,
|
|
31
|
+
typography
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/ui/theme/index.ts
|
|
21
|
+
var theme_exports = {};
|
|
22
|
+
__export(theme_exports, {
|
|
23
|
+
getEffectiveTheme: () => getEffectiveTheme,
|
|
24
|
+
getTheme: () => getTheme,
|
|
25
|
+
initTheme: () => initTheme,
|
|
26
|
+
onThemeChange: () => onThemeChange,
|
|
27
|
+
setTheme: () => setTheme
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(theme_exports);
|
|
30
|
+
|
|
31
|
+
// src/ui/theme/theme.ts
|
|
32
|
+
var STORAGE_KEY = "cs-theme";
|
|
33
|
+
var DATA_ATTR = "data-theme";
|
|
34
|
+
function getTheme() {
|
|
35
|
+
if (typeof document === "undefined") return "system";
|
|
36
|
+
const attr = document.documentElement.getAttribute(DATA_ATTR);
|
|
37
|
+
if (attr === "light" || attr === "dark") return attr;
|
|
38
|
+
return "system";
|
|
39
|
+
}
|
|
40
|
+
function setTheme(theme) {
|
|
41
|
+
if (typeof document === "undefined") return;
|
|
42
|
+
if (theme === "system") {
|
|
43
|
+
document.documentElement.removeAttribute(DATA_ATTR);
|
|
44
|
+
} else {
|
|
45
|
+
document.documentElement.setAttribute(DATA_ATTR, theme);
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
if (typeof localStorage !== "undefined") {
|
|
49
|
+
localStorage.setItem(STORAGE_KEY, theme);
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function initTheme() {
|
|
55
|
+
try {
|
|
56
|
+
if (typeof localStorage === "undefined") return;
|
|
57
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
58
|
+
if (stored === "light" || stored === "dark" || stored === "system") {
|
|
59
|
+
setTheme(stored);
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function onThemeChange(callback) {
|
|
65
|
+
if (typeof window === "undefined") return () => {
|
|
66
|
+
};
|
|
67
|
+
const observer = new MutationObserver(() => {
|
|
68
|
+
callback(getTheme());
|
|
69
|
+
});
|
|
70
|
+
observer.observe(document.documentElement, {
|
|
71
|
+
attributes: true,
|
|
72
|
+
attributeFilter: [DATA_ATTR]
|
|
73
|
+
});
|
|
74
|
+
let mediaQuery;
|
|
75
|
+
const mediaHandler = () => {
|
|
76
|
+
if (getTheme() === "system") {
|
|
77
|
+
callback("system");
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
if (typeof window.matchMedia === "function") {
|
|
81
|
+
mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
82
|
+
mediaQuery.addEventListener("change", mediaHandler);
|
|
83
|
+
}
|
|
84
|
+
return () => {
|
|
85
|
+
observer.disconnect();
|
|
86
|
+
mediaQuery?.removeEventListener("change", mediaHandler);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function getEffectiveTheme() {
|
|
90
|
+
const theme = getTheme();
|
|
91
|
+
if (theme !== "system") return theme;
|
|
92
|
+
if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
|
|
93
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
94
|
+
}
|
|
95
|
+
return "light";
|
|
96
|
+
}
|
|
97
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
98
|
+
0 && (module.exports = {
|
|
99
|
+
getEffectiveTheme,
|
|
100
|
+
getTheme,
|
|
101
|
+
initTheme,
|
|
102
|
+
onThemeChange,
|
|
103
|
+
setTheme
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ui/theme/index.ts","../../../src/ui/theme/theme.ts"],"sourcesContent":["export { getTheme, setTheme, initTheme, onThemeChange, getEffectiveTheme } from \"./theme.js\"\n","import type { Theme } from \"../tokens/types.js\"\n\nconst STORAGE_KEY = \"cs-theme\"\nconst DATA_ATTR = \"data-theme\"\n\n/**\n * Get the current theme setting.\n * Returns `\"light\"`, `\"dark\"`, or `\"system\"` (when no `data-theme` attribute is set).\n */\nexport function getTheme(): Theme {\n if (typeof document === \"undefined\") return \"system\"\n const attr = document.documentElement.getAttribute(DATA_ATTR)\n if (attr === \"light\" || attr === \"dark\") return attr\n return \"system\"\n}\n\n/**\n * Set the theme. Applies `data-theme` attribute to `<html>` and\n * persists the choice to `localStorage`.\n *\n * - `\"light\"` or `\"dark\"` sets the attribute explicitly.\n * - `\"system\"` removes the attribute, deferring to `prefers-color-scheme`.\n */\nexport function setTheme(theme: Theme): void {\n if (typeof document === \"undefined\") return\n\n if (theme === \"system\") {\n document.documentElement.removeAttribute(DATA_ATTR)\n } else {\n document.documentElement.setAttribute(DATA_ATTR, theme)\n }\n\n try {\n if (typeof localStorage !== \"undefined\") {\n localStorage.setItem(STORAGE_KEY, theme)\n }\n } catch {\n // localStorage may be unavailable (e.g., iframe sandboxing)\n }\n}\n\n/**\n * Initialize the theme from `localStorage` on page load.\n * Call this early (e.g., in a `<script>` tag or app init) to\n * prevent a flash of wrong theme.\n */\nexport function initTheme(): void {\n try {\n if (typeof localStorage === \"undefined\") return\n const stored = localStorage.getItem(STORAGE_KEY)\n if (stored === \"light\" || stored === \"dark\" || stored === \"system\") {\n setTheme(stored)\n }\n } catch {\n // localStorage may be unavailable\n }\n}\n\n/**\n * Subscribe to theme changes (both programmatic and OS-level).\n * Returns an unsubscribe function.\n */\nexport function onThemeChange(callback: (theme: Theme) => void): () => void {\n if (typeof window === \"undefined\") return () => {}\n\n const observer = new MutationObserver(() => {\n callback(getTheme())\n })\n\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [DATA_ATTR],\n })\n\n let mediaQuery: MediaQueryList | undefined\n const mediaHandler = () => {\n if (getTheme() === \"system\") {\n callback(\"system\")\n }\n }\n\n if (typeof window.matchMedia === \"function\") {\n mediaQuery = window.matchMedia(\"(prefers-color-scheme: dark)\")\n mediaQuery.addEventListener(\"change\", mediaHandler)\n }\n\n return () => {\n observer.disconnect()\n mediaQuery?.removeEventListener(\"change\", mediaHandler)\n }\n}\n\n/**\n * Get the resolved effective theme (never `\"system\"`).\n * Useful when you need to know the actual visual appearance.\n */\nexport function getEffectiveTheme(): \"light\" | \"dark\" {\n const theme = getTheme()\n if (theme !== \"system\") return theme\n\n if (typeof window !== \"undefined\" && typeof window.matchMedia === \"function\") {\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\"\n }\n return \"light\"\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,cAAc;AACpB,IAAM,YAAY;AAMX,SAAS,WAAkB;AAChC,MAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,QAAM,OAAO,SAAS,gBAAgB,aAAa,SAAS;AAC5D,MAAI,SAAS,WAAW,SAAS,OAAQ,QAAO;AAChD,SAAO;AACT;AASO,SAAS,SAAS,OAAoB;AAC3C,MAAI,OAAO,aAAa,YAAa;AAErC,MAAI,UAAU,UAAU;AACtB,aAAS,gBAAgB,gBAAgB,SAAS;AAAA,EACpD,OAAO;AACL,aAAS,gBAAgB,aAAa,WAAW,KAAK;AAAA,EACxD;AAEA,MAAI;AACF,QAAI,OAAO,iBAAiB,aAAa;AACvC,mBAAa,QAAQ,aAAa,KAAK;AAAA,IACzC;AAAA,EACF,QAAQ;AAAA,EAER;AACF;AAOO,SAAS,YAAkB;AAChC,MAAI;AACF,QAAI,OAAO,iBAAiB,YAAa;AACzC,UAAM,SAAS,aAAa,QAAQ,WAAW;AAC/C,QAAI,WAAW,WAAW,WAAW,UAAU,WAAW,UAAU;AAClE,eAAS,MAAM;AAAA,IACjB;AAAA,EACF,QAAQ;AAAA,EAER;AACF;AAMO,SAAS,cAAc,UAA8C;AAC1E,MAAI,OAAO,WAAW,YAAa,QAAO,MAAM;AAAA,EAAC;AAEjD,QAAM,WAAW,IAAI,iBAAiB,MAAM;AAC1C,aAAS,SAAS,CAAC;AAAA,EACrB,CAAC;AAED,WAAS,QAAQ,SAAS,iBAAiB;AAAA,IACzC,YAAY;AAAA,IACZ,iBAAiB,CAAC,SAAS;AAAA,EAC7B,CAAC;AAED,MAAI;AACJ,QAAM,eAAe,MAAM;AACzB,QAAI,SAAS,MAAM,UAAU;AAC3B,eAAS,QAAQ;AAAA,IACnB;AAAA,EACF;AAEA,MAAI,OAAO,OAAO,eAAe,YAAY;AAC3C,iBAAa,OAAO,WAAW,8BAA8B;AAC7D,eAAW,iBAAiB,UAAU,YAAY;AAAA,EACpD;AAEA,SAAO,MAAM;AACX,aAAS,WAAW;AACpB,gBAAY,oBAAoB,UAAU,YAAY;AAAA,EACxD;AACF;AAMO,SAAS,oBAAsC;AACpD,QAAM,QAAQ,SAAS;AACvB,MAAI,UAAU,SAAU,QAAO;AAE/B,MAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAAY;AAC5E,WAAO,OAAO,WAAW,8BAA8B,EAAE,UAAU,SAAS;AAAA,EAC9E;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { T as Theme } from '../../types-DrMwdlH9.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get the current theme setting.
|
|
5
|
+
* Returns `"light"`, `"dark"`, or `"system"` (when no `data-theme` attribute is set).
|
|
6
|
+
*/
|
|
7
|
+
declare function getTheme(): Theme;
|
|
8
|
+
/**
|
|
9
|
+
* Set the theme. Applies `data-theme` attribute to `<html>` and
|
|
10
|
+
* persists the choice to `localStorage`.
|
|
11
|
+
*
|
|
12
|
+
* - `"light"` or `"dark"` sets the attribute explicitly.
|
|
13
|
+
* - `"system"` removes the attribute, deferring to `prefers-color-scheme`.
|
|
14
|
+
*/
|
|
15
|
+
declare function setTheme(theme: Theme): void;
|
|
16
|
+
/**
|
|
17
|
+
* Initialize the theme from `localStorage` on page load.
|
|
18
|
+
* Call this early (e.g., in a `<script>` tag or app init) to
|
|
19
|
+
* prevent a flash of wrong theme.
|
|
20
|
+
*/
|
|
21
|
+
declare function initTheme(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Subscribe to theme changes (both programmatic and OS-level).
|
|
24
|
+
* Returns an unsubscribe function.
|
|
25
|
+
*/
|
|
26
|
+
declare function onThemeChange(callback: (theme: Theme) => void): () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Get the resolved effective theme (never `"system"`).
|
|
29
|
+
* Useful when you need to know the actual visual appearance.
|
|
30
|
+
*/
|
|
31
|
+
declare function getEffectiveTheme(): "light" | "dark";
|
|
32
|
+
|
|
33
|
+
export { getEffectiveTheme, getTheme, initTheme, onThemeChange, setTheme };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { T as Theme } from '../../types-DrMwdlH9.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get the current theme setting.
|
|
5
|
+
* Returns `"light"`, `"dark"`, or `"system"` (when no `data-theme` attribute is set).
|
|
6
|
+
*/
|
|
7
|
+
declare function getTheme(): Theme;
|
|
8
|
+
/**
|
|
9
|
+
* Set the theme. Applies `data-theme` attribute to `<html>` and
|
|
10
|
+
* persists the choice to `localStorage`.
|
|
11
|
+
*
|
|
12
|
+
* - `"light"` or `"dark"` sets the attribute explicitly.
|
|
13
|
+
* - `"system"` removes the attribute, deferring to `prefers-color-scheme`.
|
|
14
|
+
*/
|
|
15
|
+
declare function setTheme(theme: Theme): void;
|
|
16
|
+
/**
|
|
17
|
+
* Initialize the theme from `localStorage` on page load.
|
|
18
|
+
* Call this early (e.g., in a `<script>` tag or app init) to
|
|
19
|
+
* prevent a flash of wrong theme.
|
|
20
|
+
*/
|
|
21
|
+
declare function initTheme(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Subscribe to theme changes (both programmatic and OS-level).
|
|
24
|
+
* Returns an unsubscribe function.
|
|
25
|
+
*/
|
|
26
|
+
declare function onThemeChange(callback: (theme: Theme) => void): () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Get the resolved effective theme (never `"system"`).
|
|
29
|
+
* Useful when you need to know the actual visual appearance.
|
|
30
|
+
*/
|
|
31
|
+
declare function getEffectiveTheme(): "light" | "dark";
|
|
32
|
+
|
|
33
|
+
export { getEffectiveTheme, getTheme, initTheme, onThemeChange, setTheme };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getEffectiveTheme,
|
|
3
|
+
getTheme,
|
|
4
|
+
initTheme,
|
|
5
|
+
onThemeChange,
|
|
6
|
+
setTheme
|
|
7
|
+
} from "../../chunk-BUZ6CQHE.mjs";
|
|
8
|
+
export {
|
|
9
|
+
getEffectiveTheme,
|
|
10
|
+
getTheme,
|
|
11
|
+
initTheme,
|
|
12
|
+
onThemeChange,
|
|
13
|
+
setTheme
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|