@fragmentsx/client-core 0.1.1 → 0.1.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/dist/index.cjs.js +13 -4
- package/dist/index.es.js +13 -4
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/queries/AreaListQuery.d.ts +2 -0
- package/dist/plugins/fetch/queries/AreaListQuery.d.ts.map +1 -1
- package/dist/plugins/load/index.d.ts.map +1 -1
- package/dist/plugins/styleSheet/fragment/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2087,6 +2087,8 @@ const getAreaListQuery = (areaCodes) => {
|
|
|
2087
2087
|
return {
|
|
2088
2088
|
query: `query($areaCodes: [String!]!) {
|
|
2089
2089
|
clientAreas(areaCodes: $areaCodes) {
|
|
2090
|
+
areaProperties
|
|
2091
|
+
projectProperties
|
|
2090
2092
|
variant {
|
|
2091
2093
|
fragment {
|
|
2092
2094
|
props
|
|
@@ -2193,9 +2195,16 @@ const fetchPlugin = (state) => {
|
|
|
2193
2195
|
)
|
|
2194
2196
|
);
|
|
2195
2197
|
}
|
|
2198
|
+
const resultProps = [
|
|
2199
|
+
...area.projectProperties ?? [],
|
|
2200
|
+
...area.areaProperties ?? []
|
|
2201
|
+
].reduce((acc, prop) => {
|
|
2202
|
+
acc[prop._id] = prop.defaultValue;
|
|
2203
|
+
return acc;
|
|
2204
|
+
}, area.variant.fragment.props);
|
|
2196
2205
|
const entity = {
|
|
2197
2206
|
fragmentId: area.variant.fragment.fragment.id,
|
|
2198
|
-
props:
|
|
2207
|
+
props: resultProps
|
|
2199
2208
|
};
|
|
2200
2209
|
state.$fetch.cacheAreaDocuments.set(areaCode, entity);
|
|
2201
2210
|
});
|
|
@@ -2345,7 +2354,8 @@ function generateSmallerCssBlocks(layerResolver, group, cssMaker) {
|
|
|
2345
2354
|
(smallerLayer, index2, arr) => {
|
|
2346
2355
|
const smallerChildren = getAllChildren(layerResolver, smallerLayer);
|
|
2347
2356
|
const smallerCssBlocks = smallerChildren.map(cssMaker);
|
|
2348
|
-
const
|
|
2357
|
+
const primaryLayer = layerResolver(group.primary);
|
|
2358
|
+
const max = index2 === 0 ? (primaryLayer == null ? void 0 : primaryLayer.width) - 1 : arr[index2 - 1].width;
|
|
2349
2359
|
return `@container (max-width: ${max}px) {${smallerCssBlocks.map(buildCssBlock).join("")}}`;
|
|
2350
2360
|
}
|
|
2351
2361
|
);
|
|
@@ -2428,7 +2438,7 @@ const fragmentStylesheetPlugin = (state) => {
|
|
|
2428
2438
|
};
|
|
2429
2439
|
return state;
|
|
2430
2440
|
};
|
|
2431
|
-
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';
|
|
2441
|
+
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';
|
|
2432
2442
|
const globalStylesheetPlugin = (state) => {
|
|
2433
2443
|
if (!("$fragments" in state)) {
|
|
2434
2444
|
throw new Error("GlobalStylesheetPlugin need $fragments plugin");
|
|
@@ -2704,7 +2714,6 @@ const loadPlugin = (state) => {
|
|
|
2704
2714
|
const loader = async () => {
|
|
2705
2715
|
var _a2;
|
|
2706
2716
|
const areaEntity = await ((_a2 = state == null ? void 0 : state.$fetch) == null ? void 0 : _a2.queryArea(areaCode));
|
|
2707
|
-
console.log(areaEntity);
|
|
2708
2717
|
await loadFragment(areaEntity == null ? void 0 : areaEntity.fragmentId, {
|
|
2709
2718
|
suspense: false
|
|
2710
2719
|
});
|
package/dist/index.es.js
CHANGED
|
@@ -2085,6 +2085,8 @@ const getAreaListQuery = (areaCodes) => {
|
|
|
2085
2085
|
return {
|
|
2086
2086
|
query: `query($areaCodes: [String!]!) {
|
|
2087
2087
|
clientAreas(areaCodes: $areaCodes) {
|
|
2088
|
+
areaProperties
|
|
2089
|
+
projectProperties
|
|
2088
2090
|
variant {
|
|
2089
2091
|
fragment {
|
|
2090
2092
|
props
|
|
@@ -2191,9 +2193,16 @@ const fetchPlugin = (state) => {
|
|
|
2191
2193
|
)
|
|
2192
2194
|
);
|
|
2193
2195
|
}
|
|
2196
|
+
const resultProps = [
|
|
2197
|
+
...area.projectProperties ?? [],
|
|
2198
|
+
...area.areaProperties ?? []
|
|
2199
|
+
].reduce((acc, prop) => {
|
|
2200
|
+
acc[prop._id] = prop.defaultValue;
|
|
2201
|
+
return acc;
|
|
2202
|
+
}, area.variant.fragment.props);
|
|
2194
2203
|
const entity = {
|
|
2195
2204
|
fragmentId: area.variant.fragment.fragment.id,
|
|
2196
|
-
props:
|
|
2205
|
+
props: resultProps
|
|
2197
2206
|
};
|
|
2198
2207
|
state.$fetch.cacheAreaDocuments.set(areaCode, entity);
|
|
2199
2208
|
});
|
|
@@ -2343,7 +2352,8 @@ function generateSmallerCssBlocks(layerResolver, group, cssMaker) {
|
|
|
2343
2352
|
(smallerLayer, index2, arr) => {
|
|
2344
2353
|
const smallerChildren = getAllChildren(layerResolver, smallerLayer);
|
|
2345
2354
|
const smallerCssBlocks = smallerChildren.map(cssMaker);
|
|
2346
|
-
const
|
|
2355
|
+
const primaryLayer = layerResolver(group.primary);
|
|
2356
|
+
const max = index2 === 0 ? (primaryLayer == null ? void 0 : primaryLayer.width) - 1 : arr[index2 - 1].width;
|
|
2347
2357
|
return `@container (max-width: ${max}px) {${smallerCssBlocks.map(buildCssBlock).join("")}}`;
|
|
2348
2358
|
}
|
|
2349
2359
|
);
|
|
@@ -2426,7 +2436,7 @@ const fragmentStylesheetPlugin = (state) => {
|
|
|
2426
2436
|
};
|
|
2427
2437
|
return state;
|
|
2428
2438
|
};
|
|
2429
|
-
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';
|
|
2439
|
+
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';
|
|
2430
2440
|
const globalStylesheetPlugin = (state) => {
|
|
2431
2441
|
if (!("$fragments" in state)) {
|
|
2432
2442
|
throw new Error("GlobalStylesheetPlugin need $fragments plugin");
|
|
@@ -2702,7 +2712,6 @@ const loadPlugin = (state) => {
|
|
|
2702
2712
|
const loader = async () => {
|
|
2703
2713
|
var _a2;
|
|
2704
2714
|
const areaEntity = await ((_a2 = state == null ? void 0 : state.$fetch) == null ? void 0 : _a2.queryArea(areaCode));
|
|
2705
|
-
console.log(areaEntity);
|
|
2706
2715
|
await loadFragment(areaEntity == null ? void 0 : areaEntity.fragmentId, {
|
|
2707
2716
|
suspense: false
|
|
2708
2717
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAgBrD,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,UAAU;QAClB,MAAM,EAAE;YACN;;eAEG;YACH,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACpC,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;YACjD,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;YACpD,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,eAAe,GAAG,IAAI,CAAC;YACvD,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;YAC/C,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,eAAe,CAAC;YACjD,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,eAAe,EAAE,CAAC;YAC1D,KAAK,EAAE,UAAU,CAAC,OAAO,aAAa,CA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M,WAAW,EAAE,MA8IzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AreaListQuery.d.ts","sourceRoot":"","sources":["../../../../src/plugins/fetch/queries/AreaListQuery.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE;QACX,OAAO,EAAE;YACP,QAAQ,EAAE;gBACR,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAC/B,QAAQ,EAAE;oBACR,EAAE,EAAE,MAAM,CAAC;oBACX,QAAQ,EAAE,MAAM,CAAC;oBACjB,eAAe,EAAE;wBACf,EAAE,EAAE,MAAM,CAAC;wBACX,QAAQ,EAAE,MAAM,CAAC;qBAClB,CAAC;iBACH,CAAC;aACH,CAAC;SACH,CAAC;KACH,EAAE,CAAC;CACL;AAED,eAAO,MAAM,gBAAgB,cAAe,MAAM;;;;;
|
|
1
|
+
{"version":3,"file":"AreaListQuery.d.ts","sourceRoot":"","sources":["../../../../src/plugins/fetch/queries/AreaListQuery.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE;QACX,cAAc,EAAE,OAAO,EAAE,CAAC;QAC1B,iBAAiB,EAAE,OAAO,EAAE,CAAC;QAC7B,OAAO,EAAE;YACP,QAAQ,EAAE;gBACR,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAC/B,QAAQ,EAAE;oBACR,EAAE,EAAE,MAAM,CAAC;oBACX,QAAQ,EAAE,MAAM,CAAC;oBACjB,eAAe,EAAE;wBACf,EAAE,EAAE,MAAM,CAAC;wBACX,QAAQ,EAAE,MAAM,CAAC;qBAClB,CAAC;iBACH,CAAC;aACH,CAAC;SACH,CAAC;KACH,EAAE,CAAC;CACL;AAED,eAAO,MAAM,gBAAgB,cAAe,MAAM;;;;;CAyBjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/load/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,UAAU;QAClB,KAAK,EAAE;YACL,YAAY,EAAE,CACZ,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,iBAAiB,KACxB,UAAU,CAAC;YAChB,QAAQ,EAAE,CACR,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,iBAAiB,KACxB;gBACH,UAAU,EAAE,MAAM,CAAC;gBACnB,KAAK,EAAE,OAAO,CAAC;aAChB,CAAC;SACH,CAAC;KACH;CACF;AAED,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/load/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,UAAU;QAClB,KAAK,EAAE;YACL,YAAY,EAAE,CACZ,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,iBAAiB,KACxB,UAAU,CAAC;YAChB,QAAQ,EAAE,CACR,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,iBAAiB,KACxB;gBACH,UAAU,EAAE,MAAM,CAAC;gBACnB,KAAK,EAAE,OAAO,CAAC;aAChB,CAAC;SACH,CAAC;KACH;CACF;AAED,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,EAAE,MAkGxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/styleSheet/fragment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAQ/E,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/styleSheet/fragment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAQ/E,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;AAmHlD,eAAO,MAAM,wBAAwB,EAAE,MA2DtC,CAAC"}
|