@ibnlanre/jumi 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,84 @@
1
+ import createPlugin from 'tailwindcss/plugin';
2
+ import { Root } from 'postcss';
3
+
4
+ type Collection<Values = any, Key extends PropertyKey = string> = Record<Key, Values>;
5
+
6
+ /**
7
+ * The Tailwind adapter.
8
+ *
9
+ * This is the only module that knows the host. It supplies the model with a
10
+ * theme lookup and the two sinks, and it registers Jumi's definitions with
11
+ * Tailwind's plugin API — nothing else. Everything Jumi *means* lives in
12
+ * `@/core`, so the same model can drive another emitter later (a Jumi-owned
13
+ * generator, for instance) without the semantics changing at all.
14
+ *
15
+ * One model per plugin instance, and Tailwind creates the plugin once per
16
+ * compiler, so the model's registries (`values`, `phrases`, `composed`,
17
+ * `effects`, `labels`, `registered`) live exactly as long as that compiler
18
+ * does. `@/core` documents what that implies.
19
+ */
20
+
21
+ declare const _default: ReturnType<typeof createPlugin>;
22
+
23
+ /**
24
+ * The prefix every staged declaration is written under, and the only thing a host needs to
25
+ * recognize a payload. It reaches no browser, so it never has to be a property a browser applies.
26
+ */
27
+ declare const stagingMarker = "--jumi-staging-";
28
+ type Finalized = {
29
+ /**
30
+ * How many selectors the animations composition was written for. Zero means no composition was
31
+ * built, which is the ordinary result on a stylesheet with no `animate-*` in it.
32
+ */
33
+ animations: number;
34
+ /** How many payload rules were consumed. Zero on a second pass, by construction. */
35
+ staging: number;
36
+ /** The same for transitions, from the rules that declare a motion's transition chain. */
37
+ transitions: number;
38
+ /** How many rules the view-transition pass wrote — identities plus pseudo-element rules. */
39
+ viewTransitions: number;
40
+ /**
41
+ * A candidate the author wrote that this pass could not honour, with the reason.
42
+ *
43
+ * Returned rather than printed, because this function is pure and the host owns the loud channel:
44
+ * the PostCSS and Vite adapters turn each one into a `result.warn`, which survives to the terminal
45
+ * of whoever is building. A refusal that were only a console call here would be invisible in a
46
+ * bundler's output, and a refused candidate is otherwise indistinguishable from one that worked —
47
+ * the page renders either way.
48
+ */
49
+ warnings: string[];
50
+ };
51
+ declare function finalize(root: Root, aggregate?: Collection<string>): Finalized;
52
+ /**
53
+ * The string boundary: read, walk, serialize.
54
+ *
55
+ * For a host that has CSS rather than an AST in hand — a CLI writing a file, a harness, a test. A
56
+ * host that already owns an AST (PostCSS itself, or anything built on it) should call `finalize`
57
+ * directly and skip the parse.
58
+ */
59
+ declare function finalizeCss(css: string, aggregate?: Collection<string>): {
60
+ css: string;
61
+ /**
62
+ * How many selectors the animations composition was written for. Zero means no composition was
63
+ * built, which is the ordinary result on a stylesheet with no `animate-*` in it.
64
+ */
65
+ animations: number;
66
+ /** How many payload rules were consumed. Zero on a second pass, by construction. */
67
+ staging: number;
68
+ /** The same for transitions, from the rules that declare a motion's transition chain. */
69
+ transitions: number;
70
+ /** How many rules the view-transition pass wrote — identities plus pseudo-element rules. */
71
+ viewTransitions: number;
72
+ /**
73
+ * A candidate the author wrote that this pass could not honour, with the reason.
74
+ *
75
+ * Returned rather than printed, because this function is pure and the host owns the loud channel:
76
+ * the PostCSS and Vite adapters turn each one into a `result.warn`, which survives to the terminal
77
+ * of whoever is building. A refusal that were only a console call here would be invisible in a
78
+ * bundler's output, and a refused candidate is otherwise indistinguishable from one that worked —
79
+ * the page renders either way.
80
+ */
81
+ warnings: string[];
82
+ };
83
+
84
+ export { type Finalized, _default as default, finalize, finalizeCss, stagingMarker };
@@ -0,0 +1,84 @@
1
+ import createPlugin from 'tailwindcss/plugin';
2
+ import { Root } from 'postcss';
3
+
4
+ type Collection<Values = any, Key extends PropertyKey = string> = Record<Key, Values>;
5
+
6
+ /**
7
+ * The Tailwind adapter.
8
+ *
9
+ * This is the only module that knows the host. It supplies the model with a
10
+ * theme lookup and the two sinks, and it registers Jumi's definitions with
11
+ * Tailwind's plugin API — nothing else. Everything Jumi *means* lives in
12
+ * `@/core`, so the same model can drive another emitter later (a Jumi-owned
13
+ * generator, for instance) without the semantics changing at all.
14
+ *
15
+ * One model per plugin instance, and Tailwind creates the plugin once per
16
+ * compiler, so the model's registries (`values`, `phrases`, `composed`,
17
+ * `effects`, `labels`, `registered`) live exactly as long as that compiler
18
+ * does. `@/core` documents what that implies.
19
+ */
20
+
21
+ declare const _default: ReturnType<typeof createPlugin>;
22
+
23
+ /**
24
+ * The prefix every staged declaration is written under, and the only thing a host needs to
25
+ * recognize a payload. It reaches no browser, so it never has to be a property a browser applies.
26
+ */
27
+ declare const stagingMarker = "--jumi-staging-";
28
+ type Finalized = {
29
+ /**
30
+ * How many selectors the animations composition was written for. Zero means no composition was
31
+ * built, which is the ordinary result on a stylesheet with no `animate-*` in it.
32
+ */
33
+ animations: number;
34
+ /** How many payload rules were consumed. Zero on a second pass, by construction. */
35
+ staging: number;
36
+ /** The same for transitions, from the rules that declare a motion's transition chain. */
37
+ transitions: number;
38
+ /** How many rules the view-transition pass wrote — identities plus pseudo-element rules. */
39
+ viewTransitions: number;
40
+ /**
41
+ * A candidate the author wrote that this pass could not honour, with the reason.
42
+ *
43
+ * Returned rather than printed, because this function is pure and the host owns the loud channel:
44
+ * the PostCSS and Vite adapters turn each one into a `result.warn`, which survives to the terminal
45
+ * of whoever is building. A refusal that were only a console call here would be invisible in a
46
+ * bundler's output, and a refused candidate is otherwise indistinguishable from one that worked —
47
+ * the page renders either way.
48
+ */
49
+ warnings: string[];
50
+ };
51
+ declare function finalize(root: Root, aggregate?: Collection<string>): Finalized;
52
+ /**
53
+ * The string boundary: read, walk, serialize.
54
+ *
55
+ * For a host that has CSS rather than an AST in hand — a CLI writing a file, a harness, a test. A
56
+ * host that already owns an AST (PostCSS itself, or anything built on it) should call `finalize`
57
+ * directly and skip the parse.
58
+ */
59
+ declare function finalizeCss(css: string, aggregate?: Collection<string>): {
60
+ css: string;
61
+ /**
62
+ * How many selectors the animations composition was written for. Zero means no composition was
63
+ * built, which is the ordinary result on a stylesheet with no `animate-*` in it.
64
+ */
65
+ animations: number;
66
+ /** How many payload rules were consumed. Zero on a second pass, by construction. */
67
+ staging: number;
68
+ /** The same for transitions, from the rules that declare a motion's transition chain. */
69
+ transitions: number;
70
+ /** How many rules the view-transition pass wrote — identities plus pseudo-element rules. */
71
+ viewTransitions: number;
72
+ /**
73
+ * A candidate the author wrote that this pass could not honour, with the reason.
74
+ *
75
+ * Returned rather than printed, because this function is pure and the host owns the loud channel:
76
+ * the PostCSS and Vite adapters turn each one into a `result.warn`, which survives to the terminal
77
+ * of whoever is building. A refusal that were only a console call here would be invisible in a
78
+ * bundler's output, and a refused candidate is otherwise indistinguishable from one that worked —
79
+ * the page renders either way.
80
+ */
81
+ warnings: string[];
82
+ };
83
+
84
+ export { type Finalized, _default as default, finalize, finalizeCss, stagingMarker };