@fragmentsx/render-web 0.1.1 → 0.1.3
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/index.cjs.js +26 -7
- package/dist/index.es.js +26 -7
- package/package.json +4 -4
package/dist/index.cjs.js
CHANGED
|
@@ -2083,6 +2083,8 @@ const getAreaListQuery = (areaCodes) => {
|
|
|
2083
2083
|
return {
|
|
2084
2084
|
query: `query($areaCodes: [String!]!) {
|
|
2085
2085
|
clientAreas(areaCodes: $areaCodes) {
|
|
2086
|
+
areaProperties
|
|
2087
|
+
projectProperties
|
|
2086
2088
|
variant {
|
|
2087
2089
|
fragment {
|
|
2088
2090
|
props
|
|
@@ -2189,9 +2191,16 @@ const fetchPlugin = (state) => {
|
|
|
2189
2191
|
)
|
|
2190
2192
|
);
|
|
2191
2193
|
}
|
|
2194
|
+
const resultProps = [
|
|
2195
|
+
...area.projectProperties ?? [],
|
|
2196
|
+
...area.areaProperties ?? []
|
|
2197
|
+
].reduce((acc, prop) => {
|
|
2198
|
+
acc[prop._id] = prop.defaultValue;
|
|
2199
|
+
return acc;
|
|
2200
|
+
}, area.variant.fragment.props);
|
|
2192
2201
|
const entity = {
|
|
2193
2202
|
fragmentId: area.variant.fragment.fragment.id,
|
|
2194
|
-
props:
|
|
2203
|
+
props: resultProps
|
|
2195
2204
|
};
|
|
2196
2205
|
state.$fetch.cacheAreaDocuments.set(areaCode, entity);
|
|
2197
2206
|
});
|
|
@@ -2341,7 +2350,8 @@ function generateSmallerCssBlocks(layerResolver, group, cssMaker) {
|
|
|
2341
2350
|
(smallerLayer, index2, arr) => {
|
|
2342
2351
|
const smallerChildren = getAllChildren(layerResolver, smallerLayer);
|
|
2343
2352
|
const smallerCssBlocks = smallerChildren.map(cssMaker);
|
|
2344
|
-
const
|
|
2353
|
+
const primaryLayer = layerResolver(group.primary);
|
|
2354
|
+
const max = index2 === 0 ? (primaryLayer == null ? void 0 : primaryLayer.width) - 1 : arr[index2 - 1].width;
|
|
2345
2355
|
return `@container (max-width: ${max}px) {${smallerCssBlocks.map(buildCssBlock).join("")}}`;
|
|
2346
2356
|
}
|
|
2347
2357
|
);
|
|
@@ -2424,7 +2434,7 @@ const fragmentStylesheetPlugin = (state) => {
|
|
|
2424
2434
|
};
|
|
2425
2435
|
return state;
|
|
2426
2436
|
};
|
|
2427
|
-
const globalCss = '[data-key^="Fragment"] {\n [data-key^="Text"] {\n p {\n margin: 0;\n font-size: 14px;\n color: #000;\n font-weight: 400;\n }\n }\n\n /* 1. Use a more-intuitive box-sizing model */\n\n *, *::before, *::after {\n box-sizing: border-box;\n }\n\n /* 2. Remove default margin */\n\n * {\n margin: 0;\n }\n\n /* 3. Enable keyword animations */\n @media (prefers-reduced-motion: no-preference) {\n html {\n interpolate-size: allow-keywords;\n }\n }\n\n body {\n /* 4. Add accessible line-height */\n line-height: 1.5;\n /* 5. Improve text rendering */\n -webkit-font-smoothing: antialiased;\n }\n\n /* 6. Improve media defaults */\n\n img, picture, video, canvas, svg {\n display: block;\n max-width: 100%;\n }\n\n /* 7. Inherit fonts for form controls */\n\n input, button, textarea, select {\n font: inherit;\n }\n\n /* 8. Avoid text overflows */\n\n p, h1, h2, h3, h4, h5, h6 {\n overflow-wrap: break-word;\n }\n\n /*\n 10. Create a root stacking context\n */\n\n #root, #__next {\n isolation: isolate;\n }\n\n a {\n text-decoration: none;\n }\n}\n';
|
|
2437
|
+
const globalCss = '[data-key^="Fragment"] {\n [data-key^="Text"] {\n p {\n margin: 0;\n font-size: 14px;\n color: #000;\n font-weight: 400;\n }\n }\n\n ul, ol {\n padding: 0;\n }\n\n /* 1. Use a more-intuitive box-sizing model */\n\n *, *::before, *::after {\n box-sizing: border-box;\n }\n\n /* 2. Remove default margin */\n\n * {\n margin: 0;\n }\n\n /* 3. Enable keyword animations */\n @media (prefers-reduced-motion: no-preference) {\n html {\n interpolate-size: allow-keywords;\n }\n }\n\n body {\n /* 4. Add accessible line-height */\n line-height: 1.5;\n /* 5. Improve text rendering */\n -webkit-font-smoothing: antialiased;\n }\n\n /* 6. Improve media defaults */\n\n img, picture, video, canvas, svg {\n display: block;\n max-width: 100%;\n }\n\n /* 7. Inherit fonts for form controls */\n\n input, button, textarea, select {\n font: inherit;\n }\n\n /* 8. Avoid text overflows */\n\n p, h1, h2, h3, h4, h5, h6 {\n overflow-wrap: break-word;\n }\n\n /*\n 10. Create a root stacking context\n */\n\n #root, #__next {\n isolation: isolate;\n }\n\n a {\n text-decoration: none;\n }\n}\n';
|
|
2428
2438
|
const globalStylesheetPlugin = (state) => {
|
|
2429
2439
|
if (!("$fragments" in state)) {
|
|
2430
2440
|
throw new Error("GlobalStylesheetPlugin need $fragments plugin");
|
|
@@ -2700,7 +2710,6 @@ const loadPlugin = (state) => {
|
|
|
2700
2710
|
const loader = async () => {
|
|
2701
2711
|
var _a2;
|
|
2702
2712
|
const areaEntity = await ((_a2 = state == null ? void 0 : state.$fetch) == null ? void 0 : _a2.queryArea(areaCode));
|
|
2703
|
-
console.log(areaEntity);
|
|
2704
2713
|
await loadFragment(areaEntity == null ? void 0 : areaEntity.fragmentId, {
|
|
2705
2714
|
suspense: false
|
|
2706
2715
|
});
|
|
@@ -5409,12 +5418,17 @@ const useReadVariable = (variableKey) => {
|
|
|
5409
5418
|
layer: null
|
|
5410
5419
|
};
|
|
5411
5420
|
}
|
|
5412
|
-
|
|
5421
|
+
let instanceScope = scopes.findLast(
|
|
5413
5422
|
(scope) => {
|
|
5414
5423
|
var _a2;
|
|
5415
5424
|
return (scope == null ? void 0 : scope.type) === index.scopeTypes.InstanceScope && !!((_a2 = scope.documentManager) == null ? void 0 : _a2.resolve(variableKey2));
|
|
5416
5425
|
}
|
|
5417
5426
|
);
|
|
5427
|
+
if (!instanceScope) {
|
|
5428
|
+
instanceScope = scopes.find(
|
|
5429
|
+
(scope) => (scope == null ? void 0 : scope.type) === index.scopeTypes.InstanceScope
|
|
5430
|
+
);
|
|
5431
|
+
}
|
|
5418
5432
|
const variableLayer = resolveVariableLayer(
|
|
5419
5433
|
instanceScope == null ? void 0 : instanceScope.documentManager,
|
|
5420
5434
|
variableKey2
|
|
@@ -5838,8 +5852,8 @@ const useLayerStyles = (layerKey) => {
|
|
|
5838
5852
|
...layout,
|
|
5839
5853
|
...layerSize,
|
|
5840
5854
|
...textStyles,
|
|
5841
|
-
display
|
|
5842
|
-
"user-select": "none"
|
|
5855
|
+
display
|
|
5856
|
+
// "user-select": "none",
|
|
5843
5857
|
// ...cssOverride,
|
|
5844
5858
|
};
|
|
5845
5859
|
} catch (e2) {
|
|
@@ -6341,6 +6355,10 @@ const useArea = (options2) => {
|
|
|
6341
6355
|
options2 == null ? void 0 : options2.globalManager
|
|
6342
6356
|
);
|
|
6343
6357
|
const [areaData, setAreaData] = d(queryArea(options2.areaCode));
|
|
6358
|
+
const resultProps = T$1(
|
|
6359
|
+
() => ({ ...(areaData == null ? void 0 : areaData.props) ?? {}, ...(options2 == null ? void 0 : options2.props) ?? [] }),
|
|
6360
|
+
[areaData, options2]
|
|
6361
|
+
);
|
|
6344
6362
|
y$2(() => {
|
|
6345
6363
|
(async () => {
|
|
6346
6364
|
const response = await queryArea(options2.areaCode);
|
|
@@ -6351,6 +6369,7 @@ const useArea = (options2) => {
|
|
|
6351
6369
|
}, []);
|
|
6352
6370
|
return {
|
|
6353
6371
|
...areaData,
|
|
6372
|
+
props: resultProps,
|
|
6354
6373
|
globalManager: resultGlobalManager
|
|
6355
6374
|
};
|
|
6356
6375
|
};
|
package/dist/index.es.js
CHANGED
|
@@ -2082,6 +2082,8 @@ const getAreaListQuery = (areaCodes) => {
|
|
|
2082
2082
|
return {
|
|
2083
2083
|
query: `query($areaCodes: [String!]!) {
|
|
2084
2084
|
clientAreas(areaCodes: $areaCodes) {
|
|
2085
|
+
areaProperties
|
|
2086
|
+
projectProperties
|
|
2085
2087
|
variant {
|
|
2086
2088
|
fragment {
|
|
2087
2089
|
props
|
|
@@ -2188,9 +2190,16 @@ const fetchPlugin = (state) => {
|
|
|
2188
2190
|
)
|
|
2189
2191
|
);
|
|
2190
2192
|
}
|
|
2193
|
+
const resultProps = [
|
|
2194
|
+
...area.projectProperties ?? [],
|
|
2195
|
+
...area.areaProperties ?? []
|
|
2196
|
+
].reduce((acc, prop) => {
|
|
2197
|
+
acc[prop._id] = prop.defaultValue;
|
|
2198
|
+
return acc;
|
|
2199
|
+
}, area.variant.fragment.props);
|
|
2191
2200
|
const entity = {
|
|
2192
2201
|
fragmentId: area.variant.fragment.fragment.id,
|
|
2193
|
-
props:
|
|
2202
|
+
props: resultProps
|
|
2194
2203
|
};
|
|
2195
2204
|
state.$fetch.cacheAreaDocuments.set(areaCode, entity);
|
|
2196
2205
|
});
|
|
@@ -2340,7 +2349,8 @@ function generateSmallerCssBlocks(layerResolver, group, cssMaker) {
|
|
|
2340
2349
|
(smallerLayer, index2, arr) => {
|
|
2341
2350
|
const smallerChildren = getAllChildren(layerResolver, smallerLayer);
|
|
2342
2351
|
const smallerCssBlocks = smallerChildren.map(cssMaker);
|
|
2343
|
-
const
|
|
2352
|
+
const primaryLayer = layerResolver(group.primary);
|
|
2353
|
+
const max = index2 === 0 ? (primaryLayer == null ? void 0 : primaryLayer.width) - 1 : arr[index2 - 1].width;
|
|
2344
2354
|
return `@container (max-width: ${max}px) {${smallerCssBlocks.map(buildCssBlock).join("")}}`;
|
|
2345
2355
|
}
|
|
2346
2356
|
);
|
|
@@ -2423,7 +2433,7 @@ const fragmentStylesheetPlugin = (state) => {
|
|
|
2423
2433
|
};
|
|
2424
2434
|
return state;
|
|
2425
2435
|
};
|
|
2426
|
-
const globalCss = '[data-key^="Fragment"] {\n [data-key^="Text"] {\n p {\n margin: 0;\n font-size: 14px;\n color: #000;\n font-weight: 400;\n }\n }\n\n /* 1. Use a more-intuitive box-sizing model */\n\n *, *::before, *::after {\n box-sizing: border-box;\n }\n\n /* 2. Remove default margin */\n\n * {\n margin: 0;\n }\n\n /* 3. Enable keyword animations */\n @media (prefers-reduced-motion: no-preference) {\n html {\n interpolate-size: allow-keywords;\n }\n }\n\n body {\n /* 4. Add accessible line-height */\n line-height: 1.5;\n /* 5. Improve text rendering */\n -webkit-font-smoothing: antialiased;\n }\n\n /* 6. Improve media defaults */\n\n img, picture, video, canvas, svg {\n display: block;\n max-width: 100%;\n }\n\n /* 7. Inherit fonts for form controls */\n\n input, button, textarea, select {\n font: inherit;\n }\n\n /* 8. Avoid text overflows */\n\n p, h1, h2, h3, h4, h5, h6 {\n overflow-wrap: break-word;\n }\n\n /*\n 10. Create a root stacking context\n */\n\n #root, #__next {\n isolation: isolate;\n }\n\n a {\n text-decoration: none;\n }\n}\n';
|
|
2436
|
+
const globalCss = '[data-key^="Fragment"] {\n [data-key^="Text"] {\n p {\n margin: 0;\n font-size: 14px;\n color: #000;\n font-weight: 400;\n }\n }\n\n ul, ol {\n padding: 0;\n }\n\n /* 1. Use a more-intuitive box-sizing model */\n\n *, *::before, *::after {\n box-sizing: border-box;\n }\n\n /* 2. Remove default margin */\n\n * {\n margin: 0;\n }\n\n /* 3. Enable keyword animations */\n @media (prefers-reduced-motion: no-preference) {\n html {\n interpolate-size: allow-keywords;\n }\n }\n\n body {\n /* 4. Add accessible line-height */\n line-height: 1.5;\n /* 5. Improve text rendering */\n -webkit-font-smoothing: antialiased;\n }\n\n /* 6. Improve media defaults */\n\n img, picture, video, canvas, svg {\n display: block;\n max-width: 100%;\n }\n\n /* 7. Inherit fonts for form controls */\n\n input, button, textarea, select {\n font: inherit;\n }\n\n /* 8. Avoid text overflows */\n\n p, h1, h2, h3, h4, h5, h6 {\n overflow-wrap: break-word;\n }\n\n /*\n 10. Create a root stacking context\n */\n\n #root, #__next {\n isolation: isolate;\n }\n\n a {\n text-decoration: none;\n }\n}\n';
|
|
2427
2437
|
const globalStylesheetPlugin = (state) => {
|
|
2428
2438
|
if (!("$fragments" in state)) {
|
|
2429
2439
|
throw new Error("GlobalStylesheetPlugin need $fragments plugin");
|
|
@@ -2699,7 +2709,6 @@ const loadPlugin = (state) => {
|
|
|
2699
2709
|
const loader = async () => {
|
|
2700
2710
|
var _a2;
|
|
2701
2711
|
const areaEntity = await ((_a2 = state == null ? void 0 : state.$fetch) == null ? void 0 : _a2.queryArea(areaCode));
|
|
2702
|
-
console.log(areaEntity);
|
|
2703
2712
|
await loadFragment(areaEntity == null ? void 0 : areaEntity.fragmentId, {
|
|
2704
2713
|
suspense: false
|
|
2705
2714
|
});
|
|
@@ -5408,12 +5417,17 @@ const useReadVariable = (variableKey) => {
|
|
|
5408
5417
|
layer: null
|
|
5409
5418
|
};
|
|
5410
5419
|
}
|
|
5411
|
-
|
|
5420
|
+
let instanceScope = scopes.findLast(
|
|
5412
5421
|
(scope) => {
|
|
5413
5422
|
var _a2;
|
|
5414
5423
|
return (scope == null ? void 0 : scope.type) === index.scopeTypes.InstanceScope && !!((_a2 = scope.documentManager) == null ? void 0 : _a2.resolve(variableKey2));
|
|
5415
5424
|
}
|
|
5416
5425
|
);
|
|
5426
|
+
if (!instanceScope) {
|
|
5427
|
+
instanceScope = scopes.find(
|
|
5428
|
+
(scope) => (scope == null ? void 0 : scope.type) === index.scopeTypes.InstanceScope
|
|
5429
|
+
);
|
|
5430
|
+
}
|
|
5417
5431
|
const variableLayer = resolveVariableLayer(
|
|
5418
5432
|
instanceScope == null ? void 0 : instanceScope.documentManager,
|
|
5419
5433
|
variableKey2
|
|
@@ -5837,8 +5851,8 @@ const useLayerStyles = (layerKey) => {
|
|
|
5837
5851
|
...layout,
|
|
5838
5852
|
...layerSize,
|
|
5839
5853
|
...textStyles,
|
|
5840
|
-
display
|
|
5841
|
-
"user-select": "none"
|
|
5854
|
+
display
|
|
5855
|
+
// "user-select": "none",
|
|
5842
5856
|
// ...cssOverride,
|
|
5843
5857
|
};
|
|
5844
5858
|
} catch (e2) {
|
|
@@ -6340,6 +6354,10 @@ const useArea = (options2) => {
|
|
|
6340
6354
|
options2 == null ? void 0 : options2.globalManager
|
|
6341
6355
|
);
|
|
6342
6356
|
const [areaData, setAreaData] = d(queryArea(options2.areaCode));
|
|
6357
|
+
const resultProps = T$1(
|
|
6358
|
+
() => ({ ...(areaData == null ? void 0 : areaData.props) ?? {}, ...(options2 == null ? void 0 : options2.props) ?? [] }),
|
|
6359
|
+
[areaData, options2]
|
|
6360
|
+
);
|
|
6343
6361
|
y$2(() => {
|
|
6344
6362
|
(async () => {
|
|
6345
6363
|
const response = await queryArea(options2.areaCode);
|
|
@@ -6350,6 +6368,7 @@ const useArea = (options2) => {
|
|
|
6350
6368
|
}, []);
|
|
6351
6369
|
return {
|
|
6352
6370
|
...areaData,
|
|
6371
|
+
props: resultProps,
|
|
6353
6372
|
globalManager: resultGlobalManager
|
|
6354
6373
|
};
|
|
6355
6374
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fragmentsx/render-web",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@graph-state/checkers": "^0.1.2",
|
|
26
26
|
"@graph-state/core": "^0.13.0",
|
|
27
|
-
"@fragmentsx/client-core": "0.1.
|
|
28
|
-
"@fragmentsx/render-core": "0.1.0",
|
|
27
|
+
"@fragmentsx/client-core": "0.1.3",
|
|
29
28
|
"@fragmentsx/definition": "0.1.0",
|
|
30
|
-
"@fragmentsx/utils": "0.1.0"
|
|
29
|
+
"@fragmentsx/utils": "0.1.0",
|
|
30
|
+
"@fragmentsx/render-core": "0.1.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@graph-state/plugin-logger": "^0.3.0",
|