@sigx/vite 0.1.6 → 0.1.8
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.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/islands.d.ts +99 -0
- package/dist/islands.d.ts.map +1 -0
- package/dist/islands.js +418 -0
- package/dist/islands.js.map +1 -0
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +0 -1
- package/dist/lib.js.map +1 -1
- package/package.json +9 -3
- package/dist/core/src/Component.d.ts +0 -131
- package/dist/core/src/Component.d.ts.map +0 -1
- package/dist/core/src/Component.js +0 -272
- package/dist/core/src/Component.js.map +0 -1
- package/dist/core/src/Signals.d.ts +0 -34
- package/dist/core/src/Signals.d.ts.map +0 -1
- package/dist/core/src/Signals.js +0 -222
- package/dist/core/src/Signals.js.map +0 -1
- package/dist/core/src/Templating.d.ts +0 -11
- package/dist/core/src/Templating.d.ts.map +0 -1
- package/dist/core/src/Templating.js +0 -81
- package/dist/core/src/Templating.js.map +0 -1
- package/dist/core/src/factory/index.d.ts +0 -20
- package/dist/core/src/factory/index.d.ts.map +0 -1
- package/dist/core/src/factory/index.js +0 -50
- package/dist/core/src/factory/index.js.map +0 -1
- package/dist/core/src/index.d.ts +0 -8
- package/dist/core/src/index.d.ts.map +0 -1
- package/dist/core/src/index.js +0 -9
- package/dist/core/src/index.js.map +0 -1
- package/dist/core/src/jsx-runtime.d.ts +0 -43
- package/dist/core/src/jsx-runtime.d.ts.map +0 -1
- package/dist/core/src/jsx-runtime.js +0 -469
- package/dist/core/src/jsx-runtime.js.map +0 -1
- package/dist/core/src/messaging/index.d.ts +0 -9
- package/dist/core/src/messaging/index.d.ts.map +0 -1
- package/dist/core/src/messaging/index.js +0 -37
- package/dist/core/src/messaging/index.js.map +0 -1
- package/dist/core/src/models/index.d.ts +0 -18
- package/dist/core/src/models/index.d.ts.map +0 -1
- package/dist/core/src/models/index.js +0 -12
- package/dist/core/src/models/index.js.map +0 -1
- package/dist/core/src/sheet.d.ts +0 -51
- package/dist/core/src/sheet.d.ts.map +0 -1
- package/dist/core/src/sheet.js +0 -151
- package/dist/core/src/sheet.js.map +0 -1
- package/dist/core/src/stores/DefineInjectable.d.ts +0 -5
- package/dist/core/src/stores/DefineInjectable.d.ts.map +0 -1
- package/dist/core/src/stores/DefineInjectable.js +0 -56
- package/dist/core/src/stores/DefineInjectable.js.map +0 -1
- package/dist/core/src/stores/Store.d.ts +0 -70
- package/dist/core/src/stores/Store.d.ts.map +0 -1
- package/dist/core/src/stores/Store.js +0 -180
- package/dist/core/src/stores/Store.js.map +0 -1
- package/dist/core/src/styled.d.ts +0 -15
- package/dist/core/src/styled.d.ts.map +0 -1
- package/dist/core/src/styled.js +0 -62
- package/dist/core/src/styled.js.map +0 -1
- package/dist/core/src/utils/index.d.ts +0 -5
- package/dist/core/src/utils/index.d.ts.map +0 -1
- package/dist/core/src/utils/index.js +0 -12
- package/dist/core/src/utils/index.js.map +0 -1
- package/dist/hmr-plugin/src/index.d.ts +0 -2
- package/dist/hmr-plugin/src/index.d.ts.map +0 -1
- package/dist/hmr-plugin/src/index.js +0 -59
- package/dist/hmr-plugin/src/index.js.map +0 -1
- package/dist/vite/src/index.d.ts +0 -2
- package/dist/vite/src/index.d.ts.map +0 -1
- package/dist/vite/src/index.js +0 -59
- package/dist/vite/src/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigx/vite",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Vite plugin for SignalX Framework with HMR, library builds, and automatic type generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,12 +24,18 @@
|
|
|
24
24
|
],
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"sigx": "*",
|
|
27
|
-
"vite": ">=8.0.0-beta.0"
|
|
27
|
+
"vite": ">=8.0.0-beta.0",
|
|
28
|
+
"@sigx/ssr-islands": "*"
|
|
29
|
+
},
|
|
30
|
+
"peerDependenciesMeta": {
|
|
31
|
+
"@sigx/ssr-islands": {
|
|
32
|
+
"optional": true
|
|
33
|
+
}
|
|
28
34
|
},
|
|
29
35
|
"devDependencies": {
|
|
30
36
|
"@types/node": "^22.19.1",
|
|
31
37
|
"vite": "^8.0.0-beta.9",
|
|
32
|
-
"sigx": "^0.1.
|
|
38
|
+
"sigx": "^0.1.8"
|
|
33
39
|
},
|
|
34
40
|
"keywords": [
|
|
35
41
|
"SignalX"
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { JSXElement } from "./jsx-runtime.js";
|
|
2
|
-
import { signal, Signal, reactive } from "./Signals.js";
|
|
3
|
-
/**
|
|
4
|
-
* Define a single prop with type, required/optional status
|
|
5
|
-
* Use intersection to compose multiple props together
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* type MyProps = DefineProp<"name", string, true> &
|
|
10
|
-
* DefineProp<"age", number, false> &
|
|
11
|
-
* DefineProp<"email", string, false>;
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export type DefineProp<TName extends string, TType, Required extends boolean = false> = Required extends false ? {
|
|
15
|
-
[K in TName]?: TType;
|
|
16
|
-
} : {
|
|
17
|
-
[K in TName]: TType;
|
|
18
|
-
};
|
|
19
|
-
export type EventDefinition<T> = {
|
|
20
|
-
__eventDetail: T;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Define a single custom event with its detail type
|
|
24
|
-
* Use intersection to compose multiple events together
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* type MyEvents = DefineEvent<"change", string> &
|
|
29
|
-
* DefineEvent<"submit", { value: string; timestamp: number }> &
|
|
30
|
-
* DefineEvent<"cancel", void>;
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export type DefineEvent<TName extends string, TDetail = void> = {
|
|
34
|
-
[K in TName]?: EventDefinition<TDetail>;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Extract event names from an event definition
|
|
38
|
-
*/
|
|
39
|
-
type EventNames<TEvents> = {
|
|
40
|
-
[K in keyof TEvents]: TEvents[K] extends EventDefinition<any> | undefined ? K : never;
|
|
41
|
-
}[keyof TEvents] & string;
|
|
42
|
-
/**
|
|
43
|
-
* Extract event detail type for a specific event name
|
|
44
|
-
*/
|
|
45
|
-
type EventDetail<TEvents, TName extends EventNames<TEvents>> = TEvents extends {
|
|
46
|
-
[K in TName]?: EventDefinition<infer TDetail>;
|
|
47
|
-
} ? TDetail : never;
|
|
48
|
-
/**
|
|
49
|
-
* Typed emit function for dispatching custom events
|
|
50
|
-
*/
|
|
51
|
-
export type EmitFn<TEvents extends Record<string, any>> = <TName extends EventNames<TEvents>>(eventName: TName, ...args: EventDetail<TEvents, TName> extends void ? [] : [detail: EventDetail<TEvents, TName>]) => void;
|
|
52
|
-
/**
|
|
53
|
-
* Capitalize the first letter of a string
|
|
54
|
-
*/
|
|
55
|
-
type Capitalize<S extends string> = S extends `${infer First}${infer Rest}` ? `${Uppercase<First>}${Rest}` : S;
|
|
56
|
-
/**
|
|
57
|
-
* Convert events to event handler props (on{EventName})
|
|
58
|
-
* EventName is capitalized: "change" -> "onChange", "countChanged" -> "onCountChanged"
|
|
59
|
-
*/
|
|
60
|
-
type EventHandlers<TEvents extends Record<string, any>> = {
|
|
61
|
-
[K in keyof TEvents as TEvents[K] extends EventDefinition<any> | undefined ? `on${Capitalize<string & K>}` : never]?: (detail: TEvents[K] extends EventDefinition<infer D> | undefined ? D : never) => void;
|
|
62
|
-
};
|
|
63
|
-
export interface MountContext<TEl extends HTMLElement = HTMLElement> {
|
|
64
|
-
el: TEl;
|
|
65
|
-
shadow: ShadowRoot | null;
|
|
66
|
-
}
|
|
67
|
-
export interface sigxComponent extends HTMLElement {
|
|
68
|
-
__issigx: true;
|
|
69
|
-
__provides?: Map<any, any>;
|
|
70
|
-
__parentComponent?: sigxComponent | null;
|
|
71
|
-
}
|
|
72
|
-
export interface ComponentSetupContext<TEl extends HTMLElement = HTMLElement, TProps extends Record<string, any> = {}, TEvents extends Record<string, any> = {}> {
|
|
73
|
-
el: TEl;
|
|
74
|
-
shadow: ShadowRoot | null;
|
|
75
|
-
signal: typeof signal;
|
|
76
|
-
reactive: typeof reactive;
|
|
77
|
-
props: TProps;
|
|
78
|
-
emit: EmitFn<TEvents>;
|
|
79
|
-
parent: sigxComponent | null;
|
|
80
|
-
onMount(fn: (ctx: MountContext<TEl>) => void): void;
|
|
81
|
-
onCleanup(fn: (ctx: MountContext<TEl>) => void): void;
|
|
82
|
-
}
|
|
83
|
-
export declare function getCurrentInstance(): ComponentSetupContext<any, any, any> | null;
|
|
84
|
-
/**
|
|
85
|
-
* Adopt stylesheets for the current component.
|
|
86
|
-
* Works for both Shadow DOM and Light DOM components.
|
|
87
|
-
*
|
|
88
|
-
* @param sheets One or more CSSStyleSheet objects created via `css` tag
|
|
89
|
-
*/
|
|
90
|
-
export declare function adoptStyles(...sheets: CSSStyleSheet[]): void;
|
|
91
|
-
export declare function onMount(fn: (ctx: MountContext) => void): void;
|
|
92
|
-
export declare function onCleanup(fn: (ctx: MountContext) => void): void;
|
|
93
|
-
export type ViewFn = () => JSXElement;
|
|
94
|
-
export type ComponentPlugin = {
|
|
95
|
-
onDefine?: (tagName: string, setup: (ctx: ComponentSetupContext) => ViewFn) => boolean;
|
|
96
|
-
onConnect?: (tagName: string, instance: HTMLElement) => void;
|
|
97
|
-
onDisconnect?: (tagName: string, instance: HTMLElement) => void;
|
|
98
|
-
onInit?: (tagName: string, instance: HTMLElement, init: () => void) => void;
|
|
99
|
-
};
|
|
100
|
-
export declare function registerComponentPlugin(plugin: ComponentPlugin): void;
|
|
101
|
-
export interface ComponentOptions {
|
|
102
|
-
shadow?: boolean;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Define a component with automatic type registration.
|
|
106
|
-
* Returns a JSX factory function that can be used directly in JSX.
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```typescript
|
|
110
|
-
* // Mix props and events in any order with intersection
|
|
111
|
-
* export const MyComponent = component<
|
|
112
|
-
* DefineProp<"name", string, true> & DefineEvent<"change", string>
|
|
113
|
-
* >("my-component", ({ props, emit }) => { ... });
|
|
114
|
-
*
|
|
115
|
-
* // Or reverse order
|
|
116
|
-
* export const MyComponent = component<
|
|
117
|
-
* DefineEvent<"change", string> & DefineProp<"name", string, true>
|
|
118
|
-
* >("my-component", ({ props, emit }) => { ... });
|
|
119
|
-
* ```
|
|
120
|
-
*/
|
|
121
|
-
export declare function component<TCombined extends Record<string, any> = {}>(tagName: string, setup: (ctx: ComponentSetupContext<HTMLElement, TCombined, TCombined>) => ViewFn, options?: ComponentOptions): ((props: Omit<TCombined, EventNames<TCombined>> & EventHandlers<TCombined> & {
|
|
122
|
-
key?: string | number;
|
|
123
|
-
ref?: any;
|
|
124
|
-
children?: any;
|
|
125
|
-
}) => JSXElement) & {
|
|
126
|
-
__tag: string;
|
|
127
|
-
__props: TCombined;
|
|
128
|
-
__events: TCombined;
|
|
129
|
-
};
|
|
130
|
-
export type { Signal };
|
|
131
|
-
//# sourceMappingURL=Component.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../../../core/src/Component.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,UAAU,EAAc,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAU,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKhE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,MAAM,EAAE,KAAK,EAAE,QAAQ,SAAS,OAAO,GAAG,KAAK,IAAI,QAA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CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAC3B,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,EAE1C,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,CAAC,GAAG,EAAE,qBAAqB,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC,KAAK,MAAM,EAChF,OAAO,GAAE,gBAAmC,GAC7C,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,GAAG,aAAa,CAAC,SAAS,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAC;IAAC,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAE,KAAK,UAAU,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,CAsNhN;AAGD,YAAY,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
// component.ts
|
|
2
|
-
import { render, registerComponentSchema, jsx } from "./jsx-runtime.js";
|
|
3
|
-
import { effect, signal, reactive } from "./Signals.js";
|
|
4
|
-
// Dev mode - can be set to false in production builds
|
|
5
|
-
const DEV = true;
|
|
6
|
-
let currentComponentContext = null;
|
|
7
|
-
export function getCurrentInstance() {
|
|
8
|
-
return currentComponentContext;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Adopt stylesheets for the current component.
|
|
12
|
-
* Works for both Shadow DOM and Light DOM components.
|
|
13
|
-
*
|
|
14
|
-
* @param sheets One or more CSSStyleSheet objects created via `css` tag
|
|
15
|
-
*/
|
|
16
|
-
export function adoptStyles(...sheets) {
|
|
17
|
-
const ctx = getCurrentInstance();
|
|
18
|
-
if (!ctx) {
|
|
19
|
-
console.warn("adoptStyles called outside of component setup");
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (ctx.shadow) {
|
|
23
|
-
// Shadow DOM: just adopt them
|
|
24
|
-
ctx.shadow.adoptedStyleSheets = [...ctx.shadow.adoptedStyleSheets, ...sheets];
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
// Light DOM: adopt to document, but avoid duplicates
|
|
28
|
-
// Note: This affects the global document, so styles should be scoped or unique
|
|
29
|
-
const doc = document;
|
|
30
|
-
const existing = new Set(doc.adoptedStyleSheets);
|
|
31
|
-
const newSheets = sheets.filter(s => !existing.has(s));
|
|
32
|
-
if (newSheets.length > 0) {
|
|
33
|
-
doc.adoptedStyleSheets = [...doc.adoptedStyleSheets, ...newSheets];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export function onMount(fn) {
|
|
38
|
-
if (currentComponentContext) {
|
|
39
|
-
currentComponentContext.onMount(fn);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
console.warn("onMount called outside of component setup");
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export function onCleanup(fn) {
|
|
46
|
-
if (currentComponentContext) {
|
|
47
|
-
currentComponentContext.onCleanup(fn);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
console.warn("onCleanup called outside of component setup");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const plugins = [];
|
|
54
|
-
export function registerComponentPlugin(plugin) {
|
|
55
|
-
plugins.push(plugin);
|
|
56
|
-
}
|
|
57
|
-
const setupRegistry = new Map();
|
|
58
|
-
/**
|
|
59
|
-
* Helper to create a proxy that tracks property access
|
|
60
|
-
* This allows us to auto-detect which props are used without explicit prop arrays
|
|
61
|
-
*/
|
|
62
|
-
function createPropsProxy(target, onAccess) {
|
|
63
|
-
return new Proxy(target, {
|
|
64
|
-
get(obj, prop) {
|
|
65
|
-
if (typeof prop === 'string' && onAccess) {
|
|
66
|
-
onAccess(prop);
|
|
67
|
-
}
|
|
68
|
-
return obj[prop];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Define a component with automatic type registration.
|
|
74
|
-
* Returns a JSX factory function that can be used directly in JSX.
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```typescript
|
|
78
|
-
* // Mix props and events in any order with intersection
|
|
79
|
-
* export const MyComponent = defineComponent<
|
|
80
|
-
* DefineProp<"name", string, true> & DefineEvent<"change", string>
|
|
81
|
-
* >("my-component", ({ props, emit }) => { ... });
|
|
82
|
-
*
|
|
83
|
-
* // Or reverse order
|
|
84
|
-
* export const MyComponent = defineComponent<
|
|
85
|
-
* DefineEvent<"change", string> & DefineProp<"name", string, true>
|
|
86
|
-
* >("my-component", ({ props, emit }) => { ... });
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
export function defineComponent(tagName, setup, options = { shadow: true }) {
|
|
90
|
-
// Store/Update setup in registry for HMR support
|
|
91
|
-
setupRegistry.set(tagName, setup);
|
|
92
|
-
// Allow plugins to intercept component definition
|
|
93
|
-
for (const plugin of plugins) {
|
|
94
|
-
if (plugin.onDefine?.(tagName, setup)) {
|
|
95
|
-
return null; // Plugin handled it
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
class BaseComponent extends HTMLElement {
|
|
99
|
-
constructor() {
|
|
100
|
-
super();
|
|
101
|
-
this.__issigx = true;
|
|
102
|
-
this._mountCallbacks = [];
|
|
103
|
-
this._cleanupCallbacks = [];
|
|
104
|
-
this._dispose = null;
|
|
105
|
-
this._props = reactive({});
|
|
106
|
-
this._registeredProps = new Set();
|
|
107
|
-
if (options.shadow !== false) {
|
|
108
|
-
this.attachShadow({ mode: "open" });
|
|
109
|
-
}
|
|
110
|
-
// We'll set up property getters/setters dynamically as props are set
|
|
111
|
-
// This allows the type system to drive everything without runtime prop arrays
|
|
112
|
-
}
|
|
113
|
-
connectedCallback() {
|
|
114
|
-
// Check if we are just moving in the DOM
|
|
115
|
-
if (this.__isMoving)
|
|
116
|
-
return;
|
|
117
|
-
// Notify plugins
|
|
118
|
-
plugins.forEach(p => p.onConnect?.(tagName, this));
|
|
119
|
-
// Delay initialization to allow property bindings to be set first
|
|
120
|
-
// Properties are set synchronously during render, but after connectedCallback
|
|
121
|
-
setTimeout(() => this._init(), 0);
|
|
122
|
-
}
|
|
123
|
-
_registerProp(propName) {
|
|
124
|
-
if (this._registeredProps.has(propName))
|
|
125
|
-
return;
|
|
126
|
-
this._registeredProps.add(propName);
|
|
127
|
-
// Capture existing value if it was set before we defined the property
|
|
128
|
-
// (e.g. by jsx-runtime setting it as a property on the instance)
|
|
129
|
-
if (Object.prototype.hasOwnProperty.call(this, propName)) {
|
|
130
|
-
const existingValue = this[propName];
|
|
131
|
-
this._props[propName] = existingValue;
|
|
132
|
-
}
|
|
133
|
-
Object.defineProperty(this, propName, {
|
|
134
|
-
get() {
|
|
135
|
-
return this._props[propName];
|
|
136
|
-
},
|
|
137
|
-
set(value) {
|
|
138
|
-
this._props[propName] = value;
|
|
139
|
-
},
|
|
140
|
-
enumerable: true,
|
|
141
|
-
configurable: true,
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
_init() {
|
|
145
|
-
const el = this;
|
|
146
|
-
const shadow = this.shadowRoot;
|
|
147
|
-
// Track which props are accessed during setup to auto-register them
|
|
148
|
-
const accessedProps = new Set();
|
|
149
|
-
const propsProxy = createPropsProxy(this._props, (key) => {
|
|
150
|
-
accessedProps.add(key);
|
|
151
|
-
this._registerProp(key);
|
|
152
|
-
});
|
|
153
|
-
// Create typed emit function
|
|
154
|
-
const emit = (eventName, ...args) => {
|
|
155
|
-
const detail = args.length > 0 ? args[0] : undefined;
|
|
156
|
-
const event = new CustomEvent(eventName, {
|
|
157
|
-
detail,
|
|
158
|
-
bubbles: true,
|
|
159
|
-
composed: true,
|
|
160
|
-
});
|
|
161
|
-
el.dispatchEvent(event);
|
|
162
|
-
};
|
|
163
|
-
const getParent = (node) => {
|
|
164
|
-
// Try to find VNode attached to the element
|
|
165
|
-
let vnode = node?.__vnode;
|
|
166
|
-
if (vnode) {
|
|
167
|
-
// Walk up VNode tree to find the highest VNode with a DOM node
|
|
168
|
-
while (vnode && vnode.parent) {
|
|
169
|
-
vnode = vnode.parent;
|
|
170
|
-
if (vnode.dom) {
|
|
171
|
-
node = vnode.dom;
|
|
172
|
-
// If we hit a sigx component in the VNode tree, that is our parent!
|
|
173
|
-
if (node.__issigx) {
|
|
174
|
-
return node;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
// Standard DOM traversal from here (ShadowRoot boundary)
|
|
180
|
-
let current = node;
|
|
181
|
-
while (current) {
|
|
182
|
-
// Skip the starting node if it's the component itself (already handled or just starting)
|
|
183
|
-
if (current !== node && current.__issigx) {
|
|
184
|
-
return current;
|
|
185
|
-
}
|
|
186
|
-
if (current instanceof ShadowRoot) {
|
|
187
|
-
current = current.host;
|
|
188
|
-
// The host is always a component (or element), check it
|
|
189
|
-
if (current.__issigx) {
|
|
190
|
-
return current;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
current = current.parentNode;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return null;
|
|
198
|
-
};
|
|
199
|
-
const parent = getParent(this);
|
|
200
|
-
this.__parentComponent = parent;
|
|
201
|
-
const ctx = {
|
|
202
|
-
el,
|
|
203
|
-
shadow,
|
|
204
|
-
signal,
|
|
205
|
-
reactive,
|
|
206
|
-
props: propsProxy,
|
|
207
|
-
emit: emit,
|
|
208
|
-
parent,
|
|
209
|
-
onMount: (fn) => this._mountCallbacks.push(fn),
|
|
210
|
-
onCleanup: (fn) => this._cleanupCallbacks.push(fn)
|
|
211
|
-
};
|
|
212
|
-
// Use the latest setup from registry (supports HMR)
|
|
213
|
-
const currentSetup = setupRegistry.get(tagName) || setup;
|
|
214
|
-
const prevContext = currentComponentContext;
|
|
215
|
-
currentComponentContext = ctx;
|
|
216
|
-
let view;
|
|
217
|
-
try {
|
|
218
|
-
view = currentSetup(ctx);
|
|
219
|
-
}
|
|
220
|
-
finally {
|
|
221
|
-
currentComponentContext = prevContext;
|
|
222
|
-
}
|
|
223
|
-
let isFirstRun = true;
|
|
224
|
-
this._dispose = effect(() => {
|
|
225
|
-
const prev = currentComponentContext;
|
|
226
|
-
currentComponentContext = ctx;
|
|
227
|
-
try {
|
|
228
|
-
const tpl = view();
|
|
229
|
-
// Render to shadow root if available, otherwise to the element itself
|
|
230
|
-
render(tpl, shadow || el);
|
|
231
|
-
if (isFirstRun) {
|
|
232
|
-
isFirstRun = false;
|
|
233
|
-
const mountCtx = { el, shadow };
|
|
234
|
-
this._mountCallbacks.forEach((fn) => fn(mountCtx));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
finally {
|
|
238
|
-
currentComponentContext = prev;
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
// Register schema for dev mode validation
|
|
242
|
-
if (DEV && accessedProps.size > 0) {
|
|
243
|
-
registerComponentSchema(tagName, Array.from(accessedProps));
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
disconnectedCallback() {
|
|
247
|
-
// Check if we are just moving in the DOM
|
|
248
|
-
if (this.__isMoving)
|
|
249
|
-
return;
|
|
250
|
-
// Notify plugins
|
|
251
|
-
plugins.forEach(p => p.onDisconnect?.(tagName, this));
|
|
252
|
-
const el = this;
|
|
253
|
-
const shadow = this.shadowRoot;
|
|
254
|
-
const ctx = { el, shadow };
|
|
255
|
-
this._cleanupCallbacks.forEach((fn) => fn(ctx));
|
|
256
|
-
this._cleanupCallbacks = [];
|
|
257
|
-
this._mountCallbacks = [];
|
|
258
|
-
this._dispose?.();
|
|
259
|
-
this._dispose = null;
|
|
260
|
-
// Clean up VDOM
|
|
261
|
-
render(null, shadow || el);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
customElements.define(tagName, BaseComponent);
|
|
265
|
-
// Return JSX factory function that can be used as <PropTest count={5} />
|
|
266
|
-
const factory = ((props) => jsx(tagName, props));
|
|
267
|
-
factory.__tag = tagName;
|
|
268
|
-
factory.__props = null;
|
|
269
|
-
factory.__events = null;
|
|
270
|
-
return factory;
|
|
271
|
-
}
|
|
272
|
-
//# sourceMappingURL=Component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sourceRoot":"","sources":["../../../../core/src/Component.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAc,GAAG,EAAS,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,EAAU,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEhE,sDAAsD;AACtD,MAAM,GAAG,GAAG,IAAI,CAAC;AAqGjB,IAAI,uBAAuB,GAAgD,IAAI,CAAC;AAEhF,MAAM,UAAU,kBAAkB;IAC9B,OAAO,uBAAuB,CAAC;AACnC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,GAAG,MAAuB;IAClD,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;IACjC,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,OAAO,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;QAC9D,OAAO;IACX,CAAC;IAED,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACb,8BAA8B;QAC9B,GAAG,CAAC,MAAM,CAAC,kBAAkB,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,kBAAkB,EAAE,GAAG,MAAM,CAAC,CAAC;IAClF,CAAC;SAAM,CAAC;QACJ,qDAAqD;QACrD,+EAA+E;QAC/E,MAAM,GAAG,GAAG,QAAQ,CAAC;QACrB,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QACjD,MAAM,SAAS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aAAa,CAAC,CAAC;IAE9C,yEAAyE;IACzE,MAAM,OAAO,GAAG,CAAC,CAAC,KAAwH,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAuM,CAAC;IAC1W,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC;IACxB,OAAO,CAAC,OAAO,GAAG,IAAqB,CAAC;IACxC,OAAO,CAAC,QAAQ,GAAG,IAAsB,CAAC;IAC1C,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export type EffectFn = () => void;
|
|
2
|
-
export interface ReactiveEffect extends EffectFn {
|
|
3
|
-
deps: Set<ReactiveEffect>[];
|
|
4
|
-
}
|
|
5
|
-
export declare function batch(fn: () => void): void;
|
|
6
|
-
export interface Signal<T> {
|
|
7
|
-
value: T;
|
|
8
|
-
}
|
|
9
|
-
export declare function signal<T>(initial: T): Signal<T>;
|
|
10
|
-
export declare function effect(fn: EffectFn): () => void;
|
|
11
|
-
/**
|
|
12
|
-
* Create a reactive object where all property accesses are tracked
|
|
13
|
-
*/
|
|
14
|
-
export declare function reactive<T extends object>(target: T): T;
|
|
15
|
-
export type WatchSource<T = any> = Signal<T> | (() => T);
|
|
16
|
-
export type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: (fn: () => void) => void) => any;
|
|
17
|
-
export interface WatchOptions<Immediate = boolean> {
|
|
18
|
-
immediate?: Immediate;
|
|
19
|
-
deep?: boolean | number;
|
|
20
|
-
once?: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface WatchHandle {
|
|
23
|
-
(): void;
|
|
24
|
-
pause: () => void;
|
|
25
|
-
resume: () => void;
|
|
26
|
-
stop: () => void;
|
|
27
|
-
}
|
|
28
|
-
export declare function watch<T>(source: WatchSource<T>, cb: WatchCallback<T>, options?: WatchOptions): WatchHandle;
|
|
29
|
-
export type EffectScope = {
|
|
30
|
-
run<T>(fn: () => T): T | undefined;
|
|
31
|
-
stop(fromParent?: boolean): void;
|
|
32
|
-
};
|
|
33
|
-
export declare function effectScope(detached?: boolean): EffectScope;
|
|
34
|
-
//# sourceMappingURL=Signals.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Signals.d.ts","sourceRoot":"","sources":["../../../../core/src/Signals.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC;AAElC,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC5C,IAAI,EAAE,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;CAC/B;AAMD,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,IAAI,QAcnC;AA0CD,MAAM,WAAW,MAAM,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC;CACZ;AAMD,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAqC/C;AAED,wBAAgB,MAAM,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,IAAI,CAE/C;AAaD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAkEvD;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AACzD,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,KAAK,GAAG,CAAC;AACpH,MAAM,WAAW,YAAY,CAAC,SAAS,GAAG,OAAO;IAC7C,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,I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