@rulecms/widget-angular 0.1.0 → 0.2.1

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.
@@ -70,6 +70,22 @@ function assertDefaultLibraryRegistered({ registrations, referenced }) {
70
70
  * consumes. Default library entries keep bare keys; all other libraries are
71
71
  * namespaced "libraryId/type" (see resolve-key.ts).
72
72
  */
73
+ function collectStylesheets(modules) {
74
+ const stylesheets = [];
75
+ const seen = new Set();
76
+ for (const module of modules.values()) {
77
+ if (typeof module.stylesheet !== 'string') {
78
+ continue;
79
+ }
80
+ const css = module.stylesheet.trim();
81
+ if (!css || seen.has(css)) {
82
+ continue;
83
+ }
84
+ seen.add(css);
85
+ stylesheets.push(css);
86
+ }
87
+ return stylesheets.length > 0 ? stylesheets : undefined;
88
+ }
73
89
  function composeSourceComponentsPlugin(modules) {
74
90
  const components = {};
75
91
  for (const [libraryId, module] of modules) {
@@ -78,7 +94,8 @@ function composeSourceComponentsPlugin(modules) {
78
94
  components[isDefault ? type : `${libraryId}/${type}`] = entry;
79
95
  }
80
96
  }
81
- return { components };
97
+ const stylesheets = collectStylesheets(modules);
98
+ return stylesheets ? { components, stylesheets } : { components };
82
99
  }
83
100
  /**
84
101
  * Creates a per-provider/per-widget registry instance.
@@ -2814,6 +2831,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
2814
2831
  type: Input
2815
2832
  }] } });
2816
2833
 
2834
+ /**
2835
+ * Emits each library stylesheet once as an SSR `<style>` tag.
2836
+ *
2837
+ * Same delivery as `BreakpointVariantRenderComponent`'s breakpoint CSS: a
2838
+ * style element next to the markup, not a file the host has to link, and not
2839
+ * CSS-in-JS. Empty or missing lists render nothing.
2840
+ */
2841
+ class LibraryStylesheetsComponent {
2842
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LibraryStylesheetsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2843
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: LibraryStylesheetsComponent, isStandalone: true, selector: "rulecms-library-stylesheets", inputs: { stylesheets: "stylesheets" }, host: { styleAttribute: "display: contents" }, ngImport: i0, template: `
2844
+ @for (css of stylesheets ?? []; track css) {
2845
+ <style data-rulecms-library-stylesheet="" [innerText]="css"></style>
2846
+ }
2847
+ `, isInline: true }); }
2848
+ }
2849
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LibraryStylesheetsComponent, decorators: [{
2850
+ type: Component,
2851
+ args: [{
2852
+ selector: 'rulecms-library-stylesheets',
2853
+ standalone: true,
2854
+ template: `
2855
+ @for (css of stylesheets ?? []; track css) {
2856
+ <style data-rulecms-library-stylesheet="" [innerText]="css"></style>
2857
+ }
2858
+ `,
2859
+ host: { style: 'display: contents' },
2860
+ }]
2861
+ }], propDecorators: { stylesheets: [{
2862
+ type: Input
2863
+ }] } });
2864
+
2817
2865
  const DEVICE_VARIANTS = ['Phone', 'Tablet', 'Desktop'];
2818
2866
  let breakpointSeq = 0;
2819
2867
  class BreakpointVariantRenderComponent {
@@ -2830,6 +2878,7 @@ class BreakpointVariantRenderComponent {
2830
2878
  }
2831
2879
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: BreakpointVariantRenderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2832
2880
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: BreakpointVariantRenderComponent, isStandalone: true, selector: "rulecms-breakpoint-variants", inputs: { displayItemList: "displayItemList", widgetCollections: "widgetCollections", plugins: "plugins", componentProps: "componentProps", scopeIdInput: "scopeIdInput" }, host: { styleAttribute: "display: contents" }, usesOnChanges: true, ngImport: i0, template: `
2881
+ <rulecms-library-stylesheets [stylesheets]="plugins.sourceComponents?.stylesheets" />
2833
2882
  @if (!divergent) {
2834
2883
  <rulecms-render-for-device
2835
2884
  [displayItemList]="displayItemList"
@@ -2860,15 +2909,16 @@ class BreakpointVariantRenderComponent {
2860
2909
  </div>
2861
2910
  }
2862
2911
  }
2863
- `, isInline: true, dependencies: [{ kind: "component", type: RenderComponentsForDeviceComponent, selector: "rulecms-render-for-device", inputs: ["displayItemList", "isComposeMode", "isWithinCollection", "widgetCollections", "showDropContainers", "reduxDeviceDisplayType", "deviceDisplayType", "plugins", "componentProps", "ancestorColumnIds"] }] }); }
2912
+ `, isInline: true, dependencies: [{ kind: "component", type: RenderComponentsForDeviceComponent, selector: "rulecms-render-for-device", inputs: ["displayItemList", "isComposeMode", "isWithinCollection", "widgetCollections", "showDropContainers", "reduxDeviceDisplayType", "deviceDisplayType", "plugins", "componentProps", "ancestorColumnIds"] }, { kind: "component", type: LibraryStylesheetsComponent, selector: "rulecms-library-stylesheets", inputs: ["stylesheets"] }] }); }
2864
2913
  }
2865
2914
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: BreakpointVariantRenderComponent, decorators: [{
2866
2915
  type: Component,
2867
2916
  args: [{
2868
2917
  selector: 'rulecms-breakpoint-variants',
2869
2918
  standalone: true,
2870
- imports: [RenderComponentsForDeviceComponent],
2919
+ imports: [RenderComponentsForDeviceComponent, LibraryStylesheetsComponent],
2871
2920
  template: `
