@srfnstack/fntags 1.2.5 → 1.2.6
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/package.json +1 -1
- package/src/fntags.d.mts +10 -0
- package/src/fntags.d.mts.map +1 -1
- package/src/fntags.mjs +24 -0
package/package.json
CHANGED
package/src/fntags.d.mts
CHANGED
|
@@ -92,6 +92,16 @@ export function getAttrs(children: any): object;
|
|
|
92
92
|
* @return {T} The styled element
|
|
93
93
|
*/
|
|
94
94
|
export function styled<T extends HTMLElement | SVGElement>(style: object | string, tag: string, children: object[] | Node[]): T;
|
|
95
|
+
/**
|
|
96
|
+
* Register a component function for HMR. Returns a stable proxy that always delegates
|
|
97
|
+
* to the latest registered implementation. When a module re-executes after HMR, the
|
|
98
|
+
* proxy's target is updated so callers holding stale import bindings get the new code.
|
|
99
|
+
*
|
|
100
|
+
* @param {string} id A stable identifier for this component (typically 'filepath:exportName')
|
|
101
|
+
* @param {Function} fn The component function
|
|
102
|
+
* @returns {Function} A stable proxy function
|
|
103
|
+
*/
|
|
104
|
+
export function registeredComponent(id: string, fn: Function): Function;
|
|
95
105
|
/**
|
|
96
106
|
* Get or create a state instance from the global HMR registry.
|
|
97
107
|
* During development with HMR, the Vite plugin rewrites fnstate() calls to use this function,
|
package/src/fntags.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fntags.d.mts","sourceRoot":"","sources":["fntags.mjs"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,2DALW,MAAM,eACH,CAAC,IAAI,MAAO,CAAC,OA6C1B;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;GAGG;AAEH;;;;;;;;;;GAUG;AACH,iEAPgB,GAAG,cAqIlB;AAqfD;;;;GAIG;AACH,iCAHW,GAAG,GACD,IAAI,CAuBhB;AAqFD;;;;GAIG;AACH,6BAHW,GAAG,GACD,OAAO,CAInB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;;;;;kCA18BmC,CAAC,YAAY,CAAC,KAAG,CAAC,IAAI,GAAC,GAAG,CAAC,KAAG,IAAI;;;;;;2BAE/C,CAAC,MAAI,CAAC,IAAI,GAAC,GAAG,CAAC,CAAC,GAAC,GAAG,GAAC,IAAI,gCAAkC,CAAC,IAAI,GAAC,GAAG,CAAC,KAAG,IAAI;;;;;qBAG9E,MAAM,KAAG,IAAI;;;;sCAEI,CAAC,YAAY,CAAC,KAAG,CAAC,MAAM,GAAC,GAAG,CAAC,KAAG,GAAG;;;;mCACvC,CAAC,YAAY,CAAC,KAAG,MAAM,KAAK,MAAM;;;;yCAC7B,GAAG,KAAG,CAAC,IAAI,GAAC,GAAG,CAAC,KAAG,IAAI;;;;+CACrB,GAAG,KAAG,CAAC,MAAM,GAAC,GAAG,CAAC,KAAG,GAAG;;;;;;kBAC7C,GAAG,KAAG,IAAI;;;;cAGhB,MAAK,GAAG;;;;;qBACC,CAAC,KAAG,IAAI;;;;;;oBAEV,MAAM,KAAG,GAAG;;;;oBAGZ,MAAM,SAAS,GAAG,mBAAmB,OAAO,KAAG,IAAI;;;;uCAClC,CAAC,YAAY,CAAC,KAAG,IAAI,KAAK,IAAI;;;;eACtD,OAAO;;;;;sDAKqB,CAAC,KAAG,CAAC"}
|
package/src/fntags.mjs
CHANGED
|
@@ -913,6 +913,30 @@ const stringifyStyle = style =>
|
|
|
913
913
|
? style
|
|
914
914
|
: Object.keys(style).map(prop => `${prop}:${style[prop]}`).join(';')
|
|
915
915
|
|
|
916
|
+
/**
|
|
917
|
+
* Register a component function for HMR. Returns a stable proxy that always delegates
|
|
918
|
+
* to the latest registered implementation. When a module re-executes after HMR, the
|
|
919
|
+
* proxy's target is updated so callers holding stale import bindings get the new code.
|
|
920
|
+
*
|
|
921
|
+
* @param {string} id A stable identifier for this component (typically 'filepath:exportName')
|
|
922
|
+
* @param {Function} fn The component function
|
|
923
|
+
* @returns {Function} A stable proxy function
|
|
924
|
+
*/
|
|
925
|
+
export function registeredComponent (id, fn) {
|
|
926
|
+
if (!globalThis.__fntags_components) {
|
|
927
|
+
globalThis.__fntags_components = new Map()
|
|
928
|
+
}
|
|
929
|
+
const reg = globalThis.__fntags_components
|
|
930
|
+
reg.set(id, fn)
|
|
931
|
+
if (!reg.has(id + '$proxy')) {
|
|
932
|
+
const proxy = function (...args) {
|
|
933
|
+
return reg.get(id).apply(this, args)
|
|
934
|
+
}
|
|
935
|
+
reg.set(id + '$proxy', proxy)
|
|
936
|
+
}
|
|
937
|
+
return reg.get(id + '$proxy')
|
|
938
|
+
}
|
|
939
|
+
|
|
916
940
|
/**
|
|
917
941
|
* Get or create a state instance from the global HMR registry.
|
|
918
942
|
* During development with HMR, the Vite plugin rewrites fnstate() calls to use this function,
|