@wix/origami-runtime 0.19.1 → 0.19.2
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/README.md +25 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/svg.d.ts +3 -0
- package/dist/svg.js +99 -0
- package/dist/svg.js.map +1 -0
- package/dist/svgContent.d.ts +4 -0
- package/dist/svgContent.js +38 -0
- package/dist/svgContent.js.map +1 -0
- package/dist/useSvgProps.d.ts +2 -0
- package/dist/useSvgProps.js +5 -0
- package/dist/useSvgProps.js.map +1 -0
- package/dist/withOrigami.js +2 -1
- package/dist/withOrigami.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,6 +4,31 @@ Before local builds or tests, run `pnpm -r run build` from the repository root t
|
|
|
4
4
|
|
|
5
5
|
The root entry exports binding, provider, and component authoring helpers.
|
|
6
6
|
|
|
7
|
+
`svg(url, uri)` creates a deferred SVG source without calling hooks or fetching content:
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
import { svg } from '@wix/origami-runtime'
|
|
11
|
+
|
|
12
|
+
<SvgImage svgId={svg(url, uri)} />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The existing `withOrigami` wrapper resolves these sources before rendering the original component,
|
|
16
|
+
including sources nested in objects, arrays, and `elementProps`. Sources can be created inside
|
|
17
|
+
repeater render callbacks. The wrapper uses a fixed set of hooks even when the number of sources changes.
|
|
18
|
+
React elements and render callbacks are left intact; their own wrapped components resolve their sources.
|
|
19
|
+
|
|
20
|
+
Resolution returns only `{svgContent}`. The root SVG markup contains the calculated `viewBox`;
|
|
21
|
+
nested SVG viewports remain unchanged. The viewport follows Thunderbolt: non-UGC artwork prefers
|
|
22
|
+
`data-bbox`; UGC preserves the raw viewport or falls back to width and height. The UGC fallback
|
|
23
|
+
accepts unitless and pixel dimensions; other units leave the viewport unspecified.
|
|
24
|
+
|
|
25
|
+
Sources receive plain URL and URI strings and have no dependency on the media SDK.
|
|
26
|
+
DM reconstructs the Core vector from the expression without fetching or executing it.
|
|
27
|
+
The wrapper supplies empty SVG content while loading or after a fetch failure, reuses loaded URLs
|
|
28
|
+
within its mounted instance, and cancels pending requests when its source URLs change or it unmounts.
|
|
29
|
+
The existing `useSvgProps(url, uri)` hook uses the same resolution implementation for direct hook consumers;
|
|
30
|
+
it must be called at the top level of a React component or hook.
|
|
31
|
+
|
|
7
32
|
Layout components and the shared DOM/CSS contract belong to
|
|
8
33
|
[`@wix/origami-system-components`](../origami-system-components/README.md).
|
|
9
34
|
This package has no layout subpaths or system-components dependency.
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ export type { Binding, ContextHook } from './bindings';
|
|
|
3
3
|
export { Remove, Show } from './components';
|
|
4
4
|
export { withOrigami } from './withOrigami';
|
|
5
5
|
export { withInteractions } from './withInteractions';
|
|
6
|
+
export { useSvgProps } from './useSvgProps';
|
|
7
|
+
export type { SvgProps } from './svgContent';
|
|
8
|
+
export { svg } from './svg';
|
|
6
9
|
export { cx, rootClass } from './classNames';
|
|
7
10
|
export type { ClassNames, Cond } from './classNames';
|
|
8
11
|
export { prop, defineComponent } from './define';
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,8 @@ export { all, ctx, fn, is, raw, resolve, isBinding } from './bindings';
|
|
|
2
2
|
export { Remove, Show } from './components';
|
|
3
3
|
export { withOrigami } from './withOrigami';
|
|
4
4
|
export { withInteractions } from './withInteractions';
|
|
5
|
+
export { useSvgProps } from './useSvgProps';
|
|
6
|
+
export { svg } from './svg';
|
|
5
7
|
export { cx, rootClass } from './classNames';
|
|
6
8
|
export { prop, defineComponent } from './define';
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE5C,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE5C,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/svg.d.ts
ADDED
package/dist/svg.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { isValidElement, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { resolveSvgProps } from "./svgContent";
|
|
3
|
+
const SVG_SOURCE = Symbol.for("@wix/origami-runtime.svgSource");
|
|
4
|
+
// Share both in-flight work and parsed results across mounted wrappers.
|
|
5
|
+
const svgRequests = new Map();
|
|
6
|
+
const loadSvg = (url) => {
|
|
7
|
+
const cached = svgRequests.get(url);
|
|
8
|
+
if (cached)
|
|
9
|
+
return cached;
|
|
10
|
+
const request = (async () => {
|
|
11
|
+
const response = await fetch(url);
|
|
12
|
+
if (!response.ok) {
|
|
13
|
+
throw new Error(`SVG fetch failed: ${response.status}`);
|
|
14
|
+
}
|
|
15
|
+
const content = await response.text();
|
|
16
|
+
return resolveSvgProps(content);
|
|
17
|
+
})().catch((error) => {
|
|
18
|
+
svgRequests.delete(url);
|
|
19
|
+
throw error;
|
|
20
|
+
});
|
|
21
|
+
svgRequests.set(url, request);
|
|
22
|
+
return request;
|
|
23
|
+
};
|
|
24
|
+
class SvgSource {
|
|
25
|
+
url;
|
|
26
|
+
uri;
|
|
27
|
+
[SVG_SOURCE] = true;
|
|
28
|
+
constructor(url, uri) {
|
|
29
|
+
this.url = url;
|
|
30
|
+
this.uri = uri;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export const svg = (url, uri) => new SvgSource(url, uri);
|
|
34
|
+
const isSvgSource = (value) => value !== null &&
|
|
35
|
+
typeof value === "object" &&
|
|
36
|
+
SVG_SOURCE in value &&
|
|
37
|
+
value[SVG_SOURCE] === true;
|
|
38
|
+
const mapSources = (value, resolve, seen = new WeakMap()) => {
|
|
39
|
+
if (isSvgSource(value))
|
|
40
|
+
return resolve(value);
|
|
41
|
+
if (value === null || typeof value !== "object" || isValidElement(value))
|
|
42
|
+
return value;
|
|
43
|
+
if (seen.has(value))
|
|
44
|
+
return seen.get(value);
|
|
45
|
+
if (Array.isArray(value)) {
|
|
46
|
+
const mapped = new Array(value.length);
|
|
47
|
+
seen.set(value, mapped);
|
|
48
|
+
value.forEach((entry, index) => {
|
|
49
|
+
mapped[index] = mapSources(entry, resolve, seen);
|
|
50
|
+
});
|
|
51
|
+
return mapped;
|
|
52
|
+
}
|
|
53
|
+
if (Object.getPrototypeOf(value) === Object.prototype) {
|
|
54
|
+
const mapped = {};
|
|
55
|
+
seen.set(value, mapped);
|
|
56
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
57
|
+
Object.defineProperty(mapped, key, {
|
|
58
|
+
value: mapSources(entry, resolve, seen),
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return mapped;
|
|
65
|
+
}
|
|
66
|
+
return value;
|
|
67
|
+
};
|
|
68
|
+
export function useSvgSources(props) {
|
|
69
|
+
const cache = useRef(new Map());
|
|
70
|
+
const [, setVersion] = useState(0);
|
|
71
|
+
const urls = new Set();
|
|
72
|
+
mapSources(props, (source) => urls.add(source.url));
|
|
73
|
+
const urlsKey = JSON.stringify([...urls].sort());
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
let active = true;
|
|
76
|
+
const load = async (url) => {
|
|
77
|
+
try {
|
|
78
|
+
const resolved = await loadSvg(url);
|
|
79
|
+
if (active) {
|
|
80
|
+
cache.current.set(url, resolved);
|
|
81
|
+
setVersion((version) => version + 1);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if (active)
|
|
86
|
+
console.error("Could not load SVG:", error);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
for (const url of JSON.parse(urlsKey)) {
|
|
90
|
+
if (!cache.current.has(url))
|
|
91
|
+
void load(url);
|
|
92
|
+
}
|
|
93
|
+
return () => {
|
|
94
|
+
active = false;
|
|
95
|
+
};
|
|
96
|
+
}, [urlsKey]);
|
|
97
|
+
return mapSources(props, (source) => cache.current.get(source.url) ?? { svgContent: "" });
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=svg.js.map
|
package/dist/svg.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg.js","sourceRoot":"","sources":["../src/svg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,Q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C;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,MAAM;oBAAE,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC,CAAC;QACF,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAa,EAAE,CAAC;YAClD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,GAAG,EAAE;YACV,MAAM,GAAG,KAAK,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,UAAU,CACf,KAAK,EACL,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,CAC3D,CAAC;AACT,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Other units need a layout or unit conversion context; do not guess their viewport size.
|
|
2
|
+
function viewportDimension(value) {
|
|
3
|
+
const match = value
|
|
4
|
+
?.trim()
|
|
5
|
+
.match(/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(?:px)?$/i);
|
|
6
|
+
if (!match)
|
|
7
|
+
return undefined;
|
|
8
|
+
const dimension = Number(match[1]);
|
|
9
|
+
return Number.isFinite(dimension) && dimension >= 0 ? dimension : undefined;
|
|
10
|
+
}
|
|
11
|
+
export function resolveSvgProps(svgContent) {
|
|
12
|
+
const props = { svgContent };
|
|
13
|
+
if (!svgContent)
|
|
14
|
+
return props;
|
|
15
|
+
const document = new DOMParser().parseFromString(svgContent, "image/svg+xml");
|
|
16
|
+
const svg = document.documentElement;
|
|
17
|
+
if (svg.localName !== "svg" || document.querySelector("parsererror"))
|
|
18
|
+
return { svgContent: "" };
|
|
19
|
+
const contentType = svg.getAttribute("data-type") || "shape";
|
|
20
|
+
const contentBox = svg.getAttribute("data-bbox") || "";
|
|
21
|
+
const rawViewBox = svg.getAttribute("viewBox") || "";
|
|
22
|
+
const width = viewportDimension(svg.getAttribute("width"));
|
|
23
|
+
const height = viewportDimension(svg.getAttribute("height"));
|
|
24
|
+
const fallback = contentType === "ugc" && width !== undefined && height !== undefined
|
|
25
|
+
? `0 0 ${width} ${height}`
|
|
26
|
+
: "";
|
|
27
|
+
const viewBox = !rawViewBox && fallback
|
|
28
|
+
? fallback
|
|
29
|
+
: contentType !== "ugc" && contentBox
|
|
30
|
+
? contentBox
|
|
31
|
+
: rawViewBox;
|
|
32
|
+
if (viewBox && viewBox !== rawViewBox) {
|
|
33
|
+
svg.setAttribute("viewBox", viewBox);
|
|
34
|
+
props.svgContent = new XMLSerializer().serializeToString(svg);
|
|
35
|
+
}
|
|
36
|
+
return props;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=svgContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svgContent.js","sourceRoot":"","sources":["../src/svgContent.ts"],"names":[],"mappings":"AAIA,0FAA0F;AAC1F,SAAS,iBAAiB,CAAC,KAAoB;IAC7C,MAAM,KAAK,GAAG,KAAK;QACjB,EAAE,IAAI,EAAE;SACP,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAC/D,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,MAAM,KAAK,GAAa,EAAE,UAAU,EAAE,CAA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AAI,aAAa,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSvgProps.js","sourceRoot":"","sources":["../src/useSvgProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAG1C,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,GAAW;IAChD,OAAO,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AACvC,CAAC"}
|
package/dist/withOrigami.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isBinding, resolve } from './bindings';
|
|
3
|
+
import { useSvgSources } from './svg';
|
|
3
4
|
// Resolve the authored props (reading the hooks they bind to), render the real component.
|
|
4
5
|
export const withOrigami = (Component) => {
|
|
5
6
|
const W = (props) => {
|
|
@@ -8,7 +9,7 @@ export const withOrigami = (Component) => {
|
|
|
8
9
|
throw new Error(`${k}: a callback has no spelling (ADR-0015); fn() would run at render`);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
|
-
const resolved = resolve(props);
|
|
12
|
+
const resolved = useSvgSources(resolve(props));
|
|
12
13
|
return _jsx(Component, { ...resolved });
|
|
13
14
|
};
|
|
14
15
|
W.displayName = `Origami(${Component.displayName ?? Component.name})`;
|
package/dist/withOrigami.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withOrigami.js","sourceRoot":"","sources":["../src/withOrigami.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"withOrigami.js","sourceRoot":"","sources":["../src/withOrigami.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC,0FAA0F;AAC1F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAmB,SAA2B,EAAwB,EAAE;IAC/F,MAAM,CAAC,GAAyB,CAAC,KAAQ,EAAE,EAAE;QACzC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;YACpE,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrC,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAA;YAC5F,CAAC;QACL,CAAC;QACD,MAAM,QAAQ,GAAG,aAAa,CAAC,OAAO,CAAC,KAAK,CAAM,CAAC,CAAA;QACnD,OAAO,KAAC,SAAS,OAAK,QAAQ,GAAI,CAAA;IACtC,CAAC,CAAA;IACD,CAAC,CAAC,WAAW,GAAG,WAAW,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,GAAG,CAAA;IACrE,OAAO,CAAC,CAAA;AACZ,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/origami-runtime",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"description": "React runtime for Origami-generated component wrappers: context bindings, providers, and className resolution",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"type": "module",
|
|
64
|
-
"falconPackageHash": "
|
|
64
|
+
"falconPackageHash": "ff4fcb08d2eb21bdfd748f51b326dd359dc90e3015702d9eecbd8660"
|
|
65
65
|
}
|