vasille-jsx 4.0.1 → 4.2.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 CHANGED
@@ -35,6 +35,7 @@ $ npm create vasille
35
35
  ### Full documentation:
36
36
  * [Learn `Vasille` in 5 minutes](https://github.com/vasille-js/vasille-js/blob/v4/doc/V4-API.md)
37
37
  * [Vasille Router Documentation](https://github.com/vasille-js/vasille-js/blob/v4/doc/Router-API.md)
38
+ * [Vasille Compostion function](https://github.com/vasille-js/vasille-js/blob/v4/doc/Compositions.md)
38
39
 
39
40
  ### Examples
40
41
  * [TypeScript Example](https://github.com/vasille-js/example-typescript)
@@ -97,10 +98,24 @@ All of these are supported:
97
98
  * [x] `100%` Test Coverage fot babel plugin.
98
99
  * [x] Add CSS support (define styles in components).
99
100
  * [x] Add router.
100
- * [ ] Add SSG (static site generation).
101
+ * [x] Add SSG (static site generation).
101
102
  * [ ] Add SSR (server side rendering).
102
103
  * [ ] Develop tools extension for debugging.
103
104
 
105
+ ## Change log
106
+
107
+ ### 4.2.0
108
+
109
+ Add support for inlined conditions in JSX, binary `&&` and ternary `?:` operator.
110
+
111
+ ### 4.1.0
112
+
113
+ Added SSG (static site generation) as build option `vasille-web build static`.
114
+
115
+ ### 4.0.0
116
+
117
+ Initial version of the framework with file based routing and building scripts (`vasille-web dev` and `vasille-web build spa`).
118
+
104
119
  ## Questions
105
120
 
106
121
  If you have questions, feel free to contact the maintainer of the project:
package/lib/components.js CHANGED
@@ -4,7 +4,7 @@ export function Slot({ model, slot, ...options }, ctx, defaultSlot) {
4
4
  model(options, ctx);
5
5
  }
6
6
  else {
7
- (slot ?? defaultSlot)?.(ctx);
7
+ (slot ?? defaultSlot)?.({}, ctx);
8
8
  }
9
9
  }
10
10
  export function Switch(options, ctx) {
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Debug, Delay, For, Slot, Watch, Switch } from "./components.js";
2
2
  export { view, mount, model, store } from "./compose.js";
3
3
  export { awaited } from "./library.js";
4
- export { ref, arrayModel, backward, mapModel, expr, setModel, forward, set, ensure } from "./internal.js";
4
+ export { ref, arrayModel, backward, mapModel, expr, setModel, forward, set, ensure, match } from "./internal.js";
5
5
  export { setErrorHandler } from "vasille";
package/lib/internal.js CHANGED
@@ -49,7 +49,7 @@ export function ensure(data) {
49
49
  * 1. `{[a]: a1 = 3} = {x: 2}` to `{[a]: a1 = match("a1", 3)} = {x: 2}`
50
50
  */
51
51
  export function match(name, data) {
52
- const iValueRequired = name.startsWith("$");
52
+ const iValueRequired = typeof name === "string" && name.startsWith("$");
53
53
  const isIValue = data instanceof IValue;
54
54
  if (iValueRequired && !isIValue) {
55
55
  return new Reference(data);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vasille-jsx",
3
- "version": "4.0.1",
4
- "description": "The framework designed to build bulletproof frontends (JSX components)",
3
+ "version": "4.2.0",
4
+ "description": "The same framework which is designed to build bulletproof frontends (JSX components)",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
7
7
  "types": "./types/index.d.ts",
@@ -44,7 +44,7 @@
44
44
  "opera 15"
45
45
  ],
46
46
  "dependencies": {
47
- "vasille": "^4.0.0"
47
+ "vasille": "^4.1.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/jest": "^30.0.0",
@@ -1,9 +1,9 @@
1
1
  import { Fragment, IValue } from "vasille";
2
2
  interface SlotOptions<Node, Element, TagOptions extends object, T extends object> {
3
3
  model?: (input: T, ctx: Fragment<Node, Element, TagOptions>) => void;
4
- slot?: (ctx: Fragment<Node, Element, TagOptions>) => void;
4
+ slot?: (input: object, ctx: Fragment<Node, Element, TagOptions>) => void;
5
5
  }
6
- export declare function Slot<Node, Element, TagOptions extends object, T extends object = {}>({ model, slot, ...options }: SlotOptions<Node, Element, TagOptions, T> & T, ctx: Fragment<Node, Element, TagOptions>, defaultSlot?: (ctx: Fragment<Node, Element, TagOptions>) => void): void;
6
+ export declare function Slot<Node, Element, TagOptions extends object, T extends object = {}>({ model, slot, ...options }: SlotOptions<Node, Element, TagOptions, T> & T, ctx: Fragment<Node, Element, TagOptions>, defaultSlot?: (input: object, ctx: Fragment<Node, Element, TagOptions>) => void): void;
7
7
  interface SwitchOptions<Node, Element, TagOptions extends object> {
8
8
  cases: {
9
9
  $case: IValue<unknown>;
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Debug, Delay, For, Slot, Watch, Switch } from "./components.js";
2
2
  export { view, mount, model, store, type Composed } from "./compose.js";
3
3
  export { awaited } from "./library.js";
4
- export { ref, arrayModel, backward, mapModel, expr, setModel, forward, set, ensure } from "./internal.js";
4
+ export { ref, arrayModel, backward, mapModel, expr, setModel, forward, set, ensure, match } from "./internal.js";
5
5
  export { setErrorHandler } from "vasille";
@@ -32,7 +32,7 @@ export declare function ensure(data: unknown): IValue<any>;
32
32
  * 1. `{[a]: a1} = {x: 2}` to `{[a]: a1 = match("a1")} = {x: 2}`
33
33
  * 1. `{[a]: a1 = 3} = {x: 2}` to `{[a]: a1 = match("a1", 3)} = {x: 2}`
34
34
  */
35
- export declare function match(name: string, data?: unknown): any;
35
+ export declare function match(name: string | number | symbol, data?: unknown): any;
36
36
  /**
37
37
  * Set a value of a field (alternative to proxies)
38
38
  * 1. `obj.$key = 23` to `set(obj, "$key", 23)`
package/eslint.config.js DELETED
@@ -1,25 +0,0 @@
1
- import compat from "eslint-plugin-compat";
2
- import tseslint from "typescript-eslint";
3
- import { globalIgnores } from "eslint/config";
4
-
5
- export default tseslint.config(
6
- tseslint.configs.base,
7
- {
8
- name: "compat check",
9
- files: ["src/**/*.ts", "src/**/*.tsx"],
10
- plugins: { compat },
11
- rules: {
12
- "compat/compat": "error",
13
- },
14
- settings: {
15
- polyfills: [],
16
- },
17
- languageOptions: {
18
- parserOptions: {
19
- projectService: false,
20
- tsconfigRootDir: import.meta.dirname,
21
- },
22
- },
23
- },
24
- globalIgnores(["node_modules", "lib/**/*", "types", "coverage/**/*"]),
25
- );