boss-css 0.0.20 → 0.0.21
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/dist/ai/server.d.cts +9 -0
- package/dist/ai/server.d.mts +9 -0
- package/dist/ai/skills.d.cts +13 -0
- package/dist/ai/skills.d.mts +13 -0
- package/dist/api/browser.d.cts +7 -0
- package/dist/api/browser.d.mts +7 -0
- package/dist/api/config.d.cts +6 -0
- package/dist/api/config.d.mts +6 -0
- package/dist/api/dictionary.d.cts +29 -0
- package/dist/api/dictionary.d.mts +29 -0
- package/dist/api/noopCss.d.cts +29 -0
- package/dist/api/noopCss.d.mts +29 -0
- package/dist/api/server.d.cts +7 -0
- package/dist/api/server.d.mts +7 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.mts +1 -0
- package/dist/compile/runtime.d.cts +5 -0
- package/dist/compile/runtime.d.mts +5 -0
- package/dist/cx/index.d.cts +15 -0
- package/dist/cx/index.d.mts +15 -0
- package/dist/detect-fw/index.d.cts +47 -0
- package/dist/detect-fw/index.d.mts +47 -0
- package/dist/dev/client.d.cts +10 -0
- package/dist/dev/client.d.mts +10 -0
- package/dist/dev/plugin/browser.d.cts +7 -0
- package/dist/dev/plugin/browser.d.mts +7 -0
- package/dist/dev/plugin/server.d.cts +8 -0
- package/dist/dev/plugin/server.d.mts +8 -0
- package/dist/dev/runtime.d.cts +1 -0
- package/dist/dev/runtime.d.mts +1 -0
- package/dist/dev/server.d.cts +16 -0
- package/dist/dev/server.d.mts +16 -0
- package/dist/eslint-plugin/index.d.cts +1472 -0
- package/dist/eslint-plugin/index.d.mts +1473 -0
- package/dist/fontsource/directory.d.cts +19 -0
- package/dist/fontsource/directory.d.mts +19 -0
- package/dist/fontsource/server.d.cts +7 -0
- package/dist/fontsource/server.d.mts +7 -0
- package/dist/fontsource/types.d.cts +37 -0
- package/dist/fontsource/types.d.mts +37 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.mts +6 -0
- package/dist/merge/index.d.cts +18 -0
- package/dist/merge/index.d.mts +18 -0
- package/dist/native/browser.d.cts +7 -0
- package/dist/native/browser.d.mts +7 -0
- package/dist/native/server.d.cts +9 -0
- package/dist/native/server.d.mts +9 -0
- package/dist/parser/classname/server.d.cts +7 -0
- package/dist/parser/classname/server.d.mts +7 -0
- package/dist/parser/jsx/browser.d.cts +7 -0
- package/dist/parser/jsx/browser.d.mts +7 -0
- package/dist/parser/jsx/native.d.cts +7 -0
- package/dist/parser/jsx/native.d.mts +7 -0
- package/dist/parser/jsx/runtime.d.cts +2 -0
- package/dist/parser/jsx/runtime.d.mts +2 -0
- package/dist/parser/jsx/server.d.cts +9 -0
- package/dist/parser/jsx/server.d.mts +9 -0
- package/dist/postcss/index.d.cts +12 -0
- package/dist/postcss/index.d.mts +12 -0
- package/dist/prop/at/runtime-only.d.cts +8 -0
- package/dist/prop/at/runtime-only.d.mts +8 -0
- package/dist/prop/at/server.d.cts +13 -0
- package/dist/prop/at/server.d.mts +13 -0
- package/dist/prop/bosswind/browser.d.cts +8 -0
- package/dist/prop/bosswind/browser.d.mts +8 -0
- package/dist/prop/bosswind/runtime-only.d.cts +8 -0
- package/dist/prop/bosswind/runtime-only.d.mts +8 -0
- package/dist/prop/bosswind/server.d.cts +9 -0
- package/dist/prop/bosswind/server.d.mts +9 -0
- package/dist/prop/bosswind/shared.d.cts +11 -0
- package/dist/prop/bosswind/shared.d.mts +11 -0
- package/dist/prop/child/runtime-only.d.cts +8 -0
- package/dist/prop/child/runtime-only.d.mts +8 -0
- package/dist/prop/child/server.d.cts +9 -0
- package/dist/prop/child/server.d.mts +9 -0
- package/dist/prop/css/runtime-only.d.cts +5 -0
- package/dist/prop/css/runtime-only.d.mts +5 -0
- package/dist/prop/css/server.d.cts +9 -0
- package/dist/prop/css/server.d.mts +9 -0
- package/dist/prop/pseudo/runtime-only.d.cts +8 -0
- package/dist/prop/pseudo/runtime-only.d.mts +8 -0
- package/dist/prop/pseudo/server.d.cts +9 -0
- package/dist/prop/pseudo/server.d.mts +9 -0
- package/dist/reset/server.d.cts +7 -0
- package/dist/reset/server.d.mts +7 -0
- package/dist/runtime/index.d.cts +20 -0
- package/dist/runtime/index.d.mts +20 -0
- package/dist/runtime/preact.d.cts +2 -0
- package/dist/runtime/preact.d.mts +2 -0
- package/dist/runtime/qwik.d.cts +8 -0
- package/dist/runtime/qwik.d.mts +8 -0
- package/dist/runtime/react.d.cts +2 -0
- package/dist/runtime/react.d.mts +2 -0
- package/dist/runtime/solid.d.cts +6 -0
- package/dist/runtime/solid.d.mts +6 -0
- package/dist/runtime/stencil.d.cts +7 -0
- package/dist/runtime/stencil.d.mts +7 -0
- package/dist/runtime/style.d.cts +4 -0
- package/dist/runtime/style.d.mts +4 -0
- package/dist/shared/types.d.cts +96 -0
- package/dist/shared/types.d.mts +96 -0
- package/dist/strategy/classic/runtime-only.d.cts +7 -0
- package/dist/strategy/classic/runtime-only.d.mts +7 -0
- package/dist/strategy/classname-first/browser.d.cts +7 -0
- package/dist/strategy/classname-first/browser.d.mts +7 -0
- package/dist/strategy/classname-first/runtime-only.d.cts +7 -0
- package/dist/strategy/classname-first/runtime-only.d.mts +7 -0
- package/dist/strategy/classname-first/server.d.cts +9 -0
- package/dist/strategy/classname-first/server.d.mts +9 -0
- package/dist/strategy/classname-only/server.d.cts +8 -0
- package/dist/strategy/classname-only/server.d.mts +8 -0
- package/dist/strategy/inline-first/browser.d.cts +7 -0
- package/dist/strategy/inline-first/browser.d.mts +7 -0
- package/dist/strategy/inline-first/runtime-only.d.cts +7 -0
- package/dist/strategy/inline-first/runtime-only.d.mts +7 -0
- package/dist/strategy/inline-first/server.d.cts +9 -0
- package/dist/strategy/inline-first/server.d.mts +9 -0
- package/dist/strategy/runtime/runtime-only.d.cts +9 -0
- package/dist/strategy/runtime/runtime-only.d.mts +9 -0
- package/dist/strategy/runtime/server.d.cts +9 -0
- package/dist/strategy/runtime/server.d.mts +9 -0
- package/dist/strategy/runtime-only/css.d.cts +43 -0
- package/dist/strategy/runtime-only/css.d.mts +43 -0
- package/dist/tasks/build.d.cts +23 -0
- package/dist/tasks/build.d.mts +23 -0
- package/dist/tasks/compile.d.cts +31 -0
- package/dist/tasks/compile.d.mts +31 -0
- package/dist/tasks/postcss.d.cts +10 -0
- package/dist/tasks/postcss.d.mts +10 -0
- package/dist/tasks/session.d.cts +12 -0
- package/dist/tasks/session.d.mts +12 -0
- package/dist/tasks/watch.d.cts +17 -0
- package/dist/tasks/watch.d.mts +17 -0
- package/dist/types/Plugin.d.cts +251 -0
- package/dist/types/Plugin.d.mts +251 -0
- package/dist/use/token/browser.d.cts +16 -0
- package/dist/use/token/browser.d.mts +16 -0
- package/dist/use/token/propMap.d.cts +8 -0
- package/dist/use/token/propMap.d.mts +8 -0
- package/dist/use/token/runtime-only.d.cts +22 -0
- package/dist/use/token/runtime-only.d.mts +22 -0
- package/dist/use/token/server.d.cts +19 -0
- package/dist/use/token/server.d.mts +19 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/tasks/session.d.ts
|
|
2
|
+
type SessionPhase = 'start' | 'run' | 'stop';
|
|
3
|
+
type SessionKind = 'watch' | 'postcss' | 'build' | 'compile' | 'custom';
|
|
4
|
+
type SessionPayload = {
|
|
5
|
+
phase: SessionPhase;
|
|
6
|
+
kind: SessionKind;
|
|
7
|
+
baseDir: string;
|
|
8
|
+
configPath: string | null;
|
|
9
|
+
runtimePath: string | null;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { SessionPayload };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/tasks/session.d.ts
|
|
2
|
+
type SessionPhase = 'start' | 'run' | 'stop';
|
|
3
|
+
type SessionKind = 'watch' | 'postcss' | 'build' | 'compile' | 'custom';
|
|
4
|
+
type SessionPayload = {
|
|
5
|
+
phase: SessionPhase;
|
|
6
|
+
kind: SessionKind;
|
|
7
|
+
baseDir: string;
|
|
8
|
+
configPath: string | null;
|
|
9
|
+
runtimePath: string | null;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { SessionPayload };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UserConfig } from "../shared/types.cjs";
|
|
2
|
+
import { BuildResult } from "./build.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/tasks/watch.d.ts
|
|
5
|
+
type WatchResult = {
|
|
6
|
+
close: () => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
type WatchOptions = {
|
|
9
|
+
baseDir?: string;
|
|
10
|
+
debounceMs?: number;
|
|
11
|
+
onBuild?: (result: BuildResult) => void;
|
|
12
|
+
onError?: (error: Error) => void;
|
|
13
|
+
onReady?: () => void;
|
|
14
|
+
};
|
|
15
|
+
declare const runWatch: (userConfig: UserConfig, options?: WatchOptions) => Promise<WatchResult>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { WatchOptions, WatchResult, runWatch };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UserConfig } from "../shared/types.mjs";
|
|
2
|
+
import { BuildResult } from "./build.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/tasks/watch.d.ts
|
|
5
|
+
type WatchResult = {
|
|
6
|
+
close: () => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
type WatchOptions = {
|
|
9
|
+
baseDir?: string;
|
|
10
|
+
debounceMs?: number;
|
|
11
|
+
onBuild?: (result: BuildResult) => void;
|
|
12
|
+
onError?: (error: Error) => void;
|
|
13
|
+
onReady?: () => void;
|
|
14
|
+
};
|
|
15
|
+
declare const runWatch: (userConfig: UserConfig, options?: WatchOptions) => Promise<WatchResult>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { WatchOptions, WatchResult, runWatch };
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { DebugValue, UserConfig } from "../shared/types.cjs";
|
|
2
|
+
import { FrameworkDescriptor } from "../detect-fw/index.cjs";
|
|
3
|
+
import { Dictionary } from "../api/dictionary.cjs";
|
|
4
|
+
import { SessionPayload } from "../tasks/session.cjs";
|
|
5
|
+
|
|
6
|
+
//#region src/types/Plugin.d.ts
|
|
7
|
+
type BossPropPrimitive = string | number | boolean | null | undefined;
|
|
8
|
+
type BossProp = {
|
|
9
|
+
value: BossPropValue;
|
|
10
|
+
dynamic?: boolean;
|
|
11
|
+
isFn?: boolean;
|
|
12
|
+
ast?: unknown;
|
|
13
|
+
code?: string;
|
|
14
|
+
selectorValue?: unknown;
|
|
15
|
+
selectorName?: string;
|
|
16
|
+
classToken?: string;
|
|
17
|
+
important?: boolean;
|
|
18
|
+
named?: string;
|
|
19
|
+
rawName?: string;
|
|
20
|
+
query?: string | null;
|
|
21
|
+
tokenKey?: string;
|
|
22
|
+
tokenPath?: string;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
type BossPropTree = Record<string, BossProp>;
|
|
26
|
+
type BossPropValue = BossPropPrimitive | BossPropTree | BossProp[] | Record<string, unknown> | unknown[];
|
|
27
|
+
type BossParseInput = {
|
|
28
|
+
content: string;
|
|
29
|
+
path?: string;
|
|
30
|
+
file?: string;
|
|
31
|
+
preparedOnly?: boolean;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
};
|
|
34
|
+
type BossPropTreePayload = {
|
|
35
|
+
input: Record<string, unknown>;
|
|
36
|
+
tree: BossPropTree;
|
|
37
|
+
preferVariables?: boolean;
|
|
38
|
+
parser?: 'jsx' | 'classname' | string;
|
|
39
|
+
file?: BossParseInput | {
|
|
40
|
+
path?: string;
|
|
41
|
+
file?: string;
|
|
42
|
+
} | null;
|
|
43
|
+
code?: string;
|
|
44
|
+
};
|
|
45
|
+
type BossPropPayload = {
|
|
46
|
+
name: string;
|
|
47
|
+
prop: BossProp;
|
|
48
|
+
contexts: string[];
|
|
49
|
+
preferVariables?: boolean;
|
|
50
|
+
file?: BossParseInput | {
|
|
51
|
+
path?: string;
|
|
52
|
+
file?: string;
|
|
53
|
+
} | null;
|
|
54
|
+
};
|
|
55
|
+
type BossCompilePropPayload = {
|
|
56
|
+
name: string;
|
|
57
|
+
prop: BossProp;
|
|
58
|
+
output: Record<string, BossProp | unknown>;
|
|
59
|
+
tag?: string;
|
|
60
|
+
file?: BossParseInput | {
|
|
61
|
+
path?: string;
|
|
62
|
+
file?: string;
|
|
63
|
+
} | null;
|
|
64
|
+
keep?: boolean;
|
|
65
|
+
remove?: boolean;
|
|
66
|
+
};
|
|
67
|
+
type BossBrowserObjectPayload = {
|
|
68
|
+
input: Record<string, unknown>;
|
|
69
|
+
output?: Record<string, unknown>;
|
|
70
|
+
tag?: string;
|
|
71
|
+
contexts?: string[];
|
|
72
|
+
};
|
|
73
|
+
type BossMetaDataPayload = {
|
|
74
|
+
kind: string;
|
|
75
|
+
data?: unknown;
|
|
76
|
+
label?: string;
|
|
77
|
+
type?: string;
|
|
78
|
+
[key: string]: unknown;
|
|
79
|
+
};
|
|
80
|
+
type BossPluginEventName = 'onBoot' | 'onReady' | 'onParse' | 'onPropTree' | 'onProp' | 'onCompileProp' | 'onInit' | 'onBrowserObjectStart' | 'onSession' | 'onMetaData';
|
|
81
|
+
type BossPluginEventPayload = {
|
|
82
|
+
onBoot: void;
|
|
83
|
+
onReady: void;
|
|
84
|
+
onParse: BossParseInput;
|
|
85
|
+
onPropTree: BossPropTreePayload;
|
|
86
|
+
onProp: BossPropPayload;
|
|
87
|
+
onCompileProp: BossCompilePropPayload;
|
|
88
|
+
onInit: void;
|
|
89
|
+
onBrowserObjectStart: BossBrowserObjectPayload;
|
|
90
|
+
onSession: SessionPayload;
|
|
91
|
+
onMetaData: BossMetaDataPayload;
|
|
92
|
+
};
|
|
93
|
+
type BossCssSelectorInput = {
|
|
94
|
+
className?: string | null;
|
|
95
|
+
selector?: string | null;
|
|
96
|
+
pseudos?: string[];
|
|
97
|
+
query?: string | null;
|
|
98
|
+
source?: string | null;
|
|
99
|
+
};
|
|
100
|
+
type BossCssRuleOptions = {
|
|
101
|
+
important?: boolean;
|
|
102
|
+
};
|
|
103
|
+
type BossCssCustomBlock = {
|
|
104
|
+
start: number;
|
|
105
|
+
end: number;
|
|
106
|
+
cssText: string;
|
|
107
|
+
};
|
|
108
|
+
type BossLogger = {
|
|
109
|
+
namespace: string;
|
|
110
|
+
enabled: boolean;
|
|
111
|
+
log: (...args: any[]) => void;
|
|
112
|
+
child: (name: string) => BossLogger;
|
|
113
|
+
};
|
|
114
|
+
interface BossCssLike {
|
|
115
|
+
text: string;
|
|
116
|
+
source?: string | null;
|
|
117
|
+
setSource?: (source: string | null) => void;
|
|
118
|
+
selector: (input: BossCssSelectorInput) => void;
|
|
119
|
+
rule: (property: string, value: unknown, options?: BossCssRuleOptions) => void;
|
|
120
|
+
addRule: (rule: string, query?: string | null, source?: string | null) => void;
|
|
121
|
+
addImport: (url: string) => void;
|
|
122
|
+
addRoot: (value: string, source?: string | null) => void;
|
|
123
|
+
removeSource: (source: string | null | undefined) => void;
|
|
124
|
+
write: () => void;
|
|
125
|
+
reset: () => void;
|
|
126
|
+
snapshot?: () => unknown;
|
|
127
|
+
restore?: (snapshot: unknown) => void;
|
|
128
|
+
syncCustomBlocks?: (file: string | undefined, blocks: BossCssCustomBlock[]) => void;
|
|
129
|
+
getCustomText?: () => string;
|
|
130
|
+
current?: unknown;
|
|
131
|
+
imports?: Set<string>;
|
|
132
|
+
root?: Set<string>;
|
|
133
|
+
}
|
|
134
|
+
type BossFileSection = 'head' | 'import' | 'body' | 'foot';
|
|
135
|
+
type BossFileEntry = {
|
|
136
|
+
content: unknown;
|
|
137
|
+
test?: () => boolean;
|
|
138
|
+
};
|
|
139
|
+
interface BossFileBase {
|
|
140
|
+
get: (section: BossFileSection) => Map<unknown, BossFileEntry>;
|
|
141
|
+
set: (section: BossFileSection, key: unknown, content: unknown, test?: () => boolean) => this;
|
|
142
|
+
append: (section: BossFileSection, key: unknown, content: string, test?: () => boolean) => this;
|
|
143
|
+
prepend: (section: BossFileSection, key: unknown, content: string, test?: () => boolean) => this;
|
|
144
|
+
replace: (section: BossFileSection, key: unknown, callback: (value: BossFileEntry | BossFileEntry['content']) => BossFileEntry | string) => this;
|
|
145
|
+
write: () => Promise<void>;
|
|
146
|
+
text: string;
|
|
147
|
+
hasContent: boolean;
|
|
148
|
+
}
|
|
149
|
+
interface BossDtsFile extends BossFileBase {}
|
|
150
|
+
interface BossJsFile extends BossFileBase {
|
|
151
|
+
dts: BossDtsFile;
|
|
152
|
+
import: (options: {
|
|
153
|
+
name?: string | null;
|
|
154
|
+
from: string;
|
|
155
|
+
as?: string | null;
|
|
156
|
+
}, test?: () => boolean) => string;
|
|
157
|
+
importAndConfig: (options: {
|
|
158
|
+
name: string;
|
|
159
|
+
from: string;
|
|
160
|
+
}, test?: () => boolean) => string;
|
|
161
|
+
config: (options: {
|
|
162
|
+
from: string;
|
|
163
|
+
config: Record<string, unknown>;
|
|
164
|
+
}, test?: () => boolean) => void;
|
|
165
|
+
}
|
|
166
|
+
type BossApiFiles = {
|
|
167
|
+
js: BossJsFile;
|
|
168
|
+
native: BossJsFile;
|
|
169
|
+
[key: string]: BossJsFile;
|
|
170
|
+
};
|
|
171
|
+
type BossRuntimeAdapter = {
|
|
172
|
+
createElement: (component: unknown, props: Record<string, unknown> | null, children?: unknown, dev?: unknown) => unknown;
|
|
173
|
+
getChildren?: (restArgs: unknown[]) => unknown;
|
|
174
|
+
getFactoryChildren?: (props: unknown, ref: unknown, restArgs: unknown[]) => unknown;
|
|
175
|
+
applyRef?: (props: Record<string, unknown>, ref: unknown) => void;
|
|
176
|
+
getDev?: (ref: unknown, restArgs: unknown[]) => unknown;
|
|
177
|
+
};
|
|
178
|
+
type BossApiConfig = UserConfig & {
|
|
179
|
+
plugins?: BossPluginModule[] | unknown[];
|
|
180
|
+
debug?: DebugValue;
|
|
181
|
+
baseDir?: string;
|
|
182
|
+
runtimeApi?: BossRuntimeAdapter;
|
|
183
|
+
framework?: FrameworkDescriptor | UserConfig['framework'];
|
|
184
|
+
strategy?: string;
|
|
185
|
+
};
|
|
186
|
+
interface BossApiBase extends Omit<UserConfig, 'css' | 'plugins' | 'framework'> {
|
|
187
|
+
unit: string;
|
|
188
|
+
plugins: BossPluginModule[];
|
|
189
|
+
trigger: BossPluginTrigger;
|
|
190
|
+
dictionary: Dictionary;
|
|
191
|
+
css?: BossCssLike;
|
|
192
|
+
file?: BossApiFiles;
|
|
193
|
+
log: BossLogger;
|
|
194
|
+
isServer?: boolean;
|
|
195
|
+
isBrowser?: boolean;
|
|
196
|
+
baseDir?: string;
|
|
197
|
+
userConfig?: UserConfig;
|
|
198
|
+
framework?: FrameworkDescriptor | UserConfig['framework'];
|
|
199
|
+
strategy?: string;
|
|
200
|
+
emitAllTokens?: boolean;
|
|
201
|
+
runtimeApi?: BossRuntimeAdapter;
|
|
202
|
+
tokenVars?: (tokens?: Record<string, unknown>) => Record<string, string | number>;
|
|
203
|
+
tokenPropGroups?: Record<string, string[]>;
|
|
204
|
+
propTreeToObject: (tree: BossPropTree) => Record<string, unknown>;
|
|
205
|
+
propTreeToArray: (tree: BossProp[]) => unknown[];
|
|
206
|
+
propTreeToValue: (tree: BossPropTree | BossProp[] | BossProp | unknown) => unknown;
|
|
207
|
+
walkPropTree: (tree: BossPropTree, callback: (name: string, prop: BossProp) => void) => void;
|
|
208
|
+
objectToPropTree: (obj: Record<string, unknown>, output?: BossPropTree) => BossPropTree;
|
|
209
|
+
mapPropTree: (tree: BossPropTree, callback: (name: string, prop: BossProp, depth: number) => BossProp, depth?: number) => BossPropTree;
|
|
210
|
+
escapeClassName: (value: string) => string;
|
|
211
|
+
contextToCSSVariable: (name: string, value: unknown, contexts: string[], selectorPrefix?: string) => string;
|
|
212
|
+
contextToClassName: (name: string, value: unknown, contexts: string[], useSelector?: boolean, selectorPrefix?: string) => string;
|
|
213
|
+
camelCaseToDash: (value: string) => string;
|
|
214
|
+
dashToCamelCase: (value: string) => string;
|
|
215
|
+
classTokenToSelector: (value: string) => string;
|
|
216
|
+
applyChildSelectors: (selector: string, contexts: string[]) => string;
|
|
217
|
+
}
|
|
218
|
+
interface BossServerApi extends BossApiBase {
|
|
219
|
+
isServer: true;
|
|
220
|
+
css: BossCssLike;
|
|
221
|
+
file: BossApiFiles;
|
|
222
|
+
}
|
|
223
|
+
interface BossBrowserApi extends BossApiBase {
|
|
224
|
+
isBrowser: true;
|
|
225
|
+
}
|
|
226
|
+
type BossApi = BossServerApi | BossBrowserApi;
|
|
227
|
+
type BossPluginEventApiMap = {
|
|
228
|
+
onBoot: BossServerApi;
|
|
229
|
+
onReady: BossServerApi;
|
|
230
|
+
onParse: BossServerApi;
|
|
231
|
+
onPropTree: BossServerApi;
|
|
232
|
+
onProp: BossServerApi;
|
|
233
|
+
onCompileProp: BossServerApi;
|
|
234
|
+
onInit: BossBrowserApi;
|
|
235
|
+
onBrowserObjectStart: BossBrowserApi;
|
|
236
|
+
onSession: BossServerApi;
|
|
237
|
+
onMetaData: BossServerApi;
|
|
238
|
+
};
|
|
239
|
+
type BossPluginTest = (plugin: BossPluginModule) => boolean | Promise<boolean>;
|
|
240
|
+
type BossPluginHandler<Event extends BossPluginEventName> = BossPluginEventPayload[Event] extends void ? (api: BossPluginEventApiMap[Event], payload?: BossPluginEventPayload[Event]) => void | Promise<void> : (api: BossPluginEventApiMap[Event], payload: BossPluginEventPayload[Event]) => void | Promise<void>;
|
|
241
|
+
type BossPluginHandlers = { [Event in BossPluginEventName]?: BossPluginHandler<Event> | Array<BossPluginHandler<Event>> };
|
|
242
|
+
interface BossPluginModule extends BossPluginHandlers {
|
|
243
|
+
name: string;
|
|
244
|
+
dependencies?: Set<string>;
|
|
245
|
+
settings?: Map<string, unknown>;
|
|
246
|
+
[key: string]: unknown;
|
|
247
|
+
}
|
|
248
|
+
type BossPluginTrigger = <Event extends BossPluginEventName>(eventName: Event, payload?: BossPluginEventPayload[Event], test?: BossPluginTest) => void | Promise<void>;
|
|
249
|
+
type Plugin<T extends BossPluginEventName> = BossPluginHandler<T>;
|
|
250
|
+
//#endregion
|
|
251
|
+
export { BossApi, BossApiBase, BossApiConfig, BossApiFiles, BossBrowserApi, BossBrowserObjectPayload, BossCssCustomBlock, BossCssLike, BossCssRuleOptions, BossCssSelectorInput, BossDtsFile, BossFileBase, BossFileEntry, BossFileSection, BossJsFile, BossMetaDataPayload, BossParseInput, BossPluginEventName, BossPluginEventPayload, BossPluginHandler, BossPluginHandlers, BossPluginModule, BossPluginTest, BossPluginTrigger, BossProp, BossPropPayload, BossPropPrimitive, BossPropTree, BossPropTreePayload, BossPropValue, BossRuntimeAdapter, BossServerApi, Plugin };
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { DebugValue, UserConfig } from "../shared/types.mjs";
|
|
2
|
+
import { FrameworkDescriptor } from "../detect-fw/index.mjs";
|
|
3
|
+
import { Dictionary } from "../api/dictionary.mjs";
|
|
4
|
+
import { SessionPayload } from "../tasks/session.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/types/Plugin.d.ts
|
|
7
|
+
type BossPropPrimitive = string | number | boolean | null | undefined;
|
|
8
|
+
type BossProp = {
|
|
9
|
+
value: BossPropValue;
|
|
10
|
+
dynamic?: boolean;
|
|
11
|
+
isFn?: boolean;
|
|
12
|
+
ast?: unknown;
|
|
13
|
+
code?: string;
|
|
14
|
+
selectorValue?: unknown;
|
|
15
|
+
selectorName?: string;
|
|
16
|
+
classToken?: string;
|
|
17
|
+
important?: boolean;
|
|
18
|
+
named?: string;
|
|
19
|
+
rawName?: string;
|
|
20
|
+
query?: string | null;
|
|
21
|
+
tokenKey?: string;
|
|
22
|
+
tokenPath?: string;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
type BossPropTree = Record<string, BossProp>;
|
|
26
|
+
type BossPropValue = BossPropPrimitive | BossPropTree | BossProp[] | Record<string, unknown> | unknown[];
|
|
27
|
+
type BossParseInput = {
|
|
28
|
+
content: string;
|
|
29
|
+
path?: string;
|
|
30
|
+
file?: string;
|
|
31
|
+
preparedOnly?: boolean;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
};
|
|
34
|
+
type BossPropTreePayload = {
|
|
35
|
+
input: Record<string, unknown>;
|
|
36
|
+
tree: BossPropTree;
|
|
37
|
+
preferVariables?: boolean;
|
|
38
|
+
parser?: 'jsx' | 'classname' | string;
|
|
39
|
+
file?: BossParseInput | {
|
|
40
|
+
path?: string;
|
|
41
|
+
file?: string;
|
|
42
|
+
} | null;
|
|
43
|
+
code?: string;
|
|
44
|
+
};
|
|
45
|
+
type BossPropPayload = {
|
|
46
|
+
name: string;
|
|
47
|
+
prop: BossProp;
|
|
48
|
+
contexts: string[];
|
|
49
|
+
preferVariables?: boolean;
|
|
50
|
+
file?: BossParseInput | {
|
|
51
|
+
path?: string;
|
|
52
|
+
file?: string;
|
|
53
|
+
} | null;
|
|
54
|
+
};
|
|
55
|
+
type BossCompilePropPayload = {
|
|
56
|
+
name: string;
|
|
57
|
+
prop: BossProp;
|
|
58
|
+
output: Record<string, BossProp | unknown>;
|
|
59
|
+
tag?: string;
|
|
60
|
+
file?: BossParseInput | {
|
|
61
|
+
path?: string;
|
|
62
|
+
file?: string;
|
|
63
|
+
} | null;
|
|
64
|
+
keep?: boolean;
|
|
65
|
+
remove?: boolean;
|
|
66
|
+
};
|
|
67
|
+
type BossBrowserObjectPayload = {
|
|
68
|
+
input: Record<string, unknown>;
|
|
69
|
+
output?: Record<string, unknown>;
|
|
70
|
+
tag?: string;
|
|
71
|
+
contexts?: string[];
|
|
72
|
+
};
|
|
73
|
+
type BossMetaDataPayload = {
|
|
74
|
+
kind: string;
|
|
75
|
+
data?: unknown;
|
|
76
|
+
label?: string;
|
|
77
|
+
type?: string;
|
|
78
|
+
[key: string]: unknown;
|
|
79
|
+
};
|
|
80
|
+
type BossPluginEventName = 'onBoot' | 'onReady' | 'onParse' | 'onPropTree' | 'onProp' | 'onCompileProp' | 'onInit' | 'onBrowserObjectStart' | 'onSession' | 'onMetaData';
|
|
81
|
+
type BossPluginEventPayload = {
|
|
82
|
+
onBoot: void;
|
|
83
|
+
onReady: void;
|
|
84
|
+
onParse: BossParseInput;
|
|
85
|
+
onPropTree: BossPropTreePayload;
|
|
86
|
+
onProp: BossPropPayload;
|
|
87
|
+
onCompileProp: BossCompilePropPayload;
|
|
88
|
+
onInit: void;
|
|
89
|
+
onBrowserObjectStart: BossBrowserObjectPayload;
|
|
90
|
+
onSession: SessionPayload;
|
|
91
|
+
onMetaData: BossMetaDataPayload;
|
|
92
|
+
};
|
|
93
|
+
type BossCssSelectorInput = {
|
|
94
|
+
className?: string | null;
|
|
95
|
+
selector?: string | null;
|
|
96
|
+
pseudos?: string[];
|
|
97
|
+
query?: string | null;
|
|
98
|
+
source?: string | null;
|
|
99
|
+
};
|
|
100
|
+
type BossCssRuleOptions = {
|
|
101
|
+
important?: boolean;
|
|
102
|
+
};
|
|
103
|
+
type BossCssCustomBlock = {
|
|
104
|
+
start: number;
|
|
105
|
+
end: number;
|
|
106
|
+
cssText: string;
|
|
107
|
+
};
|
|
108
|
+
type BossLogger = {
|
|
109
|
+
namespace: string;
|
|
110
|
+
enabled: boolean;
|
|
111
|
+
log: (...args: any[]) => void;
|
|
112
|
+
child: (name: string) => BossLogger;
|
|
113
|
+
};
|
|
114
|
+
interface BossCssLike {
|
|
115
|
+
text: string;
|
|
116
|
+
source?: string | null;
|
|
117
|
+
setSource?: (source: string | null) => void;
|
|
118
|
+
selector: (input: BossCssSelectorInput) => void;
|
|
119
|
+
rule: (property: string, value: unknown, options?: BossCssRuleOptions) => void;
|
|
120
|
+
addRule: (rule: string, query?: string | null, source?: string | null) => void;
|
|
121
|
+
addImport: (url: string) => void;
|
|
122
|
+
addRoot: (value: string, source?: string | null) => void;
|
|
123
|
+
removeSource: (source: string | null | undefined) => void;
|
|
124
|
+
write: () => void;
|
|
125
|
+
reset: () => void;
|
|
126
|
+
snapshot?: () => unknown;
|
|
127
|
+
restore?: (snapshot: unknown) => void;
|
|
128
|
+
syncCustomBlocks?: (file: string | undefined, blocks: BossCssCustomBlock[]) => void;
|
|
129
|
+
getCustomText?: () => string;
|
|
130
|
+
current?: unknown;
|
|
131
|
+
imports?: Set<string>;
|
|
132
|
+
root?: Set<string>;
|
|
133
|
+
}
|
|
134
|
+
type BossFileSection = 'head' | 'import' | 'body' | 'foot';
|
|
135
|
+
type BossFileEntry = {
|
|
136
|
+
content: unknown;
|
|
137
|
+
test?: () => boolean;
|
|
138
|
+
};
|
|
139
|
+
interface BossFileBase {
|
|
140
|
+
get: (section: BossFileSection) => Map<unknown, BossFileEntry>;
|
|
141
|
+
set: (section: BossFileSection, key: unknown, content: unknown, test?: () => boolean) => this;
|
|
142
|
+
append: (section: BossFileSection, key: unknown, content: string, test?: () => boolean) => this;
|
|
143
|
+
prepend: (section: BossFileSection, key: unknown, content: string, test?: () => boolean) => this;
|
|
144
|
+
replace: (section: BossFileSection, key: unknown, callback: (value: BossFileEntry | BossFileEntry['content']) => BossFileEntry | string) => this;
|
|
145
|
+
write: () => Promise<void>;
|
|
146
|
+
text: string;
|
|
147
|
+
hasContent: boolean;
|
|
148
|
+
}
|
|
149
|
+
interface BossDtsFile extends BossFileBase {}
|
|
150
|
+
interface BossJsFile extends BossFileBase {
|
|
151
|
+
dts: BossDtsFile;
|
|
152
|
+
import: (options: {
|
|
153
|
+
name?: string | null;
|
|
154
|
+
from: string;
|
|
155
|
+
as?: string | null;
|
|
156
|
+
}, test?: () => boolean) => string;
|
|
157
|
+
importAndConfig: (options: {
|
|
158
|
+
name: string;
|
|
159
|
+
from: string;
|
|
160
|
+
}, test?: () => boolean) => string;
|
|
161
|
+
config: (options: {
|
|
162
|
+
from: string;
|
|
163
|
+
config: Record<string, unknown>;
|
|
164
|
+
}, test?: () => boolean) => void;
|
|
165
|
+
}
|
|
166
|
+
type BossApiFiles = {
|
|
167
|
+
js: BossJsFile;
|
|
168
|
+
native: BossJsFile;
|
|
169
|
+
[key: string]: BossJsFile;
|
|
170
|
+
};
|
|
171
|
+
type BossRuntimeAdapter = {
|
|
172
|
+
createElement: (component: unknown, props: Record<string, unknown> | null, children?: unknown, dev?: unknown) => unknown;
|
|
173
|
+
getChildren?: (restArgs: unknown[]) => unknown;
|
|
174
|
+
getFactoryChildren?: (props: unknown, ref: unknown, restArgs: unknown[]) => unknown;
|
|
175
|
+
applyRef?: (props: Record<string, unknown>, ref: unknown) => void;
|
|
176
|
+
getDev?: (ref: unknown, restArgs: unknown[]) => unknown;
|
|
177
|
+
};
|
|
178
|
+
type BossApiConfig = UserConfig & {
|
|
179
|
+
plugins?: BossPluginModule[] | unknown[];
|
|
180
|
+
debug?: DebugValue;
|
|
181
|
+
baseDir?: string;
|
|
182
|
+
runtimeApi?: BossRuntimeAdapter;
|
|
183
|
+
framework?: FrameworkDescriptor | UserConfig['framework'];
|
|
184
|
+
strategy?: string;
|
|
185
|
+
};
|
|
186
|
+
interface BossApiBase extends Omit<UserConfig, 'css' | 'plugins' | 'framework'> {
|
|
187
|
+
unit: string;
|
|
188
|
+
plugins: BossPluginModule[];
|
|
189
|
+
trigger: BossPluginTrigger;
|
|
190
|
+
dictionary: Dictionary;
|
|
191
|
+
css?: BossCssLike;
|
|
192
|
+
file?: BossApiFiles;
|
|
193
|
+
log: BossLogger;
|
|
194
|
+
isServer?: boolean;
|
|
195
|
+
isBrowser?: boolean;
|
|
196
|
+
baseDir?: string;
|
|
197
|
+
userConfig?: UserConfig;
|
|
198
|
+
framework?: FrameworkDescriptor | UserConfig['framework'];
|
|
199
|
+
strategy?: string;
|
|
200
|
+
emitAllTokens?: boolean;
|
|
201
|
+
runtimeApi?: BossRuntimeAdapter;
|
|
202
|
+
tokenVars?: (tokens?: Record<string, unknown>) => Record<string, string | number>;
|
|
203
|
+
tokenPropGroups?: Record<string, string[]>;
|
|
204
|
+
propTreeToObject: (tree: BossPropTree) => Record<string, unknown>;
|
|
205
|
+
propTreeToArray: (tree: BossProp[]) => unknown[];
|
|
206
|
+
propTreeToValue: (tree: BossPropTree | BossProp[] | BossProp | unknown) => unknown;
|
|
207
|
+
walkPropTree: (tree: BossPropTree, callback: (name: string, prop: BossProp) => void) => void;
|
|
208
|
+
objectToPropTree: (obj: Record<string, unknown>, output?: BossPropTree) => BossPropTree;
|
|
209
|
+
mapPropTree: (tree: BossPropTree, callback: (name: string, prop: BossProp, depth: number) => BossProp, depth?: number) => BossPropTree;
|
|
210
|
+
escapeClassName: (value: string) => string;
|
|
211
|
+
contextToCSSVariable: (name: string, value: unknown, contexts: string[], selectorPrefix?: string) => string;
|
|
212
|
+
contextToClassName: (name: string, value: unknown, contexts: string[], useSelector?: boolean, selectorPrefix?: string) => string;
|
|
213
|
+
camelCaseToDash: (value: string) => string;
|
|
214
|
+
dashToCamelCase: (value: string) => string;
|
|
215
|
+
classTokenToSelector: (value: string) => string;
|
|
216
|
+
applyChildSelectors: (selector: string, contexts: string[]) => string;
|
|
217
|
+
}
|
|
218
|
+
interface BossServerApi extends BossApiBase {
|
|
219
|
+
isServer: true;
|
|
220
|
+
css: BossCssLike;
|
|
221
|
+
file: BossApiFiles;
|
|
222
|
+
}
|
|
223
|
+
interface BossBrowserApi extends BossApiBase {
|
|
224
|
+
isBrowser: true;
|
|
225
|
+
}
|
|
226
|
+
type BossApi = BossServerApi | BossBrowserApi;
|
|
227
|
+
type BossPluginEventApiMap = {
|
|
228
|
+
onBoot: BossServerApi;
|
|
229
|
+
onReady: BossServerApi;
|
|
230
|
+
onParse: BossServerApi;
|
|
231
|
+
onPropTree: BossServerApi;
|
|
232
|
+
onProp: BossServerApi;
|
|
233
|
+
onCompileProp: BossServerApi;
|
|
234
|
+
onInit: BossBrowserApi;
|
|
235
|
+
onBrowserObjectStart: BossBrowserApi;
|
|
236
|
+
onSession: BossServerApi;
|
|
237
|
+
onMetaData: BossServerApi;
|
|
238
|
+
};
|
|
239
|
+
type BossPluginTest = (plugin: BossPluginModule) => boolean | Promise<boolean>;
|
|
240
|
+
type BossPluginHandler<Event extends BossPluginEventName> = BossPluginEventPayload[Event] extends void ? (api: BossPluginEventApiMap[Event], payload?: BossPluginEventPayload[Event]) => void | Promise<void> : (api: BossPluginEventApiMap[Event], payload: BossPluginEventPayload[Event]) => void | Promise<void>;
|
|
241
|
+
type BossPluginHandlers = { [Event in BossPluginEventName]?: BossPluginHandler<Event> | Array<BossPluginHandler<Event>> };
|
|
242
|
+
interface BossPluginModule extends BossPluginHandlers {
|
|
243
|
+
name: string;
|
|
244
|
+
dependencies?: Set<string>;
|
|
245
|
+
settings?: Map<string, unknown>;
|
|
246
|
+
[key: string]: unknown;
|
|
247
|
+
}
|
|
248
|
+
type BossPluginTrigger = <Event extends BossPluginEventName>(eventName: Event, payload?: BossPluginEventPayload[Event], test?: BossPluginTest) => void | Promise<void>;
|
|
249
|
+
type Plugin<T extends BossPluginEventName> = BossPluginHandler<T>;
|
|
250
|
+
//#endregion
|
|
251
|
+
export { BossApi, BossApiBase, BossApiConfig, BossApiFiles, BossBrowserApi, BossBrowserObjectPayload, BossCssCustomBlock, BossCssLike, BossCssRuleOptions, BossCssSelectorInput, BossDtsFile, BossFileBase, BossFileEntry, BossFileSection, BossJsFile, BossMetaDataPayload, BossParseInput, BossPluginEventName, BossPluginEventPayload, BossPluginHandler, BossPluginHandlers, BossPluginModule, BossPluginTest, BossPluginTrigger, BossProp, BossPropPayload, BossPropPrimitive, BossPropTree, BossPropTreePayload, BossPropValue, BossRuntimeAdapter, BossServerApi, Plugin };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Plugin } from "../../types/Plugin.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/use/token/browser.d.ts
|
|
4
|
+
type TokenFn = (() => string) & {
|
|
5
|
+
IS_TOKEN_FN?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type TokenProxy = TokenFn & {
|
|
8
|
+
[key: string]: TokenProxy;
|
|
9
|
+
};
|
|
10
|
+
declare const tokenVars: (input?: Record<string, unknown>) => Record<string, string | number>;
|
|
11
|
+
declare const onInit: Plugin<'onInit'>;
|
|
12
|
+
declare const create: (currentKey?: string) => TokenProxy;
|
|
13
|
+
declare const tokenPaths: Set<unknown>;
|
|
14
|
+
declare const onBrowserObjectStart: Plugin<'onBrowserObjectStart'>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { TokenProxy, create, onBrowserObjectStart, onInit, tokenPaths, tokenVars };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Plugin } from "../../types/Plugin.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/use/token/browser.d.ts
|
|
4
|
+
type TokenFn = (() => string) & {
|
|
5
|
+
IS_TOKEN_FN?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type TokenProxy = TokenFn & {
|
|
8
|
+
[key: string]: TokenProxy;
|
|
9
|
+
};
|
|
10
|
+
declare const tokenVars: (input?: Record<string, unknown>) => Record<string, string | number>;
|
|
11
|
+
declare const onInit: Plugin<'onInit'>;
|
|
12
|
+
declare const create: (currentKey?: string) => TokenProxy;
|
|
13
|
+
declare const tokenPaths: Set<unknown>;
|
|
14
|
+
declare const onBrowserObjectStart: Plugin<'onBrowserObjectStart'>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { TokenProxy, create, onBrowserObjectStart, onInit, tokenPaths, tokenVars };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/use/token/propMap.d.ts
|
|
2
|
+
declare const propMap: Map<string, string[] | Set<string>>;
|
|
3
|
+
declare const getTokenGroupsForProp: (prop: string) => string[];
|
|
4
|
+
declare const getTokenGroupForProp: (prop: string) => string;
|
|
5
|
+
declare const setTokenPropGroups: (groups: Record<string, string[]>) => void;
|
|
6
|
+
declare const getTokenPropGroups: () => Record<string, string[]>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getTokenGroupForProp, getTokenGroupsForProp, getTokenPropGroups, propMap, setTokenPropGroups };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/use/token/propMap.d.ts
|
|
2
|
+
declare const propMap: Map<string, string[] | Set<string>>;
|
|
3
|
+
declare const getTokenGroupsForProp: (prop: string) => string[];
|
|
4
|
+
declare const getTokenGroupForProp: (prop: string) => string;
|
|
5
|
+
declare const setTokenPropGroups: (groups: Record<string, string[]>) => void;
|
|
6
|
+
declare const getTokenPropGroups: () => Record<string, string[]>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getTokenGroupForProp, getTokenGroupsForProp, getTokenPropGroups, propMap, setTokenPropGroups };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BossBrowserApi, Plugin } from "../../types/Plugin.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/use/token/runtime-only.d.ts
|
|
4
|
+
type TokenFn = (() => string) & {
|
|
5
|
+
IS_TOKEN_FN?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type TokenProxy = TokenFn & {
|
|
8
|
+
[key: string]: TokenProxy;
|
|
9
|
+
};
|
|
10
|
+
declare const tokenVars: (input?: Record<string, unknown>) => Record<string, string | number>;
|
|
11
|
+
declare const onInit: Plugin<'onInit'>;
|
|
12
|
+
declare const create: (currentKey?: string) => TokenProxy;
|
|
13
|
+
declare const tokenPaths: Set<string>;
|
|
14
|
+
declare const resolveRuntimeToken: (api: BossBrowserApi, prop: string, value: unknown) => {
|
|
15
|
+
value: string | Record<string, any>;
|
|
16
|
+
selectorValue: string | Record<string, any>;
|
|
17
|
+
tokenKey: string;
|
|
18
|
+
tokenPath: string;
|
|
19
|
+
} | null;
|
|
20
|
+
declare const onBrowserObjectStart: Plugin<'onBrowserObjectStart'>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { TokenProxy, create, onBrowserObjectStart, onInit, resolveRuntimeToken, tokenPaths, tokenVars };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BossBrowserApi, Plugin } from "../../types/Plugin.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/use/token/runtime-only.d.ts
|
|
4
|
+
type TokenFn = (() => string) & {
|
|
5
|
+
IS_TOKEN_FN?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type TokenProxy = TokenFn & {
|
|
8
|
+
[key: string]: TokenProxy;
|
|
9
|
+
};
|
|
10
|
+
declare const tokenVars: (input?: Record<string, unknown>) => Record<string, string | number>;
|
|
11
|
+
declare const onInit: Plugin<'onInit'>;
|
|
12
|
+
declare const create: (currentKey?: string) => TokenProxy;
|
|
13
|
+
declare const tokenPaths: Set<string>;
|
|
14
|
+
declare const resolveRuntimeToken: (api: BossBrowserApi, prop: string, value: unknown) => {
|
|
15
|
+
value: string | Record<string, any>;
|
|
16
|
+
selectorValue: string | Record<string, any>;
|
|
17
|
+
tokenKey: string;
|
|
18
|
+
tokenPath: string;
|
|
19
|
+
} | null;
|
|
20
|
+
declare const onBrowserObjectStart: Plugin<'onBrowserObjectStart'>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { TokenProxy, create, onBrowserObjectStart, onInit, resolveRuntimeToken, tokenPaths, tokenVars };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Plugin } from "../../types/Plugin.cjs";
|
|
2
|
+
import { getTokenGroupForProp, getTokenGroupsForProp, getTokenPropGroups, propMap, setTokenPropGroups } from "./propMap.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/use/token/server.d.ts
|
|
5
|
+
declare const name = "token";
|
|
6
|
+
type TokenGroup = Record<string, unknown>;
|
|
7
|
+
type TokenValueMap = Map<string, TokenGroup> & {
|
|
8
|
+
asObject?: () => Record<string, TokenGroup>;
|
|
9
|
+
};
|
|
10
|
+
type TokenInput = Record<string, unknown>;
|
|
11
|
+
type TokenInputResolver = (values: TokenValueMap) => TokenInput;
|
|
12
|
+
declare const getTokens: () => TokenInput;
|
|
13
|
+
declare const set: (input: TokenInput | TokenInputResolver) => void;
|
|
14
|
+
declare const onBoot: Plugin<'onBoot'>;
|
|
15
|
+
declare const onReady: Plugin<'onReady'>;
|
|
16
|
+
declare const onParse: Plugin<'onParse'>;
|
|
17
|
+
declare const onPropTree: Plugin<'onPropTree'>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { getTokenGroupForProp, getTokenGroupsForProp, getTokenPropGroups, getTokens, name, onBoot, onParse, onPropTree, onReady, propMap, set, setTokenPropGroups };
|