@fluffjs/fluff 0.4.1 → 0.4.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluffjs/fluff",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",
@@ -60,6 +60,7 @@ export declare abstract class FluffBase extends HTMLElement {
60
60
  private static __expressionsReady;
61
61
  private static readonly __pendingInitCallbacks;
62
62
  static __setExpressionTable(expressions: ExpressionFn[], handlers: HandlerFn[], strings?: string[]): void;
63
+ static __decodeString(idx: number): string;
63
64
  static __decodeDep(dep: number | number[]): string | string[];
64
65
  static __decodeDeps(deps: (number | number[])[] | null): (string | string[])[] | undefined;
65
66
  static __decodeMarkerConfig(compact: CompactMarkerConfig): unknown;
@@ -37,6 +37,9 @@ export class FluffBase extends HTMLElement {
37
37
  callback();
38
38
  }
39
39
  }
40
+ static __decodeString(idx) {
41
+ return FluffBase.__s[idx];
42
+ }
40
43
  static __decodeDep(dep) {
41
44
  if (Array.isArray(dep)) {
42
45
  return dep.map(idx => FluffBase.__s[idx]);
@@ -22,7 +22,7 @@ export declare abstract class FluffElement extends FluffBase {
22
22
  protected __pipe(name: string, value: unknown, ...args: unknown[]): unknown;
23
23
  protected __getPipeFn(name: string): ((value: unknown, ...args: unknown[]) => unknown) | undefined;
24
24
  protected __getShadowRoot(): ShadowRoot;
25
- protected __createProp<T>(name: string, options: T | {
25
+ protected __createProp<T>(nameOrIdx: string | number, options: T | {
26
26
  initialValue: T;
27
27
  [key: string]: unknown;
28
28
  }): Property<T>;
@@ -101,7 +101,8 @@ export class FluffElement extends FluffBase {
101
101
  __getShadowRoot() {
102
102
  return this._shadowRoot;
103
103
  }
104
- __createProp(name, options) {
104
+ __createProp(nameOrIdx, options) {
105
+ const name = typeof nameOrIdx === 'number' ? FluffBase.__decodeString(nameOrIdx) : nameOrIdx;
105
106
  const prop = new Property(options);
106
107
  Object.defineProperty(this, name, {
107
108
  get() {
package/utils/Property.js CHANGED
@@ -174,11 +174,11 @@ export class Property {
174
174
  if (this.value === undefined)
175
175
  return;
176
176
  this.onChange.emit(this.value);
177
- if (direction == Direction.Outbound) {
177
+ if (direction === Direction.Outbound) {
178
178
  this.onOutboundChange.emit(this.value);
179
179
  }
180
- if (direction == Direction.Inbound) {
181
- this.onOutboundChange.emit(this.value);
180
+ if (direction === Direction.Inbound) {
181
+ this.onInboundChange.emit(this.value);
182
182
  }
183
183
  }
184
184
  subscribe(direction, cb) {