xmlui 0.7.17 → 0.7.18

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 (41) hide show
  1. package/dist/{apiInterceptorWorker-DkEyFV8g.mjs → apiInterceptorWorker-CXfI_qcP.mjs} +1 -1
  2. package/dist/{grammar.tmLanguage-Qpdanc5_.mjs → grammar.tmLanguage-69iP6c5d.mjs} +23 -9
  3. package/dist/{index-BiwoF6JS.mjs → index-B6CaX0jY.mjs} +10377 -12573
  4. package/dist/scripts/package.json +1 -1
  5. package/dist/scripts/src/components/AppHeader/AppHeader.js +2 -2
  6. package/dist/scripts/src/components/AppState/AppState.js +4 -0
  7. package/dist/scripts/src/components/Carousel/Carousel.js +7 -4
  8. package/dist/scripts/src/components/Carousel/CarouselContext.js +48 -0
  9. package/dist/scripts/src/components/Carousel/CarouselItem.js +1 -4
  10. package/dist/scripts/src/components/Carousel/CarouselItemNative.js +18 -8
  11. package/dist/scripts/src/components/Carousel/CarouselNative.js +20 -11
  12. package/dist/scripts/src/components/ComponentProvider.js +0 -4
  13. package/dist/scripts/src/components/Markdown/Markdown.js +11 -2
  14. package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +1 -1
  15. package/dist/scripts/src/components/{slot-helpers.js → SlotItem.js} +9 -0
  16. package/dist/scripts/src/components/Tabs/TabContext.js +5 -1
  17. package/dist/scripts/src/components/Tabs/TabItem.js +1 -1
  18. package/dist/scripts/src/components/Tabs/TabItemNative.js +11 -5
  19. package/dist/scripts/src/components/Tabs/TabsNative.js +21 -10
  20. package/dist/scripts/src/components/Text/Text.js +3 -2
  21. package/dist/scripts/src/components/Text/TextNative.js +4 -84
  22. package/dist/scripts/src/components/TextBox/TextBoxNative.js +1 -4
  23. package/dist/scripts/src/components/Toggle/Toggle.js +2 -3
  24. package/dist/scripts/src/components/abstractions.js +158 -19
  25. package/dist/scripts/src/components-core/ComponentBed.js +83 -78
  26. package/dist/scripts/src/components-core/CompoundComponent.js +2 -1
  27. package/dist/scripts/src/components-core/appContext/misc-utils.js +1 -0
  28. package/dist/scripts/src/components-core/container/Container.js +43 -21
  29. package/dist/scripts/src/components-core/event-handlers.js +43 -0
  30. package/dist/scripts/src/components-core/utils/misc.js +7 -0
  31. package/dist/scripts/src/parsers/xmlui-parser/ParserError.js +39 -41
  32. package/dist/scripts/src/parsers/xmlui-parser/transform.js +42 -20
  33. package/dist/scripts/src/syntax/grammar.tmLanguage.json +17 -11
  34. package/dist/xmlui-metadata.mjs +2032 -1956
  35. package/dist/xmlui-metadata.umd.js +16 -16
  36. package/dist/xmlui-standalone.umd.js +149 -149
  37. package/dist/xmlui.d.ts +3 -2
  38. package/dist/xmlui.mjs +1 -1
  39. package/package.json +1 -1
  40. package/dist/scripts/src/components/Animation/Animation.js +0 -59
  41. package/dist/scripts/src/components/Animation/AnimationNative.js +0 -75
package/dist/xmlui.d.ts CHANGED
@@ -302,6 +302,7 @@ declare type AppContextObject = {
302
302
  readonly embed: {
303
303
  isInIFrame: boolean;
304
304
  };
305
+ distinct: (arr: any[]) => any[];
305
306
  };
306
307
 
