mates 0.1.0-beta.9 → 0.2.1
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/README.md +5 -15
- package/dist/Directives/animationClasses.d.ts +1 -1
- package/dist/Directives/index.d.ts +1 -1
- package/dist/Directives/index.d.ts.map +1 -1
- package/dist/Directives/onParentDirective.d.ts +1 -1
- package/dist/Directives/timerDirective.d.ts +2 -2
- package/dist/Fetch/Fetch.d.ts +11 -11
- package/dist/Mutables/Extended Atoms/themeAtom.d.ts +11 -11
- package/dist/Mutables/Extended Atoms/themeAtom.d.ts.map +1 -1
- package/dist/Mutables/atom/index.d.ts +1 -1
- package/dist/Mutables/atom/index.d.ts.map +1 -1
- package/dist/Template/x-x.d.ts.map +1 -1
- package/dist/Template/x.d.ts +4 -0
- package/dist/Template/x.d.ts.map +1 -1
- package/dist/Utils/svgIcon.d.ts +2 -4
- package/dist/Utils/svgIcon.d.ts.map +1 -1
- package/dist/css-in-js/theme.d.ts +9 -4
- package/dist/css-in-js/theme.d.ts.map +1 -1
- package/dist/index.d.ts +250 -243
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +52 -38
- package/dist/index.esm.js.map +1 -1
- package/dist/socket/ws.d.ts +2 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
# MATES
|
|
2
2
|
|
|
3
|
-
**MATES** is a
|
|
3
|
+
**MATES** is a TypeScript-first front-end framework built on lit-html — no virtual DOM, no compiler needed. It's faster than React, fully type-safe, and runs via Vite, Bun, or CDN (~50KB gzipped).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
Check the Full **Docs** Here
|
|
7
|
-
|
|
8
|
-
What if we had a framework that is just perfect? A framework that's faster than react and without the need of a compiler. A Framework that's super type safe. A framework that cherishes capabilities of Javascript. Mates a Beautiful, simple, Perfect Javascript Framework with **no virtual DOM**, **no compiler step**, but with lots of **goodness**. You can install Mates and run using a build tool like Vite or Bun or just use CDN to load Mates at runtime.
|
|
9
|
-
|
|
10
|
-
MATES is based on an architecture: **M**utable State, **A**ctions, **T**emplates, **E**vents and **S**etups. State is mutable, Actions are trackable functions, Templates are functions that return html template strings, setups are run once before the component is mounted to set up some state or some business logic or effects.
|
|
11
|
-
|
|
12
|
-
Mates is about 50Kb gzipped, but it comes with a Router, really good state management system (you will not need anything else), Date Utils with timezone support (no need for extra library), Fetch and web socket Utils (no axios or socket.io needed), Animation Utils, Form Validation Utils, Virtualisation for lists or tables, built in CSS-in-Js library, portals, tooltips, snackbars, popups (so it'll help you create popups with no effort), UUID utils to generate random ID, Actions, Events, custom hook support, Memoisation, Zero promises (cancellable and reusable promises), built in support for pagination and lazy loading, with tons of built in hooks that are very useful, utilites to handle local storage across all tabs, a Task Manager to handle lots of async tasks in parallel or one by one and many more.
|
|
13
|
-
|
|
14
|
-
---
|
|
5
|
+
Its architecture follows the MATES pattern: Mutable State, Actions, Templates, Events, and Setups.
|
|
15
6
|
|
|
7
|
+
It comes fully batteries-included with: a Router, state management, date/timezone utils, fetch & WebSocket utils, animations, form validation, list virtualisation, CSS-in-JS, portals, tooltips, popups, UUID generation, memoisation, cancellable promises, pagination, lazy loading, local storage sync across tabs, a Task Manager, and a rich set of built-in hooks — eliminating the need for most third-party libraries.
|
|
16
8
|
|
|
17
9
|
---
|
|
18
10
|
|
|
@@ -24,8 +16,6 @@ Most frameworks ask you to learn a new mental model — JSX compilers, reactive
|
|
|
24
16
|
- **No virtual DOM** — `lit-html` patches only the parts of the DOM that actually changed. Updates are surgical, not diffed from scratch.]
|
|
25
17
|
- **Predictable two-layer components** — the outer function (setup) runs once. The inner function (render) runs on every update. Clear separation between initialization and rendering.
|
|
26
18
|
- **Batteries included** — routing, async state machines, CSS-in-JS, WebSocket, virtualization, portals, and animations are all first-party and designed to work together.
|
|
27
|
-
- **Very Capable** it's shipped with lots of utitlies to help you avoid installing a third party library just for few of it's functions.
|
|
28
|
-
- **TypeScript-first** — every API is fully typed from the ground up.
|
|
29
19
|
|
|
30
20
|
---
|
|
31
21
|
|
|
@@ -73,7 +63,7 @@ Every Mates component is a **closure** with two layers:
|
|
|
73
63
|
|
|
74
64
|
| Layer | Runs | Purpose |
|
|
75
65
|
|-------|------|---------|
|
|
76
|
-
| **Outer function** | Once on mount | Create atoms, set up subscriptions, register lifecycle hooks |
|
|
66
|
+
| **Outer function** | Once on mount | Create atoms, set up subscriptions using **on** function, register lifecycle hooks..etc |
|
|
77
67
|
| **Inner function** | Every render | Read reactive values and return a `TemplateResult` |
|
|
78
68
|
|
|
79
69
|
```typescript
|
|
@@ -92,7 +82,7 @@ const Counter = (propsFn: Props<{ label: string }>) => {
|
|
|
92
82
|
};
|
|
93
83
|
```
|
|
94
84
|
|
|
95
|
-
> **Rule of thumb:** atoms, effects, hooks, and subscriptions always go in the **outer** function, you can also make api calls..etc you can be
|
|
85
|
+
> **Rule of thumb:** atoms, effects, hooks, and subscriptions always go in the **outer** function, you can also make api calls..etc you can be assured that this code is only executed once. template function always returns html temlate strings. Modern IDEs have a built in formatting support for the html template strings.
|
|
96
86
|
|
|
97
87
|
---
|
|
98
88
|
|
|
@@ -18,7 +18,7 @@ export declare function injectMatesAnimations(): void;
|
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```ts
|
|
21
|
-
* import { MA } from "
|
|
21
|
+
* import { MA } from "mates";
|
|
22
22
|
* html`<div class=${MA.fadeIn}>Hello</div>`
|
|
23
23
|
* html`<div class="${MA.slideInUp}" style="--mates-duration:500ms">Hi</div>`
|
|
24
24
|
* ```
|
|
@@ -9,7 +9,7 @@ export { type LazyLoadCallback, type LazyLoadOptions, lazyLoad, onScrolledIntoVi
|
|
|
9
9
|
export { type ConnectCallback, type DisconnectCallback, onConnect, onDisconnect, onUpdate, type UpdateCallback, } from "./lifecycleDirectives";
|
|
10
10
|
export { type MasonryGridOptions, type MasonryItemTemplate, type MasonryKeyFn, masonryGrid, } from "./masonryGrid";
|
|
11
11
|
export { type MemoKeys, type MemoTemplateFn, memoTemplate, } from "./memoTemplate";
|
|
12
|
-
export { type MatesCustomEventMap, type OnEventMap, on, removeOn, } from "./onDirective";
|
|
12
|
+
export { type MatesCustomEventMap, type OnEventMap, on, on as onEvent, removeOn, } from "./onDirective";
|
|
13
13
|
export { type OnParentMap, onParent } from "./onParentDirective";
|
|
14
14
|
export { renderSwitch, type SwitchCase, type SwitchEntry, } from "./renderSwitch";
|
|
15
15
|
export { removeStyle, type StyleMap, type StyleValue, style, } from "./styleDirective";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/Directives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,UAAU,EACV,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,IAAI,EACJ,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,OAAO,EACP,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,QAAQ,EACR,WAAW,EACX,SAAS,GACV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,QAAQ,EACR,kBAAkB,EAClB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,qBAAq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,EAAE,KAAK,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,WAAW,EACX,WAAW,EACX,cAAc,GACf,MAAM,kBAAkB,CAAC"}
|
|
@@ -19,8 +19,8 @@ export type TimerContent = () => unknown;
|
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
* ```ts
|
|
22
|
-
* import { html } from "
|
|
23
|
-
* import { timer } from "
|
|
22
|
+
* import { html } from "mates";
|
|
23
|
+
* import { timer } from "mates";
|
|
24
24
|
*
|
|
25
25
|
* // Live clock — updates every second, no component re-render
|
|
26
26
|
* html`
|
package/dist/Fetch/Fetch.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export type FetchRequest = Omit<RequestInit, "body"> & {
|
|
|
8
8
|
* - If it starts with `http:` or `https:` it is used as-is (absolute URL),
|
|
9
9
|
* ignoring any `host` set on the client/base request.
|
|
10
10
|
* - Otherwise it is treated as a path and appended to `host`
|
|
11
|
-
* (e.g. `host = "https
|
|
12
|
-
* `"https
|
|
11
|
+
* (e.g. `host = "https://<host>"` + `url = "/users"` →
|
|
12
|
+
* `"https://<host>/users"`).
|
|
13
13
|
* - Dynamic segments (`:id`) are substituted from `params`.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
@@ -24,7 +24,7 @@ export type FetchRequest = Omit<RequestInit, "body"> & {
|
|
|
24
24
|
*/
|
|
25
25
|
path?: string;
|
|
26
26
|
/**
|
|
27
|
-
* Origin / base host, e.g. `"https
|
|
27
|
+
* Origin / base host, e.g. `"https://<your-api>"`.
|
|
28
28
|
* Used as a prefix when `url` is a relative path.
|
|
29
29
|
* Defaults to `""` (no host prefix).
|
|
30
30
|
*/
|
|
@@ -67,7 +67,7 @@ export declare const clearInterceptors: () => void;
|
|
|
67
67
|
* - All requests are logged to Mates DevTools when devtools is connected.
|
|
68
68
|
*
|
|
69
69
|
* @example
|
|
70
|
-
* const api = new FetchClient({ host: "https
|
|
70
|
+
* const api = new FetchClient({ host: "https://<your-api>" });
|
|
71
71
|
* api.interceptBefore((url, opts) => ({
|
|
72
72
|
* url,
|
|
73
73
|
* options: { ...opts, headers: { ...opts.headers, Authorization: `Bearer ${token}` } },
|
|
@@ -106,16 +106,16 @@ export declare class FetchClient {
|
|
|
106
106
|
* exactly as `buildRequestUrl` handles them.
|
|
107
107
|
*
|
|
108
108
|
* @example
|
|
109
|
-
* const loadUser = api.fetchAction({ host: "https
|
|
109
|
+
* const loadUser = api.fetchAction({ host: "https://<your-api>", url: "/users/:id" });
|
|
110
110
|
* loadUser({ id: 7, expand: "posts" });
|
|
111
|
-
* // → GET https
|
|
111
|
+
* // → GET https://<your-api>/users/7?expand=posts
|
|
112
112
|
*/
|
|
113
113
|
fetchAction<T = unknown>(config?: FetchActionConfig): AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
114
114
|
/**
|
|
115
115
|
* Creates an asyncAction that always issues a GET request via this client.
|
|
116
116
|
*
|
|
117
117
|
* @example
|
|
118
|
-
* const loadUsers = api.getAction({ host: "https
|
|
118
|
+
* const loadUsers = api.getAction({ host: "https://<your-api>", url: "/users" });
|
|
119
119
|
* loadUsers({ page: 2, limit: 20 });
|
|
120
120
|
*/
|
|
121
121
|
getAction<T = unknown>(config?: FetchActionConfig): AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
@@ -123,7 +123,7 @@ export declare class FetchClient {
|
|
|
123
123
|
* Creates an asyncAction that always issues a POST request via this client.
|
|
124
124
|
*
|
|
125
125
|
* @example
|
|
126
|
-
* const createUser = api.postAction({ host: "https
|
|
126
|
+
* const createUser = api.postAction({ host: "https://<your-api>", url: "/users" });
|
|
127
127
|
* createUser({ name: "Alice" });
|
|
128
128
|
*/
|
|
129
129
|
postAction<T = unknown>(config?: FetchActionConfig): AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
@@ -131,7 +131,7 @@ export declare class FetchClient {
|
|
|
131
131
|
* Creates an asyncAction that always issues a PUT request via this client.
|
|
132
132
|
*
|
|
133
133
|
* @example
|
|
134
|
-
* const replaceUser = api.putAction({ host: "https
|
|
134
|
+
* const replaceUser = api.putAction({ host: "https://<your-api>", url: "/users/:id" });
|
|
135
135
|
* replaceUser({ id: 7, name: "Bob" });
|
|
136
136
|
*/
|
|
137
137
|
putAction<T = unknown>(config?: FetchActionConfig): AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
@@ -139,7 +139,7 @@ export declare class FetchClient {
|
|
|
139
139
|
* Creates an asyncAction that always issues a PATCH request via this client.
|
|
140
140
|
*
|
|
141
141
|
* @example
|
|
142
|
-
* const patchUser = api.patchAction({ host: "https
|
|
142
|
+
* const patchUser = api.patchAction({ host: "https://<your-api>", url: "/users/:id" });
|
|
143
143
|
* patchUser({ id: 7, status: "inactive" });
|
|
144
144
|
*/
|
|
145
145
|
patchAction<T = unknown>(config?: FetchActionConfig): AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
@@ -147,7 +147,7 @@ export declare class FetchClient {
|
|
|
147
147
|
* Creates an asyncAction that always issues a DELETE request via this client.
|
|
148
148
|
*
|
|
149
149
|
* @example
|
|
150
|
-
* const removeUser = api.deleteAction({ host: "https
|
|
150
|
+
* const removeUser = api.deleteAction({ host: "https://<your-api>", url: "/users/:id" });
|
|
151
151
|
* removeUser({ id: 7 });
|
|
152
152
|
*/
|
|
153
153
|
deleteAction<T = unknown>(config?: FetchActionConfig): AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
@@ -34,10 +34,9 @@ export type ThemeAtomType = AtomType<ThemeValue> & {
|
|
|
34
34
|
readonly name: "themeAtom";
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* The singleton reactive theme atom.
|
|
38
38
|
*
|
|
39
|
-
*
|
|
40
|
-
* returns the same instance with no side-effects.
|
|
39
|
+
* Use directly — it is the atom, not a factory.
|
|
41
40
|
*
|
|
42
41
|
* - Reads the initial theme from `localStorage["mates-theme"]`.
|
|
43
42
|
* - Falls back to the OS color-scheme preference when no value is stored.
|
|
@@ -47,13 +46,14 @@ export type ThemeAtomType = AtomType<ThemeValue> & {
|
|
|
47
46
|
* "auto" mode, re-notifying all subscribers so derived UIs update.
|
|
48
47
|
*
|
|
49
48
|
* @example
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
49
|
+
* import { themeAtom } from "mates";
|
|
50
|
+
*
|
|
51
|
+
* themeAtom.setToDark();
|
|
52
|
+
* themeAtom.toggle(); // → "light"
|
|
53
|
+
* themeAtom.setToAuto(); // follows OS
|
|
54
|
+
* themeAtom.resolved; // "light" | "dark" — never "auto"
|
|
55
|
+
* themeAtom(); // read current value: "light" | "dark" | "auto"
|
|
56
|
+
* themeAtom.val; // same
|
|
57
57
|
*/
|
|
58
|
-
export declare
|
|
58
|
+
export declare const themeAtom: ThemeAtomType;
|
|
59
59
|
//# sourceMappingURL=themeAtom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeAtom.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/Extended Atoms/themeAtom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAQ,MAAM,cAAc,CAAC;AAUnD,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG;IACjD,mEAAmE;IACnE,UAAU,IAAI,IAAI,CAAC;IACnB,kEAAkE;IAClE,SAAS,IAAI,IAAI,CAAC;IAClB,uEAAuE;IACvE,SAAS,IAAI,IAAI,CAAC;IAClB;;;;OAIG;IACH,MAAM,IAAI,IAAI,CAAC;IACf,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"themeAtom.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/Extended Atoms/themeAtom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAQ,MAAM,cAAc,CAAC;AAUnD,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG;IACjD,mEAAmE;IACnE,UAAU,IAAI,IAAI,CAAC;IACnB,kEAAkE;IAClE,SAAS,IAAI,IAAI,CAAC;IAClB,uEAAuE;IACvE,SAAS,IAAI,IAAI,CAAC;IAClB;;;;OAIG;IACH,MAAM,IAAI,IAAI,CAAC;IACf,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B,CAAC;AA6JF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,SAAS,EAAE,aAAgC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/atom/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/atom/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x-x.d.ts","sourceRoot":"","sources":["../../lib/Template/x-x.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"x-x.d.ts","sourceRoot":"","sources":["../../lib/Template/x-x.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,gBAAgB,EAAgB,MAAM,2BAA2B,CAAC;AAWhF,qBAAa,SAAU,SAAQ,WAAW;IACxC,OAAO,CAAC,MAAM,CAAsB;IAE7B,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,IAAI,SAAe;IAC1B,OAAO,CAAC,KAAK,CAAM;IACnB,OAAO,CAAC,WAAW,CAEV;IACT,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,gBAAgB,CAAU;IAE3B,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/B,MAAM,EAAE,GAAG,CAAC,UAAU,GAAG,EAAE,MAAM,GAAG,CAAC,CAAa;IAEzD,gFAAgF;IACzE,UAAU,EAAE;QAAE,KAAK,EAAE,GAAG,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,EAAE,CAAM;IAEpD,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,EAAE,KAAK,EAAE,GAAG;IAIvC,WAAW,SAAM;IAExB,iGAAiG;IAC1F,MAAM,SAAK;IAClB,sEAAsE;IAC/D,gBAAgB,EAAE,SAAS,GAAG,IAAI,CAAQ;IACjD,kFAAkF;IAC3E,cAAc,SAAK;IAE1B,+CAA+C;IACxC,cAAc,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,EAAE,CAAM;IACzD,2EAA2E;IACpE,WAAW,EAAE,OAAO,CAAQ;IAG5B,qBAAqB,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,CAAa;IACnD,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;IAKjC,aAAa,EAAE,IAAI,GAAG,gBAAgB,CAAQ;IAC9C,UAAU,EAAE,IAAI,GAAG,gBAAgB,CAAQ;;IAwBlD,IAAI,KAAK,CAAC,GAAG,qBAAA,EAGZ;IAED,IAAI,KAAK,wBAER;IAEM,OAAO,EAAE,GAAG,CAAC;IAEpB,OAAO,CAAC,cAAc,CAAS;IAM/B;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IAmBxB,IAAI,IAAI,CAAC,GAAG,KAAA,EAyBX;IAED,IAAI,IAAI,QAEP;IAMD,gBAAgB;IAIhB,iBAAiB;IAgCjB,oBAAoB;IAqBpB,OAAO,CAAC,qBAAqB,CAa3B;IAEF,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ;IAazC,OAAO;IA6CP,OAAO,CAAC,eAAe;IAqFvB,OAAO,CAAC,kBAAkB;CAiF3B"}
|
package/dist/Template/x.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { ComponentType } from "./x-x.types";
|
|
2
2
|
export declare const x: <T extends Record<string, any>>(viewFn: ComponentType<T>, props?: T) => import("lit-html").TemplateResult<1>;
|
|
3
3
|
export declare const view: <T extends Record<string, any>>(viewFn: ComponentType<T>, props?: T) => import("lit-html").TemplateResult<1>;
|
|
4
|
+
/** @alias x */
|
|
5
|
+
export declare const template: <T extends Record<string, any>>(viewFn: ComponentType<T>, props?: T) => import("lit-html").TemplateResult<1>;
|
|
4
6
|
export declare const renderX: <T extends Record<string, any>>(viewFn: ComponentType<T>, element: HTMLElement, props?: T) => import("lit-html").RootPart;
|
|
7
|
+
/** @alias renderX */
|
|
8
|
+
export declare const renderTemplate: <T extends Record<string, any>>(viewFn: ComponentType<T>, element: HTMLElement, props?: T) => import("lit-html").RootPart;
|
|
5
9
|
//# sourceMappingURL=x.d.ts.map
|
package/dist/Template/x.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x.d.ts","sourceRoot":"","sources":["../../lib/Template/x.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,eAAO,MAAM,CAAC,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7C,QAAQ,aAAa,CAAC,CAAC,CAAC,EACxB,QAAO,CAAW,yCAGnB,CAAC;AAGF,eAAO,MAAM,IAAI,GARC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UACrC,aAAa,CAAC,CAAC,CAAC,UACjB,CAAC,yCAMW,CAAC;
|
|
1
|
+
{"version":3,"file":"x.d.ts","sourceRoot":"","sources":["../../lib/Template/x.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,eAAO,MAAM,CAAC,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7C,QAAQ,aAAa,CAAC,CAAC,CAAC,EACxB,QAAO,CAAW,yCAGnB,CAAC;AAGF,eAAO,MAAM,IAAI,GARC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UACrC,aAAa,CAAC,CAAC,CAAC,UACjB,CAAC,yCAMW,CAAC;AACtB,eAAe;AACf,eAAO,MAAM,QAAQ,GAVH,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UACrC,aAAa,CAAC,CAAC,CAAC,UACjB,CAAC,yCAQe,CAAC;AAE1B,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnD,QAAQ,aAAa,CAAC,CAAC,CAAC,EACxB,SAAS,WAAW,EACpB,QAAO,CAAW,gCAGnB,CAAC;AAEF,qBAAqB;AACrB,eAAO,MAAM,cAAc,GATH,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UAC3C,aAAa,CAAC,CAAC,CAAC,WACf,WAAW,UACb,CAAC,gCAM2B,CAAC"}
|
package/dist/Utils/svgIcon.d.ts
CHANGED
|
@@ -69,10 +69,8 @@ declare const svgIconDirective: (_markup: string, _config: SvgConfig) => import(
|
|
|
69
69
|
* ```ts
|
|
70
70
|
* import { safeSVG, html } from "mates";
|
|
71
71
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5…"/>
|
|
75
|
-
* </svg>`;
|
|
72
|
+
* // markup must be a valid SVG string (starts with <svg ...>)
|
|
73
|
+
* const heartIcon = `<svg viewBox="0 0 24 24"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5…"/></svg>`;
|
|
76
74
|
*
|
|
77
75
|
* html`<button>${safeSVG(heartIcon, { size: 24, fill: "currentColor" })}</button>`;
|
|
78
76
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svgIcon.d.ts","sourceRoot":"","sources":["../../lib/Utils/svgIcon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAuB,MAAM,uBAAuB,CAAC;AAIvE;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;I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AAIrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,SAAc,GACrB,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAErC;AAED;;;;;;;;;GASG;AACH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ThemeAtomType } from "../Mutables/Extended Atoms/themeAtom";
|
|
2
2
|
/**
|
|
3
3
|
* A flat map of token names to CSS values.
|
|
4
4
|
* Keys may include or omit the leading "--".
|
|
@@ -33,8 +33,13 @@ export type ThemeMode<T extends ThemesInput> = "auto" | (string & keyof T);
|
|
|
33
33
|
export type GlobalThemeResult<T extends ThemesInput> = {
|
|
34
34
|
/** Plain object: tokenKey → "--token-key" (the CSS variable name, no var() wrapper). */
|
|
35
35
|
cssVars: CssVars<T[keyof T]>;
|
|
36
|
-
/**
|
|
37
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The singleton theme atom shared across the entire app.
|
|
38
|
+
* Call `.setToDark()`, `.setToLight()`, `.setToAuto()`, or `.toggle()`.
|
|
39
|
+
* Reads/writes localStorage & data-theme on <html>.
|
|
40
|
+
* Always the same instance as `themeAtom()` from mates.
|
|
41
|
+
*/
|
|
42
|
+
themeAtom: ThemeAtomType;
|
|
38
43
|
};
|
|
39
44
|
/**
|
|
40
45
|
* Define your application's themes as named token maps.
|
|
@@ -101,5 +106,5 @@ export declare function globalTheme<T extends ThemesInput>(themes: T): GlobalThe
|
|
|
101
106
|
* });
|
|
102
107
|
* ```
|
|
103
108
|
*/
|
|
104
|
-
export declare function rootCSS
|
|
109
|
+
export declare function rootCSS<T extends Record<string, string>>(tokens: T): T;
|
|
105
110
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../lib/css-in-js/theme.ts"],"names":[],"mappings":"AAcA,OAAO,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../lib/css-in-js/theme.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,sCAAsC,CAAC;AAK9C;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAExD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,aAAa,IAAI;IAC7C,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,WAAW,IAAI,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;AAE3E,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,WAAW,IAAI;IACrD,wFAAwF;IACxF,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7B;;;;;OAKG;IACH,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AA4CF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAC/C,MAAM,EAAE,CAAC,GACR,iBAAiB,CAAC,CAAC,CAAC,CAmDtB;AAID;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAQtE"}
|