@g4rcez/components 0.0.7 → 0.0.8

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,22 +1,13 @@
1
1
  {
2
2
  "name": "@g4rcez/components",
3
- "version": "0.0.7",
4
- "scripts": {
5
- "build": "vite build; npm run lib:types; npm run preset; npm run lib:css",
6
- "dev": "next dev",
7
- "format": "npx prettier --write .",
8
- "lib:css": "tailwind -i ./src/index.css -o ./dist/index.css --minify",
9
- "lib:tailwind": "tsc -p tsconfig.tailwind.json",
10
- "lib:types": "tsc -p tsconfig.lib.json",
11
- "lint": "next lint",
12
- "preset": "tsc -p tsconfig.tailwind.json"
13
- },
3
+ "version": "0.0.8",
14
4
  "sideEffects": false,
15
5
  "source": "./src/index.ts",
16
6
  "types": "./dist/inmjs.d.ts",
17
7
  "main": "./dist/index.umd.js",
18
8
  "browser": "./dist/index.umd.js",
19
9
  "module": "./dist/index.cjs",
10
+ "packageManager": "pnpm@8.15.3",
20
11
  "exports": {
21
12
  ".": {
22
13
  "types": {
@@ -43,6 +34,16 @@
43
34
  "dist",
44
35
  "dist/index.css"
45
36
  ],
37
+ "scripts": {
38
+ "build": "vite build; npm run lib:types; npm run preset; npm run lib:css",
39
+ "dev": "next dev",
40
+ "format": "npx prettier --write .",
41
+ "lib:css": "tailwind -i ./src/index.css -o ./dist/index.css --minify",
42
+ "lib:tailwind": "tsc -p tsconfig.tailwind.json",
43
+ "lib:types": "tsc -p tsconfig.lib.json",
44
+ "lint": "next lint",
45
+ "preset": "tsc -p tsconfig.tailwind.json"
46
+ },
46
47
  "publishConfig": {
47
48
  "directory": "dist"
48
49
  },
@@ -1,15 +0,0 @@
1
- export * from "./form/autocomplete";
2
- export * from "./form/input";
3
- export * from "./form/select";
4
- export * from "./form/file-upload";
5
- export * from "./form/form";
6
- export * from "./form/select";
7
- export * from "./form/switch";
8
- export * from "./form/input-field";
9
- export * from "./core/button";
10
- export * from "./core/polymorph";
11
- export * from "./display/card";
12
- export * from "./floating/dropdown";
13
- export * from "./floating/tooltip";
14
- export * from "./table/index";
15
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
@@ -1,14 +0,0 @@
1
- export * from "./form/autocomplete";
2
- export * from "./form/input";
3
- export * from "./form/select";
4
- export * from "./form/file-upload";
5
- export * from "./form/form";
6
- export * from "./form/select";
7
- export * from "./form/switch";
8
- export * from "./form/input-field";
9
- export * from "./core/button";
10
- export * from "./core/polymorph";
11
- export * from "./display/card";
12
- export * from "./floating/dropdown";
13
- export * from "./floating/tooltip";
14
- export * from "./table/index";
@@ -1,28 +0,0 @@
1
- import React from "react";
2
- import { AllPaths } from "sidekicker";
3
- import { z } from "zod";
4
- import { InputProps } from "~/components/form/input";
5
- import { SelectProps } from "~/components/form/select";
6
- export declare const formToJson: (form: HTMLFormElement) => any;
7
- export declare const convertPath: (path: string) => string[];
8
- export declare const getSchemaShape: <T extends z.ZodObject<any>>(name: string, schema: T) => T;
9
- type CustomOnInvalid = (args: {
10
- form: HTMLFormElement;
11
- errors: Record<string, string>;
12
- }) => any;
13
- type CustomOnSubmit<T> = (args: {
14
- json: T;
15
- form: HTMLFormElement;
16
- reset: () => void;
17
- event: React.FormEvent<HTMLFormElement>;
18
- }) => any;
19
- export declare const useForm: <T extends z.ZodObject<any>>(schema: T) => {
20
- input: <Props extends InputProps>(name: AllPaths<z.infer<T>>, props?: Props) => Props;
21
- select: <Props extends SelectProps>(name: AllPaths<z.infer<T>>, props?: Props) => Props;
22
- onSubmit: (exec: CustomOnSubmit<z.infer<T>>) => (event: React.FormEvent<HTMLFormElement>) => void;
23
- errors: Record<string, string | undefined> | null;
24
- onInvalid: (exec?: CustomOnInvalid) => (event: React.FormEvent<HTMLFormElement>) => void;
25
- disabled: boolean;
26
- };
27
- export {};
28
- //# sourceMappingURL=use-form.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-form.ts"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAe,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,CAAC,EAAuB,MAAM,KAAK,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAiBvD,eAAO,MAAM,UAAU,SAAU,eAAe,KAAG,GAIlD,CAAC;AAEF,eAAO,MAAM,WAAW,SAAU,MAAM,aAAuD,CAAC;AAEhG,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,MAAM,UAAU,CAAC,MAKpE,CAAC;AAQf,KAAK,eAAe,GAAG,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,KAAK,GAAG,CAAC;AAEhG,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,IAAI,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,CAAA;CAAE,KAAK,GAAG,CAAC;AAEvI,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;YAkB1C,KAAK,SAAS,UAAU,QAAQ,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,KAAG,KAAK;aAd1E,KAAK,SAAS,WAAW,QAAQ,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,KAAG,KAAK;qBAkFjF,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC;;uBAnBtE,eAAe,aAAa,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC;;CAuC3E,CAAC"}
@@ -1,153 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- import { parse } from "qs";
24
- import { useCallback, useEffect, useRef, useState } from "react";
25
- import { Is, setPath } from "sidekicker";
26
- import { ZodArray, ZodNumber } from "zod";
27
- import { formReset } from "~/components/form/form";
28
- var sort = function (a, b) { return a.localeCompare(b); };
29
- var options = {
30
- sort: sort,
31
- allowDots: true,
32
- charset: "utf-8",
33
- parseArrays: true,
34
- plainObjects: true,
35
- charsetSentinel: true,
36
- allowPrototypes: false,
37
- depth: Number.MAX_SAFE_INTEGER,
38
- arrayLimit: Number.MAX_SAFE_INTEGER,
39
- parameterLimit: Number.MAX_SAFE_INTEGER,
40
- };
41
- export var formToJson = function (form) {
42
- var formData = new FormData(form);
43
- var urlSearchParams = new URLSearchParams(formData);
44
- return parse(urlSearchParams.toString(), options);
45
- };
46
- export var convertPath = function (path) { return path.replace("[", ".").replace("]", "").split("."); };
47
- export var getSchemaShape = function (name, schema) {
48
- return convertPath(name).reduce(function (acc, el) {
49
- var _a;
50
- if (el === "")
51
- return acc;
52
- var shape = ((_a = acc.shape) === null || _a === void 0 ? void 0 : _a[el]) || acc;
53
- return shape instanceof ZodArray ? shape.element : shape;
54
- }, schema);
55
- };
56
- var getValueByType = function (e) {
57
- if (e.type === "checkbox")
58
- return e.checked;
59
- if (e.type === "number")
60
- return e.valueAsNumber;
61
- return e.value;
62
- };
63
- export var useForm = function (schema) {
64
- var _a = useState(null), errors = _a[0], setErrors = _a[1];
65
- var ref = useRef({});
66
- var select = function (name, props) {
67
- var validator = getSchemaShape(name, schema);
68
- return __assign(__assign({}, props), { name: name, id: name, error: errors === null || errors === void 0 ? void 0 : errors[name], ref: function (e) {
69
- if (e === null)
70
- return;
71
- ref.current[name] = { element: e, schema: validator };
72
- } });
73
- };
74
- var input = function (name, props) {
75
- var _a;
76
- var validator = getSchemaShape(name, schema);
77
- return __assign(__assign({}, props), { name: name, id: name, type: Is.instance(validator, ZodNumber) ? "number" : (_a = props === null || props === void 0 ? void 0 : props.type) !== null && _a !== void 0 ? _a : "text", error: errors === null || errors === void 0 ? void 0 : errors[name], ref: function (e) {
78
- if (e === null)
79
- return;
80
- ref.current[name] = { element: e, schema: validator };
81
- } });
82
- };
83
- useEffect(function () {
84
- var events = Object.values(ref.current).map(function (input) {
85
- var validation = input.schema.safeParse(getValueByType(input.element));
86
- var onBlurField = function (e) {
87
- var validation = input.schema.safeParse(getValueByType(e.target));
88
- var html = input.element;
89
- var name = html.name;
90
- if (validation.success) {
91
- html.setCustomValidity("");
92
- return setErrors(function (prev) {
93
- var _a = prev || {}, _b = name, removed = _a[_b], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
94
- return rest === null || Is.empty(rest) ? null : rest;
95
- });
96
- }
97
- if (html.required) {
98
- var errorMessage_1 = validation.error.issues[0].message;
99
- html.setCustomValidity(errorMessage_1);
100
- setErrors(function (prev) {
101
- var _a;
102
- return (__assign(__assign({}, prev), (_a = {}, _a[name] = errorMessage_1, _a)));
103
- });
104
- }
105
- };
106
- var event = input.element.tagName === "INPUT" ? "blur" : "change";
107
- input.element.addEventListener(event, onBlurField);
108
- return {
109
- input: input,
110
- hasInitialError: input.element.required ? !validation.success : false,
111
- unsubscribe: function () { return input.element.removeEventListener(event, onBlurField); },
112
- };
113
- });
114
- var hasErrors = events.some(function (x) { return x.hasInitialError; });
115
- if (hasErrors)
116
- setErrors(function (prev) { return (prev === null ? {} : prev); });
117
- return function () { return events.forEach(function (item) { return item.unsubscribe(); }); };
118
- });
119
- var onInvalid = useCallback(function (exec) { return function (event) {
120
- event.preventDefault();
121
- var form = event.currentTarget;
122
- var validationErrors = Object.values(ref.current).reduce(function (acc, input) {
123
- var _a;
124
- var field = input.element;
125
- var validation = input.schema.safeParse(getValueByType(field));
126
- if (validation.success)
127
- return acc;
128
- var errorMessage = validation.error.issues[0].message;
129
- field.setAttribute("data-initialized", "true");
130
- return __assign(__assign({}, acc), (_a = {}, _a[field.name] = errorMessage, _a));
131
- }, {});
132
- var e = Is.empty(validationErrors) ? null : {};
133
- setErrors(e);
134
- exec === null || exec === void 0 ? void 0 : exec({ form: form, errors: e || {} });
135
- }; }, []);
136
- var onSubmit = useCallback(function (exec) { return function (event) {
137
- event.preventDefault();
138
- var form = event.currentTarget;
139
- var json = formToJson(form);
140
- Array.from(form.elements).forEach(function (field) {
141
- if (field.tagName === "SELECT") {
142
- var input_1 = field;
143
- json = setPath(json, input_1.name, input_1.value);
144
- }
145
- if (field.tagName === "INPUT") {
146
- var input_2 = field;
147
- json = setPath(json, input_2.name, getValueByType(input_2));
148
- }
149
- });
150
- exec({ form: form, json: json, event: event, reset: function () { return formReset(form); } });
151
- }; }, []);
152
- return { input: input, select: select, onSubmit: onSubmit, errors: errors, onInvalid: onInvalid, disabled: errors !== null };
153
- };
@@ -1,2 +0,0 @@
1
- export declare const usePrevious: <T>(value: T) => T;
2
- //# sourceMappingURL=use-previous.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-previous.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-previous.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,CAAC,KAAG,CAMzC,CAAC"}
@@ -1,8 +0,0 @@
1
- import { useEffect, useRef } from "react";
2
- export var usePrevious = function (value) {
3
- var ref = useRef();
4
- useEffect(function () {
5
- ref.current = value;
6
- }, [value]);
7
- return ref.current;
8
- };
@@ -1,2 +0,0 @@
1
- export declare const useReactive: <T extends unknown>(t: T, initial?: T) => readonly [T, import("react").Dispatch<import("react").SetStateAction<T>>];
2
- //# sourceMappingURL=use-reactive.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-reactive.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-reactive.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,OAAO,KAAK,CAAC,YAAY,CAAC,8EAM/D,CAAC"}
@@ -1,8 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- export var useReactive = function (t, initial) {
3
- var _a = useState(function () { return (initial ? initial : t); }), state = _a[0], setState = _a[1];
4
- useEffect(function () {
5
- setState(t);
6
- }, [t]);
7
- return [state, setState];
8
- };
@@ -1,9 +0,0 @@
1
- export * from "./components";
2
- export * from "./hooks/use-form";
3
- export * from "./hooks/use-previous";
4
- export * from "./hooks/use-reactive";
5
- export * from "./lib/dom";
6
- export * from "./lib/fns";
7
- export * from "./styles/dark";
8
- export * from "./styles/design-tokens";
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC"}
@@ -1,8 +0,0 @@
1
- export * from "./components";
2
- export * from "./hooks/use-form";
3
- export * from "./hooks/use-previous";
4
- export * from "./hooks/use-reactive";
5
- export * from "./lib/dom";
6
- export * from "./lib/fns";
7
- export * from "./styles/dark";
8
- export * from "./styles/design-tokens";
@@ -1,6 +0,0 @@
1
- import { ClassValue } from "clsx";
2
- import React, { LegacyRef, MutableRefObject, RefCallback } from "react";
3
- export declare const mergeRefs: <T extends unknown = any>(...refs: Array<MutableRefObject<T> | LegacyRef<T> | undefined | null>) => RefCallback<T>;
4
- export declare const isReactComponent: (a: any) => a is React.FC;
5
- export declare const css: (...styles: ClassValue[]) => string;
6
- //# sourceMappingURL=dom.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../../src/lib/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAC;AAExC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAExE,eAAO,MAAM,SAAS,GACjB,CAAC,iCAA6B,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,KAAG,WAAW,CAAC,CAAC,CAS1G,CAAC;AAEN,eAAO,MAAM,gBAAgB,MAAO,GAAG,KAAG,CAAC,IAAI,KAAK,CAAC,EAQpD,CAAC;AAEF,eAAO,MAAM,GAAG,cAAe,UAAU,EAAE,WAA0B,CAAC"}
@@ -1,34 +0,0 @@
1
- import { clsx } from "clsx";
2
- import { twMerge } from "tailwind-merge";
3
- export var mergeRefs = function () {
4
- var refs = [];
5
- for (var _i = 0; _i < arguments.length; _i++) {
6
- refs[_i] = arguments[_i];
7
- }
8
- return function (value) {
9
- refs.forEach(function (ref) {
10
- if (typeof ref === "function") {
11
- ref(value);
12
- }
13
- else if (ref !== null) {
14
- ref.current = value;
15
- }
16
- });
17
- };
18
- };
19
- export var isReactComponent = function (a) {
20
- if (a.$$typeof === Symbol.for("react.forward_ref")) {
21
- return true;
22
- }
23
- if (a.$$typeof === Symbol.for("react.fragment")) {
24
- return true;
25
- }
26
- return a.$$typeof === Symbol.for("react.element");
27
- };
28
- export var css = function () {
29
- var styles = [];
30
- for (var _i = 0; _i < arguments.length; _i++) {
31
- styles[_i] = arguments[_i];
32
- }
33
- return twMerge(clsx(styles));
34
- };
@@ -1,5 +0,0 @@
1
- import { AllPaths } from "sidekicker";
2
- export declare const uuid: () => string;
3
- export declare const path: <T extends {}, K extends AllPaths<T>>(obj: T, path: K) => any;
4
- export declare const isSsr: () => boolean;
5
- //# sourceMappingURL=fns.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fns.d.ts","sourceRoot":"","sources":["../../../../src/lib/fns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,eAAO,MAAM,IAAI,QAAO,MAKlB,CAAC;AAUP,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,QAGxE,CAAC;AAEF,eAAO,MAAM,KAAK,eAAsC,CAAC"}
@@ -1,19 +0,0 @@
1
- export var uuid = function () {
2
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
3
- var r = (Math.random() * 16) | 0;
4
- var v = c == "x" ? r : (r & 0x3) | 0x8;
5
- return v.toString(16);
6
- });
7
- };
8
- var travel = function (path, regexp, obj) {
9
- return path
10
- .split(regexp)
11
- .filter(Boolean)
12
- .reduce(function (res, key) { return (res !== null && res !== undefined ? res[key] : res); }, obj);
13
- };
14
- var regexPaths = { basic: /[,[\]]+?/, extend: /[,[\].]+?/ };
15
- export var path = function (obj, path) {
16
- var result = travel(path, regexPaths.basic, obj) || travel(path, regexPaths.extend, obj);
17
- return result === undefined || result === obj ? undefined : result;
18
- };
19
- export var isSsr = function () { return typeof window === 'undefined'; };
@@ -1,67 +0,0 @@
1
- export declare const Theme: {
2
- name: string;
3
- spacing: {
4
- base: string;
5
- lg: string;
6
- sm: string;
7
- };
8
- colors: {
9
- foreground: string;
10
- background: string;
11
- accent: string;
12
- disabled: string;
13
- primary: {
14
- foreground: string;
15
- DEFAULT: string;
16
- subtle: string;
17
- hover: string;
18
- };
19
- secondary: {
20
- DEFAULT: string;
21
- subtle: string;
22
- hover: string;
23
- };
24
- info: {
25
- DEFAULT: string;
26
- subtle: string;
27
- hover: string;
28
- };
29
- danger: {
30
- DEFAULT: string;
31
- subtle: string;
32
- hover: string;
33
- };
34
- success: {
35
- DEFAULT: string;
36
- subtle: string;
37
- hover: string;
38
- };
39
- input: {
40
- border: string;
41
- placeholder: string;
42
- "mask-error": string;
43
- "switch-bg": string;
44
- switch: string;
45
- };
46
- card: {
47
- background: string;
48
- border: string;
49
- overlay: string;
50
- };
51
- floating: {
52
- background: string;
53
- border: string;
54
- overlay: string;
55
- };
56
- tooltip: {
57
- background: string;
58
- border: string;
59
- };
60
- table: {
61
- background: string;
62
- border: string;
63
- row: string;
64
- };
65
- };
66
- };
67
- //# sourceMappingURL=dark.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dark.d.ts","sourceRoot":"","sources":["../../../../src/styles/dark.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiEjB,CAAC"}
@@ -1,66 +0,0 @@
1
- export var Theme = {
2
- name: "dark",
3
- spacing: {
4
- base: "1rem",
5
- lg: "1.5rem",
6
- sm: "0.75rem",
7
- },
8
- colors: {
9
- foreground: "#f8fafc",
10
- background: "#191817",
11
- accent: "#0ea5e9",
12
- disabled: "#52525b",
13
- primary: {
14
- foreground: "#f8fafc",
15
- DEFAULT: "#0ea5e9",
16
- subtle: "#bae6fd",
17
- hover: "#0284c7",
18
- },
19
- secondary: {
20
- DEFAULT: "#475569",
21
- subtle: "#cbd5e1",
22
- hover: "#334155",
23
- },
24
- info: {
25
- DEFAULT: "#3b82f6",
26
- subtle: "#93c5fd",
27
- hover: "#1d4ed8",
28
- },
29
- danger: {
30
- DEFAULT: "#ef4444",
31
- subtle: "#fca5a5",
32
- hover: "#dc2626",
33
- },
34
- success: {
35
- DEFAULT: "#10b981",
36
- subtle: "#6ee7b7",
37
- hover: "#047857",
38
- },
39
- input: {
40
- border: "#52525b",
41
- placeholder: "#94a3b8",
42
- "mask-error": "#fca5a5",
43
- "switch-bg": "#171717",
44
- switch: "#fff",
45
- },
46
- card: {
47
- background: "#27272a",
48
- border: "#3f3f46",
49
- overlay: "#00000080",
50
- },
51
- floating: {
52
- background: "#252525",
53
- border: "#3f3f46",
54
- overlay: "#00000080",
55
- },
56
- tooltip: {
57
- background: "#141414",
58
- border: "#27272a",
59
- },
60
- table: {
61
- background: "#27272a",
62
- border: "#52525b",
63
- row: "#3f3f46",
64
- },
65
- },
66
- };
@@ -1,32 +0,0 @@
1
- declare module "src/styles/design-tokens" {
2
- type DesignTokens = {
3
- [K in string]: string | DesignTokens;
4
- };
5
- type Token = {
6
- key: string;
7
- value: string;
8
- };
9
- type DesignTokensParser = (value: string, key: string, combine: string) => string;
10
- type DesignTokensBuilder = (value: string, key: string, combine: string) => Token;
11
- export const parsers: {
12
- cssVariable: (_: string, __: string, k: string) => string;
13
- rgba: (value: string) => string;
14
- rgb: (value: string) => string;
15
- hsl: (value: string) => string;
16
- hsla: (value: string) => string;
17
- hex: (value: string) => string;
18
- raw: (value: string) => string;
19
- };
20
- export const reduceTokens: <T extends DesignTokens>(colors: T, parse: DesignTokensBuilder, prefix?: string, append?: string) => Token[];
21
- export const createDesignTokens: <T extends DesignTokens>(colors: T, parse: DesignTokensParser, prefix?: string, append?: string) => T;
22
- export const createStyles: {
23
- default: (tokens: Token[]) => string;
24
- dark: (tokens: Token[]) => string;
25
- };
26
- }
27
- declare module "preset.tailwind" {
28
- import { Config } from "tailwindcss";
29
- const config: Partial<Config>;
30
- export default config;
31
- }
32
- //# sourceMappingURL=preset.tailwind.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"preset.tailwind.d.ts","sourceRoot":"","sources":["../src/styles/design-tokens.ts","../preset.tailwind.ts"],"names":[],"mappings":";IAAA,KAAK,YAAY,GAAG;SACf,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,YAAY;KACvC,CAAC;IAEF,KAAK,KAAK,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAE5C,KAAK,kBAAkB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAElF,KAAK,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,KAAK,CAAC;IAElF,MAAM,CAAC,MAAM,OAAO;;;;;;;;KAQ0B,CAAC;IAE/C,MAAM,CAAC,MAAM,YAAY,GAAI,CAAC,SAAS,YAAY,UAAU,CAAC,SAAS,mBAAmB,WAAU,MAAM,WAAe,MAAM,KAAQ,KAAK,EAQlI,CAAC;IAEX,MAAM,CAAC,MAAM,kBAAkB,GAAI,CAAC,SAAS,YAAY,UAAU,CAAC,SAAS,kBAAkB,WAAU,MAAM,WAAe,MAAM,KAAQ,CAW7H,CAAC;IAYhB,MAAM,CAAC,MAAM,YAAY;0BACH,KAAK,EAAE;uBACV,KAAK,EAAE;KACzB,CAAC;;;ICxDF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;IASrC,MAAM,MAAM,EAAE,OAAO,CAAC,MAAM,CA8B3B,CAAC;IAEF,eAAe,MAAM,CAAC"}
@@ -1,167 +0,0 @@
1
- System.register("src/styles/design-tokens", [], function (exports_1, context_1) {
2
- "use strict";
3
- var parsers, reduceTokens, createDesignTokens, modifiers, createStyleContent, createStyles;
4
- var __moduleName = context_1 && context_1.id;
5
- return {
6
- setters: [],
7
- execute: function () {
8
- exports_1("parsers", parsers = {
9
- cssVariable: (_, __, k) => `var(--${k})`,
10
- rgba: (value) => `rgba(${value})`,
11
- rgb: (value) => `rgb(${value})`,
12
- hsl: (value) => `hsl(${value})`,
13
- hsla: (value) => `hsla(${value})`,
14
- hex: (value) => value,
15
- raw: (value) => value,
16
- });
17
- exports_1("reduceTokens", reduceTokens = (colors, parse, prefix = "", append = "") => Object.entries(colors).reduce((acc, [key, value]) => {
18
- const combine = append === "" ? `${prefix}${key}` : `${append}-${key}`;
19
- if (typeof value === "string") {
20
- const k = append === "" ? `${prefix}${key}` : key;
21
- return acc.concat(parse(value, k, combine));
22
- }
23
- return acc.concat(reduceTokens(value, parse, prefix, combine));
24
- }, []));
25
- exports_1("createDesignTokens", createDesignTokens = (colors, parse, prefix = "", append = "") => Object.entries(colors).reduce((acc, [key, value]) => {
26
- const combine = append === "" ? `${prefix}${key}` : `${append}-${key}`;
27
- if (typeof value === "string") {
28
- const k = append === "" ? `${prefix}${key}` : key;
29
- return Object.assign(Object.assign({}, acc), { [k]: parse(value, key, combine) });
30
- }
31
- return Object.assign(Object.assign({}, acc), { [key]: createDesignTokens(value, parse, prefix, combine) });
32
- }, {}));
33
- modifiers = {
34
- default: (variables) => `:root { ${variables} }`,
35
- dark: (variables) => `html.dark {${variables}}`,
36
- };
37
- createStyleContent = (tokens, modifier) => {
38
- const content = tokens.map((token) => `${token.key}: ${token.value}`).join(";");
39
- return modifier(content);
40
- };
41
- exports_1("createStyles", createStyles = {
42
- default: (tokens) => createStyleContent(tokens, modifiers.default),
43
- dark: (tokens) => createStyleContent(tokens, modifiers.dark),
44
- });
45
- }
46
- };
47
- });
48
- {
49
- "name": "dark",
50
- "spacing": {
51
- "base": "1rem",
52
- "lg": "1.5rem",
53
- "sm": "0.75rem"
54
- },
55
- "colors": {
56
- "foreground": "#f8fafc",
57
- "background": "#191817",
58
- "accent": "#0ea5e9",
59
- "disabled": "#52525b",
60
- "primary": {
61
- "foreground": "#f8fafc",
62
- "DEFAULT": "#0ea5e9",
63
- "subtle": "#bae6fd",
64
- "hover": "#0284c7"
65
- },
66
- "secondary": {
67
- "DEFAULT": "#475569",
68
- "subtle": "#cbd5e1",
69
- "hover": "#334155"
70
- },
71
- "info": {
72
- "DEFAULT": "#3b82f6",
73
- "subtle": "#93c5fd",
74
- "hover": "#1d4ed8"
75
- },
76
- "danger": {
77
- "DEFAULT": "#ef4444",
78
- "subtle": "#fca5a5",
79
- "hover": "#dc2626"
80
- },
81
- "success": {
82
- "DEFAULT": "#10b981",
83
- "subtle": "#6ee7b7",
84
- "hover": "#047857"
85
- },
86
- "input": {
87
- "border": "#52525b",
88
- "placeholder": "#94a3b8",
89
- "mask-error": "#fca5a5",
90
- "switch-bg": "#171717",
91
- "switch": "#fff"
92
- },
93
- "card": {
94
- "background": "#27272a",
95
- "border": "#3f3f46",
96
- "overlay": "#00000080"
97
- },
98
- "floating": {
99
- "background": "#252525",
100
- "border": "#3f3f46",
101
- "overlay": "#00000080"
102
- },
103
- "tooltip": {
104
- "background": "#141414",
105
- "border": "#27272a"
106
- },
107
- "table": {
108
- "background": "#27272a",
109
- "border": "#52525b",
110
- "row": "#3f3f46"
111
- }
112
- }
113
- }
114
- System.register("preset.tailwind", ["tailwindcss/plugin", "src/styles/dark", "src/styles/design-tokens"], function (exports_2, context_2) {
115
- "use strict";
116
- var plugin_1, dark_json_1, design_tokens_1, COLORS, css, config;
117
- var __moduleName = context_2 && context_2.id;
118
- return {
119
- setters: [
120
- function (plugin_1_1) {
121
- plugin_1 = plugin_1_1;
122
- },
123
- function (dark_json_1_1) {
124
- dark_json_1 = dark_json_1_1;
125
- },
126
- function (design_tokens_1_1) {
127
- design_tokens_1 = design_tokens_1_1;
128
- }
129
- ],
130
- execute: function () {
131
- COLORS = design_tokens_1.createDesignTokens(dark_json_1.default.colors, design_tokens_1.parsers.cssVariable);
132
- css = String.raw;
133
- config = {
134
- theme: {
135
- transitionTimingFunction: { DEFAULT: "cubic-bezier(1,.43,.36,.67)" },
136
- transitionDuration: { DEFAULT: "375ms" },
137
- extend: {
138
- fill: COLORS,
139
- colors: COLORS,
140
- borderColors: COLORS,
141
- placeholderColor: COLORS,
142
- zIndex: {
143
- floating: "10",
144
- },
145
- boxShadow: {
146
- floating: "rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.2) 0px 3px 6px, rgba(15, 15, 15, 0.4) 0px 9px 24px"
147
- }
148
- },
149
- },
150
- plugins: [
151
- plugin_1.default(function ({ addVariant }) {
152
- addVariant("link", ["&:hover", "&:active"]);
153
- addVariant("landing", ["&"]);
154
- addVariant("group-assert", [css `:merge(.group):valid:has(.input:valid:not(:placeholder-shown)) &`]);
155
- addVariant("group-error", [
156
- css `:merge(.group):invalid:has(.input:not(:focus):invalid[data-initialized=true]) &`,
157
- css `:merge(.group[data-error=true][data-interactive=true]):has(.input[data-initialized=true]) &`,
158
- css `:merge(.group[data-error=true][data-interactive=true]):has(.input) &`,
159
- css `:merge(.group[data-error=true]:has(.input[data-initialized=true])) &`,
160
- ]);
161
- }),
162
- ],
163
- };
164
- exports_2("default", config);
165
- }
166
- };
167
- });