2921
+ <rulecms-library-stylesheets [stylesheets]="plugins.sourceComponents?.stylesheets" />
2872
2922
  @if (!divergent) {
2873
2923
  <rulecms-render-for-device
2874
2924
  [displayItemList]="displayItemList"
@@ -2961,7 +3011,10 @@ class RenderComponentsComponent {
2961
3011
  this.deviceDisplayType = resolveDisplayDeviceType(this.phoneQuery?.matches ?? false, this.tabletQuery?.matches ?? false, this.reduxDeviceDisplayType);
2962
3012
  }
2963
3013
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: RenderComponentsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2964
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: RenderComponentsComponent, isStandalone: true, selector: "rulecms-render-components", inputs: { displayItemList: "displayItemList", isComposeMode: "isComposeMode", isWithinCollection: "isWithinCollection", widgetCollections: "widgetCollections", showDropContainers: "showDropContainers", reduxDeviceDisplayType: "reduxDeviceDisplayType", plugins: "plugins", componentProps: "componentProps" }, host: { styleAttribute: "display: contents" }, ngImport: i0, template: `
3014
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: RenderComponentsComponent, isStandalone: true, selector: "rulecms-render-components", inputs: { displayItemList: "displayItemList", isComposeMode: "isComposeMode", isWithinCollection: "isWithinCollection", widgetCollections: "widgetCollections", showDropContainers: "showDropContainers", reduxDeviceDisplayType: "reduxDeviceDisplayType", plugins: "plugins", componentProps: "componentProps" }, host: { styleAttribute: "display: contents" }, ngImport: i0, template: `
3015
+ @if (!isWithinCollection) {
3016
+ <rulecms-library-stylesheets [stylesheets]="plugins.sourceComponents?.stylesheets" />
3017
+ }
2965
3018
  <rulecms-render-for-device
2966
3019
  [displayItemList]="displayItemList"
2967
3020
  [isComposeMode]="isComposeMode"
@@ -2973,15 +3026,18 @@ class RenderComponentsComponent {
2973
3026
  [plugins]="plugins"
2974
3027
  [componentProps]="componentProps"
2975
3028
  />
2976
- `, isInline: true, dependencies: [{ kind: "component", type: RenderComponentsForDeviceComponent, selector: "rulecms-render-for-device", inputs: ["displayItemList", "isComposeMode", "isWithinCollection", "widgetCollections", "showDropContainers", "reduxDeviceDisplayType", "deviceDisplayType", "plugins", "componentProps", "ancestorColumnIds"] }] }); }
3029
+ `, isInline: true, dependencies: [{ kind: "component", type: RenderComponentsForDeviceComponent, selector: "rulecms-render-for-device", inputs: ["displayItemList", "isComposeMode", "isWithinCollection", "widgetCollections", "showDropContainers", "reduxDeviceDisplayType", "deviceDisplayType", "plugins", "componentProps", "ancestorColumnIds"] }, { kind: "component", type: LibraryStylesheetsComponent, selector: "rulecms-library-stylesheets", inputs: ["stylesheets"] }] }); }
2977
3030
  }
2978
3031
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: RenderComponentsComponent, decorators: [{
2979
3032
  type: Component,
2980
3033
  args: [{
2981
3034
  selector: 'rulecms-render-components',
2982
3035
  standalone: true,
2983
- imports: [RenderComponentsForDeviceComponent],
3036
+ imports: [RenderComponentsForDeviceComponent, LibraryStylesheetsComponent],
2984
3037
  template: `
3038
+ @if (!isWithinCollection) {
3039
+ <rulecms-library-stylesheets [stylesheets]="plugins.sourceComponents?.stylesheets" />
3040
+ }
2985
3041
  <rulecms-render-for-device
2986
3042
  [displayItemList]="displayItemList"
2987
3043
  [isComposeMode]="isComposeMode"