xmlui 0.7.19 → 0.7.21

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.
Files changed (60) hide show
  1. package/dist/{apiInterceptorWorker-C3bvewX6.mjs → apiInterceptorWorker-LRHkKnha.mjs} +1 -1
  2. package/dist/{grammar.tmLanguage-69iP6c5d.mjs → grammar.tmLanguage-DNepe_jP.mjs} +1 -1
  3. package/dist/index-5NLXyjX0.mjs +31055 -0
  4. package/dist/index.css +1 -1
  5. package/dist/scripts/bin/build-lib.js +1 -1
  6. package/dist/scripts/bin/index.js +2 -2
  7. package/dist/scripts/bin/start.js +23 -6
  8. package/dist/scripts/bin/viteConfig.js +1 -0
  9. package/dist/scripts/package.json +2 -1
  10. package/dist/scripts/src/abstractions/ExtensionDefs.js +2 -0
  11. package/dist/scripts/src/components/Carousel/CarouselItemNative.js +7 -4
  12. package/dist/scripts/src/components/Carousel/CarouselNative.js +6 -6
  13. package/dist/scripts/src/components/ComponentProvider.js +171 -148
  14. package/dist/scripts/src/components/FormItem/FormItemNative.js +1 -1
  15. package/dist/scripts/src/components/HtmlTags/HtmlTags.js +33 -0
  16. package/dist/scripts/src/components/RawHtml/RawHtml.js +39 -0
  17. package/dist/scripts/src/components/RawHtml/RawHtmlNative.js +13 -0
  18. package/dist/scripts/src/components/Theme/ThemeNative.js +1 -1
  19. package/dist/scripts/src/components-core/LoaderComponent.js +1 -1
  20. package/dist/scripts/src/components-core/RestApiProxy.js +1 -1
  21. package/dist/scripts/src/components-core/StandaloneApp.js +19 -19
  22. package/dist/scripts/src/components-core/{StandaloneComponentManager.js → StandaloneExtensionManager.js} +6 -13
  23. package/dist/scripts/src/components-core/action/APICall.js +1 -1
  24. package/dist/scripts/src/components-core/loader/PageableLoader.js +4 -4
  25. package/dist/scripts/src/components-core/{AppRoot.js → rendering/AppContent.js} +60 -145
  26. package/dist/scripts/src/components-core/rendering/AppRoot.js +55 -0
  27. package/dist/scripts/src/components-core/rendering/AppWrapper.js +44 -0
  28. package/dist/scripts/src/components-core/{ComponentBed.js → rendering/ComponentAdapter.js} +8 -8
  29. package/dist/scripts/src/components-core/rendering/ComponentWrapper.js +147 -0
  30. package/dist/scripts/src/components-core/rendering/Container.js +576 -0
  31. package/dist/scripts/src/components-core/rendering/ContainerWrapper.js +82 -0
  32. package/dist/scripts/src/components-core/{ErrorBoundary.js → rendering/ErrorBoundary.js} +9 -3
  33. package/dist/scripts/src/components-core/rendering/StateContainer.js +331 -0
  34. package/dist/scripts/src/components-core/{container → rendering}/buildProxy.js +11 -7
  35. package/dist/scripts/src/components-core/{container → rendering}/collectFnVarDeps.js +2 -2
  36. package/dist/scripts/src/components-core/{container → rendering}/reducer.js +3 -0
  37. package/dist/scripts/src/components-core/rendering/renderChild.js +81 -0
  38. package/dist/scripts/src/index.js +3 -6
  39. package/dist/scripts/src/parsers/xmlui-parser/transform.js +193 -164
  40. package/dist/scripts/src/syntax/grammar.tmLanguage.json +1 -1
  41. package/dist/style.css +1 -1
  42. package/dist/xmlui-metadata.mjs +4216 -4232
  43. package/dist/xmlui-metadata.umd.js +16 -16
  44. package/dist/xmlui-standalone.umd.js +262 -290
  45. package/dist/xmlui.d.ts +36 -61
  46. package/dist/xmlui.mjs +1 -1
  47. package/package.json +2 -1
  48. package/dist/index-BwlAHBcX.mjs +0 -76810
  49. package/dist/scripts/src/components/BarChart/BarChart.js +0 -49
  50. package/dist/scripts/src/components/BarChart/BarChartNative.js +0 -176
  51. package/dist/scripts/src/components/Map/Map.js +0 -75
  52. package/dist/scripts/src/components/Map/world_countries.json +0 -45307
  53. package/dist/scripts/src/components/PieChart/PieChart.js +0 -45
  54. package/dist/scripts/src/components/PieChart/PieChartNative.js +0 -165
  55. package/dist/scripts/src/components/chart-color-schemes.js +0 -43
  56. package/dist/scripts/src/components-core/container/Container.js +0 -1186
  57. package/dist/scripts/src/components-core/container/ContainerComponentDef.js +0 -15
  58. /package/dist/scripts/src/components-core/{InvalidComponent.js → rendering/InvalidComponent.js} +0 -0
  59. /package/dist/scripts/src/components-core/{UnknownComponent.js → rendering/UnknownComponent.js} +0 -0
  60. /package/dist/scripts/src/components-core/{container → rendering}/valueExtractor.js +0 -0
