tfy-web-components 0.0.11 → 0.0.13

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.
@@ -121,7 +121,7 @@ const darkPalette = {
121
121
  950: "#FAFAFA",
122
122
  1e3: "#FDFDFD",
123
123
  // Light text on dark backgrounds
124
- disabled: "#404040",
124
+ disabled: "#222225",
125
125
  whitesmoke: "#1a1a1a"
126
126
  },
127
127
  indigo: {
@@ -1 +1 @@
1
- {"version":3,"file":"colors.es.js","sources":["../../../src/components/theme/colors.ts"],"sourcesContent":["export const lightPalette = {\n gray: {\n 16: '#162236',\n 25: '#F5FAFF',\n 50: '#fafcff',\n 75: '#F9FAFB',\n 100: '#F0F7FF',\n 125: '#ECF5FF',\n 150: '#E8F2FE',\n 200: '#E0ECFD',\n 250: '#CEE0F8',\n 275: '#F0F7FF',\n 300: '#A8C3E8',\n 350: '#95B2DD',\n 375: '#AAAAAA',\n 400: '#82A0CE',\n 450: '#6F8EBD',\n 500: '#5E7BAA',\n 550: '#4D6896',\n 600: '#3E5680',\n 650: '#31456A',\n 700: '#263755',\n 750: '#1C2A42',\n 800: '#0E1623',\n 850: '#090F17',\n 900: '#05090E',\n 950: '#030407',\n 1000: '#010202',\n disabled: '#f2f2f2',\n whitesmoke: '#fafafa',\n },\n indigo: {\n 500: '#6366F1',\n 525: '#3A47F9',\n 550: '#5429FF',\n 700: '#4338CA',\n 725: '#2300F7',\n 750: '#5501E1',\n 850: '#2900CE',\n },\n yellow: {\n '50light': '#FFFBEB',\n 100: '#FEF3C7',\n '200dark': '#FDE68A',\n 500: '#F59E0B',\n },\n skyblue: '#F5FAFF',\n blue: {\n 25: '#F5F9FF',\n 45: '#F0F7FF',\n primary: '#481DF1',\n secondary: '#93C5FD',\n 'secondary-light': '#0EA5E9',\n purple: '#5501E1',\n 'purple-2': '#0047ff',\n 'purple-3': '#2900CE',\n 100: '#e0e7ff',\n 150: '#CEE0F8',\n 200: '#818cf8',\n 350: '#A8C3E8',\n 375: '#82A0CE',\n 500: '#BBD2F1',\n 550: '#2F85F4',\n '500original': '#3b82f6',\n 600: '#2563EB',\n 650: '#4D6896',\n 725: '#3E5680',\n },\n green: {\n 600: '#059669',\n },\n fuchsia: {\n 100: '#FAE8FF',\n 500: '#F0449D',\n },\n violet: {\n 500: '#4F46E5',\n },\n red: {\n 500: '#EF4444',\n 650: '#E10101',\n 50: '#FEF2F2',\n },\n orange: {\n 100: '#FFEDD5',\n 650: '#FA2A00',\n },\n amber: {\n 450: '#FF9D00',\n },\n white: '#ffffff',\n black: '#09090B',\n background: '#fafcff',\n}\n\nexport const darkPalette = {\n gray: {\n 16: '#E4E4E7',\n 25: '#1e1e1e',\n 50: '#000000',\n 75: '#2a2a2a',\n 100: '#101013',\n 125: '#141417',\n 150: '#18181B',\n 200: '#1F1F22',\n 250: '#27272A',\n 275: '#343439',\n 300: '#3F3F46',\n 350: '#494950',\n 375: '#757575',\n 400: '#52525B',\n 450: '#616167',\n 500: '#71717A',\n 550: '#8C8C92',\n 600: '#A1A1AA',\n 650: '#B8B8BE',\n 700: '#D4D4D8',\n 750: '#DFDFE2',\n 800: '#ECECEE',\n 850: '#F4F4F5',\n 900: '#F7F7F8',\n 950: '#FAFAFA',\n 1000: '#FDFDFD', // Light text on dark backgrounds\n disabled: '#404040',\n whitesmoke: '#1a1a1a',\n },\n indigo: {\n 500: '#6366F1',\n 525: '#3A47F9',\n 550: '#5429FF',\n 700: '#4338CA',\n 725: '#2300F7',\n 750: '#5501E1',\n 850: '#2900CE',\n },\n yellow: {\n '50light': '#FFFBEB',\n 100: '#FEF3C7',\n '200dark': '#FDE68A',\n 500: '#F59E0B',\n },\n skyblue: '#1e2538',\n blue: {\n 25: '#1a1f2e',\n 45: '#1e2437',\n primary: '#6366f1',\n secondary: '#60a5fa',\n 'secondary-light': '#38bdf8',\n purple: '#8b5cf6',\n 'purple-2': '#3b82f6',\n 'purple-3': '#6366f1',\n 100: '#1e2a3a',\n 150: '#263445',\n 200: '#3b82f6',\n 350: '#60a5fa',\n 375: '#7dd3fc',\n 500: '#60a5fa',\n 550: '#3b82f6',\n '500original': '#3b82f6',\n 600: '#2563eb',\n 650: '#1d4ed8',\n 725: '#1e40af',\n },\n green: {\n 600: '#059669',\n },\n fuchsia: {\n 100: '#FAE8FF',\n 500: '#F0449D',\n },\n violet: {\n 500: '#4F46E5',\n },\n red: {\n 500: '#EF4444',\n 650: '#E10101',\n 50: '#FEF2F2',\n },\n orange: {\n 100: '#FFEDD5',\n 650: '#FA2A00',\n },\n amber: {\n 450: '#FF9D00',\n },\n white: '#1F1F22',\n black: '#ffffff',\n background: '#18181B',\n}\n"],"names":[],"mappings":"AAAO,MAAM,eAAe;AAAA,EAC1B,MAAM;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EACA,QAAQ;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EACA,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,KAAK;AAAA,IACL,WAAW;AAAA,IACX,KAAK;AAAA,EACP;AAAA,EACA,SAAS;AAAA,EACT,MAAM;AAA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;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EACA,QAAQ;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EACA,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,KAAK;AAAA,IACL,WAAW;AAAA,IACX,KAAK;AAAA,EACP;AAAA,EACA,SAAS;AAAA,EACT,MAAM;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,SAAS;AAAA,IACT,WAAW;AAAA,IACX,mBAAmB;AAAA,IACnB,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,eAAe;AAAA,IACf,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EACA,OAAO;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EACA,SAAS;AAAA,IACP,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EACA,QAAQ;AAAA,IACN,KAAK;AAAA,EACP;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,KAAK;AAAA,IACL,IAAI;AAAA,EACN;AAAA,EACA,QAAQ;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EACA,OAAO;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EACA,OAAO;AAAA,EACP,OAAO;AAAA,EACP,YAAY;AACd;"}
1
+ {"version":3,"file":"colors.es.js","sources":["../../../src/components/theme/colors.ts"],"sourcesContent":["export const lightPalette = {\n gray: {\n 16: '#162236',\n 25: '#F5FAFF',\n 50: '#fafcff',\n 75: '#F9FAFB',\n 100: '#F0F7FF',\n 125: '#ECF5FF',\n 150: '#E8F2FE',\n 200: '#E0ECFD',\n 250: '#CEE0F8',\n 275: '#F0F7FF',\n 300: '#A8C3E8',\n 350: '#95B2DD',\n 375: '#AAAAAA',\n 400: '#82A0CE',\n 450: '#6F8EBD',\n 500: '#5E7BAA',\n 550: '#4D6896',\n 600: '#3E5680',\n 650: '#31456A',\n 700: '#263755',\n 750: '#1C2A42',\n 800: '#0E1623',\n 850: '#090F17',\n 900: '#05090E',\n 950: '#030407',\n 1000: '#010202',\n disabled: '#f2f2f2',\n whitesmoke: '#fafafa',\n },\n indigo: {\n 500: '#6366F1',\n 525: '#3A47F9',\n 550: '#5429FF',\n 700: '#4338CA',\n 725: '#2300F7',\n 750: '#5501E1',\n 850: '#2900CE',\n },\n yellow: {\n '50light': '#FFFBEB',\n 100: '#FEF3C7',\n '200dark': '#FDE68A',\n 500: '#F59E0B',\n },\n skyblue: '#F5FAFF',\n blue: {\n 25: '#F5F9FF',\n 45: '#F0F7FF',\n primary: '#481DF1',\n secondary: '#93C5FD',\n 'secondary-light': '#0EA5E9',\n purple: '#5501E1',\n 'purple-2': '#0047ff',\n 'purple-3': '#2900CE',\n 100: '#e0e7ff',\n 150: '#CEE0F8',\n 200: '#818cf8',\n 350: '#A8C3E8',\n 375: '#82A0CE',\n 500: '#BBD2F1',\n 550: '#2F85F4',\n '500original': '#3b82f6',\n 600: '#2563EB',\n 650: '#4D6896',\n 725: '#3E5680',\n },\n green: {\n 600: '#059669',\n },\n fuchsia: {\n 100: '#FAE8FF',\n 500: '#F0449D',\n },\n violet: {\n 500: '#4F46E5',\n },\n red: {\n 500: '#EF4444',\n 650: '#E10101',\n 50: '#FEF2F2',\n },\n orange: {\n 100: '#FFEDD5',\n 650: '#FA2A00',\n },\n amber: {\n 450: '#FF9D00',\n },\n white: '#ffffff',\n black: '#09090B',\n background: '#fafcff',\n}\n\nexport const darkPalette = {\n gray: {\n 16: '#E4E4E7',\n 25: '#1e1e1e',\n 50: '#000000',\n 75: '#2a2a2a',\n 100: '#101013',\n 125: '#141417',\n 150: '#18181B',\n 200: '#1F1F22',\n 250: '#27272A',\n 275: '#343439',\n 300: '#3F3F46',\n 350: '#494950',\n 375: '#757575',\n 400: '#52525B',\n 450: '#616167',\n 500: '#71717A',\n 550: '#8C8C92',\n 600: '#A1A1AA',\n 650: '#B8B8BE',\n 700: '#D4D4D8',\n 750: '#DFDFE2',\n 800: '#ECECEE',\n 850: '#F4F4F5',\n 900: '#F7F7F8',\n 950: '#FAFAFA',\n 1000: '#FDFDFD', // Light text on dark backgrounds\n disabled: '#222225',\n whitesmoke: '#1a1a1a',\n },\n indigo: {\n 500: '#6366F1',\n 525: '#3A47F9',\n 550: '#5429FF',\n 700: '#4338CA',\n 725: '#2300F7',\n 750: '#5501E1',\n 850: '#2900CE',\n },\n yellow: {\n '50light': '#FFFBEB',\n 100: '#FEF3C7',\n '200dark': '#FDE68A',\n 500: '#F59E0B',\n },\n skyblue: '#1e2538',\n blue: {\n 25: '#1a1f2e',\n 45: '#1e2437',\n primary: '#6366f1',\n secondary: '#60a5fa',\n 'secondary-light': '#38bdf8',\n purple: '#8b5cf6',\n 'purple-2': '#3b82f6',\n 'purple-3': '#6366f1',\n 100: '#1e2a3a',\n 150: '#263445',\n 200: '#3b82f6',\n 350: '#60a5fa',\n 375: '#7dd3fc',\n 500: '#60a5fa',\n 550: '#3b82f6',\n '500original': '#3b82f6',\n 600: '#2563eb',\n 650: '#1d4ed8',\n 725: '#1e40af',\n },\n green: {\n 600: '#059669',\n },\n fuchsia: {\n 100: '#FAE8FF',\n 500: '#F0449D',\n },\n violet: {\n 500: '#4F46E5',\n },\n red: {\n 500: '#EF4444',\n 650: '#E10101',\n 50: '#FEF2F2',\n },\n orange: {\n 100: '#FFEDD5',\n 650: '#FA2A00',\n },\n amber: {\n 450: '#FF9D00',\n },\n white: '#1F1F22',\n black: '#ffffff',\n background: '#18181B',\n}\n"],"names":[],"mappings":"AAAO,MAAM,eAAe;AAAA,EAC1B,MAAM;AAAA,IACJ,IAAI;AAAA,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AA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,eAAe;AAAA,IACf,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EACA,OAAO;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EACA,SAAS;AAAA,IACP,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EACA,QAAQ;AAAA,IACN,KAAK;AAAA,EACP;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,KAAK;AAAA,IACL,IAAI;AAAA,EACN;AAAA,EACA,QAAQ;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EACA,OAAO;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EACA,OAAO;AAAA,EACP,OAAO;AAAA,EACP,YAAY;AACd;"}
@@ -1,6 +1 @@
1
- import { PluginCreator, Config } from 'tailwindcss/types/config';
2
- declare const lightColorPlugin: {
3
- handler: PluginCreator;
4
- config?: Partial<Config> | undefined;
5
- };
6
- export default lightColorPlugin;
1
+ export declare const createLightColorPlugin: (plugin: any) => any;
@@ -1,61 +1,4 @@
1
1
  import { lightPalette } from "./colors.es.js";
2
- function getDefaultExportFromCjs(x) {
3
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
4
- }
5
- var createPlugin$2 = {};
6
- var createPlugin$1 = {};
7
- (function(exports) {
8
- Object.defineProperty(exports, "__esModule", {
9
- value: true
10
- });
11
- Object.defineProperty(exports, "default", {
12
- enumerable: true,
13
- get: function() {
14
- return _default;
15
- }
16
- });
17
- function createPlugin2(plugin2, config) {
18
- return {
19
- handler: plugin2,
20
- config
21
- };
22
- }
23
- createPlugin2.withOptions = function(pluginFunction, configFunction = () => ({})) {
24
- const optionsFunction = function(options) {
25
- return {
26
- __options: options,
27
- handler: pluginFunction(options),
28
- config: configFunction(options)
29
- };
30
- };
31
- optionsFunction.__isOptionsFunction = true;
32
- optionsFunction.__pluginFunction = pluginFunction;
33
- optionsFunction.__configFunction = configFunction;
34
- return optionsFunction;
35
- };
36
- const _default = createPlugin2;
37
- })(createPlugin$1);
38
- (function(exports) {
39
- Object.defineProperty(exports, "__esModule", {
40
- value: true
41
- });
42
- Object.defineProperty(exports, "default", {
43
- enumerable: true,
44
- get: function() {
45
- return _default;
46
- }
47
- });
48
- const _createPlugin = /* @__PURE__ */ _interop_require_default(createPlugin$1);
49
- function _interop_require_default(obj) {
50
- return obj && obj.__esModule ? obj : {
51
- default: obj
52
- };
53
- }
54
- const _default = _createPlugin.default;
55
- })(createPlugin$2);
56
- let createPlugin = createPlugin$2;
57
- var plugin = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default;
58
- const plugin$1 = /* @__PURE__ */ getDefaultExportFromCjs(plugin);
59
2
  function flattenColors(colors, prefix = "") {
60
3
  const result = {};
61
4
  for (const [key, value] of Object.entries(colors)) {
@@ -126,22 +69,24 @@ function generateRingUtilities(colors) {
126
69
  }
127
70
  return utilities;
128
71
  }
129
- const lightColorPlugin = plugin$1(function({ addUtilities }) {
130
- const flatColors = flattenColors(lightPalette);
131
- const utilities = {
132
- ...generateColorUtilities("background-color", "bg", flatColors),
133
- ...generateColorUtilities("color", "text", flatColors),
134
- ...generateBorderUtilities(flatColors),
135
- ...generateDivideUtilities(flatColors),
136
- ...generateRingUtilities(flatColors),
137
- ...generateColorUtilities("fill", "fill", flatColors),
138
- ...generateColorUtilities("stroke", "stroke", flatColors),
139
- ...generateColorUtilities("accent-color", "accent", flatColors),
140
- ...generateColorUtilities("caret-color", "caret", flatColors)
141
- };
142
- addUtilities(utilities);
143
- });
72
+ const createLightColorPlugin = (plugin) => {
73
+ return plugin(function({ addUtilities }) {
74
+ const flatColors = flattenColors(lightPalette);
75
+ const utilities = {
76
+ ...generateColorUtilities("background-color", "bg", flatColors),
77
+ ...generateColorUtilities("color", "text", flatColors),
78
+ ...generateBorderUtilities(flatColors),
79
+ ...generateDivideUtilities(flatColors),
80
+ ...generateRingUtilities(flatColors),
81
+ ...generateColorUtilities("fill", "fill", flatColors),
82
+ ...generateColorUtilities("stroke", "stroke", flatColors),
83
+ ...generateColorUtilities("accent-color", "accent", flatColors),
84
+ ...generateColorUtilities("caret-color", "caret", flatColors)
85
+ };
86
+ addUtilities(utilities);
87
+ });
88
+ };
144
89
  export {
145
- lightColorPlugin as default
90
+ createLightColorPlugin
146
91
  };
147
92
  //# sourceMappingURL=lightColorPlugin.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lightColorPlugin.es.js","sources":["../../../node_modules/tailwindcss/lib/util/createPlugin.js","../../../node_modules/tailwindcss/lib/public/create-plugin.js","../../../node_modules/tailwindcss/plugin.js","../../../src/components/theme/lightColorPlugin.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nfunction createPlugin(plugin, config) {\n return {\n handler: plugin,\n config\n };\n}\ncreatePlugin.withOptions = function(pluginFunction, configFunction = ()=>({})) {\n const optionsFunction = function(options) {\n return {\n __options: options,\n handler: pluginFunction(options),\n config: configFunction(options)\n };\n };\n optionsFunction.__isOptionsFunction = true;\n // Expose plugin dependencies so that `object-hash` returns a different\n // value if anything here changes, to ensure a rebuild is triggered.\n optionsFunction.__pluginFunction = pluginFunction;\n optionsFunction.__configFunction = configFunction;\n return optionsFunction;\n};\nconst _default = createPlugin;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nconst _createPlugin = /*#__PURE__*/ _interop_require_default(require(\"../util/createPlugin\"));\nfunction _interop_require_default(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\nconst _default = _createPlugin.default;\n","let createPlugin = require('./lib/public/create-plugin')\nmodule.exports = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default\n","import plugin from 'tailwindcss/plugin.js'\n\nimport { lightPalette } from './colors'\n\n// Type definitions\ntype ColorValue = string | Record<string, any>\ntype FlattenedColors = Record<string, string>\ntype UtilityObject = Record<string, Record<string, string>>\ntype DirectionProperties = string | string[]\n\nfunction flattenColors(colors: ColorValue, prefix = ''): FlattenedColors {\n const result: FlattenedColors = {}\n\n for (const [key, value] of Object.entries(colors)) {\n const newKey = prefix ? `${prefix}-${key}` : key\n\n if (typeof value === 'string') {\n result[newKey] = value\n } else if (typeof value === 'object' && value !== null) {\n Object.assign(result, flattenColors(value, newKey))\n }\n }\n\n return result\n}\n\nfunction generateColorUtilities(property: string, prefix: string, colors: FlattenedColors): UtilityObject {\n const utilities: UtilityObject = {}\n\n for (const [colorKey, colorValue] of Object.entries(colors)) {\n utilities[`.${prefix}-light-${colorKey}`] = {\n [property]: colorValue,\n }\n }\n\n return utilities\n}\n\nfunction generateBorderUtilities(colors: FlattenedColors): UtilityObject {\n const utilities: UtilityObject = {}\n\n Object.assign(utilities, generateColorUtilities('border-color', 'border', colors))\n\n const directions: Record<string, DirectionProperties> = {\n t: 'border-top-color',\n r: 'border-right-color',\n b: 'border-bottom-color',\n l: 'border-left-color',\n x: ['border-left-color', 'border-right-color'],\n y: ['border-top-color', 'border-bottom-color'],\n }\n\n for (const [dirKey, properties] of Object.entries(directions)) {\n for (const [colorKey, colorValue] of Object.entries(colors)) {\n const className = `.border-${dirKey}-light-${colorKey}`\n\n if (Array.isArray(properties)) {\n utilities[className] = {}\n properties.forEach((prop) => {\n utilities[className][prop] = colorValue\n })\n } else {\n utilities[className] = {\n [properties]: colorValue,\n }\n }\n }\n }\n\n return utilities\n}\n\nfunction generateDivideUtilities(colors: FlattenedColors): UtilityObject {\n const utilities: UtilityObject = {}\n\n for (const [colorKey, colorValue] of Object.entries(colors)) {\n utilities[`.divide-light-${colorKey} > :not([hidden]) ~ :not([hidden])`] = {\n 'border-color': colorValue,\n }\n }\n\n return utilities\n}\n\nfunction generateRingUtilities(colors: FlattenedColors): UtilityObject {\n const utilities: UtilityObject = {}\n\n for (const [colorKey, colorValue] of Object.entries(colors)) {\n utilities[`.ring-light-${colorKey}`] = {\n '--tw-ring-color': colorValue,\n }\n\n utilities[`.ring-offset-light-${colorKey}`] = {\n '--tw-ring-offset-color': colorValue,\n }\n }\n\n return utilities\n}\n\nconst lightColorPlugin = plugin(function ({ addUtilities }) {\n const flatColors = flattenColors(lightPalette)\n\n const utilities = {\n ...generateColorUtilities('background-color', 'bg', flatColors),\n ...generateColorUtilities('color', 'text', flatColors),\n ...generateBorderUtilities(flatColors),\n ...generateDivideUtilities(flatColors),\n ...generateRingUtilities(flatColors),\n ...generateColorUtilities('fill', 'fill', flatColors),\n ...generateColorUtilities('stroke', 'stroke', flatColors),\n ...generateColorUtilities('accent-color', 'accent', flatColors),\n ...generateColorUtilities('caret-color', 'caret', flatColors),\n }\n\n addUtilities(utilities)\n})\n\nexport default lightColorPlugin\n"],"names":["createPlugin","plugin","require$$0"],"mappings":";;;;;;;AACA,SAAO,eAAwB,SAAA,cAAc;AAAA,IACzC,OAAO;AAAA,EACX,CAAC;AACD,SAAO,eAAe,SAAS,WAAW;AAAA,IACtC,YAAY;AAAA,IACZ,KAAK,WAAW;AACZ,aAAO;AAAA,IACV;AAAA,EACL,CAAC;AACD,WAASA,cAAaC,SAAQ,QAAQ;AAClC,WAAO;AAAA,MACH,SAASA;AAAA,MACT;AAAA,IACR;AAAA,EACC;AACD,EAAAD,cAAa,cAAc,SAAS,gBAAgB,iBAAiB,OAAK,CAAE,IAAG;AAC3E,UAAM,kBAAkB,SAAS,SAAS;AACtC,aAAO;AAAA,QACH,WAAW;AAAA,QACX,SAAS,eAAe,OAAO;AAAA,QAC/B,QAAQ,eAAe,OAAO;AAAA,MAC1C;AAAA,IACA;AACI,oBAAgB,sBAAsB;AAGtC,oBAAgB,mBAAmB;AACnC,oBAAgB,mBAAmB;AACnC,WAAO;AAAA,EACX;AACA,QA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AAM,UAAU;AAAA,IAC9D,GAAG,uBAAuB,SAAS,QAAQ,UAAU;AAAA,IACrD,GAAG,wBAAwB,UAAU;AAAA,IACrC,GAAG,wBAAwB,UAAU;AAAA,IACrC,GAAG,sBAAsB,UAAU;AAAA,IACnC,GAAG,uBAAuB,QAAQ,QAAQ,UAAU;AAAA,IACpD,GAAG,uBAAuB,UAAU,UAAU,UAAU;AAAA,IACxD,GAAG,uBAAuB,gBAAgB,UAAU,UAAU;AAAA,IAC9D,GAAG,uBAAuB,eAAe,SAAS,UAAU;AAAA,EAAA;AAG9D,eAAa,SAAS;AACxB,CAAC;","x_google_ignoreList":[0,1,2]}
1
+ {"version":3,"file":"lightColorPlugin.es.js","sources":["../../../src/components/theme/lightColorPlugin.ts"],"sourcesContent":["import { lightPalette } from './colors'\n\ntype ColorValue = string | Record<string, any>\ntype FlattenedColors = Record<string, string>\ntype UtilityObject = Record<string, Record<string, string>>\ntype DirectionProperties = string | string[]\n\nfunction flattenColors(colors: ColorValue, prefix = ''): FlattenedColors {\n const result: FlattenedColors = {}\n\n for (const [key, value] of Object.entries(colors)) {\n const newKey = prefix ? `${prefix}-${key}` : key\n\n if (typeof value === 'string') {\n result[newKey] = value\n } else if (typeof value === 'object' && value !== null) {\n Object.assign(result, flattenColors(value, newKey))\n }\n }\n\n return result\n}\n\nfunction generateColorUtilities(property: string, prefix: string, colors: FlattenedColors): UtilityObject {\n const utilities: UtilityObject = {}\n\n for (const [colorKey, colorValue] of Object.entries(colors)) {\n utilities[`.${prefix}-light-${colorKey}`] = {\n [property]: colorValue,\n }\n }\n\n return utilities\n}\n\nfunction generateBorderUtilities(colors: FlattenedColors): UtilityObject {\n const utilities: UtilityObject = {}\n\n Object.assign(utilities, generateColorUtilities('border-color', 'border', colors))\n\n const directions: Record<string, DirectionProperties> = {\n t: 'border-top-color',\n r: 'border-right-color',\n b: 'border-bottom-color',\n l: 'border-left-color',\n x: ['border-left-color', 'border-right-color'],\n y: ['border-top-color', 'border-bottom-color'],\n }\n\n for (const [dirKey, properties] of Object.entries(directions)) {\n for (const [colorKey, colorValue] of Object.entries(colors)) {\n const className = `.border-${dirKey}-light-${colorKey}`\n\n if (Array.isArray(properties)) {\n utilities[className] = {}\n properties.forEach((prop) => {\n utilities[className][prop] = colorValue\n })\n } else {\n utilities[className] = {\n [properties]: colorValue,\n }\n }\n }\n }\n\n return utilities\n}\n\nfunction generateDivideUtilities(colors: FlattenedColors): UtilityObject {\n const utilities: UtilityObject = {}\n\n for (const [colorKey, colorValue] of Object.entries(colors)) {\n utilities[`.divide-light-${colorKey} > :not([hidden]) ~ :not([hidden])`] = {\n 'border-color': colorValue,\n }\n }\n\n return utilities\n}\n\nfunction generateRingUtilities(colors: FlattenedColors): UtilityObject {\n const utilities: UtilityObject = {}\n\n for (const [colorKey, colorValue] of Object.entries(colors)) {\n utilities[`.ring-light-${colorKey}`] = {\n '--tw-ring-color': colorValue,\n }\n\n utilities[`.ring-offset-light-${colorKey}`] = {\n '--tw-ring-offset-color': colorValue,\n }\n }\n\n return utilities\n}\nexport const createLightColorPlugin = (plugin: any) => {\n return plugin(function ({ addUtilities }: any) {\n const flatColors = flattenColors(lightPalette)\n\n const utilities = {\n ...generateColorUtilities('background-color', 'bg', flatColors),\n ...generateColorUtilities('color', 'text', flatColors),\n ...generateBorderUtilities(flatColors),\n ...generateDivideUtilities(flatColors),\n ...generateRingUtilities(flatColors),\n ...generateColorUtilities('fill', 'fill', flatColors),\n ...generateColorUtilities('stroke', 'stroke', flatColors),\n ...generateColorUtilities('accent-color', 'accent', flatColors),\n ...generateColorUtilities('caret-color', 'caret', flatColors),\n }\n\n addUtilities(utilities)\n })\n}\n"],"names":[],"mappings":";AAOA,SAAS,cAAc,QAAoB,SAAS,IAAqB;AACvE,QAAM,SAA0B,CAAA;AAEhC,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,UAAM,SAAS,SAAS,GAAG,MAAM,IAAI,GAAG,KAAK;AAEz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AM,YAA2B,CAAA;AAEjC,aAAW,CAAC,UAAU,UAAU,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,cAAA,iBAAiB,QAAQ,oCAAoC,IAAI;AAAA,MACzE,gBAAgB;AAAA,IAAA;AAAA,EAEpB;AAEO,SAAA;AACT;AAEA,SAAS,sBAAsB,QAAwC;AACrE,QAAM,YAA2B,CAAA;AAEjC,aAAW,CAAC,UAAU,UAAU,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,cAAA,eAAe,QAAQ,EAAE,IAAI;AAAA,MACrC,mBAAmB;AAAA,IAAA;AAGX,cAAA,sBAAsB,QAAQ,EAAE,IAAI;AAAA,MAC5C,0BAA0B;AAAA,IAAA;AAAA,EAE9B;AAEO,SAAA;AACT;AACa,MAAA,yBAAyB,CAAC,WAAgB;AACrD,SAAO,OAAO,SAAU,EAAE,gBAAqB;AACvC,UAAA,aAAa,cAAc,YAAY;AAE7C,UAAM,YAAY;AAAA,MAChB,GAAG,uBAAuB,oBAAoB,MAAM,UAAU;AAAA,MAC9D,GAAG,uBAAuB,SAAS,QAAQ,UAAU;AAAA,MACrD,GAAG,wBAAwB,UAAU;AAAA,MACrC,GAAG,wBAAwB,UAAU;AAAA,MACrC,GAAG,sBAAsB,UAAU;AAAA,MACnC,GAAG,uBAAuB,QAAQ,QAAQ,UAAU;AAAA,MACpD,GAAG,uBAAuB,UAAU,UAAU,UAAU;AAAA,MACxD,GAAG,uBAAuB,gBAAgB,UAAU,UAAU;AAAA,MAC9D,GAAG,uBAAuB,eAAe,SAAS,UAAU;AAAA,IAAA;AAG9D,iBAAa,SAAS;AAAA,EAAA,CACvB;AACH;"}
@@ -1,4 +1,5 @@
1
1
  export type ThemeMode = 'light' | 'dark';
2
+ export type ThemeModePreference = ThemeMode | 'system';
2
3
  export declare const injectThemes: (lightTheme: any, darkTheme: any) => void;
3
4
  export declare const getTailwindColors: () => any;
4
5
  export declare const colors: any;
@@ -7,7 +8,7 @@ export declare const colors: any;
7
8
  * @param theme - 'light' or 'dark'
8
9
  */
9
10
  export declare const setThemeMode: (theme: ThemeMode) => void;
10
- export declare const getThemeMode: () => ThemeMode;
11
+ export declare const getThemeMode: (tenantPrefered?: ThemeModePreference) => ThemeMode;
11
12
  /**
12
13
  * Toggle between light and dark themes
13
14
  */
@@ -16,7 +17,7 @@ export declare const toggleThemeMode: () => ThemeMode;
16
17
  * Initialize theme based on stored preference or system preference
17
18
  * Call this once when your app starts
18
19
  */
19
- export declare const initializeTheme: () => ThemeMode;
20
+ export declare const initializeTheme: (tenantPrefered?: ThemeModePreference) => ThemeMode;
20
21
  /**
21
22
  * Check if current theme is dark mode
22
23
  */
@@ -85,14 +85,22 @@ const setThemeMode = (theme) => {
85
85
  console.warn("Failed to set theme mode:", error);
86
86
  }
87
87
  };
88
- const getThemeMode = () => {
88
+ const getThemeMode = (tenantPrefered = "system") => {
89
89
  if (!isBrowser)
90
90
  return "light";
91
91
  const stored = safeLocalStorage.getItem("theme-mode");
92
92
  if (stored === "light" || stored === "dark") {
93
93
  return stored;
94
94
  }
95
- return "light";
95
+ if (tenantPrefered === "light" || tenantPrefered === "dark") {
96
+ return tenantPrefered;
97
+ }
98
+ try {
99
+ const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
100
+ return prefersDark ? "dark" : "light";
101
+ } catch {
102
+ return "light";
103
+ }
96
104
  };
97
105
  const toggleThemeMode = () => {
98
106
  const current = getThemeMode();
@@ -100,8 +108,8 @@ const toggleThemeMode = () => {
100
108
  setThemeMode(newTheme);
101
109
  return newTheme;
102
110
  };
103
- const initializeTheme = () => {
104
- const theme = getThemeMode();
111
+ const initializeTheme = (tenantPrefered = "system") => {
112
+ const theme = getThemeMode(tenantPrefered);
105
113
  if (isBrowser) {
106
114
  try {
107
115
  injectThemes(lightPalette, darkPalette);
@@ -1 +1 @@
1
- {"version":3,"file":"theme.es.js","sources":["../../../src/components/theme/theme.ts"],"sourcesContent":["import { darkPalette, lightPalette } from './colors'\n\nexport type ThemeMode = 'light' | 'dark'\n\nconst flattenTheme = (prefix: string, obj: any): Record<string, string> => {\n const vars: Record<string, string> = {}\n\n for (const key in obj) {\n const val = obj[key]\n const newKey = prefix ? `${prefix}-${key}` : key\n\n if (typeof val === 'string') {\n vars[`--color-${newKey}`] = val\n } else {\n Object.assign(vars, flattenTheme(newKey, val))\n }\n }\n\n return vars\n}\n\nexport const injectThemes = (lightTheme: any, darkTheme: any) => {\n const lightVars = flattenTheme('', lightTheme)\n const darkVars = flattenTheme('', darkTheme)\n\n // Remove existing theme styles if they exist\n const existingStyle = document.getElementById('theme-css-variables')\n if (existingStyle) {\n existingStyle.remove()\n }\n\n // Create CSS rules instead of inline styles\n const lightRules = Object.entries(lightVars)\n .map(([key, value]) => ` ${key}: ${value};`)\n .join('\\n')\n\n const darkRules = Object.entries(darkVars)\n .map(([key, value]) => ` ${key}: ${value};`)\n .join('\\n')\n\n const css = `\n:root {\n${lightRules}\n}\n\n.dark {\n${darkRules}\n}\n `\n\n // Inject CSS as a style element\n const styleElement = document.createElement('style')\n styleElement.id = 'theme-css-variables'\n styleElement.textContent = css\n document.head.appendChild(styleElement)\n}\n\nexport const getTailwindColors = () => {\n const processPalette = (prefix: string, obj: any): any => {\n const newObj: any = {}\n for (const key in obj) {\n const val = obj[key]\n const newKey = prefix ? `${prefix}-${key}` : key\n if (typeof val === 'string') {\n newObj[key] = `var(--color-${newKey})`\n } else {\n newObj[key] = processPalette(newKey, val)\n }\n }\n return newObj\n }\n\n return processPalette('', lightPalette)\n}\n\nexport const colors = getTailwindColors()\n\n/**\n * Check if running in browser environment\n */\nconst isBrowser = typeof window !== 'undefined'\n\n/**\n * Safe localStorage access with fallback\n */\nconst safeLocalStorage = {\n getItem: (key: string): string | null => {\n try {\n return isBrowser ? localStorage.getItem(key) : null\n } catch {\n return null\n }\n },\n setItem: (key: string, value: string): void => {\n try {\n if (isBrowser) {\n localStorage.setItem(key, value)\n }\n } catch {\n // Silent fail if localStorage is not available\n }\n },\n}\n\n/**\n * Set theme mode\n * @param theme - 'light' or 'dark'\n */\nexport const setThemeMode = (theme: ThemeMode): void => {\n if (!isBrowser) return\n\n try {\n document.documentElement.setAttribute('data-theme', theme)\n\n if (theme === 'dark') {\n document.documentElement.classList.add('dark')\n } else {\n document.documentElement.classList.remove('dark')\n }\n\n safeLocalStorage.setItem('theme-mode', theme)\n } catch (error) {\n console.warn('Failed to set theme mode:', error)\n }\n}\n\nexport const getThemeMode = (): ThemeMode => {\n if (!isBrowser) return 'light'\n\n // Check stored preference\n const stored = safeLocalStorage.getItem('theme-mode')\n if (stored === 'light' || stored === 'dark') {\n return stored\n }\n\n return 'light' // prefering light for now\n // Check system preference\n // try {\n // const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches\n // return prefersDark ? 'dark' : 'light'\n // } catch {\n // return 'light'\n // }\n}\n\n/**\n * Toggle between light and dark themes\n */\nexport const toggleThemeMode = (): ThemeMode => {\n const current = getThemeMode()\n const newTheme: ThemeMode = current === 'light' ? 'dark' : 'light'\n setThemeMode(newTheme)\n return newTheme\n}\n\n/**\n * Initialize theme based on stored preference or system preference\n * Call this once when your app starts\n */\nexport const initializeTheme = (): ThemeMode => {\n const theme = getThemeMode()\n if (isBrowser) {\n try {\n injectThemes(lightPalette, darkPalette)\n setThemeMode(theme)\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Failed to initialize theme:', error)\n }\n }\n return theme\n}\n\n/**\n * Check if current theme is dark mode\n */\nexport const isDarkMode = (): boolean => {\n return getThemeMode() === 'dark'\n}\n"],"names":[],"mappings":";AAIA,MAAM,eAAe,CAAC,QAAgB,QAAqC;AACzE,QAAM,OAA+B,CAAA;AAErC,aAAW,OAAO,KAAK;AACf,UAAA,MAAM,IAAI,GAAG;AACnB,UAAM,SAAS,SAAS,GAAG,MAAM,IAAI,GAAG,KAAK;AAEzC,QAAA,OAAO,QAAQ,UAAU;AACtB,WAAA,WAAW,MAAM,EAAE,IAAI;AAAA,IAAA,OACvB;AACL,a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me/theme.ts"],"sourcesContent":["import { darkPalette, lightPalette } from './colors'\n\nexport type ThemeMode = 'light' | 'dark'\n\nexport type ThemeModePreference = ThemeMode | 'system'\n\nconst flattenTheme = (prefix: string, obj: any): Record<string, string> => {\n const vars: Record<string, string> = {}\n\n for (const key in obj) {\n const val = obj[key]\n const newKey = prefix ? `${prefix}-${key}` : key\n\n if (typeof val === 'string') {\n vars[`--color-${newKey}`] = val\n } else {\n Object.assign(vars, flattenTheme(newKey, val))\n }\n }\n\n return vars\n}\n\nexport const injectThemes = (lightTheme: any, darkTheme: any) => {\n const lightVars = flattenTheme('', lightTheme)\n const darkVars = flattenTheme('', darkTheme)\n\n // Remove existing theme styles if they exist\n const existingStyle = document.getElementById('theme-css-variables')\n if (existingStyle) {\n existingStyle.remove()\n }\n\n // Create CSS rules instead of inline styles\n const lightRules = Object.entries(lightVars)\n .map(([key, value]) => ` ${key}: ${value};`)\n .join('\\n')\n\n const darkRules = Object.entries(darkVars)\n .map(([key, value]) => ` ${key}: ${value};`)\n .join('\\n')\n\n const css = `\n:root {\n${lightRules}\n}\n\n.dark {\n${darkRules}\n}\n `\n\n // Inject CSS as a style element\n const styleElement = document.createElement('style')\n styleElement.id = 'theme-css-variables'\n styleElement.textContent = css\n document.head.appendChild(styleElement)\n}\n\nexport const getTailwindColors = () => {\n const processPalette = (prefix: string, obj: any): any => {\n const newObj: any = {}\n for (const key in obj) {\n const val = obj[key]\n const newKey = prefix ? `${prefix}-${key}` : key\n if (typeof val === 'string') {\n newObj[key] = `var(--color-${newKey})`\n } else {\n newObj[key] = processPalette(newKey, val)\n }\n }\n return newObj\n }\n\n return processPalette('', lightPalette)\n}\n\nexport const colors = getTailwindColors()\n\n/**\n * Check if running in browser environment\n */\nconst isBrowser = typeof window !== 'undefined'\n\n/**\n * Safe localStorage access with fallback\n */\nconst safeLocalStorage = {\n getItem: (key: string): string | null => {\n try {\n return isBrowser ? localStorage.getItem(key) : null\n } catch {\n return null\n }\n },\n setItem: (key: string, value: string): void => {\n try {\n if (isBrowser) {\n localStorage.setItem(key, value)\n }\n } catch {\n // Silent fail if localStorage is not available\n }\n },\n}\n\n/**\n * Set theme mode\n * @param theme - 'light' or 'dark'\n */\nexport const setThemeMode = (theme: ThemeMode): void => {\n if (!isBrowser) return\n\n try {\n document.documentElement.setAttribute('data-theme', theme)\n\n if (theme === 'dark') {\n document.documentElement.classList.add('dark')\n } else {\n document.documentElement.classList.remove('dark')\n }\n\n safeLocalStorage.setItem('theme-mode', theme)\n } catch (error) {\n console.warn('Failed to set theme mode:', error)\n }\n}\n\nexport const getThemeMode = (tenantPrefered: ThemeModePreference = 'system'): ThemeMode => {\n if (!isBrowser) return 'light'\n\n // Check stored preference\n const stored = safeLocalStorage.getItem('theme-mode')\n if (stored === 'light' || stored === 'dark') {\n return stored\n }\n\n if (tenantPrefered === 'light' || tenantPrefered === 'dark') {\n return tenantPrefered\n }\n\n try {\n const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches\n return prefersDark ? 'dark' : 'light'\n } catch {\n return 'light'\n }\n}\n\n/**\n * Toggle between light and dark themes\n */\nexport const toggleThemeMode = (): ThemeMode => {\n const current = getThemeMode()\n const newTheme: ThemeMode = current === 'light' ? 'dark' : 'light'\n setThemeMode(newTheme)\n return newTheme\n}\n\n/**\n * Initialize theme based on stored preference or system preference\n * Call this once when your app starts\n */\nexport const initializeTheme = (tenantPrefered: ThemeModePreference = 'system'): ThemeMode => {\n const theme = getThemeMode(tenantPrefered)\n if (isBrowser) {\n try {\n injectThemes(lightPalette, darkPalette)\n setThemeMode(theme)\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Failed to initialize theme:', error)\n }\n }\n return theme\n}\n\n/**\n * Check if current theme is dark mode\n */\nexport const isDarkMode = (): boolean => {\n return getThemeMode() === 'dark'\n}\n"],"names":[],"mappings":";AAMA,MAAM,eAAe,CAAC,QAAgB,QAAqC;AACzE,QAAM,OAA+B,CAAA;AAErC,aAAW,OAAO,KAAK;AACf,U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AAU,SAAS;AAC3D,eAAa,QAAQ;AACd,SAAA;AACT;AAMa,MAAA,kBAAkB,CAAC,iBAAsC,aAAwB;AACtF,QAAA,QAAQ,aAAa,cAAc;AACzC,MAAI,WAAW;AACT,QAAA;AACF,mBAAa,cAAc,WAAW;AACtC,mBAAa,KAAK;AAAA,aACX,OAAO;AAEN,cAAA,KAAK,+BAA+B,KAAK;AAAA,IACnD;AAAA,EACF;AACO,SAAA;AACT;AAKO,MAAM,aAAa,MAAe;AACvC,SAAO,aAAmB,MAAA;AAC5B;"}
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import type { ThemeMode } from './theme';
2
+ import type { ThemeMode, ThemeModePreference } from './theme';
3
3
  export interface UseThemeReturn {
4
4
  mode: ThemeMode;
5
5
  isDark: boolean;
@@ -8,6 +8,7 @@ export interface UseThemeReturn {
8
8
  }
9
9
  interface ThemeProviderProps {
10
10
  children: ReactNode;
11
+ tenantThemePreference?: ThemeModePreference;
11
12
  }
12
13
  export declare const ThemeProvider: React.FC<ThemeProviderProps>;
13
14
  export declare const useTheme: () => UseThemeReturn;
@@ -3,10 +3,10 @@ import { createContext, useState, useEffect, useCallback, useContext } from "rea
3
3
  import { getThemeMode, initializeTheme, setThemeMode, toggleThemeMode } from "./theme.es.js";
4
4
  import "./colors.es.js";
5
5
  const ThemeContext = createContext(void 0);
6
- const ThemeProvider = ({ children }) => {
7
- const [mode, setModeState] = useState(() => getThemeMode());
6
+ const ThemeProvider = ({ children, tenantThemePreference }) => {
7
+ const [mode, setModeState] = useState(() => getThemeMode(tenantThemePreference));
8
8
  useEffect(() => {
9
- const initialTheme = initializeTheme();
9
+ const initialTheme = initializeTheme(tenantThemePreference);
10
10
  setModeState(initialTheme);
11
11
  }, []);
12
12
  const handleSetTheme = useCallback((newTheme) => {
@@ -1 +1 @@
1
- {"version":3,"file":"useTheme.es.js","sources":["../../../src/components/theme/useTheme.tsx"],"sourcesContent":["import { createContext, ReactNode, useCallback, useContext, useEffect, useState } from 'react'\n\nimport type { ThemeMode } from './theme'\nimport { getThemeMode, initializeTheme, setThemeMode, toggleThemeMode } from './theme'\n\nexport interface UseThemeReturn {\n mode: ThemeMode\n isDark: boolean\n setTheme: (theme: ThemeMode) => void\n toggleTheme: () => void\n}\n\ninterface ThemeProviderProps {\n children: ReactNode\n}\n\n// Create the theme context\nconst ThemeContext = createContext<UseThemeReturn | undefined>(undefined)\n\n// Theme Provider component\nexport const ThemeProvider: React.FC<ThemeProviderProps> = ({ children }) => {\n const [mode, setModeState] = useState<ThemeMode>(() => getThemeMode())\n\n useEffect(() => {\n const initialTheme = initializeTheme()\n setModeState(initialTheme)\n }, [])\n\n const handleSetTheme = useCallback((newTheme: ThemeMode) => {\n setThemeMode(newTheme)\n setModeState(newTheme)\n }, [])\n\n const handleToggleTheme = useCallback(() => {\n const newTheme = toggleThemeMode()\n setModeState(newTheme)\n }, [])\n\n const value: UseThemeReturn = {\n mode,\n isDark: mode === 'dark',\n setTheme: handleSetTheme,\n toggleTheme: handleToggleTheme,\n }\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>\n}\n\n// Hook to use the theme context\nexport const useTheme = (): UseThemeReturn => {\n const context = useContext(ThemeContext)\n\n if (context === undefined) {\n throw new Error('useTheme must be used within a ThemeProvider')\n }\n\n return context\n}\n\nexport default useTheme\n"],"names":[],"mappings":";;;;AAiBA,MAAM,eAAe,cAA0C,MAAS;AAGjE,MAAM,gBAA8C,CAAC,EAAE,eAAe;AAC3E,QAAM,CAAC,MAAM,YAAY,IAAI,SAAoB,MAAM,cAAc;AAErE,YAAU,MAAM;AACd,UAAM,eAAe;AACrB,iBAAa,YAAY;AAAA,EAC3B,GAAG,CAAE,CAAA;AAEC,QAAA,iBAAiB,YAAY,CAAC,aAAwB;AAC1D,iBAAa,QAAQ;AACrB,iBAAa,QAAQ;AAAA,EACvB,GAAG,CAAE,CAAA;AAEC,QAAA,oBAAoB,YAAY,MAAM;AAC1C,UAAM,WAAW;AACjB,iBAAa,QAAQ;AAAA,EACvB,GAAG,CAAE,CAAA;AAEL,QAAM,QAAwB;AAAA,IAC5B;AAAA,IACA,QAAQ,SAAS;AAAA,IACjB,UAAU;AAAA,IACV,aAAa;AAAA,EAAA;AAGf,SAAQ,oBAAA,aAAa,UAAb,EAAsB,OAAe,SAAS,CAAA;AACxD;AAGO,MAAM,WAAW,MAAsB;AACtC,QAAA,UAAU,WAAW,YAAY;AAEvC,MAAI,YAAY,QAAW;AACnB,UAAA,IAAI,MAAM,8CAA8C;AAAA,EAChE;AAEO,SAAA;AACT;"}
1
+ {"version":3,"file":"useTheme.es.js","sources":["../../../src/components/theme/useTheme.tsx"],"sourcesContent":["import { createContext, ReactNode, useCallback, useContext, useEffect, useState } from 'react'\n\nimport type { ThemeMode, ThemeModePreference } from './theme'\nimport { getThemeMode, initializeTheme, setThemeMode, toggleThemeMode } from './theme'\n\nexport interface UseThemeReturn {\n mode: ThemeMode\n isDark: boolean\n setTheme: (theme: ThemeMode) => void\n toggleTheme: () => void\n}\n\ninterface ThemeProviderProps {\n children: ReactNode\n tenantThemePreference?: ThemeModePreference\n}\n\n// Create the theme context\nconst ThemeContext = createContext<UseThemeReturn | undefined>(undefined)\n\n// Theme Provider component\nexport const ThemeProvider: React.FC<ThemeProviderProps> = ({ children, tenantThemePreference }) => {\n const [mode, setModeState] = useState<ThemeMode>(() => getThemeMode(tenantThemePreference))\n\n useEffect(() => {\n const initialTheme = initializeTheme(tenantThemePreference)\n setModeState(initialTheme)\n }, [])\n\n const handleSetTheme = useCallback((newTheme: ThemeMode) => {\n setThemeMode(newTheme)\n setModeState(newTheme)\n }, [])\n\n const handleToggleTheme = useCallback(() => {\n const newTheme = toggleThemeMode()\n setModeState(newTheme)\n }, [])\n\n const value: UseThemeReturn = {\n mode,\n isDark: mode === 'dark',\n setTheme: handleSetTheme,\n toggleTheme: handleToggleTheme,\n }\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>\n}\n\n// Hook to use the theme context\nexport const useTheme = (): UseThemeReturn => {\n const context = useContext(ThemeContext)\n\n if (context === undefined) {\n throw new Error('useTheme must be used within a ThemeProvider')\n }\n\n return context\n}\n\nexport default useTheme\n"],"names":[],"mappings":";;;;AAkBA,MAAM,eAAe,cAA0C,MAAS;AAGjE,MAAM,gBAA8C,CAAC,EAAE,UAAU,4BAA4B;AAC5F,QAAA,CAAC,MAAM,YAAY,IAAI,SAAoB,MAAM,aAAa,qBAAqB,CAAC;AAE1F,YAAU,MAAM;AACR,UAAA,eAAe,gBAAgB,qBAAqB;AAC1D,iBAAa,YAAY;AAAA,EAC3B,GAAG,CAAE,CAAA;AAEC,QAAA,iBAAiB,YAAY,CAAC,aAAwB;AAC1D,iBAAa,QAAQ;AACrB,iBAAa,QAAQ;AAAA,EACvB,GAAG,CAAE,CAAA;AAEC,QAAA,oBAAoB,YAAY,MAAM;AAC1C,UAAM,WAAW;AACjB,iBAAa,QAAQ;AAAA,EACvB,GAAG,CAAE,CAAA;AAEL,QAAM,QAAwB;AAAA,IAC5B;AAAA,IACA,QAAQ,SAAS;AAAA,IACjB,UAAU;AAAA,IACV,aAAa;AAAA,EAAA;AAGf,SAAQ,oBAAA,aAAa,UAAb,EAAsB,OAAe,SAAS,CAAA;AACxD;AAGO,MAAM,WAAW,MAAsB;AACtC,QAAA,UAAU,WAAW,YAAY;AAEvC,MAAI,YAAY,QAAW;AACnB,UAAA,IAAI,MAAM,8CAA8C;AAAA,EAChE;AAEO,SAAA;AACT;"}
@@ -1,10 +1,3 @@
1
- import { Config } from 'tailwindcss/types/config';
2
- import { PluginCreator } from 'tailwindcss/types/config';
3
-
4
- declare const lightColorPlugin: {
5
- handler: PluginCreator;
6
- config?: Partial<Config> | undefined;
7
- };
8
- export default lightColorPlugin;
1
+ export declare const createLightColorPlugin: (plugin: any) => any;
9
2
 
10
3
  export { }
package/dist/theme.d.ts CHANGED
@@ -2,13 +2,13 @@ export declare const colors: any;
2
2
 
3
3
  export declare const getTailwindColors: () => any;
4
4
 
5
- export declare const getThemeMode: () => ThemeMode;
5
+ export declare const getThemeMode: (tenantPrefered?: ThemeModePreference) => ThemeMode;
6
6
 
7
7
  /**
8
8
  * Initialize theme based on stored preference or system preference
9
9
  * Call this once when your app starts
10
10
  */
11
- export declare const initializeTheme: () => ThemeMode;
11
+ export declare const initializeTheme: (tenantPrefered?: ThemeModePreference) => ThemeMode;
12
12
 
13
13
  export declare const injectThemes: (lightTheme: any, darkTheme: any) => void;
14
14
 
@@ -25,6 +25,8 @@ export declare const setThemeMode: (theme: ThemeMode) => void;
25
25
 
26
26
  export declare type ThemeMode = 'light' | 'dark';
27
27
 
28
+ export declare type ThemeModePreference = ThemeMode | 'system';
29
+
28
30
  /**
29
31
  * Toggle between light and dark themes
30
32
  */
@@ -2,10 +2,13 @@ import { ReactNode } from 'react';
2
2
 
3
3
  declare type ThemeMode = 'light' | 'dark';
4
4
 
5
+ declare type ThemeModePreference = ThemeMode | 'system';
6
+
5
7
  export declare const ThemeProvider: React.FC<ThemeProviderProps>;
6
8
 
7
9
  declare interface ThemeProviderProps {
8
10
  children: ReactNode;
11
+ tenantThemePreference?: ThemeModePreference;
9
12
  }
10
13
 
11
14
  declare const useTheme: () => UseThemeReturn;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "tfy-web-components",
4
- "version": "0.0.11",
4
+ "version": "0.0.13",
5
5
  "description": "Truefoundry web components",
6
6
  "author": "Truefoundry",
7
7
  "license": "ISC",