@yak/solid 0.0.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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +126 -0
  3. package/dist/context/baseContext.d.ts +7 -0
  4. package/dist/context/baseContext.js +8 -0
  5. package/dist/context/baseContext.js.map +1 -0
  6. package/dist/context/index.d.ts +29 -0
  7. package/dist/context/index.js +17 -0
  8. package/dist/context/index.js.map +1 -0
  9. package/dist/index.d.ts +352 -0
  10. package/dist/index.js +2 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/internal.d.ts +473 -0
  13. package/dist/internal.js +382 -0
  14. package/dist/internal.js.map +1 -0
  15. package/dist/isolated-source-eval/index.d.ts +30 -0
  16. package/dist/isolated-source-eval/index.js +315 -0
  17. package/dist/isolated-source-eval/index.js.map +1 -0
  18. package/dist/isolated-source-eval/worker.js +59 -0
  19. package/dist/isolated-source-eval/worker.js.map +1 -0
  20. package/dist/loaders/vite-plugin.d.ts +116 -0
  21. package/dist/loaders/vite-plugin.js +862 -0
  22. package/dist/loaders/vite-plugin.js.map +1 -0
  23. package/loaders/vite-plugin.ts +29 -0
  24. package/package.json +108 -0
  25. package/runtime/__tests__/mergeClasses.test.ts +22 -0
  26. package/runtime/__tests__/reactivity.test.tsx +157 -0
  27. package/runtime/__tests__/styled.test.tsx +270 -0
  28. package/runtime/__tests__/testUtils.tsx +25 -0
  29. package/runtime/__tests__/tsconfig.json +9 -0
  30. package/runtime/__tests__/typeTest.tsx +62 -0
  31. package/runtime/atoms.ts +44 -0
  32. package/runtime/context/baseContext.ts +5 -0
  33. package/runtime/context/index.ts +37 -0
  34. package/runtime/cssLiteral.ts +215 -0
  35. package/runtime/cssProp.ts +26 -0
  36. package/runtime/globalStyle.ts +54 -0
  37. package/runtime/index.ts +39 -0
  38. package/runtime/internal.ts +41 -0
  39. package/runtime/internals/mergeClasses.ts +36 -0
  40. package/runtime/internals/mergeCssProp.ts +54 -0
  41. package/runtime/internals/unitPostFix.ts +34 -0
  42. package/runtime/keyframes.ts +30 -0
  43. package/runtime/mocks/cssLiteral.ts +74 -0
  44. package/runtime/mocks/globalStyle.ts +14 -0
  45. package/runtime/mocks/keyframes.ts +29 -0
  46. package/runtime/mocks/styled.ts +8 -0
  47. package/runtime/publicStyledApi.ts +177 -0
  48. package/runtime/styled.ts +393 -0
  49. package/runtime/styledDom.ts +139 -0
