@trackunit/css-tailwind 0.0.11 → 0.0.17

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/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@trackunit/css-tailwind",
3
- "version": "0.0.11",
3
+ "version": "0.0.17",
4
4
  "main": "./index.cjs",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
7
7
  "type": "commonjs",
8
- "types": "./index.d.ts",
8
+ "types": "./src/index.d.ts",
9
9
  "dependencies": {
10
- "@trackunit/ui-design-tokens": "0.0.50"
10
+ "@trackunit/ui-design-tokens": "0.0.51"
11
11
  },
12
12
  "peerDependencies": {}
13
13
  }
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __defProps = Object.defineProperties;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
8
10
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
11
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
12
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -20,6 +22,9 @@ var __spreadValues = (a, b) => {
20
22
  return a;
21
23
  };
22
24
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __commonJS = (cb, mod) => function __require() {
26
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
27
+ };
23
28
  var __export = (target, all) => {
24
29
  for (var name in all)
25
30
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -32,8 +37,75 @@ var __copyProps = (to, from, except, desc) => {
32
37
  }
33
38
  return to;
34
39
  };
40
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
41
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
+ mod
43
+ ));
35
44
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
45
 
46
+ // node_modules/tailwindcss/lib/util/createPlugin.js
47
+ var require_createPlugin = __commonJS({
48
+ "node_modules/tailwindcss/lib/util/createPlugin.js"(exports) {
49
+ "use strict";
50
+ Object.defineProperty(exports, "__esModule", {
51
+ value: true
52
+ });
53
+ Object.defineProperty(exports, "default", {
54
+ enumerable: true,
55
+ get: () => _default
56
+ });
57
+ function createPlugin(plugin3, config) {
58
+ return {
59
+ handler: plugin3,
60
+ config
61
+ };
62
+ }
63
+ createPlugin.withOptions = function(pluginFunction, configFunction = () => ({})) {
64
+ const optionsFunction = function(options) {
65
+ return {
66
+ __options: options,
67
+ handler: pluginFunction(options),
68
+ config: configFunction(options)
69
+ };
70
+ };
71
+ optionsFunction.__isOptionsFunction = true;
72
+ optionsFunction.__pluginFunction = pluginFunction;
73
+ optionsFunction.__configFunction = configFunction;
74
+ return optionsFunction;
75
+ };
76
+ var _default = createPlugin;
77
+ }
78
+ });
79
+
80
+ // node_modules/tailwindcss/lib/public/create-plugin.js
81
+ var require_create_plugin = __commonJS({
82
+ "node_modules/tailwindcss/lib/public/create-plugin.js"(exports) {
83
+ "use strict";
84
+ Object.defineProperty(exports, "__esModule", {
85
+ value: true
86
+ });
87
+ Object.defineProperty(exports, "default", {
88
+ enumerable: true,
89
+ get: () => _default
90
+ });
91
+ var _createPlugin = /* @__PURE__ */ _interopRequireDefault(require_createPlugin());
92
+ function _interopRequireDefault(obj) {
93
+ return obj && obj.__esModule ? obj : {
94
+ default: obj
95
+ };
96
+ }
97
+ var _default = _createPlugin.default;
98
+ }
99
+ });
100
+
101
+ // node_modules/tailwindcss/plugin.js
102
+ var require_plugin = __commonJS({
103
+ "node_modules/tailwindcss/plugin.js"(exports, module2) {
104
+ var createPlugin = require_create_plugin();
105
+ module2.exports = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default;
106
+ }
107
+ });
108
+
37
109
  // libs/css/tailwind/src/lib/tailwind-base.ts
38
110
  var tailwind_base_exports = {};
