p-elements-core 2.1.0-rc8 → 2.1.0
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/p-elements-core.js +1 -1
- package/package.json +15 -5
- package/readme.md +13 -13
- package/typings/custom-element-controller.d.ts +18 -0
- package/typings/custom-element-controller.d.ts.map +1 -0
- package/typings/custom-element.d.ts +140 -0
- package/typings/custom-element.d.ts.map +1 -0
- package/typings/decorators/bind.d.ts +6 -0
- package/typings/decorators/bind.d.ts.map +1 -0
- package/typings/decorators/custom-element-config.d.ts +8 -0
- package/typings/decorators/custom-element-config.d.ts.map +1 -0
- package/typings/decorators/property.d.ts +213 -0
- package/typings/decorators/property.d.ts.map +1 -0
- package/typings/decorators/query.d.ts +2 -0
- package/typings/decorators/query.d.ts.map +1 -0
- package/typings/decorators/render-property-on-set.d.ts +2 -0
- package/typings/decorators/render-property-on-set.d.ts.map +1 -0
- package/typings/maquette/cache.d.ts +10 -0
- package/typings/maquette/cache.d.ts.map +1 -0
- package/typings/maquette/dom.d.ts +60 -0
- package/typings/maquette/dom.d.ts.map +1 -0
- package/typings/maquette/h.d.ts +35 -0
- package/typings/maquette/h.d.ts.map +1 -0
- package/{src/maquette/index.ts → typings/maquette/index.d.ts} +1 -1
- package/typings/maquette/index.d.ts.map +1 -0
- package/typings/maquette/interfaces.d.ts +475 -0
- package/typings/maquette/interfaces.d.ts.map +1 -0
- package/typings/maquette/jsx.d.ts +6 -0
- package/typings/maquette/jsx.d.ts.map +1 -0
- package/typings/maquette/mapping.d.ts +14 -0
- package/typings/maquette/mapping.d.ts.map +1 -0
- package/typings/maquette/projection.d.ts +9 -0
- package/typings/maquette/projection.d.ts.map +1 -0
- package/typings/maquette/projector.d.ts +27 -0
- package/typings/maquette/projector.d.ts.map +1 -0
- package/typings/p-elements-core.d.ts +239 -0
- package/typings/p-elements-core.d.ts.map +1 -0
- package/.babelrc +0 -21
- package/.editorconfig +0 -17
- package/.gitlab-ci.yml +0 -18
- package/demo/sample.js +0 -1
- package/demo/screen.css +0 -6
- package/demo/theme.css +0 -14
- package/docs/.eleventy.js +0 -109
- package/docs/package.json +0 -27
- package/docs/src/404.md +0 -8
- package/docs/src/_data/demos/animation/animation.tsx +0 -216
- package/docs/src/_data/demos/animation/index.html +0 -10
- package/docs/src/_data/demos/animation/project.json +0 -7
- package/docs/src/_data/demos/hello-world/hello-world.tsx +0 -35
- package/docs/src/_data/demos/hello-world/index.html +0 -10
- package/docs/src/_data/demos/hello-world/project.json +0 -7
- package/docs/src/_data/demos/timer/demo-timer.tsx +0 -120
- package/docs/src/_data/demos/timer/icons.tsx +0 -62
- package/docs/src/_data/demos/timer/index.html +0 -12
- package/docs/src/_data/demos/timer/project.json +0 -8
- package/docs/src/_data/global.js +0 -14
- package/docs/src/_data/helpers.js +0 -19
- package/docs/src/_includes/layouts/base.njk +0 -31
- package/docs/src/_includes/layouts/playground.njk +0 -40
- package/docs/src/_includes/partials/app-header.njk +0 -9
- package/docs/src/_includes/partials/head.njk +0 -15
- package/docs/src/_includes/partials/nav.njk +0 -20
- package/docs/src/_includes/partials/top-nav.njk +0 -52
- package/docs/src/assets/favicon.png +0 -0
- package/docs/src/assets/logo.svg +0 -9
- package/docs/src/documentation/custom-element-controller.md +0 -294
- package/docs/src/documentation/custom-element.md +0 -221
- package/docs/src/documentation/decorators/bind.md +0 -71
- package/docs/src/documentation/decorators/custom-element-config.md +0 -63
- package/docs/src/documentation/decorators/property.md +0 -83
- package/docs/src/documentation/decorators/query.md +0 -66
- package/docs/src/documentation/decorators/render-property-on-set.md +0 -60
- package/docs/src/documentation/decorators.md +0 -9
- package/docs/src/documentation/getting-started.md +0 -60
- package/docs/src/documentation/index.md +0 -33
- package/docs/src/documentation/reactive-properties.md +0 -54
- package/docs/src/index.d.ts +0 -25
- package/docs/src/index.md +0 -3
- package/docs/src/playground/animation.njk +0 -10
- package/docs/src/playground/index.njk +0 -10
- package/docs/src/playground/timer.njk +0 -10
- package/docs/src/scripts/components/app-drawer/app-drawer.css +0 -92
- package/docs/src/scripts/components/app-drawer/app-drawer.tsx +0 -67
- package/docs/src/scripts/components/app-mobile-menu/app-mobile-menu.css +0 -48
- package/docs/src/scripts/components/app-mobile-menu/app-mobile-menu.tsx +0 -112
- package/docs/src/scripts/components/app-mode-switch/app-mode-switch.css +0 -78
- package/docs/src/scripts/components/app-mode-switch/app-mode-switch.tsx +0 -166
- package/docs/src/scripts/components/app-playground/app-playground.tsx +0 -190
- package/docs/src/scripts/components/app-split-panel/app-split-panel.css +0 -33
- package/docs/src/scripts/components/app-split-panel/app-split-panel.tsx +0 -73
- package/docs/src/scripts/components/app-split-panel/resize-bar.tsx +0 -155
- package/docs/src/scripts/components/lazy-svg/lazy-svg.tsx +0 -94
- package/docs/src/scripts/index.ts +0 -6
- package/docs/src/scripts/playground.ts +0 -1
- package/docs/src/styles/main.css +0 -699
- package/docs/tsconfig.json +0 -22
- package/index.html +0 -49
- package/src/custom-element-controller.ts +0 -31
- package/src/custom-element.ts +0 -588
- package/src/decorators/bind.ts +0 -46
- package/src/decorators/custom-element-config.ts +0 -17
- package/src/decorators/property.ts +0 -684
- package/src/decorators/query.ts +0 -12
- package/src/decorators/render-property-on-set.ts +0 -3
- package/src/maquette/cache.ts +0 -35
- package/src/maquette/dom.ts +0 -115
- package/src/maquette/h.ts +0 -100
- package/src/maquette/interfaces.ts +0 -536
- package/src/maquette/jsx.ts +0 -61
- package/src/maquette/mapping.ts +0 -56
- package/src/maquette/projection.ts +0 -666
- package/src/maquette/projector.ts +0 -200
- package/src/p-elements-core.ts +0 -260
- package/src/sample/animate.tsx +0 -199
- package/src/sample/mixin/highlight.tsx +0 -33
- package/src/sample/sample.tsx +0 -450
- package/storybook/storybook-demo/.storybook/main.ts +0 -30
- package/storybook/storybook-demo/.storybook/preview-head.html +0 -1
- package/storybook/storybook-demo/.storybook/preview.ts +0 -20
- package/storybook/storybook-demo/package.json +0 -23
- package/storybook/storybook-demo/stories/bar.stories.tsx +0 -27
- package/storybook/storybook-demo/stories/baz.stories.tsx +0 -37
- package/storybook/storybook-demo/stories/foo.mdx +0 -11
- package/storybook/storybook-demo/stories/foo.stories.tsx +0 -27
- package/storybook/storybook-demo/stories/foo.tsx +0 -24
- package/storybook/storybook-demo/tsconfig.json +0 -30
- package/storybook/storybook-p-element-vite/README.md +0 -97
- package/storybook/storybook-p-element-vite/package.json +0 -81
- package/storybook/storybook-p-element-vite/preset.js +0 -2
- package/storybook/storybook-p-element-vite/src/docs/index.ts +0 -8
- package/storybook/storybook-p-element-vite/src/docs/source-decorator.ts +0 -55
- package/storybook/storybook-p-element-vite/src/entry-preview-docs.ts +0 -16
- package/storybook/storybook-p-element-vite/src/entry-preview.ts +0 -8
- package/storybook/storybook-p-element-vite/src/index.ts +0 -9
- package/storybook/storybook-p-element-vite/src/node/index.ts +0 -5
- package/storybook/storybook-p-element-vite/src/portable-stories.ts +0 -35
- package/storybook/storybook-p-element-vite/src/preset.ts +0 -69
- package/storybook/storybook-p-element-vite/src/render.ts +0 -96
- package/storybook/storybook-p-element-vite/src/types.ts +0 -99
- package/storybook/storybook-p-element-vite/tsconfig.json +0 -14
- package/storybook/storybook-p-element-vite/tsdown.config.ts +0 -26
- package/tsconfig.json +0 -67
- package/tsconfig.sample.json +0 -20
- package/webpack.config.js +0 -76
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported property type constructors for reactive properties.
|
|
3
|
+
* These constructors are used to convert attribute values to the correct JavaScript type.
|
|
4
|
+
*
|
|
5
|
+
* @typedef {StringConstructor | NumberConstructor | BooleanConstructor | ObjectConstructor | ArrayConstructor} PropertyType
|
|
6
|
+
*/
|
|
7
|
+
type PropertyType = StringConstructor | NumberConstructor | BooleanConstructor | ObjectConstructor | ArrayConstructor;
|
|
8
|
+
/**
|
|
9
|
+
* Legacy string-based property types (deprecated).
|
|
10
|
+
* Maintained for backward compatibility. Use PropertyType constructors instead.
|
|
11
|
+
*
|
|
12
|
+
* @typedef {('string' | 'number' | 'boolean' | 'object' | 'array')} oldPropertyType
|
|
13
|
+
* @deprecated Use PropertyType constructors (String, Number, Boolean, Object, Array) instead
|
|
14
|
+
*/
|
|
15
|
+
type oldPropertyType = "string" | "number" | "boolean" | "object" | "array";
|
|
16
|
+
/**
|
|
17
|
+
* Configuration options for the @property decorator.
|
|
18
|
+
* Defines how a property should sync with HTML attributes and trigger updates.
|
|
19
|
+
*
|
|
20
|
+
* @interface PropertyOptions
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* @property({ type: String, reflect: true })
|
|
25
|
+
* name = 'default';
|
|
26
|
+
*
|
|
27
|
+
* @property({ type: Number, attribute: 'data-count' })
|
|
28
|
+
* count = 0;
|
|
29
|
+
*
|
|
30
|
+
* @property({ type: Boolean })
|
|
31
|
+
* active = false;
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export interface PropertyOptions {
|
|
35
|
+
/**
|
|
36
|
+
* The type constructor for converting attribute values to property values.
|
|
37
|
+
* Use String, Number, Boolean, Object, or Array.
|
|
38
|
+
* @type {PropertyType | oldPropertyType}
|
|
39
|
+
*/
|
|
40
|
+
type?: PropertyType | oldPropertyType;
|
|
41
|
+
/**
|
|
42
|
+
* The HTML attribute name to sync with, or false to disable attribute syncing.
|
|
43
|
+
* - `true` (default): Use kebab-case version of property name
|
|
44
|
+
* - `string`: Use specific attribute name
|
|
45
|
+
* - `false`: No attribute syncing
|
|
46
|
+
* @type {string | boolean}
|
|
47
|
+
*/
|
|
48
|
+
attribute?: string | boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether to reflect property changes back to the HTML attribute.
|
|
51
|
+
* When true, setting the property will update the attribute.
|
|
52
|
+
* @type {boolean}
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
reflect?: boolean;
|
|
56
|
+
readonly?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Custom converter for complex attribute/property transformations.
|
|
59
|
+
* @type {AttributeConverter<any>}
|
|
60
|
+
*/
|
|
61
|
+
converter?: AttributeConverter<any>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* PropertyOptions extended with the property name.
|
|
65
|
+
* Used internally to track registered properties.
|
|
66
|
+
*
|
|
67
|
+
* @typedef {PropertyOptions & { name: string }} PropertyOptionsWithName
|
|
68
|
+
*/
|
|
69
|
+
export type PropertyOptionsWithName = PropertyOptions & {
|
|
70
|
+
name: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Checks if an element is currently updating its attributes from property setters.
|
|
74
|
+
* Used to prevent circular updates during property reflection.
|
|
75
|
+
*
|
|
76
|
+
* @param {HTMLElement} element - The element to check
|
|
77
|
+
* @returns {boolean} True if the element is currently setting attributes
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* if (!isSettingAttribute(this)) {
|
|
82
|
+
* // Safe to update property from attribute
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare function isSettingAttribute(element: HTMLElement): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Process any pending update callbacks for an element.
|
|
89
|
+
* Should be called when the element connects to the DOM to trigger
|
|
90
|
+
* deferred lifecycle callbacks.
|
|
91
|
+
*
|
|
92
|
+
* @param {any} element - The element with pending updates
|
|
93
|
+
* @returns {void}
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* connectedCallback() {
|
|
98
|
+
* processPendingUpdates(this);
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare function processPendingUpdates(element: any): void;
|
|
103
|
+
/**
|
|
104
|
+
* Interface for custom attribute conversion functions.
|
|
105
|
+
*
|
|
106
|
+
* @interface AttributeConverter
|
|
107
|
+
* @template T The type of the property value
|
|
108
|
+
* @description Provides custom conversion logic between HTML attribute strings
|
|
109
|
+
* and JavaScript property values for complex data types or custom formatting.
|
|
110
|
+
*/
|
|
111
|
+
export interface AttributeConverter<T> {
|
|
112
|
+
/**
|
|
113
|
+
* Converts an HTML attribute string value to a JavaScript property value.
|
|
114
|
+
*
|
|
115
|
+
* @param {string | null} value - The attribute value to convert
|
|
116
|
+
* @returns {T} The converted JavaScript value
|
|
117
|
+
* @optional
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* fromAttribute: (value: string | null) => {
|
|
122
|
+
* return value ? JSON.parse(value) : null;
|
|
123
|
+
* }
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
fromAttribute?(value: string | null): T;
|
|
127
|
+
/**
|
|
128
|
+
* Converts a JavaScript property value to an HTML attribute string.
|
|
129
|
+
*
|
|
130
|
+
* @param {T} value - The JavaScript value to convert
|
|
131
|
+
* @returns {string} The converted attribute string
|
|
132
|
+
* @optional
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* toAttribute: (value: object) => {
|
|
137
|
+
* return JSON.stringify(value);
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
toAttribute?(value: T): string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Class field decorator that creates a reactive property with automatic attribute syncing.
|
|
145
|
+
*
|
|
146
|
+
* Features:
|
|
147
|
+
* - Automatic type conversion between attributes and properties
|
|
148
|
+
* - Optional property → attribute reflection
|
|
149
|
+
* - Custom converters for complex types
|
|
150
|
+
* - Automatic observedAttributes registration
|
|
151
|
+
* - Deferred updates for disconnected elements
|
|
152
|
+
* - Lifecycle integration (updated, shouldUpdate, renderNow)
|
|
153
|
+
*
|
|
154
|
+
* @decorator
|
|
155
|
+
* @param {PropertyOptions} [options={}] - Configuration options for the property
|
|
156
|
+
* @returns {(target: any, propertyKey: string) => void} The decorator function
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* Basic usage with different types:
|
|
160
|
+
* ```typescript
|
|
161
|
+
* class MyElement extends BaseComponent {
|
|
162
|
+
* @property({ type: String })
|
|
163
|
+
* name = 'default';
|
|
164
|
+
*
|
|
165
|
+
* @property({ type: Number })
|
|
166
|
+
* count = 0;
|
|
167
|
+
*
|
|
168
|
+
* @property({ type: Boolean })
|
|
169
|
+
* active = false;
|
|
170
|
+
* }
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* With reflection (property changes update attribute):
|
|
175
|
+
* ```typescript
|
|
176
|
+
* class MyElement extends BaseComponent {
|
|
177
|
+
* @property({ type: String, reflect: true })
|
|
178
|
+
* status = 'pending';
|
|
179
|
+
*
|
|
180
|
+
* updateStatus() {
|
|
181
|
+
* this.status = 'complete'; // Also updates status="complete" attribute
|
|
182
|
+
* }
|
|
183
|
+
* }
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* Custom attribute name and converter:
|
|
188
|
+
* ```typescript
|
|
189
|
+
* class MyElement extends BaseComponent {
|
|
190
|
+
* @property({
|
|
191
|
+
* type: Object,
|
|
192
|
+
* attribute: 'data-config',
|
|
193
|
+
* converter: {
|
|
194
|
+
* fromAttribute: (value) => value ? JSON.parse(value) : {},
|
|
195
|
+
* toAttribute: (value) => JSON.stringify(value)
|
|
196
|
+
* }
|
|
197
|
+
* })
|
|
198
|
+
* config = {};
|
|
199
|
+
* }
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* Property without attribute syncing:
|
|
204
|
+
* ```typescript
|
|
205
|
+
* class MyElement extends BaseComponent {
|
|
206
|
+
* @property({ attribute: false })
|
|
207
|
+
* internalState = null; // No attribute created or observed
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
export declare function property(options?: PropertyOptions): (target: any, propertyKey: string) => void;
|
|
212
|
+
export {};
|
|
213
|
+
//# sourceMappingURL=property.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../src/decorators/property.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,KAAK,YAAY,GACb,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,CAAC;AAErB;;;;;;GAMG;AACH,KAAK,eAAe,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE5E;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,IAAI,CAAC,EAAE,YAAY,GAAG,eAAe,CAAC;IAEtC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAE7B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;CACrC;AAED;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,eAAe,GAAG;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC;AAoCvE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAEhE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CAiCxD;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC;IAExC;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;CAChC;AAiLD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,wBAAgB,QAAQ,CACtB,OAAO,GAAE,eAAoB,GAC5B,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAoN5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/decorators/query.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,GAAI,UAAU,MAAM,EAAE,uBAAoB,MAC1C,QAAQ,MAAM,EAAE,aAAa,MAAM,SAUpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-property-on-set.d.ts","sourceRoot":"","sources":["../../src/decorators/render-property-on-set.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,4CAAmB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CalculationCache } from "./interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a [[CalculationCache]] object, useful for caching [[VNode]] trees.
|
|
4
|
+
* In practice, caching of [[VNode]] trees is not needed, because achieving 60 frames per second is almost never a problem.
|
|
5
|
+
* For more information, see [[CalculationCache]].
|
|
6
|
+
*
|
|
7
|
+
* @param <Result> The type of the value that is cached.
|
|
8
|
+
*/
|
|
9
|
+
export declare let createCache: <Result>() => CalculationCache<Result>;
|
|
10
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/maquette/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,IAAI,WAAW,GAAI,MAAM,OAAM,gBAAgB,CAAC,MAAM,CAyB5D,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contains simple low-level utility functions to manipulate the real DOM.
|
|
3
|
+
*/
|
|
4
|
+
import { Projection, ProjectionOptions, VNode } from "./interfaces";
|
|
5
|
+
export declare let applyDefaultProjectionOptions: (projectorOptions?: ProjectionOptions) => ProjectionOptions;
|
|
6
|
+
export declare let dom: {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a real DOM tree from `vnode`. The [[Projection]] object returned will contain the resulting DOM Node in
|
|
9
|
+
* its [[Projection.domNode|domNode]] property.
|
|
10
|
+
* This is a low-level method. Users will typically use a [[Projector]] instead.
|
|
11
|
+
* @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]
|
|
12
|
+
* objects may only be rendered once.
|
|
13
|
+
* @param projectionOptions - Options to be used to create and update the projection.
|
|
14
|
+
* @returns The [[Projection]] which also contains the DOM Node that was created.
|
|
15
|
+
*/
|
|
16
|
+
create: (vnode: VNode, projectionOptions?: ProjectionOptions) => Projection;
|
|
17
|
+
/**
|
|
18
|
+
* Appends a new child node to the DOM which is generated from a [[VNode]].
|
|
19
|
+
* This is a low-level method. Users will typically use a [[Projector]] instead.
|
|
20
|
+
* @param parentNode - The parent node for the new child node.
|
|
21
|
+
* @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]
|
|
22
|
+
* objects may only be rendered once.
|
|
23
|
+
* @param projectionOptions - Options to be used to create and update the [[Projection]].
|
|
24
|
+
* @returns The [[Projection]] that was created.
|
|
25
|
+
*/
|
|
26
|
+
append: (parentNode: Element, vnode: VNode, projectionOptions?: ProjectionOptions) => Projection;
|
|
27
|
+
/**
|
|
28
|
+
* Inserts a new DOM node which is generated from a [[VNode]].
|
|
29
|
+
* This is a low-level method. Users wil typically use a [[Projector]] instead.
|
|
30
|
+
* @param beforeNode - The node that the DOM Node is inserted before.
|
|
31
|
+
* @param vnode - The root of the virtual DOM tree that was created using the [[h]] function.
|
|
32
|
+
* NOTE: [[VNode]] objects may only be rendered once.
|
|
33
|
+
* @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].
|
|
34
|
+
* @returns The [[Projection]] that was created.
|
|
35
|
+
*/
|
|
36
|
+
insertBefore: (beforeNode: Element, vnode: VNode, projectionOptions?: ProjectionOptions) => Projection;
|
|
37
|
+
/**
|
|
38
|
+
* Merges a new DOM node which is generated from a [[VNode]] with an existing DOM Node.
|
|
39
|
+
* This means that the virtual DOM and the real DOM will have one overlapping element.
|
|
40
|
+
* Therefore the selector for the root [[VNode]] will be ignored, but its properties and children will be applied to the Element provided.
|
|
41
|
+
* This is a low-level method. Users wil typically use a [[Projector]] instead.
|
|
42
|
+
* @param element - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.
|
|
43
|
+
* @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]] objects
|
|
44
|
+
* may only be rendered once.
|
|
45
|
+
* @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].
|
|
46
|
+
* @returns The [[Projection]] that was created.
|
|
47
|
+
*/
|
|
48
|
+
merge: (element: Element, vnode: VNode, projectionOptions?: ProjectionOptions) => Projection;
|
|
49
|
+
/**
|
|
50
|
+
* Replaces an existing DOM node with a node generated from a [[VNode]].
|
|
51
|
+
* This is a low-level method. Users will typically use a [[Projector]] instead.
|
|
52
|
+
* @param element - The node for the [[VNode]] to replace.
|
|
53
|
+
* @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]
|
|
54
|
+
* objects may only be rendered once.
|
|
55
|
+
* @param projectionOptions - Options to be used to create and update the [[Projection]].
|
|
56
|
+
* @returns The [[Projection]] that was created.
|
|
57
|
+
*/
|
|
58
|
+
replace: (element: Element, vnode: VNode, projectionOptions?: ProjectionOptions) => Projection;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/maquette/dom.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAkBpE,eAAO,IAAI,6BAA6B,GACtC,mBAAmB,iBAAiB,KACnC,iBAEF,CAAC;AAEF,eAAO,IAAI,GAAG;IACZ;;;;;;;;OAQG;oBACa,KAAK,sBAAsB,iBAAiB,KAAG,UAAU;IAMzE;;;;;;;;OAQG;yBAEW,OAAO,SACZ,KAAK,sBACQ,iBAAiB,KACpC,UAAU;IAMb;;;;;;;;OAQG;+BAEW,OAAO,SACZ,KAAK,sBACQ,iBAAiB,KACpC,UAAU;IAMb;;;;;;;;;;OAUG;qBACc,OAAO,SAAS,KAAK,sBAAsB,iBAAiB,KAAG,UAAU;IAO1F;;;;;;;;OAQG;uBACgB,OAAO,SAAS,KAAK,sBAAsB,iBAAiB,KAAG,UAAU;CAM7F,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { VNode, VNodeChild, VNodeProperties } from "./interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* The `h` function is used to create a virtual DOM node.
|
|
4
|
+
* This function is largely inspired by the mercuryjs and mithril frameworks.
|
|
5
|
+
* The `h` stands for (virtual) hyperscript.
|
|
6
|
+
*
|
|
7
|
+
* @param selector Contains the tagName, id and fixed css classnames in CSS selector format.
|
|
8
|
+
* It is formatted as follows: `tagname.cssclass1.cssclass2#id`.
|
|
9
|
+
* @param properties An object literal containing properties that will be placed on the DOM node.
|
|
10
|
+
* @param children Virtual DOM nodes and strings to add as child nodes.
|
|
11
|
+
* `children` may contain [[VNode]]s, `string`s, nested arrays, `null` and `undefined`.
|
|
12
|
+
* Nested arrays are flattened, `null` and `undefined` are removed.
|
|
13
|
+
*
|
|
14
|
+
* @returns A VNode object, used to render a real DOM later.
|
|
15
|
+
*
|
|
16
|
+
* NOTE: There are {@link http://maquettejs.org/docs/rules.html two basic rules} you should be aware of when updating the virtual DOM.
|
|
17
|
+
*/
|
|
18
|
+
export declare function h(selector: string, properties?: VNodeProperties, children?: VNodeChild[] | null): VNode;
|
|
19
|
+
/**
|
|
20
|
+
* The `h` function is used to create a virtual DOM node.
|
|
21
|
+
* This function is largely inspired by the mercuryjs and mithril frameworks.
|
|
22
|
+
* The `h` stands for (virtual) hyperscript.
|
|
23
|
+
*
|
|
24
|
+
* @param selector Contains the tagName, id and fixed css classnames in CSS selector format.
|
|
25
|
+
* It is formatted as follows: `tagname.cssclass1.cssclass2#id`.
|
|
26
|
+
* @param children Virtual DOM nodes and strings to add as child nodes.
|
|
27
|
+
* `children` may contain [[VNode]]s, `string`s, nested arrays, `null` and `undefined`.
|
|
28
|
+
* Nested arrays are flattened, `null` and `undefined` are removed.
|
|
29
|
+
*
|
|
30
|
+
* @returns A VNode object, used to render a real DOM later.
|
|
31
|
+
*
|
|
32
|
+
* NOTE: There are {@link http://maquettejs.org/docs/rules.html two basic rules} you should be aware of when updating the virtual DOM.
|
|
33
|
+
*/
|
|
34
|
+
export declare function h(selector: string, children: VNodeChild[]): VNode;
|
|
35
|
+
//# sourceMappingURL=h.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h.d.ts","sourceRoot":"","sources":["../../src/maquette/h.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AA4BlE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,CAAC,CACf,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,eAAe,EAC5B,QAAQ,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,GAC7B,KAAK,CAAC;AACT;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// Comment that is displayed in the API documentation for the maquette module:
|
|
2
1
|
/**
|
|
3
2
|
* Welcome to the API documentation of the **maquette** library.
|
|
4
3
|
*
|
|
@@ -10,3 +9,4 @@ export { h } from "./h";
|
|
|
10
9
|
export { createProjector } from "./projector";
|
|
11
10
|
export { createCache } from "./cache";
|
|
12
11
|
export { createMapping } from "./mapping";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/maquette/index.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
|