wallace 0.10.0 → 0.11.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
@@ -1,6 +1,6 @@
1
1
  # Wallace
2
2
 
3
- This package contains the library for the [Wallace](https://github.com/wallace-js/wallace) framework, which you import into your source files:
3
+ This package contains the library for the [Wallace](https://wallace.js.org) framework, which you import into your source files:
4
4
 
5
5
  ```jsx
6
6
  import { mount } from 'wallace';
@@ -26,4 +26,4 @@ npx create-wallace-app
26
26
 
27
27
  As that sets up your babel and webpack configurations for you.
28
28
 
29
- For more detailed documentation see the [Wallace repository on github](https://github.com/wallace-js/wallace).
29
+ For more detailed documentation see the [Wallace repository on github](https://wallace.js.org/docs/).
package/lib/component.js CHANGED
@@ -115,10 +115,13 @@ Object.defineProperty(ComponentPrototype, "hidden", {
115
115
  });
116
116
 
117
117
  const ComponentBase = {
118
- stubs: {},
119
118
  prototype: ComponentPrototype
120
119
  };
121
120
 
121
+ if (wallaceConfig.flags.useStubs) {
122
+ ComponentBase.stubs = {};
123
+ }
124
+
122
125
  /**
123
126
  *
124
127
  * @param {function} ComponentFunction - The Component definition function to add bits to.
@@ -134,15 +137,22 @@ export function initConstructor(ComponentFunction, BaseComponentFunction) {
134
137
  }
135
138
  }
136
139
  ));
137
- Object.defineProperty(ComponentFunction, "methods", {
138
- set: function (value) {
139
- Object.assign(proto, value);
140
- },
141
- get: function () {
142
- return proto;
143
- }
144
- });
145
- ComponentFunction.stubs = Object.assign({}, BaseComponentFunction.stubs);
140
+
141
+ if (wallaceConfig.flags.useMethods) {
142
+ Object.defineProperty(ComponentFunction, "methods", {
143
+ set: function (value) {
144
+ Object.assign(proto, value);
145
+ },
146
+ get: function () {
147
+ return proto;
148
+ }
149
+ });
150
+ }
151
+
152
+ if (wallaceConfig.flags.useStubs) {
153
+ ComponentFunction.stubs = Object.assign({}, BaseComponentFunction.stubs);
154
+ }
155
+
146
156
  return ComponentFunction;
147
157
  }
148
158
 
package/lib/types.d.ts CHANGED
@@ -8,6 +8,7 @@
8
8
 
9
9
  ### Contents
10
10
 
11
+ 0. Configuration
11
12
  1. Components
12
13
  2. JSX
13
14
  3. Nesting
@@ -19,7 +20,41 @@
19
20
  9. TypeScript
20
21
  10. Helpers
21
22
 
22
- For more detailed documentation go to https://github.com/wallace-js/wallace
23
+ For more detailed documentation go to https://wallace.js.org/docs/
24
+
25
+
26
+ ## 0. Configuration
27
+
28
+ You need to set flags in your babel config to use certain features:
29
+
30
+ 1. useControllers - enables use of `ctrl` in components.
31
+ 2. useMethods - adds the `methods` helper to components.
32
+ 3. useStubs - enables the use of stubs.
33
+
34
+ The types (and therefore tool tips) are unaffected by these flags, and will treat them
35
+ all as being true.
36
+
37
+ ```tsx
38
+ module.exports = {
39
+ plugins: [
40
+ [
41
+ "babel-plugin-wallace",
42
+ {
43
+ flags: {
44
+ useControllers: true,
45
+ useMethods: true,
46
+ useStubs: true
47
+ },
48
+ directives: [...]
49
+ }
50
+ ],
51
+ "@babel/plugin-syntax-jsx"
52
+ ],
53
+ presets: ["@babel/preset-typescript", ...]
54
+ };
55
+ ```
56
+
57
+ The `directives` option lets you override or define new directives. See main docs.
23
58
 
24
59
  ## 1. Components
25
60
 
@@ -1012,9 +1047,11 @@ interface DirectiveAttributes extends AllDomEvents {
1012
1047
  toggle?: string;
1013
1048
 
1014
1049
  /**
1015
- * Foo
1050
+ * ## Wallace directive: unique
1051
+ *
1052
+ * Performance optimisation that can be applied to a component which is only used once.
1016
1053
  */
1017
- "class-a"?: string;
1054
+ unique?: boolean;
1018
1055
  }
1019
1056
 
1020
1057
  declare namespace JSX {
@@ -1051,6 +1088,7 @@ declare namespace JSX {
1051
1088
  * - `style:xyz` sets a specific style property.
1052
1089
  * - `toggle:xyz` toggles `xyz` as defined by `class:xyz` on same element, or class
1053
1090
  * `xyz`.
1091
+ * - `unique` can be set on components which only used once for better performance.
1054
1092
  *
1055
1093
  * You will get more details by hovering on the directive itself, but unfortunetely
1056
1094
  * the tool tip won't display when you use a qualifier, like `class:danger`. To see
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "wallace",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "author": "Andrew Buchan",
5
5
  "description": "An insanely small, fast, intuitive and extendable front-end framework",
6
+ "homepage": "https://wallace.js.org",
6
7
  "license": "ISC",
7
8
  "main": "lib/index.js",
8
9
  "files": [
@@ -14,8 +15,8 @@
14
15
  "test": "jest --clearCache && jest"
15
16
  },
16
17
  "dependencies": {
17
- "babel-plugin-wallace": "^0.10.0",
18
+ "babel-plugin-wallace": "^0.11.0",
18
19
  "browserify": "^17.0.1"
19
20
  },
20
- "gitHead": "5516e673ca0e4c0a01644701b914ca923e000580"
21
+ "gitHead": "f145fe3b852025e2c851c27d75e7a104c5ec2bda"
21
22
  }