39
111
  __export(tailwind_base_exports, {
@@ -41,6 +113,115 @@ __export(tailwind_base_exports, {
41
113
  });
42
114
  module.exports = __toCommonJS(tailwind_base_exports);
43
115
 
116
+ // libs/css/tailwind-custom-properties-plugin/src/plugin.ts
117
+ var import_plugin = __toESM(require_plugin());
118
+
119
+ // libs/css/tailwind-custom-properties-plugin/src/variablesToCSSRules.ts
120
+ var keysToCssVariableName = (keys) => `--${keys.join("-")}`.replace(/[^a-zA-Z0-9]/g, "-");
121
+ var flattenVariablesDeclerationValues = (values, output = {}, keys = []) => {
122
+ for (const [key, value] of Object.entries(values)) {
123
+ let flattend = {};
124
+ if (typeof value === "object") {
125
+ flattend = flattenVariablesDeclerationValues(value, output, [...keys, key]);
126
+ } else {
127
+ flattend[keysToCssVariableName([...keys, key])] = value;
128
+ }
129
+ output = __spreadValues(__spreadValues({}, flattend), output);
130
+ }
131
+ return output;
132
+ };
133
+ var variablesToCSSRules = (variablesDecleration) => {
134
+ if (!variablesDecleration) {
135
+ return [];
136
+ }
137
+ const cssRules = Object.entries(variablesDecleration).map(([key, value]) => ({
138
+ [key === "DEFAULT" ? ":root" : `.${key}`]: flattenVariablesDeclerationValues(value)
139
+ }));
140
+ return cssRules;
141
+ };
142
+
143
+ // libs/css/tailwind-custom-properties-plugin/src/plugin.ts
144
+ var CssTailwindCustomPropertiesPlugin = (0, import_plugin.default)(({ addBase, theme }) => {
145
+ const variablesDeclerationFromThemeConfig = theme("variables", {});
146
+ const cssRules = variablesToCSSRules(variablesDeclerationFromThemeConfig);
147
+ addBase(cssRules);
148
+ });
149
+
150
+ // libs/css/component-tokens/src/plugin.ts
151
+ var import_plugin2 = __toESM(require_plugin());
152
+
153
+ // libs/css/component-tokens/src/component-tokens/ComponentTokenDefinition.ts
154
+ var AsComponentTokenDefinition = (designTokens) => designTokens;
155
+
156
+ // libs/css/component-tokens/src/component-tokens/components/Card.tokens.ts
157
+ var CardTokenDefinition = AsComponentTokenDefinition({
158
+ DEFAULT: {
159
+ border: { borderColor: "rgb(var(--color-slate-200))", borderRadius: "var(--border-radius-DEFAULT)" },
160
+ shadow: { boxShadow: "var(--box-shadow-DEFAULT)" }
161
+ },
162
+ "theme-marketing": {
163
+ border: { borderColor: "rgba(0, 0, 0, 0)", borderRadius: "2rem" },
164
+ shadow: { boxShadow: "0px 20px 48px rgba(73, 55, 54, 0.1)" }
165
+ }
166
+ });
167
+
168
+ // libs/css/component-tokens/src/component-tokens/ComponentTokens.ts
169
+ var componentTokenDefinitions = {
170
+ card: CardTokenDefinition
171
+ };
172
+
173
+ // libs/css/component-tokens/src/component-tokens/ComponentTokenVariablesByThemeName.ts
174
+ var getComponentTokenVariablesByThemeName = (theme, componentTokenDefinitions2) => {
175
+ const themeTokenObject = Object.fromEntries(
176
+ Object.entries(componentTokenDefinitions2).map(([componentName, componentThemes]) => [
177
+ componentName,
178
+ componentThemes[theme]
179
+ ])
180
+ );
181
+ return themeTokenObject;
182
+ };
183
+
184
+ // libs/css/component-tokens/src/component-tokens/pluginUtilityFunctions.ts
185
+ var PREFIX = "component";
186
+ var componentTokenAsCssVariableString = (component, token, cssProperty) => `var(--${PREFIX}-${component}-${token}-${cssProperty})`;
187
+ var componentTokenToCSSProperties = (component, token, tokenObject) => {
188
+ return Object.fromEntries(
189
+ Object.keys(tokenObject).map((key) => [
190
+ key,
191
+ componentTokenAsCssVariableString(component, token, key)
192
+ ])
193
+ );
194
+ };
195
+ var getAllComponentTokenRules = (componentDefinitions) => {
196
+ const components = {};
197
+ Object.entries(componentDefinitions).forEach(
198
+ ([componentName, themes]) => Object.entries(themes.DEFAULT).forEach(([tokenName, value]) => {
199
+ const typedComponentName = componentName;
200
+ const typedTokenName = tokenName;
201
+ const selector = `.${PREFIX}-${typedComponentName}-${typedTokenName}`;
202
+ components[selector] = componentTokenToCSSProperties(typedComponentName, typedTokenName, value);
203
+ })
204
+ );
205
+ return components;
206
+ };
207
+
208
+ // libs/css/component-tokens/src/plugin.ts
209
+ var cssVariablesDefinition = variablesToCSSRules({
210
+ DEFAULT: {
211
+ component: getComponentTokenVariablesByThemeName("DEFAULT", componentTokenDefinitions)
212
+ },
213
+ "theme-marketing": {
214
+ component: getComponentTokenVariablesByThemeName("theme-marketing", componentTokenDefinitions)
215
+ }
216
+ });
217
+ var ComponentTokensPlugin = (0, import_plugin2.default)(function({ addComponents }) {
218
+ addComponents(cssVariablesDefinition);
219
+ addComponents(getAllComponentTokenRules(componentTokenDefinitions));
220
+ });
221
+
222
+ // libs/css/component-tokens/src/index.ts
223
+ var src_default = ComponentTokensPlugin;
224
+
44
225
  // libs/ui/design-tokens/src/tokens/colors/tailwindPalette.ts
45
226
  var tailwindPalette = {
46
227
  slate: {
@@ -629,7 +810,8 @@ var tailwindBaseConfig = {
629
810
  toast: withCustomPropertyValueAsComment("--z-toast")
630
811
  }
631
812
  })
632
- }
813
+ },
814
+ plugins: [CssTailwindCustomPropertiesPlugin, src_default]
633
815
  };
634
816
  var tailwind_base_default = tailwindBaseConfig;
635
817
  // Annotate the CommonJS export names for ESM import in node: