@cratis/scene.components 4.15.0 → 4.17.0

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 (62) hide show
  1. package/cratisComponentsDescriptors.ts +16 -0
  2. package/cratisComponentsPackage.ts +9 -125
  3. package/cratisComponentsPackageManifest.ts +106 -0
  4. package/cratisComponentsRuntimePackage.ts +22 -0
  5. package/designTime/cratisComponentsDesignTime.ts +22 -0
  6. package/dist/cjs/cratisComponentsDescriptors.js +68 -1
  7. package/dist/cjs/cratisComponentsDescriptors.js.map +1 -1
  8. package/dist/cjs/cratisComponentsPackage.js +10 -144
  9. package/dist/cjs/cratisComponentsPackage.js.map +1 -1
  10. package/dist/cjs/cratisComponentsPackageManifest.js +126 -0
  11. package/dist/cjs/cratisComponentsPackageManifest.js.map +1 -0
  12. package/dist/cjs/cratisComponentsRuntimePackage.js +24 -0
  13. package/dist/cjs/cratisComponentsRuntimePackage.js.map +1 -0
  14. package/dist/cjs/designTime/cratisComponentsDesignTime.js +24 -0
  15. package/dist/cjs/designTime/cratisComponentsDesignTime.js.map +1 -0
  16. package/dist/cjs/forms/generateCommandFieldsAction.js +10 -1
  17. package/dist/cjs/forms/generateCommandFieldsAction.js.map +1 -1
  18. package/dist/cjs/index.js +6 -1
  19. package/dist/cjs/index.js.map +1 -1
  20. package/dist/cjs/runtime.js +15 -0
  21. package/dist/cjs/runtime.js.map +1 -0
  22. package/dist/cjs/toolbar/SceneToolbarButton.js +34 -2
  23. package/dist/cjs/toolbar/SceneToolbarButton.js.map +1 -1
  24. package/dist/esm/cratisComponentsDescriptors.d.ts.map +1 -1
  25. package/dist/esm/cratisComponentsDescriptors.js +68 -1
  26. package/dist/esm/cratisComponentsDescriptors.js.map +1 -1
  27. package/dist/esm/cratisComponentsPackage.d.ts +1 -2
  28. package/dist/esm/cratisComponentsPackage.d.ts.map +1 -1
  29. package/dist/esm/cratisComponentsPackage.js +10 -144
  30. package/dist/esm/cratisComponentsPackage.js.map +1 -1
  31. package/dist/esm/cratisComponentsPackageManifest.d.ts +3 -0
  32. package/dist/esm/cratisComponentsPackageManifest.d.ts.map +1 -0
  33. package/dist/esm/cratisComponentsPackageManifest.js +124 -0
  34. package/dist/esm/cratisComponentsPackageManifest.js.map +1 -0
  35. package/dist/esm/cratisComponentsRuntimePackage.d.ts +3 -0
  36. package/dist/esm/cratisComponentsRuntimePackage.d.ts.map +1 -0
  37. package/dist/esm/cratisComponentsRuntimePackage.js +22 -0
  38. package/dist/esm/cratisComponentsRuntimePackage.js.map +1 -0
  39. package/dist/esm/designTime/cratisComponentsDesignTime.d.ts +3 -0
  40. package/dist/esm/designTime/cratisComponentsDesignTime.d.ts.map +1 -0
  41. package/dist/esm/designTime/cratisComponentsDesignTime.js +22 -0
  42. package/dist/esm/designTime/cratisComponentsDesignTime.js.map +1 -0
  43. package/dist/esm/forms/generateCommandFieldsAction.js +10 -1
  44. package/dist/esm/forms/generateCommandFieldsAction.js.map +1 -1
  45. package/dist/esm/index.d.ts +2 -0
  46. package/dist/esm/index.d.ts.map +1 -1
  47. package/dist/esm/index.js +4 -1
  48. package/dist/esm/index.js.map +1 -1
  49. package/dist/esm/runtime.d.ts +5 -0
  50. package/dist/esm/runtime.d.ts.map +1 -0
  51. package/dist/esm/runtime.js +5 -0
  52. package/dist/esm/runtime.js.map +1 -0
  53. package/dist/esm/toolbar/SceneToolbarButton.d.ts +1 -1
  54. package/dist/esm/toolbar/SceneToolbarButton.d.ts.map +1 -1
  55. package/dist/esm/toolbar/SceneToolbarButton.js +34 -2
  56. package/dist/esm/toolbar/SceneToolbarButton.js.map +1 -1
  57. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  58. package/forms/generateCommandFieldsAction.ts +5 -1
  59. package/index.ts +2 -0
  60. package/package.json +12 -7
  61. package/runtime.ts +9 -0
  62. package/toolbar/SceneToolbarButton.tsx +24 -2