@@ -0,0 +1,382 @@
1
+ import { createMemo, merge } from "solid-js";
2
+ import { Dynamic, createComponent } from "@solidjs/web";
3
+ import { YakThemeContext, YakThemeProvider, useTheme, useTheme as useTheme$1 } from "@yak/solid/context";
4
+
5
+ //#region runtime/cssLiteral.ts
6
+ const yakComponentSymbol = Symbol("yak");
7
+ var Classes = class {
8
+ value;
9
+ constructor(initial) {
10
+ this.value = initial || "";
11
+ }
12
+ add(name) {
13
+ if (!this.value) this.value = name;
14
+ else if (!this.has(name)) this.value += " " + name;
15
+ }
16
+ has(name) {
17
+ return (" " + this.value + " ").includes(" " + name + " ");
18
+ }
19
+ delete(name) {
20
+ if (this.has(name)) this.value = this.value.split(" ").filter((existing) => existing !== name).join(" ");
21
+ }
22
+ };
23
+ function css(...args) {
24
+ let staticClass;
25
+ const dynamicCssFunctions = [];
26
+ for (const arg of args) if (typeof arg === "string") staticClass = arg;
27
+ else if (typeof arg === "function") dynamicCssFunctions.push(arg);
28
+ else if (typeof arg === "object" && "style" in arg) dynamicCssFunctions.push((props, _, style) => {
29
+ for (const key in arg.style) {
30
+ const value = arg.style[key];
31
+ if (typeof value === "function") style[key] = String(recursivePropExecution(props, value));
32
+ else style[key] = String(value);
33
+ }
34
+ });
35
+ if (dynamicCssFunctions.length === 0) return Object.assign((_, classes) => {
36
+ if (staticClass) classes.add(staticClass);
37
+ }, { $dynamic: false });
38
+ return Object.assign((props, classes, allStyles) => {
39
+ if (staticClass) classes.add(staticClass);
40
+ for (let i = 0; i < dynamicCssFunctions.length; i++) unwrapProps(props, dynamicCssFunctions[i], classes, allStyles);
41
+ }, { $dynamic: true });
42
+ }
43
+ const unwrapProps = (props, fn, classes, style) => {
44
+ let result = fn(props, classes, style);
45
+ while (result) {
46
+ if (typeof result === "function") {
47
+ result = result(props, classes, style);
48
+ continue;
49
+ } else if (typeof result === "object") {
50
+ const resultClass = "class" in result ? result.class : void 0;
51
+ if (resultClass) classes.add(resultClass);
52
+ if ("style" in result && result.style) for (const key in result.style) style[key] = result.style[key];
53
+ }
54
+ break;
55
+ }
56
+ };
57
+ const recursivePropExecution = (props, fn) => {
58
+ const result = fn(props);
59
+ if (typeof result === "function") return recursivePropExecution(props, result);
60
+ if (typeof result !== "string" && typeof result !== "number" && !(result instanceof String)) {
61
+ if (process.env.NODE_ENV === "development") throw new Error(`Dynamic CSS functions must return a string or number but returned ${JSON.stringify(result)}\n\nDynamic CSS function: ${fn.toString()}\n`);
62
+ }
63
+ return result;
64
+ };
65
+
66
+ //#endregion
67
+ //#region runtime/internals/mergeClasses.ts
68
+ const normalizeClass = (value) => {
69
+ if (!value) return "";
70
+ if (typeof value === "string") return value;
71
+ if (Array.isArray(value)) return value.map(normalizeClass).filter(Boolean).join(" ");
72
+ if (typeof value === "object") return Object.keys(value).filter((key) => value[key]).join(" ");
73
+ return String(value);
74
+ };
75
+ const mergeClasses = (yakClass, userClass) => {
76
+ const user = normalizeClass(userClass);
77
+ if (!yakClass) return user || void 0;
78
+ if (!user) return yakClass;
79
+ return yakClass + " " + user;
80
+ };
81
+
82
+ //#endregion
83
+ //#region runtime/styled.ts
84
+ const renderDynamic = (props) => createComponent(Dynamic, props);
85
+ const styledFactory = (Component) => Object.assign(yakStyled(Component), { attrs: (attrs) => yakStyled(Component, attrs) });
86
+ const styled = styledFactory;
87
+ const yakStyled = (Component, attrs) => {
88
+ const isYakComponent = typeof Component === "function" && Component[yakComponentSymbol] !== void 0;
89
+ const [, parentAttrsFn, parentRuntimeStylesFn, parentTarget] = isYakComponent ? Component[yakComponentSymbol] : [];
90
+ const targetComponent = isYakComponent ? parentTarget : Component;
91
+ const mergedAttrsFn = buildRuntimeAttrsProcessor(attrs, parentAttrsFn);
92
+ return (styles, ...values) => {
93
+ const runtimeStyleProcessor = buildRuntimeStylesProcessor(css(styles, ...values), parentRuntimeStylesFn);
94
+ const isTag = typeof targetComponent === "string";
95
+ const targetProps = isTag ? { component: targetComponent } : {};
96
+ const renderTarget = isTag ? renderDynamic : (finalProps) => createComponent(targetComponent, finalProps);
97
+ const Yak = !mergedAttrsFn && !runtimeStyleProcessor.$dynamic ? (props) => renderTarget(filterDomProps(merge(props, targetProps, { get class() {
98
+ const classes = new Classes(normalizeClass(props.class));
99
+ runtimeStyleProcessor(props, classes, void 0);
100
+ return classes.value || void 0;
101
+ } }))) : (props) => {
102
+ const theme = useTheme$1();
103
+ const propsWithTheme = merge({ theme }, props);
104
+ const attrsProps = mergedAttrsFn ? createMemo(() => mergedAttrsFn(propsWithTheme)) : void 0;
105
+ const styleInput = attrsProps ? merge(propsWithTheme, attrsProps) : propsWithTheme;
106
+ const computed = createMemo(() => {
107
+ const attrsResult = attrsProps?.();
108
+ const classes = new Classes(normalizeClass(props.class));
109
+ const attrsClass = normalizeClass(attrsResult?.class);
110
+ if (attrsClass) classes.add(attrsClass);
111
+ const style = runtimeStyleProcessor.$dynamic || attrsResult?.style ? {
112
+ ...unwrapStyle(props.style),
113
+ ...unwrapStyle(attrsResult?.style)
114
+ } : unwrapStyle(props.style);
115
+ runtimeStyleProcessor(styleInput, classes, style);
116
+ return {
117
+ class: classes.value || void 0,
118
+ style: style && Object.keys(style).length > 0 ? style : void 0
119
+ };
120
+ });
121
+ const merged = merge(props, attrsProps ?? {}, {
122
+ get class() {
123
+ return computed().class;
124
+ },
125
+ get style() {
126
+ return computed().style;
127
+ }
128
+ });
129
+ const allowTheme = () => {
130
+ const attrsResult = attrsProps?.();
131
+ return !!attrsResult && "theme" in attrsResult && attrsResult.theme !== theme;
132
+ };
133
+ return renderTarget(filterDomProps(merge(merged, targetProps), allowTheme));
134
+ };
135
+ return Object.assign(Yak, { [yakComponentSymbol]: [
136
+ Yak,
137
+ mergedAttrsFn,
138
+ runtimeStyleProcessor,
139
+ targetComponent
140
+ ] });
141
+ };
142
+ };
143
+ const unwrapStyle = (style) => {
144
+ if (typeof style !== "string") return style;
145
+ const result = {};
146
+ for (const declaration of style.split(";")) {
147
+ const colonIndex = declaration.indexOf(":");
148
+ if (colonIndex === -1) continue;
149
+ const property = declaration.slice(0, colonIndex).trim();
150
+ const value = declaration.slice(colonIndex + 1).trim();
151
+ if (property && value) result[property] = value;
152
+ }
153
+ return result;
154
+ };
155
+ const isBlockedProp = (key, allowTheme) => typeof key === "string" && (key.startsWith("$") || key === "theme" && !(allowTheme && allowTheme()));
156
+ const filterDomProps = (props, allowTheme) => new Proxy(props, {
157
+ get: (target, key) => isBlockedProp(key, allowTheme) ? void 0 : Reflect.get(target, key),
158
+ has: (target, key) => !isBlockedProp(key, allowTheme) && Reflect.has(target, key),
159
+ ownKeys: (target) => Reflect.ownKeys(target).filter((key) => !isBlockedProp(key, allowTheme)),
160
+ getOwnPropertyDescriptor: (target, key) => isBlockedProp(key, allowTheme) ? void 0 : Reflect.getOwnPropertyDescriptor(target, key)
161
+ });
162
+ const mergeClasses$1 = (a, b) => {
163
+ if (!a && !b) return void 0;
164
+ if (!a) return b;
165
+ if (!b) return a;
166
+ return a + " " + b;
167
+ };
168
+ const combineProps = (props, newProps) => newProps ? (props.class === newProps.class || !newProps.class) && (props.style === newProps.style || !newProps.style) ? {
169
+ ...props,
170
+ ...newProps
171
+ } : {
172
+ ...props,
173
+ ...newProps,
174
+ class: mergeClasses$1(props.class, newProps.class),
175
+ style: {
176
+ ...unwrapStyle(props.style),
177
+ ...unwrapStyle(newProps.style)
178
+ }
179
+ } : props;
180
+ const buildRuntimeAttrsProcessor = (attrs, parentAttrsFn) => {
181
+ const ownAttrsFn = attrs && (typeof attrs === "function" ? attrs : () => attrs);
182
+ if (ownAttrsFn && parentAttrsFn) return (props) => {
183
+ const parentProps = parentAttrsFn(props);
184
+ return combineProps(parentProps, ownAttrsFn(combineProps(props, parentProps)));
185
+ };
186
+ return ownAttrsFn || parentAttrsFn;
187
+ };
188
+ const buildRuntimeStylesProcessor = (runtimeStylesFn, parentRuntimeStylesFn) => {
189
+ if (runtimeStylesFn && parentRuntimeStylesFn) return Object.assign((props, classes, style) => {
190
+ parentRuntimeStylesFn(props, classes, style);
191
+ runtimeStylesFn(props, classes, style);
192
+ }, { $dynamic: runtimeStylesFn.$dynamic || parentRuntimeStylesFn.$dynamic });
193
+ return runtimeStylesFn || parentRuntimeStylesFn;
194
+ };
195
+
196
+ //#endregion
197
+ //#region runtime/atoms.ts
198
+ const atoms = (...atoms) => {
199
+ const staticClasses = [];
200
+ const dynamicFunctions = [];
201
+ for (const atom of atoms) if (typeof atom === "string") staticClasses.push(...atom.split(" "));
202
+ else if (typeof atom === "function") dynamicFunctions.push(atom);
203
+ return css(...staticClasses.length > 0 ? [(_, classes) => {
204
+ staticClasses.forEach((cls) => classes.add(cls));
205
+ }, ...dynamicFunctions] : dynamicFunctions);
206
+ };
207
+
208
+ //#endregion
209
+ //#region runtime/keyframes.ts
210
+ const keyframes = (styles, ..._dynamic) => {
211
+ return styles;
212
+ };
213
+
214
+ //#endregion
215
+ //#region runtime/globalStyle.ts
216
+ const globalStyle = (_styles, ..._values) => {};
217
+
218
+ //#endregion
219
+ //#region runtime/internals/unitPostFix.ts
220
+ const unitPostFix = (arg, unit) => {
221
+ switch (typeof arg) {
222
+ case "function": return (props) => unitPostFix(arg(props), unit);
223
+ case "number":
224
+ case "string": return `${arg}${unit}`;
225
+ default: return;
226
+ }
227
+ };
228
+
229
+ //#endregion
230
+ //#region runtime/internals/mergeCssProp.ts
231
+ const mergeCssProp = (relevantProps, cssProp) => {
232
+ const classes = new Classes(relevantProps.class);
233
+ const existingStyle = relevantProps.style;
234
+ const style = existingStyle ? { ...existingStyle } : {};
235
+ if (cssProp) cssProp({}, classes, style);
236
+ const result = { ...relevantProps };
237
+ if (Object.keys(style).length > 0) result.style = style;
238
+ else delete result.style;
239
+ if (classes.value) result.class = classes.value;
240
+ else delete result.class;
241
+ return result;
242
+ };
243
+
244
+ //#endregion
245
+ //#region runtime/styledDom.ts
246
+ const __yak_a = /*#__PURE__*/ styled("a");
247
+ const __yak_abbr = /*#__PURE__*/ styled("abbr");
248
+ const __yak_address = /*#__PURE__*/ styled("address");
249
+ const __yak_area = /*#__PURE__*/ styled("area");
250
+ const __yak_article = /*#__PURE__*/ styled("article");
251
+ const __yak_aside = /*#__PURE__*/ styled("aside");
252
+ const __yak_audio = /*#__PURE__*/ styled("audio");
253
+ const __yak_b = /*#__PURE__*/ styled("b");
254
+ const __yak_base = /*#__PURE__*/ styled("base");
255
+ const __yak_bdi = /*#__PURE__*/ styled("bdi");
256
+ const __yak_bdo = /*#__PURE__*/ styled("bdo");
257
+ const __yak_big = /*#__PURE__*/ styled("big");
258
+ const __yak_blockquote = /*#__PURE__*/ styled("blockquote");
259
+ const __yak_body = /*#__PURE__*/ styled("body");
260
+ const __yak_br = /*#__PURE__*/ styled("br");
261
+ const __yak_button = /*#__PURE__*/ styled("button");
262
+ const __yak_canvas = /*#__PURE__*/ styled("canvas");
263
+ const __yak_caption = /*#__PURE__*/ styled("caption");
264
+ const __yak_cite = /*#__PURE__*/ styled("cite");
265
+ const __yak_code = /*#__PURE__*/ styled("code");
266
+ const __yak_col = /*#__PURE__*/ styled("col");
267
+ const __yak_colgroup = /*#__PURE__*/ styled("colgroup");
268
+ const __yak_data = /*#__PURE__*/ styled("data");
269
+ const __yak_datalist = /*#__PURE__*/ styled("datalist");
270
+ const __yak_dd = /*#__PURE__*/ styled("dd");
271
+ const __yak_del = /*#__PURE__*/ styled("del");
272
+ const __yak_details = /*#__PURE__*/ styled("details");
273
+ const __yak_dfn = /*#__PURE__*/ styled("dfn");
274
+ const __yak_dialog = /*#__PURE__*/ styled("dialog");
275
+ const __yak_div = /*#__PURE__*/ styled("div");
276
+ const __yak_dl = /*#__PURE__*/ styled("dl");
277
+ const __yak_dt = /*#__PURE__*/ styled("dt");
278
+ const __yak_em = /*#__PURE__*/ styled("em");
279
+ const __yak_embed = /*#__PURE__*/ styled("embed");
280
+ const __yak_fieldset = /*#__PURE__*/ styled("fieldset");
281
+ const __yak_figcaption = /*#__PURE__*/ styled("figcaption");
282
+ const __yak_figure = /*#__PURE__*/ styled("figure");
283
+ const __yak_footer = /*#__PURE__*/ styled("footer");
284
+ const __yak_form = /*#__PURE__*/ styled("form");
285
+ const __yak_h1 = /*#__PURE__*/ styled("h1");
286
+ const __yak_h2 = /*#__PURE__*/ styled("h2");
287
+ const __yak_h3 = /*#__PURE__*/ styled("h3");
288
+ const __yak_h4 = /*#__PURE__*/ styled("h4");
289
+ const __yak_h5 = /*#__PURE__*/ styled("h5");
290
+ const __yak_h6 = /*#__PURE__*/ styled("h6");
291
+ const __yak_header = /*#__PURE__*/ styled("header");
292
+ const __yak_hgroup = /*#__PURE__*/ styled("hgroup");
293
+ const __yak_hr = /*#__PURE__*/ styled("hr");
294
+ const __yak_html = /*#__PURE__*/ styled("html");
295
+ const __yak_i = /*#__PURE__*/ styled("i");
296
+ const __yak_iframe = /*#__PURE__*/ styled("iframe");
297
+ const __yak_img = /*#__PURE__*/ styled("img");
298
+ const __yak_input = /*#__PURE__*/ styled("input");
299
+ const __yak_ins = /*#__PURE__*/ styled("ins");
300
+ const __yak_kbd = /*#__PURE__*/ styled("kbd");
301
+ const __yak_keygen = /*#__PURE__*/ styled("keygen");
302
+ const __yak_label = /*#__PURE__*/ styled("label");
303
+ const __yak_legend = /*#__PURE__*/ styled("legend");
304
+ const __yak_li = /*#__PURE__*/ styled("li");
305
+ const __yak_link = /*#__PURE__*/ styled("link");
306
+ const __yak_main = /*#__PURE__*/ styled("main");
307
+ const __yak_map = /*#__PURE__*/ styled("map");
308
+ const __yak_mark = /*#__PURE__*/ styled("mark");
309
+ const __yak_menu = /*#__PURE__*/ styled("menu");
310
+ const __yak_menuitem = /*#__PURE__*/ styled("menuitem");
311
+ const __yak_meta = /*#__PURE__*/ styled("meta");
312
+ const __yak_meter = /*#__PURE__*/ styled("meter");
313
+ const __yak_nav = /*#__PURE__*/ styled("nav");
314
+ const __yak_noscript = /*#__PURE__*/ styled("noscript");
315
+ const __yak_object = /*#__PURE__*/ styled("object");
316
+ const __yak_ol = /*#__PURE__*/ styled("ol");
317
+ const __yak_optgroup = /*#__PURE__*/ styled("optgroup");
318
+ const __yak_option = /*#__PURE__*/ styled("option");
319
+ const __yak_output = /*#__PURE__*/ styled("output");
320
+ const __yak_p = /*#__PURE__*/ styled("p");
321
+ const __yak_param = /*#__PURE__*/ styled("param");
322
+ const __yak_picture = /*#__PURE__*/ styled("picture");
323
+ const __yak_pre = /*#__PURE__*/ styled("pre");
324
+ const __yak_progress = /*#__PURE__*/ styled("progress");
325
+ const __yak_q = /*#__PURE__*/ styled("q");
326
+ const __yak_rp = /*#__PURE__*/ styled("rp");
327
+ const __yak_rt = /*#__PURE__*/ styled("rt");
328
+ const __yak_ruby = /*#__PURE__*/ styled("ruby");
329
+ const __yak_s = /*#__PURE__*/ styled("s");
330
+ const __yak_samp = /*#__PURE__*/ styled("samp");
331
+ const __yak_script = /*#__PURE__*/ styled("script");
332
+ const __yak_section = /*#__PURE__*/ styled("section");
333
+ const __yak_select = /*#__PURE__*/ styled("select");
334
+ const __yak_small = /*#__PURE__*/ styled("small");
335
+ const __yak_source = /*#__PURE__*/ styled("source");
336
+ const __yak_span = /*#__PURE__*/ styled("span");
337
+ const __yak_strong = /*#__PURE__*/ styled("strong");
338
+ const __yak_style = /*#__PURE__*/ styled("style");
339
+ const __yak_sub = /*#__PURE__*/ styled("sub");
340
+ const __yak_summary = /*#__PURE__*/ styled("summary");
341
+ const __yak_sup = /*#__PURE__*/ styled("sup");
342
+ const __yak_table = /*#__PURE__*/ styled("table");
343
+ const __yak_tbody = /*#__PURE__*/ styled("tbody");
344
+ const __yak_td = /*#__PURE__*/ styled("td");
345
+ const __yak_textarea = /*#__PURE__*/ styled("textarea");
346
+ const __yak_tfoot = /*#__PURE__*/ styled("tfoot");
347
+ const __yak_th = /*#__PURE__*/ styled("th");
348
+ const __yak_thead = /*#__PURE__*/ styled("thead");
349
+ const __yak_time = /*#__PURE__*/ styled("time");
350
+ const __yak_tr = /*#__PURE__*/ styled("tr");
351
+ const __yak_track = /*#__PURE__*/ styled("track");
352
+ const __yak_u = /*#__PURE__*/ styled("u");
353
+ const __yak_ul = /*#__PURE__*/ styled("ul");
354
+ const __yak_use = /*#__PURE__*/ styled("use");
355
+ const __yak_var = /*#__PURE__*/ styled("var");
356
+ const __yak_video = /*#__PURE__*/ styled("video");
357
+ const __yak_wbr = /*#__PURE__*/ styled("wbr");
358
+ const __yak_circle = /*#__PURE__*/ styled("circle");
359
+ const __yak_clipPath = /*#__PURE__*/ styled("clipPath");
360
+ const __yak_defs = /*#__PURE__*/ styled("defs");
361
+ const __yak_ellipse = /*#__PURE__*/ styled("ellipse");
362
+ const __yak_foreignObject = /*#__PURE__*/ styled("foreignObject");
363
+ const __yak_g = /*#__PURE__*/ styled("g");
364
+ const __yak_image = /*#__PURE__*/ styled("image");
365
+ const __yak_line = /*#__PURE__*/ styled("line");
366
+ const __yak_linearGradient = /*#__PURE__*/ styled("linearGradient");
367
+ const __yak_marker = /*#__PURE__*/ styled("marker");
368
+ const __yak_mask = /*#__PURE__*/ styled("mask");
369
+ const __yak_path = /*#__PURE__*/ styled("path");
370
+ const __yak_pattern = /*#__PURE__*/ styled("pattern");
371
+ const __yak_polygon = /*#__PURE__*/ styled("polygon");
372
+ const __yak_polyline = /*#__PURE__*/ styled("polyline");
373
+ const __yak_radialGradient = /*#__PURE__*/ styled("radialGradient");
374
+ const __yak_rect = /*#__PURE__*/ styled("rect");
375
+ const __yak_stop = /*#__PURE__*/ styled("stop");
376
+ const __yak_svg = /*#__PURE__*/ styled("svg");
377
+ const __yak_text = /*#__PURE__*/ styled("text");
378
+ const __yak_tspan = /*#__PURE__*/ styled("tspan");
379
+
380
+ //#endregion
381
+ export { YakThemeContext, YakThemeProvider, __yak_a, __yak_abbr, __yak_address, __yak_area, __yak_article, __yak_aside, __yak_audio, __yak_b, __yak_base, __yak_bdi, __yak_bdo, __yak_big, __yak_blockquote, __yak_body, __yak_br, __yak_button, __yak_canvas, __yak_caption, __yak_circle, __yak_cite, __yak_clipPath, __yak_code, __yak_col, __yak_colgroup, __yak_data, __yak_datalist, __yak_dd, __yak_defs, __yak_del, __yak_details, __yak_dfn, __yak_dialog, __yak_div, __yak_dl, __yak_dt, __yak_ellipse, __yak_em, __yak_embed, __yak_fieldset, __yak_figcaption, __yak_figure, __yak_footer, __yak_foreignObject, __yak_form, __yak_g, __yak_h1, __yak_h2, __yak_h3, __yak_h4, __yak_h5, __yak_h6, __yak_header, __yak_hgroup, __yak_hr, __yak_html, __yak_i, __yak_iframe, __yak_image, __yak_img, __yak_input, __yak_ins, __yak_kbd, __yak_keygen, __yak_label, __yak_legend, __yak_li, __yak_line, __yak_linearGradient, __yak_link, __yak_main, __yak_map, __yak_mark, __yak_marker, __yak_mask, __yak_menu, __yak_menuitem, mergeClasses as __yak_mergeClassNames, mergeCssProp as __yak_mergeCssProp, __yak_meta, __yak_meter, __yak_nav, __yak_noscript, __yak_object, __yak_ol, __yak_optgroup, __yak_option, __yak_output, __yak_p, __yak_param, __yak_path, __yak_pattern, __yak_picture, __yak_polygon, __yak_polyline, __yak_pre, __yak_progress, __yak_q, __yak_radialGradient, __yak_rect, __yak_rp, __yak_rt, __yak_ruby, __yak_s, __yak_samp, __yak_script, __yak_section, __yak_select, __yak_small, __yak_source, __yak_span, __yak_stop, __yak_strong, __yak_style, __yak_sub, __yak_summary, __yak_sup, __yak_svg, __yak_table, __yak_tbody, __yak_td, __yak_text, __yak_textarea, __yak_tfoot, __yak_th, __yak_thead, __yak_time, __yak_tr, __yak_track, __yak_tspan, __yak_u, __yak_ul, unitPostFix as __yak_unitPostFix, __yak_use, __yak_var, __yak_video, __yak_wbr, atoms, css, globalStyle, keyframes, styled, useTheme };
382
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","names":["useTheme","mergeClasses"],"sources":["../runtime/cssLiteral.ts","../runtime/internals/mergeClasses.ts","../runtime/styled.ts","../runtime/atoms.ts","../runtime/keyframes.ts","../runtime/globalStyle.ts","../runtime/internals/unitPostFix.ts","../runtime/internals/mergeCssProp.ts","../runtime/styledDom.ts"],"sourcesContent":["import type { YakTheme } from \"./index.ts\";\nimport type { Accessor } from \"solid-js\";\nimport { ClassCollector, RuntimeStyleProcessor, StyleObject } from \"./publicStyledApi.js\";\n\nexport const yakComponentSymbol = Symbol(\"yak\");\n\n/**\n * Collects class names as a single space-separated string.\n *\n * `add` is the render hot path and stays a plain string append;\n * `has`/`delete` keep a Set-like contract for the rare runtime\n * functions that remove classes again (e.g. atoms).\n */\nexport class Classes implements ClassCollector {\n value: string;\n constructor(initial?: string) {\n this.value = initial || \"\";\n }\n add(name: string) {\n if (!this.value) {\n this.value = name;\n } else if (!this.has(name)) {\n this.value += \" \" + name;\n }\n }\n has(name: string) {\n return (\" \" + this.value + \" \").includes(\" \" + name + \" \");\n }\n delete(name: string) {\n if (this.has(name)) {\n this.value = this.value\n .split(\" \")\n .filter((existing) => existing !== name)\n .join(\" \");\n }\n }\n}\n\nexport type ComponentStyles<TProps> = (props: TProps) => {\n class: string;\n style?: {\n [key: string]: string;\n };\n};\n\nexport type CSSInterpolation<TProps> =\n | string\n | number\n | undefined\n | null\n | false\n | ComponentStyles<TProps>\n | {\n // type only identifier to allow targeting components\n // e.g. styled.svg`${Button}:hover & { fill: red; }`\n [yakComponentSymbol]: any;\n }\n | ((props: TProps) => CSSInterpolation<TProps>);\n\ntype CSSStyles<TProps = {}> = {\n style: { [key: string]: string | ((props: TProps) => string) };\n};\n\ntype CSSFunction = <TProps = {}>(\n styles: TemplateStringsArray,\n ...values: CSSInterpolation<TProps & { theme: Accessor<YakTheme> }>[]\n) => ComponentStyles<TProps>;\n\nexport type NestedRuntimeStyleProcessor = (\n props: unknown,\n classes: ClassCollector,\n style: StyleObject,\n) =>\n | {\n class?: string;\n style?: StyleObject;\n }\n | void\n | NestedRuntimeStyleProcessor;\n\n/**\n * css() runtime factory of css``\n *\n * /!\\ @yak/solid transpiles css`` and styled``\n *\n * This changes the typings of the css`` and styled`` functions.\n * During development the user of @yak/solid wants to work with the\n * typings BEFORE compilation.\n *\n * Therefore this is only an internal function only and it must be cast to any\n * before exported to the user.\n *\n * The internal functioning of css`` is to return a single callback function that runs all functions\n * (or creates new ones if needed) that are passed as arguments. These functions receive the props, classes, and style object as arguments\n * and operate directly on the classes and style objects.\n */\nexport function css<TProps>(\n styles: TemplateStringsArray,\n ...values: CSSInterpolation<NoInfer<TProps> & { theme: Accessor<YakTheme> }>[]\n): ComponentStyles<TProps>;\nexport function css<TProps>(...args: Array<any>): RuntimeStyleProcessor<TProps> {\n // Normally this could be an array of strings passed, but as we transpile the usage of css`` ourselves, we control the arguments\n // and ensure that only the first argument is a string (class name of the non-dynamic styles)\n let staticClass: string | undefined;\n const dynamicCssFunctions: NestedRuntimeStyleProcessor[] = [];\n for (const arg of args as Array<string | CSSFunction | CSSStyles<any>>) {\n // A CSS-module class name which got auto generated during build from static css\n // e.g. css`color: red;`\n // compiled -> css(\"yak31e4\")\n if (typeof arg === \"string\") {\n staticClass = arg;\n }\n // Dynamic CSS e.g.\n // css`${props => props.active && css`color: red;`}`\n // compiled -> css((props: { active: boolean }) => props.active && css(\"yak31e4\"))\n else if (typeof arg === \"function\") {\n dynamicCssFunctions.push(arg as unknown as NestedRuntimeStyleProcessor);\n }\n // Dynamic CSS with css variables e.g.\n // css`transform: translate(${props => props.x}, ${props => props.y});`\n // compiled -> css(\"yak31e4\", { style: { \"--yakVarX\": props => props.x }, \"--yakVarY\": props => props.y }})\n else if (typeof arg === \"object\" && \"style\" in arg) {\n dynamicCssFunctions.push((props, _, style) => {\n for (const key in arg.style) {\n const value = arg.style[key];\n if (typeof value === \"function\") {\n style[key as keyof StyleObject] = String(\n // The value for a css value can be a theme dependent function e.g.:\n // const borderColor = (props: { theme: { mode: \"dark\" | \"light\" } }) => props.theme === \"dark\" ? \"black\" : \"white\";\n // css`border-color: ${borderColor};`\n // Therefore the value has to be extracted recursively\n recursivePropExecution(props, value),\n ) as never;\n } else {\n style[key as keyof StyleObject] = String(value) as never;\n }\n }\n });\n }\n }\n\n // Non Dynamic CSS\n // This is just an optimization for the common case where there are no dynamic css functions\n // `$dynamic: false` lets the styled runtime skip theme lookup and\n // style-object allocation entirely for static components\n if (dynamicCssFunctions.length === 0) {\n return Object.assign(\n (_: unknown, classes: ClassCollector) => {\n if (staticClass) {\n classes.add(staticClass);\n }\n },\n { $dynamic: false },\n );\n }\n\n return Object.assign(\n (props: TProps, classes: ClassCollector, allStyles: StyleObject) => {\n if (staticClass) {\n classes.add(staticClass);\n }\n for (let i = 0; i < dynamicCssFunctions.length; i++) {\n unwrapProps(props, dynamicCssFunctions[i], classes, allStyles);\n }\n },\n { $dynamic: true },\n );\n}\n\n// Dynamic CSS with runtime logic\nconst unwrapProps = (\n props: unknown,\n fn: NestedRuntimeStyleProcessor,\n classes: ClassCollector,\n style: StyleObject,\n) => {\n let result = fn(props, classes, style);\n while (result) {\n if (typeof result === \"function\") {\n result = result(props, classes, style);\n continue;\n } else if (typeof result === \"object\") {\n const resultClass = \"class\" in result ? result.class : undefined;\n if (resultClass) {\n classes.add(resultClass);\n }\n if (\"style\" in result && result.style) {\n for (const key in result.style) {\n // This is hard for typescript to infer\n style[key as keyof StyleObject] = result.style[key as keyof StyleObject] as any;\n }\n }\n }\n break;\n }\n};\n\nconst recursivePropExecution = (props: unknown, fn: (props: unknown) => any): string | number => {\n const result = fn(props);\n if (typeof result === \"function\") {\n return recursivePropExecution(props, result);\n }\n // typeof guards first: the `process.env` lookup is a real per-call cost\n // for unbundled Node consumers, so it must only run on the invalid path\n if (typeof result !== \"string\" && typeof result !== \"number\" && !(result instanceof String)) {\n if (process.env.NODE_ENV === \"development\") {\n throw new Error(\n `Dynamic CSS functions must return a string or number but returned ${JSON.stringify(\n result,\n )}\\n\\nDynamic CSS function: ${fn.toString()}\\n`,\n );\n }\n }\n return result;\n};\n","/**\n * Normalize Solid `class` values for string merging.\n * Solid 2 allows strings, arrays and object syntax on the class attribute.\n */\nexport const normalizeClass = (value: unknown): string => {\n if (!value) return \"\";\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) return value.map(normalizeClass).filter(Boolean).join(\" \");\n if (typeof value === \"object\") {\n return Object.keys(value)\n .filter((key) => (value as Record<string, unknown>)[key])\n .join(\" \");\n }\n return String(value);\n};\n\n/**\n * Merges the folded yak class name with a user `class` value.\n *\n * Injected by the compiler (as `__yak_mergeClassNames`) when it replaces a JSX\n * usage of a fully static styled component with a plain element:\n * ```tsx\n * const Card = styled.div`color: red;`;\n * <Card class={active() && \"active\"} />\n * ```\n * becomes\n * ```tsx\n * <div class={__yak_mergeClassNames(\"yX\", active() && \"active\")} />\n * ```\n */\nexport const mergeClasses = (yakClass: string, userClass: unknown): string | undefined => {\n const user = normalizeClass(userClass);\n if (!yakClass) return user || undefined;\n if (!user) return yakClass;\n return yakClass + \" \" + user;\n};\n","import { css, CSSInterpolation, Classes, yakComponentSymbol } from \"./cssLiteral.js\";\nimport type {\n AnyComponent,\n Attrs,\n AttrsMerged,\n Styled,\n YakComponent,\n AttrsFunction,\n StyledFn,\n HtmlTags,\n Substitute,\n StyledLiteral,\n RuntimeStyleProcessor,\n StyleObject,\n} from \"./publicStyledApi.js\";\nimport { createMemo, merge } from \"solid-js\";\nimport { createComponent, Dynamic, type JSX } from \"@solidjs/web\";\nimport { normalizeClass } from \"./internals/mergeClasses.js\";\n// the following import is not relative but the package-level \"@yak/solid/context\"\n// export: it keeps a single context instance shared between the bundled runtime\n// and user code (and lets the vite plugin alias the user's theme context)\nimport { useTheme } from \"@yak/solid/context\";\nimport type { YakTheme } from \"./context/index.js\";\nimport type { Accessor } from \"solid-js\";\n\n//\n// The `styled()` API without `styled.` syntax\n//\n// The API design is inspired by styled-components:\n// https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/constructors/styled.tsx\n// https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/models/StyledComponent.ts\n//\n/**\n * Renders `props.component` (a tag name or component) with the remaining\n * props. Loosely typed on purpose: the runtime passes lazily-merged Proxy\n * props that no concrete component type can describe.\n */\nconst renderDynamic = (props: Record<PropertyKey, unknown>): JSX.Element =>\n createComponent(Dynamic as (props: Record<PropertyKey, unknown>) => JSX.Element, props);\n\nconst styledFactory: StyledFn = (Component) =>\n Object.assign(yakStyled(Component), {\n attrs: (attrs: Attrs<any>) => yakStyled(Component, attrs),\n });\n\n/**\n * The `styled` method works perfectly on all of your own or any third-party component,\n * as long as they attach the passed `class` prop to a DOM element.\n *\n * @usage\n *\n * ```tsx\n * const StyledLink = styled(Link)`\n * color: #BF4F74;\n * font-weight: bold;\n * `;\n * ```\n */\nexport const styled = styledFactory as Styled;\n\ntype PropsWithClassAndStyle = {\n class?: string;\n style?: StyleObject | string;\n theme?: Accessor<YakTheme>;\n} & Record<string, unknown>;\n\nconst yakStyled: StyledInternal = (Component, attrs) => {\n // Probe with a property read, not the `in` operator: in dev, solid-refresh\n // wraps registered components in a Proxy that forwards `get` to the live\n // implementation but has no `has` trap, so `in` would miss the symbol and\n // silently skip chain flattening (breaking attrs override order).\n const isYakComponent =\n typeof Component === \"function\" &&\n (Component as Partial<YakComponent<unknown>>)[yakComponentSymbol] !== undefined;\n\n // if the component that is wrapped is a yak component, we can extract the attrs function\n // and the dynamic style function to merge it with the current attrs function (or dynamic\n // style function) so that the sequence of the attrs functions is preserved\n const [, parentAttrsFn, parentRuntimeStylesFn, parentTarget] = isYakComponent\n ? ((Component as YakComponent<unknown>)[yakComponentSymbol] as unknown as [\n YakComponent<unknown>,\n ExtractAttrsFunction<typeof attrs>,\n RuntimeStyleProcessor<unknown>,\n AnyComponent<any> | string,\n ])\n : [];\n\n // the ultimate render target of the whole styled(styled(...)) chain:\n // attrs and style processors are already merged at construction time, so\n // a chain of N levels renders the target directly in ONE component instead\n // of re-entering every parent wrapper per element\n const targetComponent = (isYakComponent ? parentTarget : Component) as AnyComponent<any> | string;\n\n const mergedAttrsFn = buildRuntimeAttrsProcessor(attrs, parentAttrsFn);\n\n return (styles, ...values) => {\n // combine all interpolated logic into a single function\n // e.g. styled.button`color: ${props => props.color}; margin: ${props => props.margin};`\n const runtimeStylesFn = css(\n styles,\n ...(values as CSSInterpolation<unknown>[]),\n ) as RuntimeStyleProcessor<unknown>;\n const runtimeStyleProcessor = buildRuntimeStylesProcessor(\n runtimeStylesFn,\n parentRuntimeStylesFn,\n );\n\n // decided once per styled component: tag names render through Dynamic\n // (which needs a `component` prop), component targets are called\n // directly so a user prop named `component` reaches them (Dynamic\n // would consume it). `targetProps` is merged BEFORE filterDomProps -\n // the filter proxy must stay the outermost layer (see filterDomProps)\n const isTag = typeof targetComponent === \"string\";\n const targetProps = isTag ? { component: targetComponent } : {};\n const renderTarget = isTag\n ? renderDynamic\n : (finalProps: Record<PropertyKey, unknown>) =>\n createComponent(\n targetComponent as (props: Record<PropertyKey, unknown>) => JSX.Element,\n finalProps,\n );\n\n // fast path for fully static components (no attrs, no dynamic styles;\n // the most common case): contribute the chain's class names through a\n // single reactive `class` getter and strip $-props; skips theme lookup,\n // memo creation and style handling entirely\n const Yak: AnyComponent<PropsWithClassAndStyle> =\n !mergedAttrsFn && !runtimeStyleProcessor.$dynamic\n ? (props) =>\n renderTarget(\n filterDomProps(\n merge(props, targetProps, {\n // reading props.class inside the getter keeps the class\n // binding reactive without re-creating the element\n get class(): string | undefined {\n const classes = new Classes(normalizeClass(props.class));\n runtimeStyleProcessor(props, classes, undefined as unknown as StyleObject);\n return classes.value || undefined;\n },\n }),\n ),\n )\n : (props) => {\n // the component body runs ONCE in Solid: all per-update work\n // lives in memos/getters so only the affected DOM bindings update\n\n // attrs functions and dynamic style functions receive the theme;\n // fully static components take the fast path above and never\n // subscribe to the theme context\n const theme = useTheme();\n\n // getter-preserving merge: compiled prop functions like\n // `({ $bottom }) => ...` destructure this proxy INSIDE the memo\n // below, so every read is tracked at its use-site\n const propsWithTheme = merge({ theme }, props) as PropsWithClassAndStyle & {\n theme: Accessor<YakTheme>;\n };\n\n // The first component which is not wrapped in a yak component executes all attrs\n // functions starting from the innermost yak component to the outermost (itself)\n const attrsProps = mergedAttrsFn\n ? createMemo(() => mergedAttrsFn(propsWithTheme as any) as PropsWithClassAndStyle)\n : undefined;\n\n // input for the style processor: props + theme + attrs output\n const styleInput = attrsProps ? merge(propsWithTheme, attrsProps) : propsWithTheme;\n\n // execute all functions inside the style literal\n // e.g. styled.button`color: ${props => props.color};`\n // only reads inside this memo re-run it; the element itself is\n // never re-created, only its class/style bindings update\n const computed = createMemo(() => {\n const attrsResult = attrsProps?.();\n const classes = new Classes(normalizeClass(props.class));\n const attrsClass = normalizeClass(attrsResult?.class);\n if (attrsClass) {\n classes.add(attrsClass);\n }\n // static processors never write style values, so the incoming\n // style object can be passed through without a defensive copy\n const style =\n runtimeStyleProcessor.$dynamic || attrsResult?.style\n ? { ...unwrapStyle(props.style), ...unwrapStyle(attrsResult?.style) }\n : unwrapStyle(props.style);\n runtimeStyleProcessor(styleInput, classes, style as StyleObject);\n return {\n class: classes.value || undefined,\n style: style && Object.keys(style).length > 0 ? style : undefined,\n };\n });\n\n const merged = merge(props, attrsProps ?? {}, {\n get class(): string | undefined {\n return computed().class;\n },\n get style(): StyleObject | undefined {\n return computed().style;\n },\n });\n\n // keep the theme prop only if an attrs function intentionally\n // replaced it; the context theme itself never reaches the target\n const allowTheme = () => {\n const attrsResult = attrsProps?.();\n return !!attrsResult && \"theme\" in attrsResult && attrsResult.theme !== theme;\n };\n\n // render the chain's target directly; parent wrappers contribute\n // only their (already merged) attrs and style processors\n return renderTarget(filterDomProps(merge(merged, targetProps), allowTheme));\n };\n\n return Object.assign(Yak, {\n [yakComponentSymbol]: [Yak, mergedAttrsFn, runtimeStyleProcessor, targetComponent] as [\n unknown,\n unknown,\n unknown,\n unknown,\n ],\n });\n };\n};\n\n/**\n * Normalize a Solid style prop to an object the style processor can extend.\n * Solid allows string styles on elements; they are converted here so CSS custom\n * properties from dynamic values can be merged in (prefer object styles).\n */\nconst unwrapStyle = (style: StyleObject | string | undefined): StyleObject | undefined => {\n if (typeof style !== \"string\") {\n return style;\n }\n const result: Record<string, string> = {};\n for (const declaration of style.split(\";\")) {\n const colonIndex = declaration.indexOf(\":\");\n if (colonIndex === -1) continue;\n const property = declaration.slice(0, colonIndex).trim();\n const value = declaration.slice(colonIndex + 1).trim();\n if (property && value) {\n result[property] = value;\n }\n }\n return result as StyleObject;\n};\n\nconst isBlockedProp = (key: PropertyKey, allowTheme?: () => boolean): boolean =>\n typeof key === \"string\" &&\n (key.startsWith(\"$\") || (key === \"theme\" && !(allowTheme && allowTheme())));\n\n/**\n * Remove all props that start with a $ sign (plus the internal theme) so\n * they reach neither DOM elements nor custom components.\n *\n * Implemented as a lazy Proxy instead of an eager copy: Solid's compiled\n * spread reads props through getters, and copying would read every prop\n * exactly once and freeze its value, killing reactivity.\n */\nconst filterDomProps = <T extends object>(props: T, allowTheme?: () => boolean): T =>\n new Proxy(props, {\n get: (target, key) => (isBlockedProp(key, allowTheme) ? undefined : Reflect.get(target, key)),\n has: (target, key) => !isBlockedProp(key, allowTheme) && Reflect.has(target, key),\n ownKeys: (target) => Reflect.ownKeys(target).filter((key) => !isBlockedProp(key, allowTheme)),\n getOwnPropertyDescriptor: (target, key) =>\n isBlockedProp(key, allowTheme) ? undefined : Reflect.getOwnPropertyDescriptor(target, key),\n });\n\n// util function to merge class names, as they are concatenated with a space\nconst mergeClasses = (a?: string, b?: string) => {\n if (!a && !b) return undefined;\n if (!a) return b;\n if (!b) return a;\n return a + \" \" + b;\n};\n\n/**\n * merge props and processed props (including class names and styles)\n * e.g.:\\\n * `{ class: \"a\", foo: 1 }` and `{ class: \"b\", bar: 2 }` \\\n * => `{ class: \"a b\", foo: 1, bar: 2 }`\n */\nconst combineProps = <\n T extends {\n class?: string;\n style?: StyleObject | string;\n },\n TOther extends\n | {\n class?: string;\n style?: StyleObject | string;\n }\n | null\n | undefined,\n>(\n props: T,\n newProps: TOther,\n) =>\n newProps\n ? (props.class === newProps.class || !newProps.class) &&\n (props.style === newProps.style || !newProps.style)\n ? // shortcut if no style and class merging is necessary\n {\n ...props,\n ...newProps,\n }\n : // merge class names and styles\n {\n ...props,\n ...newProps,\n class: mergeClasses(props.class, newProps.class),\n style: { ...unwrapStyle(props.style), ...unwrapStyle(newProps.style) },\n }\n : // if no new props are provided, no merging is necessary\n props;\n\n/**\n * Merges the attrs function of the current component with the attrs function of the parent component\n * in order to preserve the sequence of the attrs functions.\n * Note: In theory, the parentAttrsFn can have different types for TAttrsIn and TAttrsOut\n * but as this is only used internally, we can ignore and simplify this case\n * @param attrs The attrs object or function of the current component (if any)\n * @param parentAttrsFn The attrs function of the parent/wrapped component (if any)\n * @returns A function that receives the props and returns the transformed props\n */\nconst buildRuntimeAttrsProcessor = <\n T,\n TAttrsIn extends object,\n TAttrsOut extends AttrsMerged<T, TAttrsIn>,\n>(\n attrs?: Attrs<T, TAttrsIn, TAttrsOut>,\n parentAttrsFn?: AttrsFunction<T, TAttrsIn, TAttrsOut>,\n): AttrsFunction<T, TAttrsIn, TAttrsOut> | undefined => {\n const ownAttrsFn = attrs && (typeof attrs === \"function\" ? attrs : () => attrs);\n\n if (ownAttrsFn && parentAttrsFn) {\n return (props) => {\n const parentProps = parentAttrsFn(props);\n\n // overwrite and merge the parent props with the props received from the attrs function\n // after they went through the parent attrs function.\n //\n // This makes sure the linearity of the attrs functions is preserved and all attrs function receive\n // the whole props object calculated from the previous attrs functions\n return combineProps(\n parentProps as any,\n ownAttrsFn(combineProps(props as any, parentProps as any) as any),\n ) as any;\n };\n }\n\n return ownAttrsFn || parentAttrsFn;\n};\n\n/**\n * Merges the runtime style function of the current component with the runtime style function of the parent component\n * in order to preserve the sequence of the attrs functions.\n * @param runtimeStylesFn The current runtime styles function\n * @param parentRuntimeStylesFn The parent runtime styles function\n * @returns The merged runtime styles function\n */\nconst buildRuntimeStylesProcessor = <T>(\n runtimeStylesFn: RuntimeStyleProcessor<T>,\n parentRuntimeStylesFn?: RuntimeStyleProcessor<T>,\n) => {\n if (runtimeStylesFn && parentRuntimeStylesFn) {\n const combined: RuntimeStyleProcessor<T> = Object.assign(\n (props: T, classes: Parameters<RuntimeStyleProcessor<T>>[1], style: StyleObject) => {\n parentRuntimeStylesFn(props, classes, style);\n runtimeStylesFn(props, classes, style);\n },\n // the chain is dynamic if any level is dynamic\n { $dynamic: runtimeStylesFn.$dynamic || parentRuntimeStylesFn.$dynamic },\n );\n return combined;\n }\n return runtimeStylesFn || parentRuntimeStylesFn;\n};\n\n/**\n * Internal function where attrs are passed to be processed\n */\nexport type StyledInternal = <\n T extends object,\n TAttrsIn extends object = {},\n TAttrsOut extends AttrsMerged<T, TAttrsIn> = AttrsMerged<T, TAttrsIn>,\n>(\n Component: AnyComponent<T> | YakComponent<T> | HtmlTags | string,\n attrs?: Attrs<T, TAttrsIn, TAttrsOut>,\n) => StyledLiteral<Substitute<T, TAttrsIn>>;\n\n/**\n * Utility type to extract the AttrsFunction from the Attrs type\n */\nexport type ExtractAttrsFunction<T> = T extends (p: any) => any ? T : never;\n","import { ComponentStyles, css } from \"./cssLiteral.js\";\nimport { RuntimeStyleProcessor } from \"./publicStyledApi.js\";\n\n/**\n * Allows to use atomic CSS classes in a styled or css block\n *\n * @usage\n *\n * ```tsx\n * import { styled, atoms } from \"@yak/solid\";\n *\n * const Button = styled.button<{ $primary?: boolean }>`\n * ${atoms(\"text-teal-600\", \"text-base\", \"rounded-md\")}\n * ${props => props.$primary && atoms(\"shadow-md\")}\n * `;\n * ```\n */\nexport const atoms = <T>(\n ...atoms: (string | RuntimeStyleProcessor<T> | false)[]\n): ComponentStyles<T> => {\n const staticClasses: string[] = [];\n const dynamicFunctions: RuntimeStyleProcessor<T>[] = [];\n\n for (const atom of atoms) {\n if (typeof atom === \"string\") {\n staticClasses.push(...atom.split(\" \"));\n } else if (typeof atom === \"function\") {\n dynamicFunctions.push(atom);\n }\n }\n\n const runtimeFunctions: RuntimeStyleProcessor<T>[] =\n staticClasses.length > 0\n ? [\n (_, classes) => {\n staticClasses.forEach((cls) => classes.add(cls));\n },\n ...dynamicFunctions,\n ]\n : dynamicFunctions;\n\n // @ts-expect-error the internal implementation of css is not typed\n return css(...runtimeFunctions);\n};\n","/**\n * Allows to use CSS keyframe animations in a styled or css block\n *\n * @usage\n *\n * ```tsx\n * import { styled, keyframes } from \"@yak/solid\";\n *\n * const rotate = keyframes`\n * from {\n * transform: rotate(0deg);\n * }\n * to {\n * transform: rotate(360deg);\n * }\n * `;\n *\n * const Spinner = styled.div`\n * animation: ${rotate} 1s linear infinite;\n * `;\n * ```\n */\nexport const keyframes = <T extends (string | number | bigint)[] = never>(\n styles: TemplateStringsArray,\n ..._dynamic: T\n): string => {\n // during compilation all args of keyframe are compiled\n // to a string which references the animation name\n return styles as any as string;\n};\n","import type { ComponentStyles } from \"./cssLiteral.js\";\nimport type { YakComponent } from \"./publicStyledApi.js\";\n\n/**\n * Values that may be interpolated into a `globalStyle` template.\n *\n * Only build-time values are allowed: constants, `keyframes` animation names,\n * static `css` mixins and styled-component selectors. Runtime functions\n * (`${(props) => ...}`) are intentionally excluded: a global rule has no element\n * to attach a CSS variable to. Declare a CSS custom property instead and toggle\n * it via an attribute/class on the root element.\n */\nexport type GlobalStyleInterpolation = string | number | ComponentStyles<{}> | YakComponent<any>;\n\n/**\n * Declares global, unscoped styles that ride the same zero-runtime extraction\n * pipeline as `styled` and `keyframes`.\n *\n * Global styles are **part of the stylesheet, not part of the render tree**.\n * They apply exactly when the module declaring them is included in the bundle,\n * typically by importing it from a layout or entry point. They cannot be\n * conditionally mounted; express conditions in CSS (`@media`, `@supports`,\n * `:root[data-theme]`, `:has()`) or through CSS custom properties.\n *\n * @usage\n *\n * ```tsx\n * import { globalStyle, keyframes } from \"@yak/solid\";\n *\n * const fadeIn = keyframes`\n * from { opacity: 0; }\n * `;\n *\n * globalStyle`\n * :root {\n * --spacing: 4px;\n * }\n *\n * body {\n * margin: 0;\n * }\n *\n * ::view-transition-new(root) {\n * animation: ${fadeIn} 200ms ease;\n * }\n * `;\n * ```\n */\nexport const globalStyle = (\n _styles: TemplateStringsArray,\n ..._values: Array<GlobalStyleInterpolation>\n): void => {\n return undefined;\n};\n","/**\n * Internal helper called by transformed code. Do not use directly.\n *\n * Takes a function and a css unit and returns the result of the function concatenated with the unit\n *\n * ```tsx\n * import { styled } from \"@yak/solid\";\n *\n * const Button = styled.button<{ $width?: boolean }>`\n * width: ${({ $width }) => $width}px;\n * `;\n * ```\n *\n * Which will be transformed to:\n * ```tsx\n * import { styled } from \"@yak/solid/internal\";\n *\n * const Button = styled.button<{ $width?: boolean }>(\n * \"button\", {\n * width: unitPostFix({ $width }) => $width, \"px\")\n * });\n */\nexport const unitPostFix = (arg: unknown, unit: string) => {\n switch (typeof arg) {\n case \"function\":\n return (props: any) => unitPostFix(arg(props), unit);\n case \"number\":\n case \"string\":\n return `${arg}${unit}`;\n // Ignore falsy values\n default:\n return undefined;\n }\n};\n","import { Classes } from \"../cssLiteral.js\";\nimport { RuntimeStyleProcessor } from \"../publicStyledApi.js\";\n\n/**\n * This is an internal helper function to merge relevant props of a native element with a css prop.\n * It's automatically added when using the `css` prop in a JSX element.\n * e.g.:\n * ```tsx\n * <p\n * class=\"foo\"\n * css={css`\n * color: green;\n * `}\n * {...{ style: { padding: \"30px\" }}}\n * />\n */\nexport const mergeCssProp = (\n relevantProps: {\n class?: string;\n style?: Record<string, string>;\n } & Record<string, unknown>,\n cssProp: RuntimeStyleProcessor<unknown> | false | null | undefined,\n) => {\n const classes = new Classes(relevantProps.class);\n\n const existingStyle = relevantProps.style;\n const style = existingStyle ? { ...existingStyle } : {};\n\n // a falsy css prop applies no styles, e.g. `css={on && css`...`}` with `on` false\n if (cssProp) {\n cssProp({}, classes, style);\n }\n\n // Forward all other props (onClick, aria-*, id, …) untouched and only\n // override class/style with the merged result — the transform already\n // built `relevantProps` in JSX attribute order, so this preserves overrides.\n const result: Record<string, unknown> & {\n class?: string;\n style?: Record<string, string>;\n } = { ...relevantProps };\n\n if (Object.keys(style).length > 0) {\n result.style = style;\n } else {\n delete result.style;\n }\n if (classes.value) {\n result.class = classes.value;\n } else {\n delete result.class;\n }\n\n return result;\n};\n","import { styled } from \"./styled.js\";\n/// Internal API to create styled components\n/// Optimization for faster rendering and smaller bundle size in production\n/// thanks to better minification and dead code elimination\n///\n/// List taken from https://github.com/styled-components/styled-components/blob/e0019ba666fab4b5aaa2bff71ba6ad0005a299fd/packages/styled-components/src/utils/domElements.ts#L90\nexport const __yak_a = /*#__PURE__*/ styled(\"a\");\nexport const __yak_abbr = /*#__PURE__*/ styled(\"abbr\");\nexport const __yak_address = /*#__PURE__*/ styled(\"address\");\nexport const __yak_area = /*#__PURE__*/ styled(\"area\");\nexport const __yak_article = /*#__PURE__*/ styled(\"article\");\nexport const __yak_aside = /*#__PURE__*/ styled(\"aside\");\nexport const __yak_audio = /*#__PURE__*/ styled(\"audio\");\nexport const __yak_b = /*#__PURE__*/ styled(\"b\");\nexport const __yak_base = /*#__PURE__*/ styled(\"base\");\nexport const __yak_bdi = /*#__PURE__*/ styled(\"bdi\");\nexport const __yak_bdo = /*#__PURE__*/ styled(\"bdo\");\nexport const __yak_big = /*#__PURE__*/ styled(\"big\");\nexport const __yak_blockquote = /*#__PURE__*/ styled(\"blockquote\");\nexport const __yak_body = /*#__PURE__*/ styled(\"body\");\nexport const __yak_br = /*#__PURE__*/ styled(\"br\");\nexport const __yak_button = /*#__PURE__*/ styled(\"button\");\nexport const __yak_canvas = /*#__PURE__*/ styled(\"canvas\");\nexport const __yak_caption = /*#__PURE__*/ styled(\"caption\");\nexport const __yak_cite = /*#__PURE__*/ styled(\"cite\");\nexport const __yak_code = /*#__PURE__*/ styled(\"code\");\nexport const __yak_col = /*#__PURE__*/ styled(\"col\");\nexport const __yak_colgroup = /*#__PURE__*/ styled(\"colgroup\");\nexport const __yak_data = /*#__PURE__*/ styled(\"data\");\nexport const __yak_datalist = /*#__PURE__*/ styled(\"datalist\");\nexport const __yak_dd = /*#__PURE__*/ styled(\"dd\");\nexport const __yak_del = /*#__PURE__*/ styled(\"del\");\nexport const __yak_details = /*#__PURE__*/ styled(\"details\");\nexport const __yak_dfn = /*#__PURE__*/ styled(\"dfn\");\nexport const __yak_dialog = /*#__PURE__*/ styled(\"dialog\");\nexport const __yak_div = /*#__PURE__*/ styled(\"div\");\nexport const __yak_dl = /*#__PURE__*/ styled(\"dl\");\nexport const __yak_dt = /*#__PURE__*/ styled(\"dt\");\nexport const __yak_em = /*#__PURE__*/ styled(\"em\");\nexport const __yak_embed = /*#__PURE__*/ styled(\"embed\");\nexport const __yak_fieldset = /*#__PURE__*/ styled(\"fieldset\");\nexport const __yak_figcaption = /*#__PURE__*/ styled(\"figcaption\");\nexport const __yak_figure = /*#__PURE__*/ styled(\"figure\");\nexport const __yak_footer = /*#__PURE__*/ styled(\"footer\");\nexport const __yak_form = /*#__PURE__*/ styled(\"form\");\nexport const __yak_h1 = /*#__PURE__*/ styled(\"h1\");\nexport const __yak_h2 = /*#__PURE__*/ styled(\"h2\");\nexport const __yak_h3 = /*#__PURE__*/ styled(\"h3\");\nexport const __yak_h4 = /*#__PURE__*/ styled(\"h4\");\nexport const __yak_h5 = /*#__PURE__*/ styled(\"h5\");\nexport const __yak_h6 = /*#__PURE__*/ styled(\"h6\");\nexport const __yak_header = /*#__PURE__*/ styled(\"header\");\nexport const __yak_hgroup = /*#__PURE__*/ styled(\"hgroup\");\nexport const __yak_hr = /*#__PURE__*/ styled(\"hr\");\nexport const __yak_html = /*#__PURE__*/ styled(\"html\");\nexport const __yak_i = /*#__PURE__*/ styled(\"i\");\nexport const __yak_iframe = /*#__PURE__*/ styled(\"iframe\");\nexport const __yak_img = /*#__PURE__*/ styled(\"img\");\nexport const __yak_input = /*#__PURE__*/ styled(\"input\");\nexport const __yak_ins = /*#__PURE__*/ styled(\"ins\");\nexport const __yak_kbd = /*#__PURE__*/ styled(\"kbd\");\nexport const __yak_keygen = /*#__PURE__*/ styled(\"keygen\");\nexport const __yak_label = /*#__PURE__*/ styled(\"label\");\nexport const __yak_legend = /*#__PURE__*/ styled(\"legend\");\nexport const __yak_li = /*#__PURE__*/ styled(\"li\");\nexport const __yak_link = /*#__PURE__*/ styled(\"link\");\nexport const __yak_main = /*#__PURE__*/ styled(\"main\");\nexport const __yak_map = /*#__PURE__*/ styled(\"map\");\nexport const __yak_mark = /*#__PURE__*/ styled(\"mark\");\nexport const __yak_menu = /*#__PURE__*/ styled(\"menu\");\nexport const __yak_menuitem = /*#__PURE__*/ styled(\"menuitem\");\nexport const __yak_meta = /*#__PURE__*/ styled(\"meta\");\nexport const __yak_meter = /*#__PURE__*/ styled(\"meter\");\nexport const __yak_nav = /*#__PURE__*/ styled(\"nav\");\nexport const __yak_noscript = /*#__PURE__*/ styled(\"noscript\");\nexport const __yak_object = /*#__PURE__*/ styled(\"object\");\nexport const __yak_ol = /*#__PURE__*/ styled(\"ol\");\nexport const __yak_optgroup = /*#__PURE__*/ styled(\"optgroup\");\nexport const __yak_option = /*#__PURE__*/ styled(\"option\");\nexport const __yak_output = /*#__PURE__*/ styled(\"output\");\nexport const __yak_p = /*#__PURE__*/ styled(\"p\");\nexport const __yak_param = /*#__PURE__*/ styled(\"param\");\nexport const __yak_picture = /*#__PURE__*/ styled(\"picture\");\nexport const __yak_pre = /*#__PURE__*/ styled(\"pre\");\nexport const __yak_progress = /*#__PURE__*/ styled(\"progress\");\nexport const __yak_q = /*#__PURE__*/ styled(\"q\");\nexport const __yak_rp = /*#__PURE__*/ styled(\"rp\");\nexport const __yak_rt = /*#__PURE__*/ styled(\"rt\");\nexport const __yak_ruby = /*#__PURE__*/ styled(\"ruby\");\nexport const __yak_s = /*#__PURE__*/ styled(\"s\");\nexport const __yak_samp = /*#__PURE__*/ styled(\"samp\");\nexport const __yak_script = /*#__PURE__*/ styled(\"script\");\nexport const __yak_section = /*#__PURE__*/ styled(\"section\");\nexport const __yak_select = /*#__PURE__*/ styled(\"select\");\nexport const __yak_small = /*#__PURE__*/ styled(\"small\");\nexport const __yak_source = /*#__PURE__*/ styled(\"source\");\nexport const __yak_span = /*#__PURE__*/ styled(\"span\");\nexport const __yak_strong = /*#__PURE__*/ styled(\"strong\");\nexport const __yak_style = /*#__PURE__*/ styled(\"style\");\nexport const __yak_sub = /*#__PURE__*/ styled(\"sub\");\nexport const __yak_summary = /*#__PURE__*/ styled(\"summary\");\nexport const __yak_sup = /*#__PURE__*/ styled(\"sup\");\nexport const __yak_table = /*#__PURE__*/ styled(\"table\");\nexport const __yak_tbody = /*#__PURE__*/ styled(\"tbody\");\nexport const __yak_td = /*#__PURE__*/ styled(\"td\");\nexport const __yak_textarea = /*#__PURE__*/ styled(\"textarea\");\nexport const __yak_tfoot = /*#__PURE__*/ styled(\"tfoot\");\nexport const __yak_th = /*#__PURE__*/ styled(\"th\");\nexport const __yak_thead = /*#__PURE__*/ styled(\"thead\");\nexport const __yak_time = /*#__PURE__*/ styled(\"time\");\nexport const __yak_tr = /*#__PURE__*/ styled(\"tr\");\nexport const __yak_track = /*#__PURE__*/ styled(\"track\");\nexport const __yak_u = /*#__PURE__*/ styled(\"u\");\nexport const __yak_ul = /*#__PURE__*/ styled(\"ul\");\nexport const __yak_use = /*#__PURE__*/ styled(\"use\");\nexport const __yak_var = /*#__PURE__*/ styled(\"var\");\nexport const __yak_video = /*#__PURE__*/ styled(\"video\");\nexport const __yak_wbr = /*#__PURE__*/ styled(\"wbr\");\nexport const __yak_circle = /*#__PURE__*/ styled(\"circle\");\nexport const __yak_clipPath = /*#__PURE__*/ styled(\"clipPath\");\nexport const __yak_defs = /*#__PURE__*/ styled(\"defs\");\nexport const __yak_ellipse = /*#__PURE__*/ styled(\"ellipse\");\nexport const __yak_foreignObject = /*#__PURE__*/ styled(\"foreignObject\");\nexport const __yak_g = /*#__PURE__*/ styled(\"g\");\nexport const __yak_image = /*#__PURE__*/ styled(\"image\");\nexport const __yak_line = /*#__PURE__*/ styled(\"line\");\nexport const __yak_linearGradient = /*#__PURE__*/ styled(\"linearGradient\");\nexport const __yak_marker = /*#__PURE__*/ styled(\"marker\");\nexport const __yak_mask = /*#__PURE__*/ styled(\"mask\");\nexport const __yak_path = /*#__PURE__*/ styled(\"path\");\nexport const __yak_pattern = /*#__PURE__*/ styled(\"pattern\");\nexport const __yak_polygon = /*#__PURE__*/ styled(\"polygon\");\nexport const __yak_polyline = /*#__PURE__*/ styled(\"polyline\");\nexport const __yak_radialGradient = /*#__PURE__*/ styled(\"radialGradient\");\nexport const __yak_rect = /*#__PURE__*/ styled(\"rect\");\nexport const __yak_stop = /*#__PURE__*/ styled(\"stop\");\nexport const __yak_svg = /*#__PURE__*/ styled(\"svg\");\nexport const __yak_text = /*#__PURE__*/ styled(\"text\");\nexport const __yak_tspan = /*#__PURE__*/ styled(\"tspan\");\n"],"mappings":";;;;;AAIA,MAAa,qBAAqB,OAAO,KAAK;AAS9C,IAAa,UAAb,MAA+C;CAC7C;CACA,YAAY,SAAkB;EAC5B,KAAK,QAAQ,WAAW;CAC1B;CACA,IAAI,MAAc;EAChB,IAAI,CAAC,KAAK,OACR,KAAK,QAAQ;OACR,IAAI,CAAC,KAAK,IAAI,IAAI,GACvB,KAAK,SAAS,MAAM;CAExB;CACA,IAAI,MAAc;EAChB,QAAQ,MAAM,KAAK,QAAQ,IAAG,CAAE,SAAS,MAAM,OAAO,GAAG;CAC3D;CACA,OAAO,MAAc;EACnB,IAAI,KAAK,IAAI,IAAI,GACf,KAAK,QAAQ,KAAK,MACf,MAAM,GAAG,CAAC,CACV,QAAQ,aAAa,aAAa,IAAI,CAAC,CACvC,KAAK,GAAG;CAEf;AACF;AAgEA,SAAgB,IAAY,GAAG,MAAiD;CAG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MAAa,aAA2B,qBAAO,MAAM;AACrD,MAAa,gBAA8B,qBAAO,SAAS;AAC3D,MAAa,gBAA8B,qBAAO,SAAS;AAC3D,MAAa,iBAA+B,qBAAO,UAAU;AAC7D,MAAa,uBAAqC,qBAAO,gBAAgB;AACzE,MAAa,aAA2B,qBAAO,MAAM;AACrD,MAAa,aAA2B,qBAAO,MAAM;AACrD,MAAa,YAA0B,qBAAO,KAAK;AACnD,MAAa,aAA2B,qBAAO,MAAM;AACrD,MAAa,cAA4B,qBAAO,OAAO"}
@@ -0,0 +1,30 @@
1
+ //#region ../yak-internals/isolated-source-eval/evaluator.d.ts
2
+ type EvaluateResult = {
3
+ ok: true;
4
+ value: Record<string, unknown>;
5
+ dependencies: string[];
6
+ } | {
7
+ ok: false;
8
+ error: {
9
+ message: string;
10
+ stack: string;
11
+ };
12
+ };
13
+ interface Evaluator {
14
+ /** Evaluate a module and return its exports plus the full transitive dependency list. */
15
+ evaluate(absolutePath: string): Promise<EvaluateResult>;
16
+ /** Clear cached results for every entry point that transitively depends on the given file(s). */
17
+ invalidate(...absolutePaths: string[]): void;
18
+ /** Clear the entire result cache and swap workers. */
19
+ invalidateAll(): void;
20
+ /** Return entry point paths that would be affected by invalidate(absolutePath). */
21
+ getDependentsOf(absolutePath: string): string[];
22
+ /** Terminate both workers and reject any pending evaluations. */
23
+ dispose(): Promise<void>;
24
+ [Symbol.asyncDispose](): Promise<void>;
25
+ }
26
+ /** Creates an evaluator that runs modules in isolated worker threads with dependency tracking. */
27
+ declare function createEvaluator(): Promise<Evaluator>;
28
+ //#endregion
29
+ export { type EvaluateResult, type Evaluator, createEvaluator };
30
+ //# sourceMappingURL=index.d.ts.map