likec4 1.4.0 → 1.5.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.
- package/dist/__app__/react/likec4.tsx +9 -5
- package/dist/__app__/src/-view-lazy-data-WZmbIsHq.mjs +9 -0
- package/dist/__app__/src/{index-CgQjA8pD.mjs → index-ChCFoQrG.mjs} +1 -6
- package/dist/__app__/src/lib/webcomponent.mjs +5597 -5111
- package/dist/__app__/src/main.mjs +6740 -6196
- package/dist/__app__/src/style.css +1 -1
- package/dist/__app__/tsconfig.tsbuildinfo +1 -0
- package/dist/cli/index.mjs +284 -274
- package/package.json +36 -34
- package/react/LikeC4Browser.d.ts +19 -2
- package/react/LikeC4ViewElement.d.ts +21 -3
- package/react/index.mjs +3273 -2824
- package/react/styles.css.d.ts +1 -1
- package/react/styles.d.ts +1 -4
- package/react/types.d.ts +5 -0
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { LikeC4Browser, type LikeC4ViewBaseProps, LikeC4ViewElement } from 'likec4/react'
|
|
2
|
-
import { useCallback, useState } from 'react'
|
|
2
|
+
import { memo, useCallback, useState } from 'react'
|
|
3
3
|
import { isLikeC4ViewId, type LikeC4ViewId, LikeC4Views } from 'virtual:likec4/views'
|
|
4
4
|
|
|
5
5
|
export { isLikeC4ViewId }
|
|
6
|
+
|
|
6
7
|
export type LikeC4ViewProps = LikeC4ViewBaseProps<LikeC4ViewId>
|
|
7
8
|
|
|
8
|
-
export
|
|
9
|
+
export const LikeC4View = memo<LikeC4ViewProps>(function LikeC4ViewComponent({
|
|
9
10
|
viewId,
|
|
10
11
|
interactive = true,
|
|
11
12
|
colorScheme,
|
|
12
13
|
injectFontCss = true,
|
|
14
|
+
background = 'transparent',
|
|
15
|
+
browserBackground = 'dots',
|
|
13
16
|
...props
|
|
14
|
-
}
|
|
17
|
+
}) {
|
|
15
18
|
const view = LikeC4Views[viewId]
|
|
16
19
|
|
|
17
20
|
const [browserViewId, onNavigateTo] = useState(null as LikeC4ViewId | null)
|
|
@@ -37,6 +40,7 @@ export function LikeC4View({
|
|
|
37
40
|
colorScheme={colorScheme}
|
|
38
41
|
injectFontCss={injectFontCss}
|
|
39
42
|
onNavigateTo={interactive ? onNavigateTo : undefined}
|
|
43
|
+
background={background}
|
|
40
44
|
{...props}
|
|
41
45
|
/>
|
|
42
46
|
{browserView && (
|
|
@@ -45,10 +49,10 @@ export function LikeC4View({
|
|
|
45
49
|
injectFontCss={false}
|
|
46
50
|
colorScheme={colorScheme}
|
|
47
51
|
onNavigateTo={onNavigateTo}
|
|
48
|
-
background=
|
|
52
|
+
background={browserBackground}
|
|
49
53
|
onClose={closeBrowser}
|
|
50
54
|
/>
|
|
51
55
|
)}
|
|
52
56
|
</>
|
|
53
57
|
)
|
|
54
|
-
}
|
|
58
|
+
})
|
|
@@ -263,12 +263,7 @@ async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl)
|
|
|
263
263
|
try {
|
|
264
264
|
const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL, contentType = getMimeType(resourceURL);
|
|
265
265
|
let dataURL;
|
|
266
|
-
|
|
267
|
-
const content = await getContentFromUrl(resolvedURL);
|
|
268
|
-
dataURL = makeDataUrl(content, contentType);
|
|
269
|
-
} else
|
|
270
|
-
dataURL = await resourceToDataURL(resolvedURL, contentType, options);
|
|
271
|
-
return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
|
|
266
|
+
return getContentFromUrl || (dataURL = await resourceToDataURL(resolvedURL, contentType, options)), cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
|
|
272
267
|
} catch {
|
|
273
268
|
}
|
|
274
269
|
return cssText;
|