aberdeen 1.4.1 → 1.5.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.
- package/README.md +19 -112
- package/dist/aberdeen.d.ts +23 -36
- package/dist/aberdeen.js +25 -3
- package/dist/aberdeen.js.map +3 -3
- package/dist-min/aberdeen.js +6 -4
- package/dist-min/aberdeen.js.map +3 -3
- package/package.json +1 -1
- package/skill/SKILL.md +13 -8
- package/src/aberdeen.ts +50 -38
package/README.md
CHANGED
|
@@ -79,14 +79,10 @@ function drawMain() {
|
|
|
79
79
|
|
|
80
80
|
// Add item and delete checked buttons.
|
|
81
81
|
$('div.row', () => {
|
|
82
|
-
$('button
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
click: () => {
|
|
87
|
-
for(let idx in items) {
|
|
88
|
-
if (items[idx].done) delete items[idx];
|
|
89
|
-
}
|
|
82
|
+
$('button text=+ click=', () => items.push(new TodoItem("")));
|
|
83
|
+
$('button.outline text="Delete checked" click=', () => {
|
|
84
|
+
for(let idx in items) {
|
|
85
|
+
if (items[idx].done) delete items[idx];
|
|
90
86
|
}
|
|
91
87
|
});
|
|
92
88
|
});
|
|
@@ -99,37 +95,33 @@ function drawItem(item) {
|
|
|
99
95
|
// create below, so that it will persist when that state reruns.
|
|
100
96
|
let editing: {value: boolean} = proxy(item.label == '');
|
|
101
97
|
|
|
102
|
-
$('div.row', todoItemStyle,
|
|
98
|
+
$('div.row', todoItemStyle, 'create=', grow, 'destroy=', shrink, () => {
|
|
103
99
|
// Conditionally add a class to `div.row`, based on item.done
|
|
104
100
|
$({".done": ref(item,'done')});
|
|
105
101
|
|
|
106
102
|
// The checkmark is hidden using CSS
|
|
107
|
-
$('div.checkmark
|
|
103
|
+
$('div.checkmark text=✅');
|
|
108
104
|
|
|
109
105
|
if (editing.value) {
|
|
110
|
-
//
|
|
106
|
+
// Proxied string to hold label while being edited.
|
|
107
|
+
const labelCopy = proxy(item.label);
|
|
111
108
|
function save() {
|
|
112
109
|
editing.value = false;
|
|
113
|
-
item.label =
|
|
110
|
+
item.label = labelCopy.value;
|
|
114
111
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
120
|
-
$('button.outline#Cancel', {click: () => editing.value = false});
|
|
121
|
-
$('button#Save', {click: save});
|
|
112
|
+
// Label <input>. Save using enter or button.
|
|
113
|
+
$('input placeholder=Label bind=', labelCopy, 'keydown=', e => e.key==='Enter' && save());
|
|
114
|
+
$('button.outline text=Cancel click=', () => editing.value = false);
|
|
115
|
+
$('button text=Save click=', save);
|
|
122
116
|
} else {
|
|
123
117
|
// Label as text.
|
|
124
|
-
$('p
|
|
118
|
+
$('p text=', item.label);
|
|
125
119
|
|
|
126
120
|
// Edit icon, if not done.
|
|
127
121
|
if (!item.done) {
|
|
128
|
-
$('a
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
e.stopPropagation(); // We don't want to toggle as well.
|
|
132
|
-
},
|
|
122
|
+
$('a text=Edit click=', e => {
|
|
123
|
+
editing.value = true;
|
|
124
|
+
e.stopPropagation(); // We don't want to toggle as well.
|
|
133
125
|
});
|
|
134
126
|
}
|
|
135
127
|
|
|
@@ -165,6 +157,7 @@ Some further examples:
|
|
|
165
157
|
- [Routing demo](https://aberdeenjs.org/examples/route/) - [Source](https://github.com/vanviegen/aberdeen/tree/master/examples/route)
|
|
166
158
|
- [JS Framework Benchmark demo](https://aberdeenjs.org/examples/js-framework-benchmark/) - [Source](https://github.com/vanviegen/aberdeen/tree/master/examples/js-framework-benchmark)
|
|
167
159
|
|
|
160
|
+
|
|
168
161
|
## Learning Aberdeen
|
|
169
162
|
|
|
170
163
|
- [Tutorial](https://aberdeenjs.org/Tutorial/)
|
|
@@ -184,92 +177,6 @@ mkdir -p .claude/skills
|
|
|
184
177
|
ln -s ../../node_modules/aberdeen/skill .claude/skills/aberdeen
|
|
185
178
|
```
|
|
186
179
|
|
|
187
|
-
|
|
188
180
|
## Changelog
|
|
189
|
-
### 1.4.1 (2026-01-14)
|
|
190
|
-
|
|
191
|
-
**Additions:**
|
|
192
|
-
- Created an AI agent Skill (Claude Code, GitHub Copilot) for using Aberdeen in your projects.
|
|
193
|
-
|
|
194
|
-
**Enhancements:**
|
|
195
|
-
- The `html-to-aberdeen` tool now automatically converts `style` attributes to Aberdeen's CSS shortcuts (like `mt:10px` for `margin-top: 10px`) and uses the modern `#text` syntax.
|
|
196
|
-
|
|
197
|
-
**Fixes:**
|
|
198
|
-
- Fixed an issue in `docs/live-code.js` where it was still trying to import the removed `observe` function.
|
|
199
|
-
|
|
200
|
-
### 1.4.0 (2025-01-07)
|
|
201
|
-
|
|
202
|
-
**Enhancements:**
|
|
203
|
-
- Shortcuts for common CSS properties. For instance: `$('div mv:10px')` for setting vertical (top and bottom) margins.
|
|
204
|
-
- Variables you can set and use in CSS styles, e.g. `$('div bg:@myColor')` after setting `cssVars.myColor = 'red'`.
|
|
205
|
-
- Default CSS variables are defined for spacing: `@2` is `0.5rem`, `@3` is `1rem`, etc. For example: `$('r:@3')` sets border radius to (a dynamically configurable) `1rem`.
|
|
206
|
-
- All CSS shortcuts and `@` variables are also supported in `insertCss` and `insertGlobalCss`.
|
|
207
|
-
- Added `insertGlobalCss` for adding global styles. The `global` argument to `insertCss` is now deprecated.
|
|
208
|
-
|
|
209
|
-
**Fixes:**
|
|
210
|
-
- When doing `$('div #first', () => $('#second'))`, *second* now comes after *first*. It used to be the other way around.
|
|
211
|
-
|
|
212
|
-
### 1.3.2 (2025-01-07)
|
|
213
|
-
|
|
214
|
-
**Enhancements:**
|
|
215
|
-
- It's now okay to first define a SELECT binding and then add its OPTIONs right after, while still allowing the binding to set the initial value. This used to throw an async error.
|
|
216
|
-
|
|
217
|
-
**Fixes:**
|
|
218
|
-
- Turns out some examples were still using old text content syntax.
|
|
219
|
-
|
|
220
|
-
### 1.3.1 (2025-01-07)
|
|
221
|
-
**Fixes:**
|
|
222
|
-
- Argument types accepted by `$` were too restrictive, as something like `$('prop=', myVal)` should be able to accept any type for `myVal`.
|
|
223
|
-
|
|
224
|
-
### 1.3.0 (2025-12-03)
|
|
225
|
-
**Breaking changes:**
|
|
226
|
-
- The shortcut for setting inline CSS styles in now `$('div color:red')` instead of `$('div $color=red')`.
|
|
227
|
-
- The shortcut for adding text content is now `$('p#Hello')` instead of `$('p:Hello')`. It now also works with dynamic content: `$('p#', myObservable)`.
|
|
228
|
-
|
|
229
|
-
**Enhancements:**
|
|
230
|
-
- New A() string parser, reducing complexity and line count.
|
|
231
|
-
|
|
232
|
-
### 1.2.0 (2025-09-27)
|
|
233
|
-
|
|
234
|
-
**Enhancements:**
|
|
235
|
-
- The `$` function now supports a more concise syntax for setting attributes and properties. Instead of writing `$('p', 'button', {$color: 'red', click: () => ...})`, you can now write `$('p button $color=red click=', () => ...)`.
|
|
236
|
-
- The `proxy()` function can now accept `Promise`s, which will return an observable object with properties for `busy` status, `error` (if any), and the resolved `value`. This makes it easier to call async functions from within UI code.
|
|
237
|
-
|
|
238
|
-
**Breaking changes:**
|
|
239
|
-
- When a UI render function returns a `Promise`, that will now be reported as an error. Async render functions are fundamentally incompatible with Aberdeen's reactive model, so it's helpful to point that out. Use the new `proxy()` async support instead.
|
|
240
|
-
|
|
241
|
-
### 1.1.0 (2025-09-12)
|
|
242
|
-
|
|
243
|
-
This major release aims to reduce surprises in our API, aligning more closely with regular JavaScript semantics (for better or worse).
|
|
244
|
-
|
|
245
|
-
**Breaking changes:**
|
|
246
|
-
|
|
247
|
-
- Functions that iterate objects (like `onEach` and `map`) will now only work on *own* properties of the object, ignoring those in the prototype chain. The new behavior should be more consistent and faster.
|
|
248
|
-
- These iteration function now properly distinguish between `undefined` and *empty*. Previously, object/array/map items with `undefined` values were considered non-existent. The new behavior (though arguably confusing) is more consistent with regular JavaScript semantics.
|
|
249
|
-
- The `copy` function no longer ..
|
|
250
|
-
- Supports `SHALLOW` and `MERGE` flags. The latter has been replaced by a dedicated `merge` function. The former turned out not to be particularly useful.
|
|
251
|
-
- Has weird special cases that would allow copying objects into maps and merging objects into arrays.
|
|
252
|
-
- Copies properties from the prototype chain of objects. Only *own* properties are copied now. As the prototype link itself *is* copied over, this should actually result in copies being *more* similar to the original.
|
|
253
|
-
- The `observe` function has been renamed to `derive` to better reflect its purpose and match terminology used in other reactive programming libraries.
|
|
254
|
-
- The `$({element: myElement})` syntax for inserting existing DOM elements has been removed. Use `$(myElement)` instead.
|
|
255
|
-
- The `route` API brings some significant changes. Modifying the `route` observable (which should now be accessed as `route.current`) will now always result in changing the current browser history item (URL and state, using `replaceState`), instead of using a heuristic to figure out what you probably want. Dedicated functions have been added for navigating to a new URL (`go`), back to a previous URL (`back`), and for going up in the route hierarchy (`up`).
|
|
256
|
-
- The concept of immediate observers (through the `immediateObserve` function) no longer exists. It caused unexpected behavior (for instance due to the fact that an array `pop()` in JavaScript is implemented as a delete followed by a length change, so happens in two steps that would each call immediate observers). The reason it existed was mostly to enable a pre-1.0 version of the `route` API. It turned out to be a mistake.
|
|
257
|
-
|
|
258
|
-
**Enhancements:**
|
|
259
|
-
|
|
260
|
-
- The `peek` function can no also accept an object and a key as argument (e.g. `peek(obj, 'myKey')`). It does the same as `peek(() => obj.myKey)`, but more concise and faster.
|
|
261
|
-
- The `copy` and `merge` functions now ..
|
|
262
|
-
- Accept an optional `dstKey` argument, allowing you to assign to a specific key with `copy` semantics, and without subscribing to the key.
|
|
263
|
-
- Return a boolean indicating whether any changes were made.
|
|
264
|
-
- Are faster.
|
|
265
|
-
- A new `dispatcher` module has been added. It provides a simple and type-safe way to match URL paths to handler functions, and extract parameters from the path. You can still use your own routing solution if you prefer, of course.
|
|
266
|
-
- The `route` module now also has tests, making the whole project now fully covered by tests.
|
|
267
|
-
|
|
268
|
-
**Fixes:**
|
|
269
|
-
|
|
270
|
-
- Browser-back behavior in the `route` module had some reliability issues after page reloads.
|
|
271
|
-
- The `copy` and `clone` function created Maps and Arrays with the wrong internal type. So `instanceof Array` would say yes, while `Array.isArray` would say no. JavaScript is weird.
|
|
272
|
-
|
|
273
|
-
### 1.0.0 (2025-05-07)
|
|
274
181
|
|
|
275
|
-
|
|
182
|
+
See [CHANGELOG.md](CHANGELOG.md) for a full history of changes.
|
package/dist/aberdeen.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* ```typescript
|
|
17
17
|
* const data = proxy("before");
|
|
18
18
|
*
|
|
19
|
-
* $(
|
|
19
|
+
* $('#'+data);
|
|
20
20
|
* console.log(1, document.body.innerHTML); // before
|
|
21
21
|
*
|
|
22
22
|
* // Make an update that should cause the DOM to change.
|
|
@@ -80,9 +80,9 @@ export declare function onEach<K extends string | number | symbol, T>(target: Re
|
|
|
80
80
|
* // Reactively display a message if the items array is empty
|
|
81
81
|
* $('div', () => {
|
|
82
82
|
* if (isEmpty(items)) {
|
|
83
|
-
* $('p
|
|
83
|
+
* $('p i#No items yet!');
|
|
84
84
|
* } else {
|
|
85
|
-
*
|
|
85
|
+
* onEach(items, item => $('p#'+item));
|
|
86
86
|
* }
|
|
87
87
|
* });
|
|
88
88
|
*
|
|
@@ -110,7 +110,7 @@ export interface ValueRef<T> {
|
|
|
110
110
|
* const cnt = count(items);
|
|
111
111
|
*
|
|
112
112
|
* // Create a DOM text node for the count:
|
|
113
|
-
* $('div',
|
|
113
|
+
* $('div text=', cnt);
|
|
114
114
|
* // <div>2</div>
|
|
115
115
|
|
|
116
116
|
* // Or we can use it in an {@link derive} function:
|
|
@@ -252,17 +252,20 @@ export declare function merge<T extends object>(dst: T, dstKey: keyof T, value:
|
|
|
252
252
|
*/
|
|
253
253
|
export declare const NO_COPY: unique symbol;
|
|
254
254
|
/**
|
|
255
|
-
* CSS
|
|
255
|
+
* CSS variables that are output as native CSS custom properties.
|
|
256
256
|
*
|
|
257
|
-
* When a CSS value starts with `@`,
|
|
257
|
+
* When a CSS value starts with `@`, it becomes `var(--name)` (or `var(--mN)` for numeric keys).
|
|
258
258
|
* Pre-initialized with keys '1'-'12' mapping to an exponential rem scale (e.g., @1=0.25rem, @3=1rem).
|
|
259
259
|
*
|
|
260
|
+
* Changes to cssVars are automatically reflected in a `<style>` tag in `<head>`, making updates
|
|
261
|
+
* reactive across all elements using those variables.
|
|
262
|
+
*
|
|
260
263
|
* @example
|
|
261
264
|
* ```typescript
|
|
262
265
|
* cssVars.primary = '#3b82f6';
|
|
263
266
|
* cssVars[3] = '16px'; // Override @3 to be 16px instead of 1rem
|
|
264
|
-
* $('p color:@primary'); // Sets color to
|
|
265
|
-
* $('div mt:@3'); // Sets margin-top to
|
|
267
|
+
* $('p color:@primary'); // Sets color to var(--primary)
|
|
268
|
+
* $('div mt:@3'); // Sets margin-top to var(--m3)
|
|
266
269
|
* ```
|
|
267
270
|
*/
|
|
268
271
|
export declare const cssVars: Record<string, string>;
|
|
@@ -293,17 +296,10 @@ export declare function clone<T extends object>(src: T): T;
|
|
|
293
296
|
* const formData = proxy({ color: 'orange', velocity: 42 });
|
|
294
297
|
*
|
|
295
298
|
* // Usage with `bind`
|
|
296
|
-
* $('input',
|
|
297
|
-
* type: 'text',
|
|
298
|
-
* // Creates a two-way binding between the input's value and formData.username
|
|
299
|
-
* bind: ref(formData, 'color')
|
|
300
|
-
* });
|
|
299
|
+
* $('input type=text bind=', ref(formData, 'color'));
|
|
301
300
|
*
|
|
302
301
|
* // Usage as a dynamic property, causes a TextNode with just the name to be created and live-updated
|
|
303
|
-
* $('p
|
|
304
|
-
* text: ref(formData, 'color'),
|
|
305
|
-
* $color: ref(formData, 'color')
|
|
306
|
-
* });
|
|
302
|
+
* $('p text="Selected color: " text=', ref(formData, 'color'), 'color:', ref(formData, 'color'));
|
|
307
303
|
*
|
|
308
304
|
* // Changes are actually stored in formData - this causes logs like `{color: "Blue", velocity 42}`
|
|
309
305
|
* $(() => console.log(formData))
|
|
@@ -352,16 +348,7 @@ export declare function ref<T extends TargetType, K extends keyof T>(target: T,
|
|
|
352
348
|
*
|
|
353
349
|
* @example Create Element
|
|
354
350
|
* ```typescript
|
|
355
|
-
* $('button.secondary.outline
|
|
356
|
-
* disabled: false,
|
|
357
|
-
* click: () => console.log('Clicked!'),
|
|
358
|
-
* $color: 'red'
|
|
359
|
-
* });
|
|
360
|
-
* ```
|
|
361
|
-
*
|
|
362
|
-
* Which can also be written as:
|
|
363
|
-
* ```typescript
|
|
364
|
-
* $('button.secondary.outline text=Submit $color=red disabled=', false, 'click=', () => console.log('Clicked!'));
|
|
351
|
+
* $('button.secondary.outline text=Submit color:red disabled=', false, 'click=', () => console.log('Clicked!'));
|
|
365
352
|
* ```
|
|
366
353
|
*
|
|
367
354
|
* We want to set `disabled` as a property instead of an attribute, so we must use the `key=` syntax in order to provide
|
|
@@ -369,7 +356,7 @@ export declare function ref<T extends TargetType, K extends keyof T>(target: T,
|
|
|
369
356
|
*
|
|
370
357
|
* @example Create Nested Elements
|
|
371
358
|
* ```typescript
|
|
372
|
-
* let inputElement: Element = $('label
|
|
359
|
+
* let inputElement: Element = $('label text="Click me" input type=checkbox');
|
|
373
360
|
* // You should usually not touch raw DOM elements, unless when integrating
|
|
374
361
|
* // with non-Aberdeen code.
|
|
375
362
|
* console.log('DOM element:', inputElement);
|
|
@@ -381,14 +368,14 @@ export declare function ref<T extends TargetType, K extends keyof T>(target: T,
|
|
|
381
368
|
* $('div', () => { // Outer element
|
|
382
369
|
* // This scope re-renders when state.count changes
|
|
383
370
|
* $(`p#Count is ${state.count}`);
|
|
384
|
-
* $('button
|
|
371
|
+
* $('button text=Increment click=', () => state.count++);
|
|
385
372
|
* });
|
|
386
373
|
* ```
|
|
387
374
|
*
|
|
388
375
|
* @example Two-way Binding
|
|
389
376
|
* ```typescript
|
|
390
377
|
* const user = proxy({ name: '' });
|
|
391
|
-
* $('input
|
|
378
|
+
* $('input placeholder=Name bind=', ref(user, 'name'));
|
|
392
379
|
* $('h3', () => { // Reactive scope
|
|
393
380
|
* $(`#Hello ${user.name || 'stranger'}`);
|
|
394
381
|
* });
|
|
@@ -397,7 +384,7 @@ export declare function ref<T extends TargetType, K extends keyof T>(target: T,
|
|
|
397
384
|
* @example Conditional Rendering
|
|
398
385
|
* ```typescript
|
|
399
386
|
* const show = proxy(false);
|
|
400
|
-
* $('button',
|
|
387
|
+
* $('button click=', () => show.value = !show.value, () => $(show.value ? '#Hide' : '#Show'));
|
|
401
388
|
* $(() => { // Reactive scope
|
|
402
389
|
* if (show.value) {
|
|
403
390
|
* $('p#Details are visible!');
|
|
@@ -418,7 +405,7 @@ export declare function $(...args: any[]): undefined | Element;
|
|
|
418
405
|
* - In case a selector contains a `&`, that character will be replaced by the parent selector.
|
|
419
406
|
* - Selectors will be split on `,` characters, each combining with the parent selector with *or* semantics.
|
|
420
407
|
* - Selector starting with `'@'` define at-rules like media queries. They may be nested within regular selectors.
|
|
421
|
-
* @param global -
|
|
408
|
+
* @param global - Deprecated! Use {@link insertGlobalCss} instead.
|
|
422
409
|
* @returns The unique class name prefix used for scoping (e.g., `.AbdStl1`). Use this
|
|
423
410
|
* prefix with {@link $} to apply the styles.
|
|
424
411
|
*
|
|
@@ -575,7 +562,7 @@ export declare function getParentElement(): Element;
|
|
|
575
562
|
* })
|
|
576
563
|
*
|
|
577
564
|
* // Show the sum
|
|
578
|
-
* $('h1',
|
|
565
|
+
* $('h1 text=', sum);
|
|
579
566
|
*
|
|
580
567
|
* // Make random changes to the array
|
|
581
568
|
* const rnd = () => 0|(Math.random()*20);
|
|
@@ -609,8 +596,8 @@ export declare function clean(cleaner: () => void): void;
|
|
|
609
596
|
* // When data.notifications changes, only this inner scope reruns,
|
|
610
597
|
* // leaving the `<p>Welcome, ..</p>` untouched.
|
|
611
598
|
* console.log('Notifications');
|
|
612
|
-
* $('code.notification-badge
|
|
613
|
-
* $('a
|
|
599
|
+
* $('code.notification-badge text=', data.notifications);
|
|
600
|
+
* $('a text=Notify! click=', () => data.notifications++);
|
|
614
601
|
* });
|
|
615
602
|
* });
|
|
616
603
|
* ```
|
|
@@ -707,7 +694,7 @@ export declare function unmountAll(): void;
|
|
|
707
694
|
* ```
|
|
708
695
|
*
|
|
709
696
|
*/
|
|
710
|
-
export declare function peek<T extends object>(target: T, key:
|
|
697
|
+
export declare function peek<T extends object, K extends keyof T>(target: T, key: K): T[K];
|
|
711
698
|
export declare function peek<K, V>(target: Map<K, V>, key: K): V | undefined;
|
|
712
699
|
export declare function peek<T>(target: T[], key: number): T | undefined;
|
|
713
700
|
export declare function peek<T>(target: () => T): T;
|
package/dist/aberdeen.js
CHANGED
|
@@ -1067,6 +1067,11 @@ var cssVars = optProxy({});
|
|
|
1067
1067
|
for (let i = 1;i <= 12; i++) {
|
|
1068
1068
|
cssVars[i] = 2 ** (i - 3) + "rem";
|
|
1069
1069
|
}
|
|
1070
|
+
var DIGIT_FIRST = /^\d/;
|
|
1071
|
+
function cssVarRef(name) {
|
|
1072
|
+
const varName = DIGIT_FIRST.test(name) ? `m${name}` : name;
|
|
1073
|
+
return `var(--${varName})`;
|
|
1074
|
+
}
|
|
1070
1075
|
function clone(src) {
|
|
1071
1076
|
if (NO_COPY in src)
|
|
1072
1077
|
return src;
|
|
@@ -1305,7 +1310,7 @@ ${styleToCss(v, prefix)}}
|
|
|
1305
1310
|
rules += styleToCss(v, k.includes("&") ? k.replace(/&/g, prefix) : `${prefix} ${k}`);
|
|
1306
1311
|
}
|
|
1307
1312
|
} else {
|
|
1308
|
-
const val = v == null || v === false ? "" : typeof v === "string" ? v[0] === "@" ?
|
|
1313
|
+
const val = v == null || v === false ? "" : typeof v === "string" ? v[0] === "@" ? cssVarRef(v.substring(1)) : v : String(v);
|
|
1309
1314
|
const expanded = CSS_SHORT[k] || k;
|
|
1310
1315
|
for (const prop of Array.isArray(expanded) ? expanded : [expanded]) {
|
|
1311
1316
|
props += `${prop.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}:${val};`;
|
|
@@ -1333,7 +1338,7 @@ function applyArg(el, key, value) {
|
|
|
1333
1338
|
el.classList.remove(...classes);
|
|
1334
1339
|
} else if (key[0] === "$") {
|
|
1335
1340
|
key = key.substring(1);
|
|
1336
|
-
const val = value == null || value === false ? "" : typeof value === "string" ? value[0] === "@" ?
|
|
1341
|
+
const val = value == null || value === false ? "" : typeof value === "string" ? value[0] === "@" ? cssVarRef(value.substring(1)) : value : String(value);
|
|
1337
1342
|
const expanded = CSS_SHORT[key] || key;
|
|
1338
1343
|
if (typeof expanded === "string") {
|
|
1339
1344
|
el.style[expanded] = val;
|
|
@@ -1502,6 +1507,23 @@ function withEmitHandler(handler, func) {
|
|
|
1502
1507
|
emit = oldEmitHandler;
|
|
1503
1508
|
}
|
|
1504
1509
|
}
|
|
1510
|
+
if (typeof document !== "undefined") {
|
|
1511
|
+
leakScope(() => {
|
|
1512
|
+
mount(document.head, () => {
|
|
1513
|
+
$("style", () => {
|
|
1514
|
+
let css = `:root {
|
|
1515
|
+
`;
|
|
1516
|
+
for (const [key, value] of Object.entries(cssVars)) {
|
|
1517
|
+
const varName = DIGIT_FIRST.test(String(key)) ? `m${key}` : key;
|
|
1518
|
+
css += ` --${varName}: ${value};
|
|
1519
|
+
`;
|
|
1520
|
+
}
|
|
1521
|
+
css += "}";
|
|
1522
|
+
$(`#${css}`);
|
|
1523
|
+
});
|
|
1524
|
+
});
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1505
1527
|
export {
|
|
1506
1528
|
withEmitHandler,
|
|
1507
1529
|
unproxy,
|
|
@@ -1535,5 +1557,5 @@ export {
|
|
|
1535
1557
|
$
|
|
1536
1558
|
};
|
|
1537
1559
|
|
|
1538
|
-
//# debugId=
|
|
1560
|
+
//# debugId=69BD2D56BBDAB97164756E2164756E21
|
|
1539
1561
|
//# sourceMappingURL=aberdeen.js.map
|