@praxisjs/core 1.8.1 → 1.8.3

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,28 @@
1
1
  # @praxisjs/core
2
2
 
3
+ ## 1.8.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 7d87288: Document `props` as `StatelessComponent`'s intended public API, and as an internal implementation detail on `StatefulComponent` (use `@Prop()` fields instead). No behavior change — `RootComponent.props`, `StatefulComponent.props`, and `StatelessComponent.props` all still return `_rawProps` exactly as before; this only clarifies, via JSDoc, which class each usage pattern is meant for.
8
+
9
+ ## 1.8.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 376e38c: Internal consolidation: move `_setProps` to `RootComponent` and mark internal fields with `@internal`.
14
+
15
+ `_setProps(props)` was implemented identically in both `StatefulComponent` and `StatelessComponent`. It is now defined once on `RootComponent` and removed from the subclasses.
16
+
17
+ 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:
18
+ - `RootComponent._rawProps` — props filled by the renderer on instantiation and update
19
+ - `RootComponent._mounted` — becomes `true` after `onMount` fires
20
+ - `RootComponent._anchor` — end-comment node set by the runtime; used by decorators to locate the parent element
21
+ - `StatefulComponent._defaults` — default field values used to reset props on update
22
+ - `StatefulComponent._stateDirty` — set by `@State` on any write; cleared by the renderer after each re-render
23
+
24
+ No public API changes.
25
+
3
26
  ## 1.8.1
4
27
 
5
28
  ### Patch Changes
@@ -1,11 +1,30 @@
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;
23
+ /**
24
+ * Raw props, typed. `StatelessComponent` re-exposes this as its public
25
+ * props API; on `StatefulComponent` it's internal — use `@Prop()` instead.
26
+ * @internal
27
+ */
9
28
  get props(): T;
10
29
  onBeforeMount?(): void;
11
30
  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;;;;OAIG;IACH,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,32 @@
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
+ }
25
+ /**
26
+ * Raw props, typed. `StatelessComponent` re-exposes this as its public
27
+ * props API; on `StatefulComponent` it's internal — use `@Prop()` instead.
28
+ * @internal
29
+ */
9
30
  get props() {
10
31
  return this._rawProps;
11
32
  }
@@ -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;;;;OAIG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CASF"}
@@ -1,9 +1,19 @@
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;
13
+ /**
14
+ * Raw props. Use `@Prop()` fields instead of reading this directly in user code.
15
+ * @internal
16
+ */
17
+ get props(): Record<string, unknown>;
8
18
  }
9
19
  //# 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;IAEpB;;;OAGG;IACH,IAAa,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE5C;CACF"}
@@ -2,16 +2,23 @@ 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);
16
+ /**
17
+ * Raw props. Use `@Prop()` fields instead of reading this directly in user code.
18
+ * @internal
19
+ */
20
+ get props() {
21
+ return this._rawProps;
15
22
  }
16
23
  }
17
24
  //# 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;IAStB,CAAC;IAPC;;;OAGG;IACH,IAAa,KAAK;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
@@ -4,7 +4,8 @@ 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;
7
+ /** Public props API for presentational components — see `RootComponent.props`. */
8
+ get props(): StatelessComponentType<T>;
8
9
  }
9
10
  export {};
10
11
  //# 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;IAChD,kFAAkF;IAClF,IAAa,KAAK,IAAI,sBAAsB,CAAC,CAAC,CAAC,CAE9C;CACF"}
@@ -1,10 +1,8 @@
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);
3
+ /** Public props API for presentational components — see `RootComponent.props`. */
4
+ get props() {
5
+ return this._rawProps;
8
6
  }
9
7
  }
10
8
  //# 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;IAChD,kFAAkF;IAClF,IAAa,KAAK;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@praxisjs/core",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,17 +1,42 @@
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
+
35
+ /**
36
+ * Raw props, typed. `StatelessComponent` re-exposes this as its public
37
+ * props API; on `StatefulComponent` it's internal — use `@Prop()` instead.
38
+ * @internal
39
+ */
15
40
  get props(): T {
16
41
  return this._rawProps;
17
42
  }
@@ -3,16 +3,23 @@ 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);
18
+ /**
19
+ * Raw props. Use `@Prop()` fields instead of reading this directly in user code.
20
+ * @internal
21
+ */
22
+ override get props(): Record<string, unknown> {
23
+ return this._rawProps;
17
24
  }
18
25
  }
@@ -7,10 +7,8 @@ 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);
10
+ /** Public props API for presentational components — see `RootComponent.props`. */
11
+ override get props(): StatelessComponentType<T> {
12
+ return this._rawProps;
15
13
  }
16
14
  }