@praxisjs/core 1.8.1 → 1.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @praxisjs/core
2
2
 
3
+ ## 1.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 376e38c: Internal consolidation: move `_setProps` to `RootComponent` and mark internal fields with `@internal`.
8
+
9
+ `_setProps(props)` was implemented identically in both `StatefulComponent` and `StatelessComponent`. It is now defined once on `RootComponent` and removed from the subclasses.
10
+
11
+ The following fields on `RootComponent`, `StatefulComponent` are now annotated with `@internal` JSDoc tags and descriptions so they are hidden from TypeDoc output and IDE autocomplete:
12
+ - `RootComponent._rawProps` — props filled by the renderer on instantiation and update
13
+ - `RootComponent._mounted` — becomes `true` after `onMount` fires
14
+ - `RootComponent._anchor` — end-comment node set by the runtime; used by decorators to locate the parent element
15
+ - `StatefulComponent._defaults` — default field values used to reset props on update
16
+ - `StatefulComponent._stateDirty` — set by `@State` on any write; cleared by the renderer after each re-render
17
+
18
+ No public API changes.
19
+
3
20
  ## 1.8.1
4
21
 
5
22
  ### Patch Changes
@@ -1,11 +1,25 @@
1
1
  export declare abstract class RootComponent<T extends object = Record<string, never>> {
2
- /** Props passed by the parent — filled by the renderer when instantiating/updating. */
2
+ /**
3
+ * Props passed by the parent — filled by the renderer when instantiating/updating.
4
+ * @internal
5
+ */
3
6
  readonly _rawProps: T;
4
- /** @internal — becomes `true` after `onMount` fires */
7
+ /**
8
+ * Becomes `true` after `onMount` fires.
9
+ * @internal
10
+ */
5
11
  _mounted: boolean;
6
- /** @internal — end comment anchor set by the runtime; used by decorators to locate the parent element */
12
+ /**
13
+ * End comment anchor set by the runtime; used by decorators to locate the parent element.
14
+ * @internal
15
+ */
7
16
  _anchor?: Comment;
8
17
  constructor(props?: T);
18
+ /**
19
+ * Replaces the current props with a new set; called by the renderer on every parent re-render.
20
+ * @internal
21
+ */
22
+ _setProps(props: Record<string, unknown>): void;
9
23
  get props(): T;
10
24
  onBeforeMount?(): void;
11
25
  onMount?(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/component/base.ts"],"names":[],"mappings":"AAAA,8BAAsB,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAC1E,uFAAuF;IACvF,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAW;IAEhC,uDAAuD;IACvD,QAAQ,UAAS;IAEjB,yGAAyG;IACzG,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEN,KAAK,GAAE,CAAW;IAI9B,IAAI,KAAK,IAAI,CAAC,CAEb;IAED,aAAa,CAAC,IAAI,IAAI;IACtB,OAAO,CAAC,IAAI,IAAI;IAChB,SAAS,CAAC,IAAI,IAAI;IAElB,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI;IAE/D,QAAQ,CAAC,MAAM,IAAI,IAAI,GAAG,IAAI,EAAE,GAAG,IAAI;CACxC"}
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/component/base.ts"],"names":[],"mappings":"AAAA,8BAAsB,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAC1E;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAW;IAEhC;;;OAGG;IACH,QAAQ,UAAS;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEN,KAAK,GAAE,CAAW;IAI9B;;;OAGG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAOxC,IAAI,KAAK,IAAI,CAAC,CAEb;IAED,aAAa,CAAC,IAAI,IAAI;IACtB,OAAO,CAAC,IAAI,IAAI;IAChB,SAAS,CAAC,IAAI,IAAI;IAElB,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI;IAE/D,QAAQ,CAAC,MAAM,IAAI,IAAI,GAAG,IAAI,EAAE,GAAG,IAAI;CACxC"}
@@ -1,11 +1,27 @@
1
1
  export class RootComponent {
2
2
  constructor(props = {}) {
3
- /** Props passed by the parent — filled by the renderer when instantiating/updating. */
3
+ /**
4
+ * Props passed by the parent — filled by the renderer when instantiating/updating.
5
+ * @internal
6
+ */
4
7
  this._rawProps = {};
5
- /** @internal — becomes `true` after `onMount` fires */
8
+ /**
9
+ * Becomes `true` after `onMount` fires.
10
+ * @internal
11
+ */
6
12
  this._mounted = false;
7
13
  Object.assign(this._rawProps, props);
8
14
  }
15
+ /**
16
+ * Replaces the current props with a new set; called by the renderer on every parent re-render.
17
+ * @internal
18
+ */
19
+ _setProps(props) {
20
+ Object.keys(this._rawProps).forEach((k) => {
21
+ Reflect.deleteProperty(this._rawProps, k);
22
+ });
23
+ Object.assign(this._rawProps, props);
24
+ }
9
25
  get props() {
10
26
  return this._rawProps;
11
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/component/base.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,aAAa;IAUjC,YAAY,QAAW,EAAO;QAT9B,uFAAuF;QAC9E,cAAS,GAAM,EAAO,CAAC;QAEhC,uDAAuD;QACvD,aAAQ,GAAG,KAAK,CAAC;QAMf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CASF"}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/component/base.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,aAAa;IAmBjC,YAAY,QAAW,EAAO;QAlB9B;;;WAGG;QACM,cAAS,GAAM,EAAO,CAAC;QAEhC;;;WAGG;QACH,aAAQ,GAAG,KAAK,CAAC;QASf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,KAA8B;QACtC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACxC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CASF"}
@@ -1,9 +1,14 @@
1
1
  import { RootComponent } from "./base";
2
2
  export declare abstract class StatefulComponent extends RootComponent<Record<string, unknown>> {
3
- /** Default values declared in the class. */
3
+ /**
4
+ * Default field values declared in the class, used to reset props on update.
5
+ * @internal
6
+ */
4
7
  readonly _defaults: Record<string, unknown>;
5
- /** @internal — set to true by @State on any write; cleared by renderer after each re-render */
8
+ /**
9
+ * Set to `true` by `@State` on any write; cleared by the renderer after each re-render.
10
+ * @internal
11
+ */
6
12
  _stateDirty: boolean;
7
- _setProps(props: Record<string, unknown>): void;
8
13
  }
9
14
  //# sourceMappingURL=stateful.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stateful.d.ts","sourceRoot":"","sources":["../../src/component/stateful.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,8BAAsB,iBAAkB,SAAQ,aAAa,CAC3D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CACxB;IACC,4CAA4C;IAC5C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IAEjD,+FAA+F;IAC/F,WAAW,UAAS;IAEpB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMzC"}
1
+ {"version":3,"file":"stateful.d.ts","sourceRoot":"","sources":["../../src/component/stateful.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,8BAAsB,iBAAkB,SAAQ,aAAa,CAC3D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CACxB;IACC;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IAEjD;;;OAGG;IACH,WAAW,UAAS;CAErB"}
@@ -2,16 +2,16 @@ import { RootComponent } from "./base";
2
2
  export class StatefulComponent extends RootComponent {
3
3
  constructor() {
4
4
  super(...arguments);
5
- /** Default values declared in the class. */
5
+ /**
6
+ * Default field values declared in the class, used to reset props on update.
7
+ * @internal
8
+ */
6
9
  this._defaults = {};
7
- /** @internal — set to true by @State on any write; cleared by renderer after each re-render */
10
+ /**
11
+ * Set to `true` by `@State` on any write; cleared by the renderer after each re-render.
12
+ * @internal
13
+ */
8
14
  this._stateDirty = false;
9
15
  }
10
- _setProps(props) {
11
- Object.keys(this._rawProps).forEach((k) => {
12
- Reflect.deleteProperty(this._rawProps, k);
13
- });
14
- Object.assign(this._rawProps, props);
15
- }
16
16
  }
17
17
  //# sourceMappingURL=stateful.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stateful.js","sourceRoot":"","sources":["../../src/component/stateful.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,OAAgB,iBAAkB,SAAQ,aAE/C;IAFD;;QAGE,4CAA4C;QACnC,cAAS,GAA4B,EAAE,CAAC;QAEjD,+FAA+F;QAC/F,gBAAW,GAAG,KAAK,CAAC;IAQtB,CAAC;IANC,SAAS,CAAC,KAA8B;QACtC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACxC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;CACF"}
1
+ {"version":3,"file":"stateful.js","sourceRoot":"","sources":["../../src/component/stateful.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,OAAgB,iBAAkB,SAAQ,aAE/C;IAFD;;QAGE;;;WAGG;QACM,cAAS,GAA4B,EAAE,CAAC;QAEjD;;;WAGG;QACH,gBAAW,GAAG,KAAK,CAAC;IAEtB,CAAC;CAAA"}
@@ -4,7 +4,6 @@ type StatelessComponentType<T> = T & {
4
4
  children?: Children;
5
5
  };
6
6
  export declare abstract class StatelessComponent<T extends object = Record<never, never>> extends RootComponent<StatelessComponentType<T>> {
7
- _setProps(props: Record<string, unknown>): void;
8
7
  }
9
8
  export {};
10
9
  //# sourceMappingURL=stateless.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stateless.d.ts","sourceRoot":"","sources":["../../src/component/stateless.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE7D,8BAAsB,kBAAkB,CACtC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CACvC,SAAQ,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAChD,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMzC"}
1
+ {"version":3,"file":"stateless.d.ts","sourceRoot":"","sources":["../../src/component/stateless.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE7D,8BAAsB,kBAAkB,CACtC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CACvC,SAAQ,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;CACjD"}
@@ -1,10 +1,4 @@
1
1
  import { RootComponent } from "./base";
2
2
  export class StatelessComponent extends RootComponent {
3
- _setProps(props) {
4
- Object.keys(this._rawProps).forEach((k) => {
5
- Reflect.deleteProperty(this._rawProps, k);
6
- });
7
- Object.assign(this._rawProps, props);
8
- }
9
3
  }
10
4
  //# sourceMappingURL=stateless.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stateless.js","sourceRoot":"","sources":["../../src/component/stateless.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAIvC,MAAM,OAAgB,kBAEpB,SAAQ,aAAwC;IAChD,SAAS,CAAC,KAA8B;QACtC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACxC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;CACF"}
1
+ {"version":3,"file":"stateless.js","sourceRoot":"","sources":["../../src/component/stateless.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAIvC,MAAM,OAAgB,kBAEpB,SAAQ,aAAwC;CACjD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@praxisjs/core",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,17 +1,37 @@
1
1
  export abstract class RootComponent<T extends object = Record<string, never>> {
2
- /** Props passed by the parent — filled by the renderer when instantiating/updating. */
2
+ /**
3
+ * Props passed by the parent — filled by the renderer when instantiating/updating.
4
+ * @internal
5
+ */
3
6
  readonly _rawProps: T = {} as T;
4
7
 
5
- /** @internal — becomes `true` after `onMount` fires */
8
+ /**
9
+ * Becomes `true` after `onMount` fires.
10
+ * @internal
11
+ */
6
12
  _mounted = false;
7
13
 
8
- /** @internal — end comment anchor set by the runtime; used by decorators to locate the parent element */
14
+ /**
15
+ * End comment anchor set by the runtime; used by decorators to locate the parent element.
16
+ * @internal
17
+ */
9
18
  _anchor?: Comment;
10
19
 
11
20
  constructor(props: T = {} as T) {
12
21
  Object.assign(this._rawProps, props);
13
22
  }
14
23
 
24
+ /**
25
+ * Replaces the current props with a new set; called by the renderer on every parent re-render.
26
+ * @internal
27
+ */
28
+ _setProps(props: Record<string, unknown>) {
29
+ Object.keys(this._rawProps).forEach((k) => {
30
+ Reflect.deleteProperty(this._rawProps, k);
31
+ });
32
+ Object.assign(this._rawProps, props);
33
+ }
34
+
15
35
  get props(): T {
16
36
  return this._rawProps;
17
37
  }
@@ -3,16 +3,16 @@ import { RootComponent } from "./base";
3
3
  export abstract class StatefulComponent extends RootComponent<
4
4
  Record<string, unknown>
5
5
  > {
6
- /** Default values declared in the class. */
6
+ /**
7
+ * Default field values declared in the class, used to reset props on update.
8
+ * @internal
9
+ */
7
10
  readonly _defaults: Record<string, unknown> = {};
8
11
 
9
- /** @internal — set to true by @State on any write; cleared by renderer after each re-render */
12
+ /**
13
+ * Set to `true` by `@State` on any write; cleared by the renderer after each re-render.
14
+ * @internal
15
+ */
10
16
  _stateDirty = false;
11
17
 
12
- _setProps(props: Record<string, unknown>) {
13
- Object.keys(this._rawProps).forEach((k) => {
14
- Reflect.deleteProperty(this._rawProps, k);
15
- });
16
- Object.assign(this._rawProps, props);
17
- }
18
18
  }
@@ -7,10 +7,4 @@ type StatelessComponentType<T> = T & { children?: Children };
7
7
  export abstract class StatelessComponent<
8
8
  T extends object = Record<never, never>,
9
9
  > extends RootComponent<StatelessComponentType<T>> {
10
- _setProps(props: Record<string, unknown>) {
11
- Object.keys(this._rawProps).forEach((k) => {
12
- Reflect.deleteProperty(this._rawProps, k);
13
- });
14
- Object.assign(this._rawProps, props);
15
- }
16
10
  }