package/dist/xmlui.d.ts CHANGED
@@ -45,22 +45,6 @@ declare interface ActionExecutionContext {
45
45
  */
46
46
  declare type ActionFunction = (executionContext: ActionExecutionContext, ...args: any[]) => any;
47
47
 
48
- /**
49
- * XMLUI keeps a registry of available actions to store information about out-of-the-box and custom
50
- * actions (contributions implemented in external packages or files). This type describes the
51
- * information the registry needs about the action to be able to render it.
52
- */
53
- declare interface ActionRendererDef {
54
- /**
55
- * The name of the action that will be used to reference it in XMLUI.
56
- */
57
- actionName: string;
58
- /**
59
- * The function that executes the action.
60
- */
61
- actionFn: ActionFunction;
62
- }
63
-
64
48
  declare type AlignmentOptions = (typeof alignmentOptionValues)[number];
65
49
 
66
50
  declare const alignmentOptionValues: readonly ["start", "center", "end"];
@@ -306,18 +290,18 @@ declare type AppContextObject = {
306
290
  };
307
291
 
308
292
  /**
309
- * This component runs the app in the context of the registered components
310
- * (including the core xmlui components and external ones passed to this
311
- * component.
293
+ * This component is responsible for running a pre-compiled xmlui app. It
294
+ * receives the internal representation of the app markup and code (coming
295
+ * from either code-behind files or inlined markup expressions) and executes
296
+ * the app accordingly.
312
297
  */
313
- export declare function AppRoot({ apiInterceptor, contributes, node, decorateComponentsWithTestId, debugEnabled, defaultTheme, defaultTone, resources, globalProps, standalone, trackContainerHeight, routerBaseName, previewMode, servedFromSingleFile, resourceMap, sources, componentManager, }: AppWrapperProps & {
314
- componentManager?: StandaloneComponentManager;
298
+ export declare function AppRoot({ apiInterceptor, contributes, node, decorateComponentsWithTestId, debugEnabled, defaultTheme, defaultTone, resources, globalProps, standalone, trackContainerHeight, routerBaseName, previewMode, resourceMap, sources, extensionManager, }: AppWrapperProps & {
299
+ extensionManager?: StandaloneExtensionManager;
315
300
  }): JSX_2.Element;
316
301
 
317
302
  declare type AppWrapperProps = {
318
303
  node: ComponentLike;
319
304
  previewMode?: boolean;
320
- servedFromSingleFile?: boolean;
321
305
  routerBaseName?: string;
322
306
  contributes?: ContributesDefinition;
323
307
  globalProps?: GlobalProps;
@@ -459,7 +443,7 @@ export declare const Button: default_2.ForwardRefExoticComponent<{
459
443
  gap?: string | number;
460
444
  accessibilityProps?: any;
461
445
  autoFocus?: boolean;
462
- } & Pick<default_2.HTMLAttributes<HTMLButtonElement>, "className" | "aria-disabled" | "aria-label" | "aria-controls" | "aria-expanded" | "onClick" | "tabIndex" | "onFocus" | "onBlur" | "onMouseEnter" | "onMouseLeave"> & default_2.RefAttributes<HTMLButtonElement>>;
446
+ } & Pick<default_2.HTMLAttributes<HTMLButtonElement>, "className" | "onClick" | "tabIndex" | "aria-controls" | "aria-disabled" | "aria-expanded" | "aria-label" | "onFocus" | "onBlur" | "onMouseEnter" | "onMouseLeave"> & default_2.RefAttributes<HTMLButtonElement>>;
463
447
 
464
448
  declare type ButtonThemeColor = (typeof buttonThemeValues)[number];
465
449
 
@@ -497,8 +481,9 @@ declare type ColorDef = {
497
481
  };
498
482
 
499
483
  /**
500
- * Components can provide an API that other components can invoke (using the host component ID). This
501
- * type defines the shape of a hash object that stores the API endpoints.
484
+ * Components can provide an API that other components can invoke (using
485
+ * the host component ID). This type defines the shape of a hash object that
486
+ * stores the API endpoints.
502
487
  */
503
488
  declare type ComponentApi = Record<string, ((...args: any[]) => any) | boolean>;
504
489
 
@@ -585,6 +570,8 @@ declare interface ComponentDefCore {
585
570
  debug?: Record<string, any>;
586
571
  }
587
572
 
573
+ declare type ComponentExtension = ComponentRendererDef | CompoundComponentDef;
574
+
588
575
  /**
589
576
  * Sometimes, components and compound components can both be used
590
577
  */
@@ -655,8 +642,6 @@ declare type ComponentPropertyMetadata = {
655
642
  isInternal?: boolean;
656
643
  };
657
644
 
658
- declare type ComponentRegisteredCallbackFn = (component: ComponentRendererDef) => void;
659
-
660
645
  declare interface ComponentRendererContextBase<TMd extends ComponentMetadata = ComponentMetadata> {
661
646
  node: ComponentDef<TMd>;
662
647
  state: ContainerState;
@@ -764,10 +749,6 @@ declare type ContributesDefinition = {
764
749
  * Native xmlui components that come with the app.
765
750
  */
766
751
  components?: ComponentRendererDef[];
767
- /**
768
- * Action functions that come with the app.
769
- */
770
- actions?: ActionRendererDef[];
771
752
  /**
772
753
  * Application-specific compound components that come with the app.
773
754
  */
@@ -838,7 +819,7 @@ declare interface EmptyStatement extends StatementBase {
838
819
  }
839
820
 
840
821
  /**
841
- * This component serves as an error boundary; it catches any errors within
822
+ * This React component serves as an error boundary; it catches any errors within
842
823
  * the nested components
843
824
  */
844
825
  export declare class ErrorBoundary extends default_2.Component<Props, State> {
@@ -847,6 +828,9 @@ export declare class ErrorBoundary extends default_2.Component<Props, State> {
847
828
  * This method implements the Error Boundaries for the React application.
848
829
  * It is invoked if errors occur during the rendering phase of any lifecycle
849
830
  * methods or children components.
831
+ *
832
+ * DO NOT DELETE this method! Though it is not referenced directly from the code,
833
+ * it is a required part of the React component lifecycle.
850
834
  */
851
835
  static getDerivedStateFromError(error: Error): State;
852
836
  /**
@@ -863,6 +847,9 @@ export declare class ErrorBoundary extends default_2.Component<Props, State> {
863
847
  * @param snapshot Optional snapshot (not used in this component)
864
848
  */
865
849
  componentDidUpdate(prevProps: Readonly<Props>, prevState: Readonly<State>, snapshot?: any): void;
850
+ /**
851
+ * Display an error message if an error occurred during rendering.
852
+ */
866
853
  render(): string | number | boolean | Iterable<default_2.ReactNode> | JSX_2.Element;
867
854
  }
868
855
 
@@ -880,6 +867,14 @@ declare interface ExpressionStatement extends StatementBase {
880
867
  expression: Expression;
881
868
  }
882
869
 
870
+ declare interface Extension {
871
+ namespace?: string;
872
+ components?: ComponentExtension[];
873
+ themes?: ThemeDefinition[];
874
+ }
875
+
876
+ declare type ExtensionRegisteredCallbackFn = (extension: Extension) => void;
877
+
883
878
  /**
884
879
  * This type describes a font definition resource.
885
880
  */
@@ -1234,17 +1229,8 @@ declare type PropertyValueDescription = string | number | {
1234
1229
 
1235
1230
  declare type PropertyValueType = "boolean" | "string" | "number" | "any" | "ComponentDef";
1236
1231
 
1237
- /**
1238
- * This type represents the properties of the error boundary
1239
- */
1240
1232
  declare interface Props {
1241
- /**
1242
- * Child nodes within the boundary
1243
- */
1244
1233
  children: ReactNode;
1245
- /**
1246
- * Whenever the value of this property changes, the boundary restores its "no error" state.
1247
- */
1248
1234
  node?: ComponentLike;
1249
1235
  location?: string;
1250
1236
  }
@@ -1410,7 +1396,7 @@ export declare const Stack: ForwardRefExoticComponent<Props_2 & RefAttributes<an
1410
1396
  * representation); ApiInterceptor can emulate some backend functionality
1411
1397
  * running in the browser.
1412
1398
  */
1413
- export declare function StandaloneApp({ appDef, decorateComponentsWithTestId, debugEnabled, runtime, components: customComponents, componentManager, }: StandaloneAppProps): JSX_2.Element;
1399
+ export declare function StandaloneApp({ appDef, decorateComponentsWithTestId, debugEnabled, runtime, extensionManager, }: StandaloneAppProps): JSX_2.Element;
1414
1400
 
1415
1401
  export declare type StandaloneAppDescription = {
1416
1402
  name?: string;
@@ -1432,8 +1418,7 @@ declare type StandaloneAppProps = {
1432
1418
  decorateComponentsWithTestId?: boolean;
1433
1419
  debugEnabled?: boolean;
1434
1420
  runtime?: any;
1435
- components?: ComponentRendererDef[];
1436
- componentManager?: StandaloneComponentManager;
1421
+ extensionManager?: StandaloneExtensionManager;
1437
1422
  };
1438
1423
 
1439
1424
  /**
@@ -1441,9 +1426,9 @@ declare type StandaloneAppProps = {
1441
1426
  * the xmlui component registry. The framework resolves the components used
1442
1427
  * in an application markup with this registry.
1443
1428
  */
1444
- declare class StandaloneComponentManager {
1445
- subscriptions: Set<ComponentRegisteredCallbackFn>;
1446
- registeredComponents: Array<ComponentRendererDef>;
1429
+ declare class StandaloneExtensionManager {
1430
+ subscriptions: Set<ExtensionRegisteredCallbackFn>;
1431
+ registeredExtensions: Array<Extension>;
1447
1432
  constructor();
1448
1433
  /**
1449
1434
  * You can add a callback function invoked whenever a new component is added
@@ -1452,22 +1437,15 @@ declare class StandaloneComponentManager {
1452
1437
  * registry.
1453
1438
  * @param cb Function to call when a new component is registered
1454
1439
  */
1455
- subscribeToRegistrations(cb: ComponentRegisteredCallbackFn): void;
1440
+ subscribeToRegistrations(cb: ExtensionRegisteredCallbackFn): void;
1456
1441
  /**
1457
1442
  * You can remove a function added by `subscribeToRegistrations`. After
1458
1443
  * calling this method, the particular callback function won't be invoked
1459
1444
  * for a new component registration.
1460
1445
  * @param cb Function to call when a new component is registered
1461
1446
  */
1462
- unSubscribeFromRegistrations(cb: ComponentRegisteredCallbackFn): void;
1463
- /**
1464
- * Use this function to add a new component to the registry. Adding a new
1465
- * component will invoke all callbacks that have already subscribed to the
1466
- * component registration.
1467
- * @param component The component to register. You can pass a single
1468
- * component or an array of components.
1469
- */
1470
- registerComponent(component: ComponentRendererDef | ComponentRendererDef[]): void;
1447
+ unSubscribeFromRegistrations(cb: ExtensionRegisteredCallbackFn): void;
1448
+ registerExtension(component: Extension | Extension[]): void;
1471
1449
  }
1472
1450
 
1473
1451
  export declare type StandaloneJsonConfig = {
@@ -1490,11 +1468,8 @@ export declare type StandaloneJsonConfig = {
1490
1468
  * @param components The related component's runtime representation
1491
1469
  * @returns The content's root element
1492
1470
  */
1493
- export declare function startApp(runtime: any, components: ComponentRendererDef[] | undefined, componentManager: StandaloneComponentManager): Root;
1471
+ export declare function startApp(runtime: any, extensions?: Extension[] | Extension, extensionManager?: StandaloneExtensionManager): Root;
1494
1472
 
1495
- /**
1496
- * This type represents the current state of the error boundary
1497
- */
1498
1473
  declare type State = {
1499
1474
  hasError: boolean;
1500
1475
  error: Error | null;
package/dist/xmlui.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as e, B as t, E as r, I as o, h as p, f as n, S as c, c as d, b as u, e as S, i as l, p as A, s as C, t as m, j as B, u as f } from "./index-BwlAHBcX.mjs";
1
+ import { A as e, B as t, E as r, I as o, h as p, f as n, S as c, c as d, b as u, e as S, i as l, p as A, s as C, t as m, j as B, u as f } from "./index-5NLXyjX0.mjs";
2
2
  export {
3
3
  e as AppRoot,
4
4
  t as Button,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmlui",
3
- "version": "0.7.19",
3
+ "version": "0.7.21",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "start-test-bed": "cd src/testing/infrastructure && xmlui start",
@@ -91,6 +91,7 @@
91
91
  "react-textarea-autosize": "8.5.3",
92
92
  "react-virtualized-auto-sizer": "1.0.24",
93
93
  "react-window": "1.8.10",
94
+ "recharts": "^2.15.1",
94
95
  "sass": "1.55.0",
95
96
  "scroll-into-view-if-needed": "^3.1.0",
96
97
  "shiki": "^1.14.1",