307
308
  /**
@@ -1002,7 +1003,7 @@ declare interface IconBaseProps extends default_2.SVGAttributes<SVGElement> {
1002
1003
  size?: string;
1003
1004
  isInline?: boolean;
1004
1005
  fallback?: string;
1005
- layout?: CSSProperties;
1006
+ style?: CSSProperties;
1006
1007
  }
1007
1008
 
1008
1009
  declare type IconPosition = (typeof iconPositionValues)[number];
@@ -1278,7 +1279,7 @@ declare type RenderChildFn<L extends ComponentDef = ComponentDef> = (children?:
1278
1279
  /**
1279
1280
  * This interface defines the renderer context for the exposed components of the XMLUI framework.
1280
1281
  */
1281
- export declare interface RendererContext<TMd extends ComponentMetadata> extends ComponentRendererContextBase<TMd> {
1282
+ export declare interface RendererContext<TMd extends ComponentMetadata = ComponentMetadata> extends ComponentRendererContextBase<TMd> {
1282
1283
  /**
1283
1284
  * The unique identifier of the component instance
1284
1285
  */
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-BiwoF6JS.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-B6CaX0jY.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.17",
3
+ "version": "0.7.18",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "start-test-bed": "cd src/testing/infrastructure && xmlui start",
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.slideInAnimationRenderer = exports.fadeInAnimationRenderer = exports.animationComponentRenderer = exports.SlideInAnimationMd = exports.FadeInAnimationMd = exports.AnimationMd = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const ComponentDefs_1 = require("@abstractions/ComponentDefs");
6
- const renderers_1 = require("@components-core/renderers");
7
- const AnimationNative_1 = require("@components/Animation/AnimationNative");
8
- const COMP = "Animation";
9
- exports.AnimationMd = (0, ComponentDefs_1.createMetadata)({
10
- status: "in progress",
11
- description: ``,
12
- props: {
13
- animation: (0, ComponentDefs_1.d)(`The animation object to be applied to the component`),
14
- animateWhenInView: (0, ComponentDefs_1.d)(`Indicates whether the animation should start when the component is in view`),
15
- duration: (0, ComponentDefs_1.d)(`The duration of the animation in milliseconds`),
16
- once: (0, ComponentDefs_1.d)(`Indicates whether the animation should only run once`),
17
- },
18
- events: {
19
- started: (0, ComponentDefs_1.d)(`Event fired when the animation starts`),
20
- stopped: (0, ComponentDefs_1.d)(`Event fired when the animation stops`),
21
- },
22
- apis: {
23
- start: (0, ComponentDefs_1.d)(`Starts the animation`),
24
- stop: (0, ComponentDefs_1.d)(`Stops the animation`),
25
- },
26
- });
27
- exports.FadeInAnimationMd = (0, ComponentDefs_1.createMetadata)(Object.assign(Object.assign({}, exports.AnimationMd), { specializedFrom: COMP, description: `The \`${COMP}\` component represents an animation that fades in the content.` }));
28
- exports.SlideInAnimationMd = (0, ComponentDefs_1.createMetadata)(Object.assign(Object.assign({}, exports.AnimationMd), { specializedFrom: COMP, description: `The \`${COMP}\` component represents an animation that slides in the content from the left.`, props: {
29
- animateWhenInView: (0, ComponentDefs_1.d)(`Indicates whether the animation should start when the component is in view`),
30
- direction: (0, ComponentDefs_1.d)(`The direction from which the content should slide in`),
31
- duration: (0, ComponentDefs_1.d)(`The duration of the animation in milliseconds`),
32
- } }));
33
- exports.animationComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AnimationMd, ({ registerComponentApi, renderChild, node, extractValue, lookupEventHandler }) => {
34
- return ((0, jsx_runtime_1.jsx)(AnimationNative_1.Animation, { registerComponentApi: registerComponentApi, animation: extractValue(node.props.animation), onStop: lookupEventHandler("stopped"), onStart: lookupEventHandler("started"), duration: extractValue.asOptionalNumber(node.props.duration), animateWhenInView: extractValue.asOptionalBoolean(node.props.animateWhenInView), once: extractValue.asOptionalBoolean(node.props.once), children: renderChild(node.children) }));
35
- });
36
- exports.fadeInAnimationRenderer = (0, renderers_1.createComponentRenderer)("FadeInAnimation", exports.FadeInAnimationMd, ({ node, renderChild, extractValue, registerComponentApi, lookupEventHandler }) => {
37
- return ((0, jsx_runtime_1.jsx)(AnimationNative_1.Animation, { registerComponentApi: registerComponentApi, animation: {
38
- from: { opacity: 0 },
39
- to: { opacity: 1 },
40
- }, duration: extractValue.asOptionalNumber(node.props.duration), onStop: lookupEventHandler("stopped"), onStart: lookupEventHandler("started"), animateWhenInView: extractValue.asOptionalBoolean(node.props.animateWhenInView), children: renderChild(node.children) }));
41
- });
42
- exports.slideInAnimationRenderer = (0, renderers_1.createComponentRenderer)("SlideInAnimation", exports.SlideInAnimationMd, ({ node, renderChild, extractValue, registerComponentApi, lookupEventHandler }) => {
43
- const direction = extractValue.asString(node.props.direction);
44
- const animation = {
45
- from: {
46
- transform: direction === "right"
47
- ? "translateX(100%)"
48
- : direction === "left"
49
- ? "translateX(-100%)"
50
- : direction === "top"
51
- ? "translateY(-100%)"
52
- : "translateY(100%)",
53
- },
54
- to: {
55
- transform: direction === "right" || direction === "left" ? "translateX(0)" : "translateY(0)",
56
- },
57
- };
58
- return ((0, jsx_runtime_1.jsx)(AnimationNative_1.Animation, { registerComponentApi: registerComponentApi, animation: animation, duration: extractValue.asOptionalNumber(node.props.duration), onStop: lookupEventHandler("stopped"), onStart: lookupEventHandler("started"), animateWhenInView: extractValue.asOptionalBoolean(node.props.animateWhenInView), children: renderChild(node.children) }));
59
- });
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.Animation = void 0;
37
- const jsx_runtime_1 = require("react/jsx-runtime");
38
- const web_1 = require("@react-spring/web");
39
- const react_1 = __importStar(require("react"));
40
- const react_2 = require("react");
41
- const AnimatedComponent = (0, web_1.animated)((0, react_1.forwardRef)(function InlineComponentDef(props, ref) {
42
- const { children, style } = props;
43
- return react_1.default.cloneElement(children, { style, ref });
44
- }));
45
- const Animation = ({ children, registerComponentApi, animation, duration = 500, onStop, onStart, animateWhenInView = false, once = false, }) => {
46
- const animationSettings = (0, react_1.useMemo)(() => ({
47
- from: animation.from,
48
- to: animation.to,
49
- config: Object.assign(Object.assign({}, animation.config), { duration }),
50
- onStart,
51
- onRest: onStop,
52
- once,
53
- }), [animation, duration, onStart, onStop, once]);
54
- const [springs, api] = (0, web_1.useSpring)(() => (Object.assign({}, animationSettings)));
55
- const [ref, animationStyles] = (0, web_1.useInView)(() => animationSettings, {
56
- once,
57
- });
58
- const startAnimation = (0, react_2.useCallback)(() => {
59
- api.start(animation);
60
- return () => {
61
- api.stop();
62
- };
63
- }, [api]);
64
- const stopAnimation = (0, react_2.useCallback)(() => {
65
- api.stop();
66
- }, [api]);
67
- (0, react_1.useEffect)(() => {
68
- registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
69
- start: startAnimation,
70
- stop: stopAnimation,
71
- });
72
- }, [registerComponentApi, startAnimation, stopAnimation]);
73
- return react_1.Children.map(children, (child, index) => ((0, jsx_runtime_1.jsx)(AnimatedComponent, { style: animateWhenInView ? animationStyles : springs, ref: ref, children: child }, index)));
74
- };
75
- exports.Animation = Animation;