@servlyadmin/runtime-core 0.1.29 → 0.1.31

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.
@@ -128,8 +128,10 @@ async function initServlyTailwind(customConfig) {
128
128
  usePlayCdn: true
129
129
  });
130
130
  }
131
+ var injectTailwindStyles = initServlyTailwind;
131
132
  var tailwind_default = {
132
133
  injectTailwind,
134
+ injectTailwindStyles,
133
135
  removeTailwind,
134
136
  isTailwindLoaded,
135
137
  getTailwind,
@@ -150,5 +152,6 @@ export {
150
152
  removeCustomStyles,
151
153
  DEFAULT_SERVLY_TAILWIND_CONFIG,
152
154
  initServlyTailwind,
155
+ injectTailwindStyles,
153
156
  tailwind_default
154
157
  };
package/dist/index.cjs CHANGED
@@ -42,6 +42,7 @@ __export(tailwind_exports, {
42
42
  getTailwind: () => getTailwind,
43
43
  initServlyTailwind: () => initServlyTailwind,
44
44
  injectTailwind: () => injectTailwind,
45
+ injectTailwindStyles: () => injectTailwindStyles,
45
46
  isTailwindLoaded: () => isTailwindLoaded,
46
47
  removeCustomStyles: () => removeCustomStyles,
47
48
  removeTailwind: () => removeTailwind,
@@ -143,7 +144,7 @@ async function initServlyTailwind(customConfig) {
143
144
  usePlayCdn: true
144
145
  });
145
146
  }
146
- var DEFAULT_TAILWIND_CDN, tailwindInjected, tailwindScript, DEFAULT_SERVLY_TAILWIND_CONFIG, tailwind_default;
147
+ var DEFAULT_TAILWIND_CDN, tailwindInjected, tailwindScript, DEFAULT_SERVLY_TAILWIND_CONFIG, injectTailwindStyles, tailwind_default;
147
148
  var init_tailwind = __esm({
148
149
  "src/tailwind.ts"() {
149
150
  "use strict";
@@ -180,8 +181,10 @@ var init_tailwind = __esm({
180
181
  { pattern: /^(transition|duration|ease|delay)-/ }
181
182
  ]
182
183
  };
184
+ injectTailwindStyles = initServlyTailwind;
183
185
  tailwind_default = {
184
186
  injectTailwind,
187
+ injectTailwindStyles,
185
188
  removeTailwind,
186
189
  isTailwindLoaded,
187
190
  getTailwind,
@@ -16761,6 +16764,7 @@ __export(index_exports, {
16761
16764
  hasTemplateSyntax: () => hasTemplateSyntax,
16762
16765
  initServlyTailwind: () => initServlyTailwind,
16763
16766
  injectTailwind: () => injectTailwind,
16767
+ injectTailwindStyles: () => injectTailwindStyles,
16764
16768
  invalidateCache: () => invalidateCache,
16765
16769
  isComponentAvailable: () => isComponentAvailable,
16766
16770
  isIconCdnEnabled: () => isIconCdnEnabled,
@@ -19393,6 +19397,17 @@ function getIconifyCollection(set) {
19393
19397
  }
19394
19398
 
19395
19399
  // src/renderer.ts
19400
+ init_tailwind();
19401
+ var tailwindAutoInjected = false;
19402
+ function ensureTailwind() {
19403
+ if (tailwindAutoInjected || typeof document === "undefined") return;
19404
+ tailwindAutoInjected = true;
19405
+ if (!isTailwindLoaded()) {
19406
+ injectTailwind({ usePlayCdn: true }).catch((err) => {
19407
+ console.warn("Failed to auto-inject Tailwind CSS:", err);
19408
+ });
19409
+ }
19410
+ }
19396
19411
  var COMPONENT_TO_TAG = {
19397
19412
  container: "div",
19398
19413
  text: "span",
@@ -19565,17 +19580,6 @@ function attachEventHandlers(domElement, element, eventHandlers, context, elemen
19565
19580
  }
19566
19581
  }
19567
19582
  }
19568
- if (isRootElement && context.props && state?.renderingStack?.size === 0) {
19569
- for (const [propName, value] of Object.entries(context.props)) {
19570
- if (propName.startsWith("on") && typeof value === "function") {
19571
- const domEventName = propName.slice(2).toLowerCase();
19572
- if (!elementState.eventListeners.has(domEventName)) {
19573
- elementState.eventListeners.set(domEventName, value);
19574
- domElement.addEventListener(domEventName, value);
19575
- }
19576
- }
19577
- }
19578
- }
19579
19583
  if (!isRootElement && elementState.eventListeners.size > 0) {
19580
19584
  for (const [eventName, originalHandler] of elementState.eventListeners) {
19581
19585
  const wrappedHandler = (e) => {
@@ -19775,11 +19779,17 @@ function renderElement(element, tree, context, eventHandlers, elementStates, sta
19775
19779
  }
19776
19780
  const elementBindings = element.configuration?.bindings?.inputs;
19777
19781
  const resolvedInputs = elementBindings ? resolveComponentViewInputs(elementBindings, context, context.props) : {};
19778
- const nonFunctionInputs = Object.fromEntries(
19779
- Object.entries(resolvedInputs).filter(([, v]) => typeof v !== "function")
19780
- );
19782
+ const functionInputs = {};
19783
+ const nonFunctionInputs = {};
19784
+ for (const [key, value] of Object.entries(resolvedInputs)) {
19785
+ if (typeof value === "function") {
19786
+ functionInputs[key] = value;
19787
+ } else {
19788
+ nonFunctionInputs[key] = value;
19789
+ }
19790
+ }
19781
19791
  const elementContext = {
19782
- props: { ...context.props, ...nonFunctionInputs },
19792
+ props: { ...context.props, ...nonFunctionInputs, ...functionInputs },
19783
19793
  state: context.state,
19784
19794
  context: context.context
19785
19795
  };
@@ -19956,6 +19966,9 @@ function renderSlotElement(element, tree, context, eventHandlers, elementStates,
19956
19966
  return elementState.domElement;
19957
19967
  }
19958
19968
  function render(options) {
19969
+ if (!options.disableTailwind) {
19970
+ ensureTailwind();
19971
+ }
19959
19972
  const {
19960
19973
  container,
19961
19974
  elements,
@@ -21606,6 +21619,7 @@ function generateIconBundle(icons) {
21606
21619
  hasTemplateSyntax,
21607
21620
  initServlyTailwind,
21608
21621
  injectTailwind,
21622
+ injectTailwindStyles,
21609
21623
  invalidateCache,
21610
21624
  isComponentAvailable,
21611
21625
  isIconCdnEnabled,
package/dist/index.js CHANGED
@@ -4,11 +4,12 @@ import {
4
4
  getTailwind,
5
5
  initServlyTailwind,
6
6
  injectTailwind,
7
+ injectTailwindStyles,
7
8
  isTailwindLoaded,
8
9
  removeCustomStyles,
9
10
  removeTailwind,
10
11
  updateTailwindConfig
11
- } from "./chunk-IWFVKY5N.js";
12
+ } from "./chunk-SMHCCKAZ.js";
12
13
  import {
13
14
  buildRegistryFromBundle,
14
15
  collectAllDependencies,
@@ -2597,6 +2598,16 @@ function getIconifyCollection(set) {
2597
2598
  }
2598
2599
 
2599
2600
  // src/renderer.ts
2601
+ var tailwindAutoInjected = false;
2602
+ function ensureTailwind() {
2603
+ if (tailwindAutoInjected || typeof document === "undefined") return;
2604
+ tailwindAutoInjected = true;
2605
+ if (!isTailwindLoaded()) {
2606
+ injectTailwind({ usePlayCdn: true }).catch((err) => {
2607
+ console.warn("Failed to auto-inject Tailwind CSS:", err);
2608
+ });
2609
+ }
2610
+ }
2600
2611
  var COMPONENT_TO_TAG = {
2601
2612
  container: "div",
2602
2613
  text: "span",
@@ -2769,17 +2780,6 @@ function attachEventHandlers(domElement, element, eventHandlers, context, elemen
2769
2780
  }
2770
2781
  }
2771
2782
  }
2772
- if (isRootElement && context.props && state?.renderingStack?.size === 0) {
2773
- for (const [propName, value] of Object.entries(context.props)) {
2774
- if (propName.startsWith("on") && typeof value === "function") {
2775
- const domEventName = propName.slice(2).toLowerCase();
2776
- if (!elementState.eventListeners.has(domEventName)) {
2777
- elementState.eventListeners.set(domEventName, value);
2778
- domElement.addEventListener(domEventName, value);
2779
- }
2780
- }
2781
- }
2782
- }
2783
2783
  if (!isRootElement && elementState.eventListeners.size > 0) {
2784
2784
  for (const [eventName, originalHandler] of elementState.eventListeners) {
2785
2785
  const wrappedHandler = (e) => {
@@ -2979,11 +2979,17 @@ function renderElement(element, tree, context, eventHandlers, elementStates, sta
2979
2979
  }
2980
2980
  const elementBindings = element.configuration?.bindings?.inputs;
2981
2981
  const resolvedInputs = elementBindings ? resolveComponentViewInputs(elementBindings, context, context.props) : {};
2982
- const nonFunctionInputs = Object.fromEntries(
2983
- Object.entries(resolvedInputs).filter(([, v]) => typeof v !== "function")
2984
- );
2982
+ const functionInputs = {};
2983
+ const nonFunctionInputs = {};
2984
+ for (const [key, value] of Object.entries(resolvedInputs)) {
2985
+ if (typeof value === "function") {
2986
+ functionInputs[key] = value;
2987
+ } else {
2988
+ nonFunctionInputs[key] = value;
2989
+ }
2990
+ }
2985
2991
  const elementContext = {
2986
- props: { ...context.props, ...nonFunctionInputs },
2992
+ props: { ...context.props, ...nonFunctionInputs, ...functionInputs },
2987
2993
  state: context.state,
2988
2994
  context: context.context
2989
2995
  };
@@ -3160,6 +3166,9 @@ function renderSlotElement(element, tree, context, eventHandlers, elementStates,
3160
3166
  return elementState.domElement;
3161
3167
  }
3162
3168
  function render(options) {
3169
+ if (!options.disableTailwind) {
3170
+ ensureTailwind();
3171
+ }
3163
3172
  const {
3164
3173
  container,
3165
3174
  elements,
@@ -3516,7 +3525,7 @@ async function createServlyRenderer(options) {
3516
3525
  container = containerOption;
3517
3526
  }
3518
3527
  if (shouldInjectTailwind) {
3519
- const { initServlyTailwind: initServlyTailwind2 } = await import("./tailwind-3FTT56ZG.js");
3528
+ const { initServlyTailwind: initServlyTailwind2 } = await import("./tailwind-37JUQFRW.js");
3520
3529
  await initServlyTailwind2(tailwindConfig);
3521
3530
  }
3522
3531
  const activeRenders = [];
@@ -4804,6 +4813,7 @@ export {
4804
4813
  hasTemplateSyntax,
4805
4814
  initServlyTailwind,
4806
4815
  injectTailwind,
4816
+ injectTailwindStyles,
4807
4817
  invalidateCache,
4808
4818
  isComponentAvailable,
4809
4819
  isIconCdnEnabled,
@@ -4,12 +4,13 @@ import {
4
4
  getTailwind,
5
5
  initServlyTailwind,
6
6
  injectTailwind,
7
+ injectTailwindStyles,
7
8
  isTailwindLoaded,
8
9
  removeCustomStyles,
9
10
  removeTailwind,
10
11
  tailwind_default,
11
12
  updateTailwindConfig
12
- } from "./chunk-IWFVKY5N.js";
13
+ } from "./chunk-SMHCCKAZ.js";
13
14
  import "./chunk-MCKGQKYU.js";
14
15
  export {
15
16
  DEFAULT_SERVLY_TAILWIND_CONFIG,
@@ -18,6 +19,7 @@ export {
18
19
  getTailwind,
19
20
  initServlyTailwind,
20
21
  injectTailwind,
22
+ injectTailwindStyles,
21
23
  isTailwindLoaded,
22
24
  removeCustomStyles,
23
25
  removeTailwind,
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@servlyadmin/runtime-core",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "Framework-agnostic core renderer for Servly components",
5
5
  "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "require": "./dist/index.cjs",
14
- "default": "./dist/index.js"
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.js",
14
+ "default": "./dist/index.mjs"
15
15
  }
16
16
  },
17
17
  "files": [