@sigil-dev/runtime 0.3.0 → 0.4.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 (3) hide show
  1. package/index.ts +3 -2
  2. package/jsr.json +1 -1
  3. package/package.json +1 -1
package/index.ts CHANGED
@@ -410,8 +410,9 @@ export function insert(parent: Element, value: unknown): void {
410
410
  */
411
411
  export type Directive = (node: Element, params: unknown) => void | (() => void);
412
412
 
413
- export function applyDirective(node: Element, directive: Directive, params?: unknown): void {
414
- const cleanup = directive(node, params);
413
+ export function applyDirective(node: Element, directive: Directive | [Directive, unknown]): void {
414
+ const [fn, params] = Array.isArray(directive) ? directive : [directive, undefined];
415
+ const cleanup = fn(node, params);
415
416
  if (typeof cleanup === "function") {
416
417
  createEffect(() => () => cleanup());
417
418
  }
package/jsr.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigil-dev/runtime",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "exports": "./index.ts",
5
5
  "publish": {
6
6
  "exclude": ["src/**/*.test.ts"]
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sigil-dev/runtime",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.3.0",
5
+ "version": "0.4.0",
6
6
  "description": "Runtime for the Sigil framework",
7
7
  "private": false,
8
8
  "devDependencies": {