@oxyhq/bloom 0.82.0 → 0.83.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/lib/commonjs/theme/color-presets.js +37 -7
- package/lib/commonjs/theme/color-presets.js.map +1 -1
- package/lib/commonjs/theme/index.js +12 -0
- package/lib/commonjs/theme/index.js.map +1 -1
- package/lib/module/theme/color-presets.js +36 -6
- package/lib/module/theme/color-presets.js.map +1 -1
- package/lib/module/theme/index.js +1 -1
- package/lib/module/theme/index.js.map +1 -1
- package/lib/typescript/commonjs/theme/color-presets.d.ts +25 -2
- package/lib/typescript/commonjs/theme/color-presets.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/index.d.ts +2 -2
- package/lib/typescript/commonjs/theme/index.d.ts.map +1 -1
- package/lib/typescript/module/theme/color-presets.d.ts +25 -2
- package/lib/typescript/module/theme/color-presets.d.ts.map +1 -1
- package/lib/typescript/module/theme/index.d.ts +2 -2
- package/lib/typescript/module/theme/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/theme/__tests__/color-preset-gates.test.ts +50 -0
- package/src/theme/color-presets.ts +46 -6
- package/src/theme/index.ts +3 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.PREMIUM_COLOR_NAMES = exports.HEX_TO_APP_COLOR = exports.APP_COLOR_PRESETS = exports.APP_COLOR_NAMES = void 0;
|
|
6
|
+
exports.PREMIUM_COLOR_NAMES = exports.HEX_TO_APP_COLOR = exports.HANDLE_COLOR_NAMES = exports.FREE_COLOR_NAMES = exports.APP_COLOR_PRESETS = exports.APP_COLOR_NAMES = void 0;
|
|
7
7
|
exports.hexToAppColorName = hexToAppColorName;
|
|
8
8
|
/**
|
|
9
9
|
* A single colour preset: a brand SEED colour plus the tonal scheme variant to
|
|
@@ -16,6 +16,14 @@ exports.hexToAppColorName = hexToAppColorName;
|
|
|
16
16
|
* maps those roles onto Bloom's canonical token names. A user-picked colour
|
|
17
17
|
* flows through the identical path — a preset is just a fixed seed.
|
|
18
18
|
*/
|
|
19
|
+
/**
|
|
20
|
+
* Why a preset is not offered to every user. Absent means it is.
|
|
21
|
+
*
|
|
22
|
+
* The two are NOT interchangeable and must not collapse back into one list: a
|
|
23
|
+
* `handle` preset belongs to a specific account and cannot be bought, while a
|
|
24
|
+
* `premium` one is exactly what is bought. Conflating them is how the picker
|
|
25
|
+
* came to offer both of Oxy's reserved brand colours to everybody.
|
|
26
|
+
*/
|
|
19
27
|
|
|
20
28
|
/**
|
|
21
29
|
* Historically each preset carried a full light/dark map of raw HSL triples.
|
|
@@ -25,9 +33,6 @@ exports.hexToAppColorName = hexToAppColorName;
|
|
|
25
33
|
*/
|
|
26
34
|
|
|
27
35
|
const APP_COLOR_NAMES = exports.APP_COLOR_NAMES = ['teal', 'blue', 'green', 'yellow', 'red', 'purple', 'pink', 'sky', 'orange', 'mint', 'oxy', 'faircoin', 'pumpkin', 'gray', 'brown', 'peach', 'rose', 'mono'];
|
|
28
|
-
|
|
29
|
-
/** Premium-exclusive presets, hidden from the standard color picker. */
|
|
30
|
-
const PREMIUM_COLOR_NAMES = exports.PREMIUM_COLOR_NAMES = ['oxy', 'faircoin'];
|
|
31
36
|
const HEX_TO_APP_COLOR = exports.HEX_TO_APP_COLOR = {
|
|
32
37
|
'#005c67': 'teal',
|
|
33
38
|
'#0085fe': 'blue',
|
|
@@ -118,12 +123,14 @@ const APP_COLOR_PRESETS = exports.APP_COLOR_PRESETS = {
|
|
|
118
123
|
oxy: {
|
|
119
124
|
name: 'oxy',
|
|
120
125
|
hex: '#c46ede',
|
|
121
|
-
variant: 'vivid'
|
|
126
|
+
variant: 'vivid',
|
|
127
|
+
gate: 'handle'
|
|
122
128
|
},
|
|
123
129
|
faircoin: {
|
|
124
130
|
name: 'faircoin',
|
|
125
131
|
hex: '#9ffb50',
|
|
126
|
-
variant: 'vivid'
|
|
132
|
+
variant: 'vivid',
|
|
133
|
+
gate: 'handle'
|
|
127
134
|
},
|
|
128
135
|
pumpkin: {
|
|
129
136
|
name: 'pumpkin',
|
|
@@ -159,7 +166,30 @@ const APP_COLOR_PRESETS = exports.APP_COLOR_PRESETS = {
|
|
|
159
166
|
mono: {
|
|
160
167
|
name: 'mono',
|
|
161
168
|
hex: '#000000',
|
|
162
|
-
variant: 'monochrome'
|
|
169
|
+
variant: 'monochrome',
|
|
170
|
+
gate: 'premium'
|
|
163
171
|
}
|
|
164
172
|
};
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The three gate groups, DERIVED from the presets rather than listed again, so a
|
|
176
|
+
* preset cannot be gated in one place and offered in another. Together they
|
|
177
|
+
* partition {@link APP_COLOR_NAMES} exactly — asserted in
|
|
178
|
+
* `__tests__/color-preset-gates.test.ts`, since a preset silently missing from
|
|
179
|
+
* every group would simply vanish from a picker with no error anywhere.
|
|
180
|
+
*
|
|
181
|
+
* A consumer builds its visible list from these; it must NOT start from
|
|
182
|
+
* `APP_COLOR_NAMES` and add the unlocked ones, which yields the gated presets to
|
|
183
|
+
* everybody and duplicates whatever the viewer did unlock.
|
|
184
|
+
*/
|
|
185
|
+
const namesGatedBy = gate => APP_COLOR_NAMES.filter(name => APP_COLOR_PRESETS[name].gate === gate);
|
|
186
|
+
|
|
187
|
+
/** Available to every user, signed in or not. */
|
|
188
|
+
const FREE_COLOR_NAMES = exports.FREE_COLOR_NAMES = namesGatedBy(undefined);
|
|
189
|
+
|
|
190
|
+
/** Reserved for the account whose brand it is (`oxy`, `faircoin`) — not for sale. */
|
|
191
|
+
const HANDLE_COLOR_NAMES = exports.HANDLE_COLOR_NAMES = namesGatedBy('handle');
|
|
192
|
+
|
|
193
|
+
/** Sold with a subscription. */
|
|
194
|
+
const PREMIUM_COLOR_NAMES = exports.PREMIUM_COLOR_NAMES = namesGatedBy('premium');
|
|
165
195
|
//# sourceMappingURL=color-presets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["APP_COLOR_NAMES","exports","
|
|
1
|
+
{"version":3,"names":["APP_COLOR_NAMES","exports","HEX_TO_APP_COLOR","hexToAppColorName","hex","toLowerCase","APP_COLOR_PRESETS","teal","name","variant","blue","green","yellow","red","purple","pink","sky","orange","mint","oxy","gate","faircoin","pumpkin","gray","brown","peach","rose","mono","namesGatedBy","filter","FREE_COLOR_NAMES","undefined","HANDLE_COLOR_NAMES","PREMIUM_COLOR_NAMES"],"sourceRoot":"../../../src","sources":["theme/color-presets.ts"],"mappings":";;;;;;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmCA;AACA;AACA;AACA;AACA;AACA;;AAGO,MAAMA,eAAwC,GAAAC,OAAA,CAAAD,eAAA,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;AAE9M,MAAME,gBAA8C,GAAAD,OAAA,CAAAC,gBAAA,GAAG;EAC5D,SAAS,EAAE,MAAM;EACjB,SAAS,EAAE,MAAM;EACjB,SAAS,EAAE,OAAO;EAClB,SAAS,EAAE,QAAQ;EACnB,SAAS,EAAE,KAAK;EAChB,SAAS,EAAE,QAAQ;EACnB,SAAS,EAAE,MAAM;EACjB,SAAS,EAAE,KAAK;EAChB,SAAS,EAAE,QAAQ;EACnB,SAAS,EAAE,MAAM;EACjB,SAAS,EAAE,KAAK;EAChB,SAAS,EAAE,UAAU;EACrB,SAAS,EAAE,SAAS;EACpB,SAAS,EAAE,MAAM;EACjB,SAAS,EAAE,OAAO;EAClB,SAAS,EAAE,OAAO;EAClB,SAAS,EAAE,MAA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;AACO,MAAMU,gBAAyC,GAAA7B,OAAA,CAAA6B,gBAAA,GAAGF,YAAY,CAACG,SAAS,CAAC;;AAEhF;AACO,MAAMC,kBAA2C,GAAA/B,OAAA,CAAA+B,kBAAA,GAAGJ,YAAY,CAAC,QAAQ,CAAC;;AAEjF;AACO,MAAMK,mBAA4C,GAAAhC,OAAA,CAAAgC,mBAAA,GAAGL,YAAY,CAAC,SAAS,CAAC","ignoreList":[]}
|
|
@@ -33,6 +33,18 @@ Object.defineProperty(exports, "BloomThemeProvider", {
|
|
|
33
33
|
return _BloomThemeProvider.BloomThemeProvider;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "FREE_COLOR_NAMES", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _colorPresets.FREE_COLOR_NAMES;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "HANDLE_COLOR_NAMES", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _colorPresets.HANDLE_COLOR_NAMES;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
36
48
|
Object.defineProperty(exports, "HEX_TO_APP_COLOR", {
|
|
37
49
|
enumerable: true,
|
|
38
50
|
get: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_BloomThemeProvider","require","_colorScope","_seedScope","_seedScope2","_index","_buildTheme","_buildThemeFromSeed","_gradients","_useTheme","_ambientStore","_useNavigationTheme","_colorPresets","_colorUtils","_presetVars","_applyDarkClass","_setColorSchemeSafe","_initCssInterop","_persistence"],"sourceRoot":"../../../src","sources":["theme/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_BloomThemeProvider","require","_colorScope","_seedScope","_seedScope2","_index","_buildTheme","_buildThemeFromSeed","_gradients","_useTheme","_ambientStore","_useNavigationTheme","_colorPresets","_colorUtils","_presetVars","_applyDarkClass","_setColorSchemeSafe","_initCssInterop","_persistence"],"sourceRoot":"../../../src","sources":["theme/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAaA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AAEA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AAOA,IAAAU,mBAAA,GAAAV,OAAA;AAIA,IAAAW,aAAA,GAAAX,OAAA;AASA,IAAAY,WAAA,GAAAZ,OAAA;AAEA,IAAAa,WAAA,GAAAb,OAAA;AAEA,IAAAc,eAAA,GAAAd,OAAA;AACA,IAAAe,mBAAA,GAAAf,OAAA;AACA,IAAAgB,eAAA,GAAAhB,OAAA;AAEA,IAAAiB,YAAA,GAAAjB,OAAA","ignoreList":[]}
|
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
* maps those roles onto Bloom's canonical token names. A user-picked colour
|
|
12
12
|
* flows through the identical path — a preset is just a fixed seed.
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* Why a preset is not offered to every user. Absent means it is.
|
|
16
|
+
*
|
|
17
|
+
* The two are NOT interchangeable and must not collapse back into one list: a
|
|
18
|
+
* `handle` preset belongs to a specific account and cannot be bought, while a
|
|
19
|
+
* `premium` one is exactly what is bought. Conflating them is how the picker
|
|
20
|
+
* came to offer both of Oxy's reserved brand colours to everybody.
|
|
21
|
+
*/
|
|
14
22
|
|
|
15
23
|
/**
|
|
16
24
|
* Historically each preset carried a full light/dark map of raw HSL triples.
|
|
@@ -20,9 +28,6 @@
|
|
|
20
28
|
*/
|
|
21
29
|
|
|
22
30
|
export const APP_COLOR_NAMES = ['teal', 'blue', 'green', 'yellow', 'red', 'purple', 'pink', 'sky', 'orange', 'mint', 'oxy', 'faircoin', 'pumpkin', 'gray', 'brown', 'peach', 'rose', 'mono'];
|
|
23
|
-
|
|
24
|
-
/** Premium-exclusive presets, hidden from the standard color picker. */
|
|
25
|
-
export const PREMIUM_COLOR_NAMES = ['oxy', 'faircoin'];
|
|
26
31
|
export const HEX_TO_APP_COLOR = {
|
|
27
32
|
'#005c67': 'teal',
|
|
28
33
|
'#0085fe': 'blue',
|
|
@@ -113,12 +118,14 @@ export const APP_COLOR_PRESETS = {
|
|
|
113
118
|
oxy: {
|
|
114
119
|
name: 'oxy',
|
|
115
120
|
hex: '#c46ede',
|
|
116
|
-
variant: 'vivid'
|
|
121
|
+
variant: 'vivid',
|
|
122
|
+
gate: 'handle'
|
|
117
123
|
},
|
|
118
124
|
faircoin: {
|
|
119
125
|
name: 'faircoin',
|
|
120
126
|
hex: '#9ffb50',
|
|
121
|
-
variant: 'vivid'
|
|
127
|
+
variant: 'vivid',
|
|
128
|
+
gate: 'handle'
|
|
122
129
|
},
|
|
123
130
|
pumpkin: {
|
|
124
131
|
name: 'pumpkin',
|
|
@@ -154,7 +161,30 @@ export const APP_COLOR_PRESETS = {
|
|
|
154
161
|
mono: {
|
|
155
162
|
name: 'mono',
|
|
156
163
|
hex: '#000000',
|
|
157
|
-
variant: 'monochrome'
|
|
164
|
+
variant: 'monochrome',
|
|
165
|
+
gate: 'premium'
|
|
158
166
|
}
|
|
159
167
|
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The three gate groups, DERIVED from the presets rather than listed again, so a
|
|
171
|
+
* preset cannot be gated in one place and offered in another. Together they
|
|
172
|
+
* partition {@link APP_COLOR_NAMES} exactly — asserted in
|
|
173
|
+
* `__tests__/color-preset-gates.test.ts`, since a preset silently missing from
|
|
174
|
+
* every group would simply vanish from a picker with no error anywhere.
|
|
175
|
+
*
|
|
176
|
+
* A consumer builds its visible list from these; it must NOT start from
|
|
177
|
+
* `APP_COLOR_NAMES` and add the unlocked ones, which yields the gated presets to
|
|
178
|
+
* everybody and duplicates whatever the viewer did unlock.
|
|
179
|
+
*/
|
|
180
|
+
const namesGatedBy = gate => APP_COLOR_NAMES.filter(name => APP_COLOR_PRESETS[name].gate === gate);
|
|
181
|
+
|
|
182
|
+
/** Available to every user, signed in or not. */
|
|
183
|
+
export const FREE_COLOR_NAMES = namesGatedBy(undefined);
|
|
184
|
+
|
|
185
|
+
/** Reserved for the account whose brand it is (`oxy`, `faircoin`) — not for sale. */
|
|
186
|
+
export const HANDLE_COLOR_NAMES = namesGatedBy('handle');
|
|
187
|
+
|
|
188
|
+
/** Sold with a subscription. */
|
|
189
|
+
export const PREMIUM_COLOR_NAMES = namesGatedBy('premium');
|
|
160
190
|
//# sourceMappingURL=color-presets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["APP_COLOR_NAMES","
|
|
1
|
+
{"version":3,"names":["APP_COLOR_NAMES","HEX_TO_APP_COLOR","hexToAppColorName","hex","toLowerCase","APP_COLOR_PRESETS","teal","name","variant","blue","green","yellow","red","purple","pink","sky","orange","mint","oxy","gate","faircoin","pumpkin","gray","brown","peach","rose","mono","namesGatedBy","filter","FREE_COLOR_NAMES","undefined","HANDLE_COLOR_NAMES","PREMIUM_COLOR_NAMES"],"sourceRoot":"../../../src","sources":["theme/color-presets.ts"],"mappings":";;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AE,SAAS;IAAEK,OAAO,EAAE;EAAQ,CAAC;EACxDe,KAAK,EAAE;IAAEhB,IAAI,EAAE,OAAO;IAAEJ,GAAG,EAAE,SAAS;IAAEK,OAAO,EAAE;EAAQ,CAAC;EAC1DgB,KAAK,EAAE;IAAEjB,IAAI,EAAE,OAAO;IAAEJ,GAAG,EAAE,SAAS;IAAEK,OAAO,EAAE;EAAQ,CAAC;EAC1DiB,IAAI,EAAE;IAAElB,IAAI,EAAE,MAAM;IAAEJ,GAAG,EAAE,SAAS;IAAEK,OAAO,EAAE;EAAQ,CAAC;EACxD;AACF;AACA;AACA;AACA;AACA;EACEkB,IAAI,EAAE;IAAEnB,IAAI,EAAE,MAAM;IAAEJ,GAAG,EAAE,SAAS;IAAEK,OAAO,EAAE,YAAY;IAAEW,IAAI,EAAE;EAAU;AAC/E,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMQ,YAAY,GAAIR,IAAiC,IACrDnB,eAAe,CAAC4B,MAAM,CAAErB,IAAI,IAAKF,iBAAiB,CAACE,IAAI,CAAC,CAACY,IAAI,KAAKA,IAAI,CAAC;;AAEzE;AACA,OAAO,MAAMU,gBAAyC,GAAGF,YAAY,CAACG,SAAS,CAAC;;AAEhF;AACA,OAAO,MAAMC,kBAA2C,GAAGJ,YAAY,CAAC,QAAQ,CAAC;;AAEjF;AACA,OAAO,MAAMK,mBAA4C,GAAGL,YAAY,CAAC,SAAS,CAAC","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@ export { THEME_GRADIENTS } from "./gradients.js";
|
|
|
14
14
|
export { useTheme, useThemeColor, useBloomTheme } from "./use-theme.js";
|
|
15
15
|
export { useAmbientTheme, ambientTheme } from "./ambient-store.js";
|
|
16
16
|
export { useNavigationTheme } from "./use-navigation-theme.js";
|
|
17
|
-
export { APP_COLOR_NAMES, PREMIUM_COLOR_NAMES, APP_COLOR_PRESETS, HEX_TO_APP_COLOR, hexToAppColorName } from "./color-presets.js";
|
|
17
|
+
export { APP_COLOR_NAMES, FREE_COLOR_NAMES, HANDLE_COLOR_NAMES, PREMIUM_COLOR_NAMES, APP_COLOR_PRESETS, HEX_TO_APP_COLOR, hexToAppColorName } from "./color-presets.js";
|
|
18
18
|
export { parseRgb, withAlpha } from "./color-utils.js";
|
|
19
19
|
export { getPresetVars, applyPresetVarsToDocument } from "./preset-vars.js";
|
|
20
20
|
export { applyDarkClass } from "./apply-dark-class.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BloomThemeProvider","BloomColorScope","useColorScopeStyle","BloomSeedScope","buildSeedScopeVars","roleColorsToPresetTokens","generateRoleColors","seedHexFromImagePixels","seedsFromImagePixels","quantizeImage","argbFromHex","hexFromArgb","argbFromRgb","redFromArgb","greenFromArgb","blueFromArgb","buildTheme","STATUS_COLORS","buildThemeFromSeed","buildColorsFromSeed","THEME_GRADIENTS","useTheme","useThemeColor","useBloomTheme","useAmbientTheme","ambientTheme","useNavigationTheme","APP_COLOR_NAMES","PREMIUM_COLOR_NAMES","APP_COLOR_PRESETS","HEX_TO_APP_COLOR","hexToAppColorName","parseRgb","withAlpha","getPresetVars","applyPresetVarsToDocument","applyDarkClass","setColorSchemeSafe","initCssInteropDarkMode","webLocalStorage"],"sourceRoot":"../../../src","sources":["theme/index.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAsB;AAKzD,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AAEnE,SAASC,cAAc,QAAQ,cAAc;AAE7C,SAASC,kBAAkB,EAAEC,wBAAwB,QAAQ,6BAA0B;AAEvF;AACA;AACA;AACA,SACEC,kBAAkB,EAClBC,sBAAsB,EACtBC,oBAAoB,EACpBC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,WAAW,EACXC,WAAW,EACXC,aAAa,EACbC,YAAY,QACP,yBAAgB;AAEvB,SAASC,UAAU,EAAEC,aAAa,QAAQ,kBAAe;AACzD,SAASC,kBAAkB,EAAEC,mBAAmB,QAAQ,4BAAyB;AAEjF,SAASC,eAAe,QAAQ,gBAAa;AAC7C,SAASC,QAAQ,EAAEC,aAAa,EAAEC,aAAa,QAAQ,gBAAa;AACpE,SAASC,eAAe,EAAEC,YAAY,QAAQ,oBAAiB;AAO/D,SAASC,kBAAkB,QAAQ,2BAAwB;AAI3D,SACEC,eAAe,EACfC,mBAAmB,EACnBC,iBAAiB,EACjBC,gBAAgB,EAChBC,iBAAiB,QACZ,oBAAiB;AACxB,SAASC,QAAQ,EAAEC,SAAS,QAAQ,kBAAe;AAEnD,SAASC,aAAa,EAAEC,yBAAyB,QAAQ,kBAAe;AAExE,SAASC,cAAc,QAAQ,uBAAoB;AACnD,SAASC,kBAAkB,QAAQ,4BAAyB;AAC5D,SAASC,sBAAsB,QAAQ,uBAAoB;AAE3D,SAASC,eAAe,QAAQ,kBAAe","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["BloomThemeProvider","BloomColorScope","useColorScopeStyle","BloomSeedScope","buildSeedScopeVars","roleColorsToPresetTokens","generateRoleColors","seedHexFromImagePixels","seedsFromImagePixels","quantizeImage","argbFromHex","hexFromArgb","argbFromRgb","redFromArgb","greenFromArgb","blueFromArgb","buildTheme","STATUS_COLORS","buildThemeFromSeed","buildColorsFromSeed","THEME_GRADIENTS","useTheme","useThemeColor","useBloomTheme","useAmbientTheme","ambientTheme","useNavigationTheme","APP_COLOR_NAMES","FREE_COLOR_NAMES","HANDLE_COLOR_NAMES","PREMIUM_COLOR_NAMES","APP_COLOR_PRESETS","HEX_TO_APP_COLOR","hexToAppColorName","parseRgb","withAlpha","getPresetVars","applyPresetVarsToDocument","applyDarkClass","setColorSchemeSafe","initCssInteropDarkMode","webLocalStorage"],"sourceRoot":"../../../src","sources":["theme/index.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAsB;AAKzD,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AAEnE,SAASC,cAAc,QAAQ,cAAc;AAE7C,SAASC,kBAAkB,EAAEC,wBAAwB,QAAQ,6BAA0B;AAEvF;AACA;AACA;AACA,SACEC,kBAAkB,EAClBC,sBAAsB,EACtBC,oBAAoB,EACpBC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,WAAW,EACXC,WAAW,EACXC,aAAa,EACbC,YAAY,QACP,yBAAgB;AAEvB,SAASC,UAAU,EAAEC,aAAa,QAAQ,kBAAe;AACzD,SAASC,kBAAkB,EAAEC,mBAAmB,QAAQ,4BAAyB;AAEjF,SAASC,eAAe,QAAQ,gBAAa;AAC7C,SAASC,QAAQ,EAAEC,aAAa,EAAEC,aAAa,QAAQ,gBAAa;AACpE,SAASC,eAAe,EAAEC,YAAY,QAAQ,oBAAiB;AAO/D,SAASC,kBAAkB,QAAQ,2BAAwB;AAI3D,SACEC,eAAe,EACfC,gBAAgB,EAChBC,kBAAkB,EAClBC,mBAAmB,EACnBC,iBAAiB,EACjBC,gBAAgB,EAChBC,iBAAiB,QACZ,oBAAiB;AACxB,SAASC,QAAQ,EAAEC,SAAS,QAAQ,kBAAe;AAEnD,SAASC,aAAa,EAAEC,yBAAyB,QAAQ,kBAAe;AAExE,SAASC,cAAc,QAAQ,uBAAoB;AACnD,SAASC,kBAAkB,QAAQ,4BAAyB;AAC5D,SAASC,sBAAsB,QAAQ,uBAAoB;AAE3D,SAASC,eAAe,QAAQ,kBAAe","ignoreList":[]}
|
|
@@ -11,6 +11,19 @@ export type AppColorName = 'teal' | 'blue' | 'green' | 'yellow' | 'red' | 'purpl
|
|
|
11
11
|
* maps those roles onto Bloom's canonical token names. A user-picked colour
|
|
12
12
|
* flows through the identical path — a preset is just a fixed seed.
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* Why a preset is not offered to every user. Absent means it is.
|
|
16
|
+
*
|
|
17
|
+
* The two are NOT interchangeable and must not collapse back into one list: a
|
|
18
|
+
* `handle` preset belongs to a specific account and cannot be bought, while a
|
|
19
|
+
* `premium` one is exactly what is bought. Conflating them is how the picker
|
|
20
|
+
* came to offer both of Oxy's reserved brand colours to everybody.
|
|
21
|
+
*/
|
|
22
|
+
export type ColorPresetGate =
|
|
23
|
+
/** Reserved for the account whose brand it is — not purchasable. */
|
|
24
|
+
'handle'
|
|
25
|
+
/** Sold with a subscription. */
|
|
26
|
+
| 'premium';
|
|
14
27
|
export interface AppColorPreset {
|
|
15
28
|
name: AppColorName;
|
|
16
29
|
/** The brand seed colour, `#rrggbb`. Also the value the colour picker matches. */
|
|
@@ -31,6 +44,12 @@ export interface AppColorPreset {
|
|
|
31
44
|
* {@link AppColorPreset.secondaryHex} for the tertiary palette.
|
|
32
45
|
*/
|
|
33
46
|
tertiaryHex?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Who may pick this preset. Absent = everyone. Bloom only DECLARES the gate;
|
|
49
|
+
* whether a given viewer satisfies it is the consuming app's question, since
|
|
50
|
+
* only the app knows who is signed in and what they pay for.
|
|
51
|
+
*/
|
|
52
|
+
gate?: ColorPresetGate;
|
|
34
53
|
}
|
|
35
54
|
/**
|
|
36
55
|
* Historically each preset carried a full light/dark map of raw HSL triples.
|
|
@@ -40,8 +59,6 @@ export interface AppColorPreset {
|
|
|
40
59
|
*/
|
|
41
60
|
export type PresetTokens = Record<string, string>;
|
|
42
61
|
export declare const APP_COLOR_NAMES: readonly AppColorName[];
|
|
43
|
-
/** Premium-exclusive presets, hidden from the standard color picker. */
|
|
44
|
-
export declare const PREMIUM_COLOR_NAMES: readonly AppColorName[];
|
|
45
62
|
export declare const HEX_TO_APP_COLOR: Record<string, AppColorName>;
|
|
46
63
|
export declare function hexToAppColorName(hex: string): AppColorName;
|
|
47
64
|
/**
|
|
@@ -51,4 +68,10 @@ export declare function hexToAppColorName(hex: string): AppColorName;
|
|
|
51
68
|
* bold `vibrant` derivation to match the prior saturated palette.
|
|
52
69
|
*/
|
|
53
70
|
export declare const APP_COLOR_PRESETS: Record<AppColorName, AppColorPreset>;
|
|
71
|
+
/** Available to every user, signed in or not. */
|
|
72
|
+
export declare const FREE_COLOR_NAMES: readonly AppColorName[];
|
|
73
|
+
/** Reserved for the account whose brand it is (`oxy`, `faircoin`) — not for sale. */
|
|
74
|
+
export declare const HANDLE_COLOR_NAMES: readonly AppColorName[];
|
|
75
|
+
/** Sold with a subscription. */
|
|
76
|
+
export declare const PREMIUM_COLOR_NAMES: readonly AppColorName[];
|
|
54
77
|
//# sourceMappingURL=color-presets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-presets.d.ts","sourceRoot":"","sources":["../../../../src/theme/color-presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,MAAM,GACN,KAAK,GACL,QAAQ,GACR,MAAM,GACN,KAAK,GACL,UAAU,GACV,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,CAAC;AAEX;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,kFAAkF;IAClF,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,OAAO,EAAE,aAAa,CAAC;IACvB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"color-presets.d.ts","sourceRoot":"","sources":["../../../../src/theme/color-presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,MAAM,GACN,KAAK,GACL,QAAQ,GACR,MAAM,GACN,KAAK,GACL,UAAU,GACV,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,CAAC;AAEX;;;;;;;;;;GAUG;AACH;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe;AACzB,oEAAoE;AAClE,QAAQ;AACV,gCAAgC;GAC9B,SAAS,CAAC;AAEd,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,kFAAkF;IAClF,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,OAAO,EAAE,aAAa,CAAC;IACvB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAElD,eAAO,MAAM,eAAe,EAAE,SAAS,YAAY,EAAkK,CAAC;AAEtN,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAmBzD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAE3D;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,YAAY,EAAE,cAAc,CA+BlE,CAAC;AAgBF,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,EAAE,SAAS,YAAY,EAA4B,CAAC;AAEjF,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,EAAE,SAAS,YAAY,EAA2B,CAAC;AAElF,gCAAgC;AAChC,eAAO,MAAM,mBAAmB,EAAE,SAAS,YAAY,EAA4B,CAAC"}
|
|
@@ -18,8 +18,8 @@ export type { AmbientThemeState, AmbientThemeApi, AmbientAccents, UseAmbientThem
|
|
|
18
18
|
export { useNavigationTheme } from './use-navigation-theme';
|
|
19
19
|
export type { NavigationTheme, NavigationThemeFont } from './use-navigation-theme';
|
|
20
20
|
export type { Theme, ThemeColors, ThemeMode, ThemeGradient, ThemeGradients } from './types';
|
|
21
|
-
export type { AppColorName, AppColorPreset, PresetTokens } from './color-presets';
|
|
22
|
-
export { APP_COLOR_NAMES, PREMIUM_COLOR_NAMES, APP_COLOR_PRESETS, HEX_TO_APP_COLOR, hexToAppColorName, } from './color-presets';
|
|
21
|
+
export type { AppColorName, AppColorPreset, ColorPresetGate, PresetTokens } from './color-presets';
|
|
22
|
+
export { APP_COLOR_NAMES, FREE_COLOR_NAMES, HANDLE_COLOR_NAMES, PREMIUM_COLOR_NAMES, APP_COLOR_PRESETS, HEX_TO_APP_COLOR, hexToAppColorName, } from './color-presets';
|
|
23
23
|
export { parseRgb, withAlpha } from './color-utils';
|
|
24
24
|
export type { RgbChannels } from './color-utils';
|
|
25
25
|
export { getPresetVars, applyPresetVarsToDocument } from './preset-vars';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACxF,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAIjE,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,aAAa,EACb,WAAW,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BAAiB,CAAC;AACnG,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACzE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -11,6 +11,19 @@ export type AppColorName = 'teal' | 'blue' | 'green' | 'yellow' | 'red' | 'purpl
|
|
|
11
11
|
* maps those roles onto Bloom's canonical token names. A user-picked colour
|
|
12
12
|
* flows through the identical path — a preset is just a fixed seed.
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* Why a preset is not offered to every user. Absent means it is.
|
|
16
|
+
*
|
|
17
|
+
* The two are NOT interchangeable and must not collapse back into one list: a
|
|
18
|
+
* `handle` preset belongs to a specific account and cannot be bought, while a
|
|
19
|
+
* `premium` one is exactly what is bought. Conflating them is how the picker
|
|
20
|
+
* came to offer both of Oxy's reserved brand colours to everybody.
|
|
21
|
+
*/
|
|
22
|
+
export type ColorPresetGate =
|
|
23
|
+
/** Reserved for the account whose brand it is — not purchasable. */
|
|
24
|
+
'handle'
|
|
25
|
+
/** Sold with a subscription. */
|
|
26
|
+
| 'premium';
|
|
14
27
|
export interface AppColorPreset {
|
|
15
28
|
name: AppColorName;
|
|
16
29
|
/** The brand seed colour, `#rrggbb`. Also the value the colour picker matches. */
|
|
@@ -31,6 +44,12 @@ export interface AppColorPreset {
|
|
|
31
44
|
* {@link AppColorPreset.secondaryHex} for the tertiary palette.
|
|
32
45
|
*/
|
|
33
46
|
tertiaryHex?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Who may pick this preset. Absent = everyone. Bloom only DECLARES the gate;
|
|
49
|
+
* whether a given viewer satisfies it is the consuming app's question, since
|
|
50
|
+
* only the app knows who is signed in and what they pay for.
|
|
51
|
+
*/
|
|
52
|
+
gate?: ColorPresetGate;
|
|
34
53
|
}
|
|
35
54
|
/**
|
|
36
55
|
* Historically each preset carried a full light/dark map of raw HSL triples.
|
|
@@ -40,8 +59,6 @@ export interface AppColorPreset {
|
|
|
40
59
|
*/
|
|
41
60
|
export type PresetTokens = Record<string, string>;
|
|
42
61
|
export declare const APP_COLOR_NAMES: readonly AppColorName[];
|
|
43
|
-
/** Premium-exclusive presets, hidden from the standard color picker. */
|
|
44
|
-
export declare const PREMIUM_COLOR_NAMES: readonly AppColorName[];
|
|
45
62
|
export declare const HEX_TO_APP_COLOR: Record<string, AppColorName>;
|
|
46
63
|
export declare function hexToAppColorName(hex: string): AppColorName;
|
|
47
64
|
/**
|
|
@@ -51,4 +68,10 @@ export declare function hexToAppColorName(hex: string): AppColorName;
|
|
|
51
68
|
* bold `vibrant` derivation to match the prior saturated palette.
|
|
52
69
|
*/
|
|
53
70
|
export declare const APP_COLOR_PRESETS: Record<AppColorName, AppColorPreset>;
|
|
71
|
+
/** Available to every user, signed in or not. */
|
|
72
|
+
export declare const FREE_COLOR_NAMES: readonly AppColorName[];
|
|
73
|
+
/** Reserved for the account whose brand it is (`oxy`, `faircoin`) — not for sale. */
|
|
74
|
+
export declare const HANDLE_COLOR_NAMES: readonly AppColorName[];
|
|
75
|
+
/** Sold with a subscription. */
|
|
76
|
+
export declare const PREMIUM_COLOR_NAMES: readonly AppColorName[];
|
|
54
77
|
//# sourceMappingURL=color-presets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-presets.d.ts","sourceRoot":"","sources":["../../../../src/theme/color-presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,MAAM,GACN,KAAK,GACL,QAAQ,GACR,MAAM,GACN,KAAK,GACL,UAAU,GACV,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,CAAC;AAEX;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,kFAAkF;IAClF,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,OAAO,EAAE,aAAa,CAAC;IACvB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"color-presets.d.ts","sourceRoot":"","sources":["../../../../src/theme/color-presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,MAAM,GACN,KAAK,GACL,QAAQ,GACR,MAAM,GACN,KAAK,GACL,UAAU,GACV,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,CAAC;AAEX;;;;;;;;;;GAUG;AACH;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe;AACzB,oEAAoE;AAClE,QAAQ;AACV,gCAAgC;GAC9B,SAAS,CAAC;AAEd,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,kFAAkF;IAClF,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,OAAO,EAAE,aAAa,CAAC;IACvB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAElD,eAAO,MAAM,eAAe,EAAE,SAAS,YAAY,EAAkK,CAAC;AAEtN,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAmBzD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAE3D;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,YAAY,EAAE,cAAc,CA+BlE,CAAC;AAgBF,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,EAAE,SAAS,YAAY,EAA4B,CAAC;AAEjF,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,EAAE,SAAS,YAAY,EAA2B,CAAC;AAElF,gCAAgC;AAChC,eAAO,MAAM,mBAAmB,EAAE,SAAS,YAAY,EAA4B,CAAC"}
|
|
@@ -18,8 +18,8 @@ export type { AmbientThemeState, AmbientThemeApi, AmbientAccents, UseAmbientThem
|
|
|
18
18
|
export { useNavigationTheme } from './use-navigation-theme';
|
|
19
19
|
export type { NavigationTheme, NavigationThemeFont } from './use-navigation-theme';
|
|
20
20
|
export type { Theme, ThemeColors, ThemeMode, ThemeGradient, ThemeGradients } from './types';
|
|
21
|
-
export type { AppColorName, AppColorPreset, PresetTokens } from './color-presets';
|
|
22
|
-
export { APP_COLOR_NAMES, PREMIUM_COLOR_NAMES, APP_COLOR_PRESETS, HEX_TO_APP_COLOR, hexToAppColorName, } from './color-presets';
|
|
21
|
+
export type { AppColorName, AppColorPreset, ColorPresetGate, PresetTokens } from './color-presets';
|
|
22
|
+
export { APP_COLOR_NAMES, FREE_COLOR_NAMES, HANDLE_COLOR_NAMES, PREMIUM_COLOR_NAMES, APP_COLOR_PRESETS, HEX_TO_APP_COLOR, hexToAppColorName, } from './color-presets';
|
|
23
23
|
export { parseRgb, withAlpha } from './color-utils';
|
|
24
24
|
export type { RgbChannels } from './color-utils';
|
|
25
25
|
export { getPresetVars, applyPresetVarsToDocument } from './preset-vars';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACxF,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAIjE,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,aAAa,EACb,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAA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,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACzE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The gate groups must PARTITION the preset list.
|
|
3
|
+
*
|
|
4
|
+
* A consumer builds its picker from these three, so a preset missing from all of
|
|
5
|
+
* them disappears with no error, and one appearing in two is offered to people
|
|
6
|
+
* who should not have it. Neither shows up as a type error, a failed render, or
|
|
7
|
+
* anything else the rest of the suite can see — the picker just renders a
|
|
8
|
+
* different set of swatches than intended.
|
|
9
|
+
*/
|
|
10
|
+
import {
|
|
11
|
+
APP_COLOR_NAMES,
|
|
12
|
+
APP_COLOR_PRESETS,
|
|
13
|
+
FREE_COLOR_NAMES,
|
|
14
|
+
HANDLE_COLOR_NAMES,
|
|
15
|
+
PREMIUM_COLOR_NAMES,
|
|
16
|
+
} from '../color-presets';
|
|
17
|
+
|
|
18
|
+
describe('colour preset gates', () => {
|
|
19
|
+
it('partitions every preset exactly once', () => {
|
|
20
|
+
const grouped = [...FREE_COLOR_NAMES, ...HANDLE_COLOR_NAMES, ...PREMIUM_COLOR_NAMES];
|
|
21
|
+
expect([...grouped].sort()).toEqual([...APP_COLOR_NAMES].sort());
|
|
22
|
+
expect(new Set(grouped).size).toBe(grouped.length);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Vacuity floor: an empty gated group would satisfy the partition above while
|
|
26
|
+
// meaning "nothing is gated at all", which is the bug this file exists for.
|
|
27
|
+
it('actually gates something in each direction', () => {
|
|
28
|
+
expect(FREE_COLOR_NAMES.length).toBeGreaterThan(10);
|
|
29
|
+
expect(HANDLE_COLOR_NAMES.length).toBeGreaterThan(0);
|
|
30
|
+
expect(PREMIUM_COLOR_NAMES.length).toBeGreaterThan(0);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// The specific assignment, stated so a change to it is a deliberate edit here
|
|
34
|
+
// rather than a silent consequence of adding a preset.
|
|
35
|
+
it('reserves the brand colours by handle and sells the colourless one', () => {
|
|
36
|
+
expect([...HANDLE_COLOR_NAMES].sort()).toEqual(['faircoin', 'oxy']);
|
|
37
|
+
expect(PREMIUM_COLOR_NAMES).toEqual(['mono']);
|
|
38
|
+
expect(FREE_COLOR_NAMES).not.toContain('mono');
|
|
39
|
+
expect(FREE_COLOR_NAMES).toContain('teal');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('keeps the declared gate and the derived group in agreement', () => {
|
|
43
|
+
for (const name of APP_COLOR_NAMES) {
|
|
44
|
+
const { gate } = APP_COLOR_PRESETS[name];
|
|
45
|
+
if (gate === undefined) expect(FREE_COLOR_NAMES).toContain(name);
|
|
46
|
+
else if (gate === 'handle') expect(HANDLE_COLOR_NAMES).toContain(name);
|
|
47
|
+
else expect(PREMIUM_COLOR_NAMES).toContain(name);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -31,6 +31,20 @@ export type AppColorName =
|
|
|
31
31
|
* maps those roles onto Bloom's canonical token names. A user-picked colour
|
|
32
32
|
* flows through the identical path — a preset is just a fixed seed.
|
|
33
33
|
*/
|
|
34
|
+
/**
|
|
35
|
+
* Why a preset is not offered to every user. Absent means it is.
|
|
36
|
+
*
|
|
37
|
+
* The two are NOT interchangeable and must not collapse back into one list: a
|
|
38
|
+
* `handle` preset belongs to a specific account and cannot be bought, while a
|
|
39
|
+
* `premium` one is exactly what is bought. Conflating them is how the picker
|
|
40
|
+
* came to offer both of Oxy's reserved brand colours to everybody.
|
|
41
|
+
*/
|
|
42
|
+
export type ColorPresetGate =
|
|
43
|
+
/** Reserved for the account whose brand it is — not purchasable. */
|
|
44
|
+
| 'handle'
|
|
45
|
+
/** Sold with a subscription. */
|
|
46
|
+
| 'premium';
|
|
47
|
+
|
|
34
48
|
export interface AppColorPreset {
|
|
35
49
|
name: AppColorName;
|
|
36
50
|
/** The brand seed colour, `#rrggbb`. Also the value the colour picker matches. */
|
|
@@ -51,6 +65,12 @@ export interface AppColorPreset {
|
|
|
51
65
|
* {@link AppColorPreset.secondaryHex} for the tertiary palette.
|
|
52
66
|
*/
|
|
53
67
|
tertiaryHex?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Who may pick this preset. Absent = everyone. Bloom only DECLARES the gate;
|
|
70
|
+
* whether a given viewer satisfies it is the consuming app's question, since
|
|
71
|
+
* only the app knows who is signed in and what they pay for.
|
|
72
|
+
*/
|
|
73
|
+
gate?: ColorPresetGate;
|
|
54
74
|
}
|
|
55
75
|
|
|
56
76
|
/**
|
|
@@ -63,9 +83,6 @@ export type PresetTokens = Record<string, string>;
|
|
|
63
83
|
|
|
64
84
|
export const APP_COLOR_NAMES: readonly AppColorName[] = ['teal', 'blue', 'green', 'yellow', 'red', 'purple', 'pink', 'sky', 'orange', 'mint', 'oxy', 'faircoin', 'pumpkin', 'gray', 'brown', 'peach', 'rose', 'mono'];
|
|
65
85
|
|
|
66
|
-
/** Premium-exclusive presets, hidden from the standard color picker. */
|
|
67
|
-
export const PREMIUM_COLOR_NAMES: readonly AppColorName[] = ['oxy', 'faircoin'];
|
|
68
|
-
|
|
69
86
|
export const HEX_TO_APP_COLOR: Record<string, AppColorName> = {
|
|
70
87
|
'#005c67': 'teal',
|
|
71
88
|
'#0085fe': 'blue',
|
|
@@ -114,8 +131,8 @@ export const APP_COLOR_PRESETS: Record<AppColorName, AppColorPreset> = {
|
|
|
114
131
|
// headroom, so the fill reads as orange instead of paying for the hue twice.
|
|
115
132
|
orange: { name: 'orange', hex: '#ff5722', variant: 'vivid' },
|
|
116
133
|
mint: { name: 'mint', hex: '#14b8a6', variant: 'vivid' },
|
|
117
|
-
oxy: { name: 'oxy', hex: '#c46ede', variant: 'vivid' },
|
|
118
|
-
faircoin: { name: 'faircoin', hex: '#9ffb50', variant: 'vivid' },
|
|
134
|
+
oxy: { name: 'oxy', hex: '#c46ede', variant: 'vivid', gate: 'handle' },
|
|
135
|
+
faircoin: { name: 'faircoin', hex: '#9ffb50', variant: 'vivid', gate: 'handle' },
|
|
119
136
|
pumpkin: { name: 'pumpkin', hex: '#ff9800', variant: 'vivid' },
|
|
120
137
|
gray: { name: 'gray', hex: '#607d8b', variant: 'vivid' },
|
|
121
138
|
brown: { name: 'brown', hex: '#813519', variant: 'vivid' },
|
|
@@ -127,5 +144,28 @@ export const APP_COLOR_PRESETS: Record<AppColorName, AppColorPreset> = {
|
|
|
127
144
|
* seed with none, so a user who picks a grey in the colour wheel lands here too
|
|
128
145
|
* rather than on a nearly-grey approximation.
|
|
129
146
|
*/
|
|
130
|
-
mono: { name: 'mono', hex: '#000000', variant: 'monochrome' },
|
|
147
|
+
mono: { name: 'mono', hex: '#000000', variant: 'monochrome', gate: 'premium' },
|
|
131
148
|
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The three gate groups, DERIVED from the presets rather than listed again, so a
|
|
152
|
+
* preset cannot be gated in one place and offered in another. Together they
|
|
153
|
+
* partition {@link APP_COLOR_NAMES} exactly — asserted in
|
|
154
|
+
* `__tests__/color-preset-gates.test.ts`, since a preset silently missing from
|
|
155
|
+
* every group would simply vanish from a picker with no error anywhere.
|
|
156
|
+
*
|
|
157
|
+
* A consumer builds its visible list from these; it must NOT start from
|
|
158
|
+
* `APP_COLOR_NAMES` and add the unlocked ones, which yields the gated presets to
|
|
159
|
+
* everybody and duplicates whatever the viewer did unlock.
|
|
160
|
+
*/
|
|
161
|
+
const namesGatedBy = (gate: ColorPresetGate | undefined): readonly AppColorName[] =>
|
|
162
|
+
APP_COLOR_NAMES.filter((name) => APP_COLOR_PRESETS[name].gate === gate);
|
|
163
|
+
|
|
164
|
+
/** Available to every user, signed in or not. */
|
|
165
|
+
export const FREE_COLOR_NAMES: readonly AppColorName[] = namesGatedBy(undefined);
|
|
166
|
+
|
|
167
|
+
/** Reserved for the account whose brand it is (`oxy`, `faircoin`) — not for sale. */
|
|
168
|
+
export const HANDLE_COLOR_NAMES: readonly AppColorName[] = namesGatedBy('handle');
|
|
169
|
+
|
|
170
|
+
/** Sold with a subscription. */
|
|
171
|
+
export const PREMIUM_COLOR_NAMES: readonly AppColorName[] = namesGatedBy('premium');
|
package/src/theme/index.ts
CHANGED
|
@@ -40,9 +40,11 @@ export type {
|
|
|
40
40
|
export { useNavigationTheme } from './use-navigation-theme';
|
|
41
41
|
export type { NavigationTheme, NavigationThemeFont } from './use-navigation-theme';
|
|
42
42
|
export type { Theme, ThemeColors, ThemeMode, ThemeGradient, ThemeGradients } from './types';
|
|
43
|
-
export type { AppColorName, AppColorPreset, PresetTokens } from './color-presets';
|
|
43
|
+
export type { AppColorName, AppColorPreset, ColorPresetGate, PresetTokens } from './color-presets';
|
|
44
44
|
export {
|
|
45
45
|
APP_COLOR_NAMES,
|
|
46
|
+
FREE_COLOR_NAMES,
|
|
47
|
+
HANDLE_COLOR_NAMES,
|
|
46
48
|
PREMIUM_COLOR_NAMES,
|
|
47
49
|
APP_COLOR_PRESETS,
|
|
48
50
|
HEX_TO_APP_COLOR,
|