routelit-client 0.0.2 → 0.3.1

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.
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
3
3
  level?: 1 | 2 | 3 | 4 | 5 | 6;
4
- children: React.ReactNode;
4
+ body: React.ReactNode;
5
5
  }
6
- declare function Heading({ children, level, ...props }: HeadingProps): React.DetailedReactHTMLElement<{
6
+ declare function Heading({ body, level, ...props }: HeadingProps): React.DetailedReactHTMLElement<{
7
7
  defaultChecked?: boolean | undefined;
8
8
  defaultValue?: string | number | readonly string[] | undefined;
9
9
  suppressContentEditableWarning?: boolean | undefined;
@@ -112,6 +112,7 @@ declare function Heading({ children, level, ...props }: HeadingProps): React.Det
112
112
  "aria-valuemin"?: number | undefined;
113
113
  "aria-valuenow"?: number | undefined;
114
114
  "aria-valuetext"?: string | undefined;
115
+ children?: React.ReactNode | undefined;
115
116
  dangerouslySetInnerHTML?: {
116
117
  __html: string | TrustedHTML;
117
118
  } | undefined;
@@ -286,7 +287,7 @@ declare function Heading({ children, level, ...props }: HeadingProps): React.Det
286
287
  onTransitionStart?: React.TransitionEventHandler<HTMLHeadingElement> | undefined;
287
288
  onTransitionStartCapture?: React.TransitionEventHandler<HTMLHeadingElement> | undefined;
288
289
  }, HTMLElement>;
289
- declare function Title({ children, ...props }: HeadingProps): import("react/jsx-runtime").JSX.Element;
290
- declare function Header({ children, ...props }: HeadingProps): import("react/jsx-runtime").JSX.Element;
291
- declare function Subheader({ children, ...props }: HeadingProps): import("react/jsx-runtime").JSX.Element;
290
+ declare function Title({ body, ...props }: HeadingProps): import("react/jsx-runtime").JSX.Element;
291
+ declare function Header({ body, ...props }: HeadingProps): import("react/jsx-runtime").JSX.Element;
292
+ declare function Subheader({ body, ...props }: HeadingProps): import("react/jsx-runtime").JSX.Element;
292
293
  export { Heading, Title, Header, Subheader };
@@ -11,18 +11,20 @@ export declare class RouteLitManager {
11
11
  private listeners;
12
12
  private isLoadingListeners;
13
13
  private errorListeners;
14
- private componentsTree?;
14
+ private componentsTree;
15
15
  private _isLoading;
16
16
  private _error?;
17
17
  private fragmentId?;
18
18
  private parentManager?;
19
19
  private address?;
20
20
  private lastURL?;
21
+ private initialized;
21
22
  constructor(props: RouteLitManagerProps);
22
23
  getLastURL: () => string;
23
24
  handleEvent: (e: CustomEvent<UIEventPayload>) => Promise<void>;
24
25
  handleError: (e: Error) => void;
25
26
  applyActions: (actionsResp: ActionsResponse, shouldNotify?: boolean) => void;
27
+ private initializeDOM;
26
28
  initialize: () => void;
27
29
  handlePopState: () => void;
28
30
  terminate: () => void;
@@ -788,13 +788,14 @@ class RouteLitManager {
788
788
  __publicField(this, "listeners", []);
789
789
  __publicField(this, "isLoadingListeners", []);
790
790
  __publicField(this, "errorListeners", []);
791
- __publicField(this, "componentsTree");
791
+ __publicField(this, "componentsTree", []);
792
792
  __publicField(this, "_isLoading", false);
793
793
  __publicField(this, "_error");
794
794
  __publicField(this, "fragmentId");
795
795
  __publicField(this, "parentManager");
796
796
  __publicField(this, "address");
797
797
  __publicField(this, "lastURL");
798
+ __publicField(this, "initialized", false);
798
799
  __publicField(this, "getLastURL", () => {
799
800
  var _a;
800
801
  return ((_a = this.parentManager) == null ? void 0 : _a.getLastURL()) ?? this.lastURL;
@@ -840,7 +841,22 @@ class RouteLitManager {
840
841
  this.componentsTree = componentsTreeCopy;
841
842
  if (shouldNotify) this.notifyListeners();
842
843
  });
844
+ __publicField(this, "initializeDOM", () => {
845
+ if (this.initialized) return;
846
+ const initializeEvent = new CustomEvent(
847
+ "routelit:event",
848
+ {
849
+ detail: {
850
+ id: "browser-navigation",
851
+ type: "initialize"
852
+ }
853
+ }
854
+ );
855
+ this.handleEvent(initializeEvent);
856
+ this.initialized = true;
857
+ });
843
858
  __publicField(this, "initialize", () => {
859
+ this.initializeDOM();
844
860
  document.addEventListener(
845
861
  "routelit:event",
846
862
  this.handleEvent
@@ -943,7 +959,7 @@ class RouteLitManager {
943
959
  }
944
960
  });
945
961
  var _a;
946
- this.componentsTree = props.componentsTree;
962
+ this.componentsTree = props.componentsTree ?? [];
947
963
  this.fragmentId = props.fragmentId;
948
964
  this.parentManager = props.parentManager;
949
965
  this.address = props.address;
@@ -20693,17 +20709,17 @@ const Expander = ({
20693
20709
  ] });
20694
20710
  };
20695
20711
  Expander.displayName = "Expander";
20696
- function Heading({ children, level = 1, ...props }) {
20697
- return React.createElement(`h${level}`, props, children);
20712
+ function Heading({ body, level = 1, ...props }) {
20713
+ return React.createElement(`h${level}`, props, body);
20698
20714
  }
20699
- function Title({ children, ...props }) {
20700
- return /* @__PURE__ */ jsx(Heading, { level: 1, ...props, children });
20715
+ function Title({ body, ...props }) {
20716
+ return /* @__PURE__ */ jsx(Heading, { level: 1, ...props, body });
20701
20717
  }
20702
- function Header({ children, ...props }) {
20703
- return /* @__PURE__ */ jsx(Heading, { level: 2, ...props, children });
20718
+ function Header({ body, ...props }) {
20719
+ return /* @__PURE__ */ jsx(Heading, { level: 2, ...props, body });
20704
20720
  }
20705
- function Subheader({ children, ...props }) {
20706
- return /* @__PURE__ */ jsx(Heading, { level: 3, ...props, children });
20721
+ function Subheader({ body, ...props }) {
20722
+ return /* @__PURE__ */ jsx(Heading, { level: 3, ...props, body });
20707
20723
  }
20708
20724
  const Checkbox = memo(function Checkbox2({
20709
20725
  label,
@@ -20779,7 +20795,7 @@ const CheckboxGroup = memo(function CheckboxGroup2({
20779
20795
  },
20780
20796
  [dispatchChange, value]
20781
20797
  );
20782
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
20798
+ return /* @__PURE__ */ jsxs("div", { className: "rl-form-group", children: [
20783
20799
  label && /* @__PURE__ */ jsxs("label", { children: [
20784
20800
  label,
20785
20801
  " ",
@@ -20849,7 +20865,7 @@ function TextInputComponent({
20849
20865
  }
20850
20866
  };
20851
20867
  const required = props.required;
20852
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
20868
+ return /* @__PURE__ */ jsxs("div", { className: "rl-form-group", children: [
20853
20869
  label && /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
20854
20870
  label,
20855
20871
  " ",
@@ -20950,7 +20966,7 @@ const Select = memo(function Select2({
20950
20966
  dispatchChange(newValue);
20951
20967
  }
20952
20968
  }
20953
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
20969
+ return /* @__PURE__ */ jsxs("div", { className: "rl-form-group", children: [
20954
20970
  label && /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
20955
20971
  label,
20956
20972
  " ",
@@ -21001,7 +21017,7 @@ function TextareaComponent({
21001
21017
  }
21002
21018
  };
21003
21019
  const required = props.required;
21004
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
21020
+ return /* @__PURE__ */ jsxs("div", { className: "rl-form-group", children: [
21005
21021
  label && /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
21006
21022
  label,
21007
21023
  " ",