@@ -1 +1 @@
1
- {"version":3,"file":"SceneToolbarButton.js","sources":["../../../toolbar/SceneToolbarButton.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ToolbarButton } from '@cratis/components/Toolbar';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty, unionProperty } from '../properties';\n\n/** Which side of the button its tooltip appears on. */\nconst tooltipPositions = ['top', 'right', 'bottom', 'left'] as const;\n\n/**\n * The `Cratis.Components:toolbarButton` component - `ToolbarButton` from `@cratis/components/Toolbar`.\n *\n * `title` is required by the underlying component and is not decoration: it is both the tooltip text and\n * the accessible name, so a toolbar of icon-only buttons is still usable by anyone who cannot see the\n * icons. It defaults to the `text` property rather than to an empty string, so a button that has a\n * visible label is never left nameless.\n */\nexport function SceneToolbarButton({ element }: RegisteredComponentProps) {\n const text = stringProperty(element.properties, 'text');\n\n return (\n <ToolbarButton\n icon={stringProperty(element.properties, 'icon')}\n text={text}\n title={stringProperty(element.properties, 'title') ?? text ?? ''}\n active={booleanProperty(element.properties, 'active')}\n tooltipPosition={unionProperty(element.properties, 'tooltipPosition', tooltipPositions)}\n />\n );\n}\n"],"names":["tooltipPositions","SceneToolbarButton","element","text","stringProperty","properties","_jsx","ToolbarButton","icon","title","active","booleanProperty","tooltipPosition","unionProperty"],"mappings":";;;;AAOA,wDACA,MAAMA,gBAAAA,GAAmB;AAAC,IAAA,KAAA;AAAO,IAAA,OAAA;AAAS,IAAA,QAAA;AAAU,IAAA;AAAO,CAAA;AAE3D;;;;;;;AAOC,IACM,SAASC,kBAAAA,CAAmB,EAAEC,OAAO,EAA4B,EAAA;AACpE,IAAA,MAAMC,IAAAA,GAAOC,cAAAA,CAAeF,OAAAA,CAAQG,UAAU,EAAE,MAAA,CAAA;AAEhD,IAAA,qBACIC,GAAA,CAACC,aAAAA,EAAAA;QACGC,IAAAA,EAAMJ,cAAAA,CAAeF,OAAAA,CAAQG,UAAU,EAAE,MAAA,CAAA;QACzCF,IAAAA,EAAMA,IAAAA;AACNM,QAAAA,KAAAA,EAAOL,cAAAA,CAAeF,OAAAA,CAAQG,UAAU,EAAE,YAAYF,IAAAA,IAAQ,EAAA;QAC9DO,MAAAA,EAAQC,eAAAA,CAAgBT,OAAAA,CAAQG,UAAU,EAAE,QAAA,CAAA;AAC5CO,QAAAA,eAAAA,EAAiBC,aAAAA,CAAcX,OAAAA,CAAQG,UAAU,EAAE,iBAAA,EAAmBL,gBAAAA;;AAGlF;;"}
1
+ {"version":3,"file":"SceneToolbarButton.js","sources":["../../../toolbar/SceneToolbarButton.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useContext } from 'react';\nimport { ToolbarButton } from '@cratis/components/Toolbar';\nimport { DestinationReference } from '@cratis/scene.model';\nimport { RegisteredComponentProps, SceneNavigationContextInternal } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty, unionProperty } from '../properties';\n\n/** Which side of the button its tooltip appears on. */\nconst tooltipPositions = ['top', 'right', 'bottom', 'left'] as const;\n\n/**\n * The `Cratis.Components:toolbarButton` component - `ToolbarButton` from `@cratis/components/Toolbar`.\n *\n * `title` is required by the underlying component and is not decoration: it is both the tooltip text and\n * the accessible name, so a toolbar of icon-only buttons is still usable by anyone who cannot see the\n * icons. It defaults to the `text` property rather than to an empty string, so a button that has a\n * visible label is never left nameless.\n */\n/**\n * A toolbar button. Its authored `destination` - a screen in an outlet, or a dialog - is executed by the\n * enclosing navigation host; outside one it is announced with the host-neutral `cratis.scene.navigate` event.\n * Interactions attached by the document run first.\n */\nexport function SceneToolbarButton({ element, interactions }: RegisteredComponentProps) {\n const text = stringProperty(element.properties, 'text');\n const navigation = useContext(SceneNavigationContextInternal);\n const destination = isDestination(element.properties.destination) ? element.properties.destination : undefined;\n const onClick = () => {\n interactions?.onClick?.({ stopPropagation: () => undefined });\n if (!destination) return;\n if (navigation) navigation.navigate(destination);\n else globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', { detail: { destination, element } }));\n };\n\n return (\n <ToolbarButton\n icon={stringProperty(element.properties, 'icon')}\n text={text}\n title={stringProperty(element.properties, 'title') ?? text ?? ''}\n active={booleanProperty(element.properties, 'active')}\n tooltipPosition={unionProperty(element.properties, 'tooltipPosition', tooltipPositions)}\n onClick={onClick}\n />\n );\n}\n\nfunction isDestination(value: unknown): value is DestinationReference {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;\n const candidate = value as Record<string, unknown>;\n return ['screen', 'module', 'route', 'dialog'].some(key => typeof candidate[key] === 'string');\n}\n"],"names":["tooltipPositions","SceneToolbarButton","element","interactions","text","stringProperty","properties","navigation","useContext","SceneNavigationContextInternal","destination","isDestination","undefined","onClick","stopPropagation","navigate","globalThis","dispatchEvent","CustomEvent","detail","_jsx","ToolbarButton","icon","title","active","booleanProperty","tooltipPosition","unionProperty","value","Array","isArray","candidate","some","key"],"mappings":";;;;;;AASA,wDACA,MAAMA,gBAAAA,GAAmB;AAAC,IAAA,KAAA;AAAO,IAAA,OAAA;AAAS,IAAA,QAAA;AAAU,IAAA;AAAO,CAAA;AAE3D;;;;;;;;;;;AAYC,IACM,SAASC,kBAAAA,CAAmB,EAAEC,OAAO,EAAEC,YAAY,EAA4B,EAAA;AAClF,IAAA,MAAMC,IAAAA,GAAOC,cAAAA,CAAeH,OAAAA,CAAQI,UAAU,EAAE,MAAA,CAAA;AAChD,IAAA,MAAMC,aAAaC,UAAAA,CAAWC,8BAAAA,CAAAA;IAC9B,MAAMC,WAAAA,GAAcC,aAAAA,CAAcT,OAAAA,CAAQI,UAAU,CAACI,WAAW,CAAA,GAAIR,OAAAA,CAAQI,UAAU,CAACI,WAAW,GAAGE,SAAAA;AACrG,IAAA,MAAMC,OAAAA,GAAU,IAAA;AACZV,QAAAA,YAAAA,EAAcU,OAAAA,GAAU;AAAEC,YAAAA,eAAAA,EAAiB,IAAMF;AAAU,SAAA,CAAA;AAC3D,QAAA,IAAI,CAACF,WAAAA,EAAa;QA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