likec4 1.0.0-next.9 → 1.0.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 (30) hide show
  1. package/bin/likec4.mjs +1 -1
  2. package/dist/__app__/favicon.ico +0 -0
  3. package/dist/__app__/react/likec4.tsx +53 -0
  4. package/dist/__app__/src/const.js +13 -0
  5. package/dist/__app__/src/lib/webcomponent.mjs +30867 -0
  6. package/dist/__app__/src/main-C8jsNnb9.js +37124 -0
  7. package/dist/__app__/src/main.js +1 -7
  8. package/dist/__app__/src/style.css +1 -1
  9. package/dist/__app__/src/{view._viewId.d2.lazy-CbaGHJdL.js → view._viewId.d2.lazy-BRVYHRy1.js} +14 -11
  10. package/dist/__app__/src/{view._viewId.dot.lazy-ClmbCByY.js → view._viewId.dot.lazy-KvXSJdzM.js} +17 -8
  11. package/dist/__app__/src/{view._viewId.mmd.lazy-eTXrVIaq.js → view._viewId.mmd.lazy-BH_rg5NV.js} +22 -31
  12. package/dist/__app__/src/view._viewId.react-legacy.lazy-CbH8iz1R.js +15461 -0
  13. package/dist/__app__/src/view_viewId_.css-BTveLWED.js +1473 -0
  14. package/dist/cli/index.mjs +640 -0
  15. package/package.json +83 -43
  16. package/react/LikeC4Browser.css.d.ts +5 -0
  17. package/react/LikeC4Browser.d.ts +10 -0
  18. package/react/LikeC4ViewElement.d.ts +9 -0
  19. package/react/ShadowRoot.d.ts +8 -0
  20. package/react/index.d.ts +5 -0
  21. package/react/index.mjs +24888 -0
  22. package/react/styles.css.d.ts +4 -0
  23. package/react/styles.d.ts +4 -0
  24. package/react/types.d.ts +27 -0
  25. package/dist/__app__/src/app-DuFP_Pd-.js +0 -51793
  26. package/dist/__app__/src/app.js +0 -4
  27. package/dist/__app__/src/react-resizable-panels.browser.esm-B9dOAvar.js +0 -2054
  28. package/dist/__app__/src/view._viewId.react-legacy.lazy-BgvBnmxb.js +0 -21986
  29. package/dist/__app__/tsconfig.json +0 -25
  30. package/dist/cli/index.js +0 -683
package/bin/likec4.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import '../dist/cli/index.js'
3
+ import '../dist/cli/index.mjs'
Binary file
@@ -0,0 +1,53 @@
1
+ import { LikeC4Browser, type LikeC4ViewBaseProps, LikeC4ViewElement as LikeC4ViewComponent } from 'likec4/react'
2
+ import { useState } from 'react'
3
+ import { createPortal } from 'react-dom'
4
+ import { isLikeC4ViewId, type LikeC4ViewId, LikeC4Views } from 'virtual:likec4/views'
5
+
6
+ type LikeC4ViewProps = LikeC4ViewBaseProps<LikeC4ViewId>
7
+
8
+ export { isLikeC4ViewId }
9
+
10
+ export function LikeC4View({
11
+ viewId,
12
+ interactive = true,
13
+ colorScheme,
14
+ injectFontCss = true,
15
+ ...props
16
+ }: LikeC4ViewProps) {
17
+ const view = LikeC4Views[viewId]
18
+
19
+ const [browserViewId, onNavigateTo] = useState(null as LikeC4ViewId | null)
20
+
21
+ const browserView = browserViewId ? LikeC4Views[browserViewId] : null
22
+
23
+ if (!view) {
24
+ throw new Error(`View with id ${viewId} not found`)
25
+ }
26
+
27
+ if (browserViewId && !browserView) {
28
+ throw new Error(`View with id ${browserViewId} not found`)
29
+ }
30
+
31
+ return (
32
+ <>
33
+ <LikeC4ViewComponent<LikeC4ViewId>
34
+ view={view}
35
+ colorScheme={colorScheme}
36
+ injectFontCss={injectFontCss}
37
+ onNavigateTo={interactive ? onNavigateTo : undefined}
38
+ {...props}
39
+ />
40
+ {browserView && (createPortal(
41
+ <LikeC4Browser<LikeC4ViewId>
42
+ view={browserView}
43
+ injectFontCss={false}
44
+ colorScheme={colorScheme}
45
+ onNavigateTo={onNavigateTo}
46
+ onClose={() => onNavigateTo(null)}
47
+ />,
48
+ document.body,
49
+ view.id
50
+ ))}
51
+ </>
52
+ )
53
+ }
@@ -0,0 +1,13 @@
1
+ export const ComponentName = {
2
+ View: WEBCOMPONENT_PREFIX + '-view',
3
+ Browser: WEBCOMPONENT_PREFIX + '-browser'
4
+ }
5
+
6
+ let BASE = import.meta.env.BASE_URL
7
+ if (!BASE.endsWith('/')) {
8
+ BASE = BASE + '/'
9
+ }
10
+
11
+ export const useHasHistory = __USE_HASH_HISTORY__
12
+
13
+ export const basepath = useHasHistory ? '/' : BASE