@praxisjs/decorators 1.6.1 → 2.0.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/CHANGELOG.md +46 -0
- package/dist/component/component.d.ts +1 -1
- package/dist/component/component.d.ts.map +1 -1
- package/dist/component/component.js +8 -15
- package/dist/component/component.js.map +1 -1
- package/dist/component/lazy.d.ts +1 -1
- package/dist/component/lazy.d.ts.map +1 -1
- package/dist/component/lazy.js +44 -36
- package/dist/component/lazy.js.map +1 -1
- package/dist/create-class-decorator.d.ts +27 -5
- package/dist/create-class-decorator.d.ts.map +1 -1
- package/dist/create-class-decorator.js +53 -18
- package/dist/create-class-decorator.js.map +1 -1
- package/dist/create-field-decorator.d.ts +42 -3
- package/dist/create-field-decorator.d.ts.map +1 -1
- package/dist/create-field-decorator.js +63 -27
- package/dist/create-field-decorator.js.map +1 -1
- package/dist/create-getter-decorator.d.ts +81 -16
- package/dist/create-getter-decorator.d.ts.map +1 -1
- package/dist/create-getter-decorator.js +127 -15
- package/dist/create-getter-decorator.js.map +1 -1
- package/dist/create-lifecycle-method-decorator.d.ts +21 -3
- package/dist/create-lifecycle-method-decorator.d.ts.map +1 -1
- package/dist/create-lifecycle-method-decorator.js +25 -18
- package/dist/create-lifecycle-method-decorator.js.map +1 -1
- package/dist/create-method-decorator.d.ts +43 -3
- package/dist/create-method-decorator.d.ts.map +1 -1
- package/dist/create-method-decorator.js +49 -8
- package/dist/create-method-decorator.js.map +1 -1
- package/dist/events/command.d.ts +2 -1
- package/dist/events/command.d.ts.map +1 -1
- package/dist/events/command.js +10 -8
- package/dist/events/command.js.map +1 -1
- package/dist/events/emit.d.ts +2 -2
- package/dist/events/emit.d.ts.map +1 -1
- package/dist/events/emit.js +18 -24
- package/dist/events/emit.js.map +1 -1
- package/dist/events/on-command.d.ts +2 -1
- package/dist/events/on-command.d.ts.map +1 -1
- package/dist/events/on-command.js +12 -14
- package/dist/events/on-command.js.map +1 -1
- package/dist/field.d.ts +51 -0
- package/dist/field.d.ts.map +1 -0
- package/dist/field.js +82 -0
- package/dist/field.js.map +1 -0
- package/dist/functions/bind.d.ts +2 -1
- package/dist/functions/bind.d.ts.map +1 -1
- package/dist/functions/bind.js +4 -4
- package/dist/functions/bind.js.map +1 -1
- package/dist/functions/debounce.d.ts +2 -2
- package/dist/functions/debounce.d.ts.map +1 -1
- package/dist/functions/debounce.js +25 -23
- package/dist/functions/debounce.js.map +1 -1
- package/dist/functions/index.d.ts +1 -1
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/log.d.ts +2 -1
- package/dist/functions/log.d.ts.map +1 -1
- package/dist/functions/log.js +38 -40
- package/dist/functions/log.js.map +1 -1
- package/dist/functions/memo.d.ts +9 -1
- package/dist/functions/memo.d.ts.map +1 -1
- package/dist/functions/memo.js +44 -30
- package/dist/functions/memo.js.map +1 -1
- package/dist/functions/once.d.ts +2 -1
- package/dist/functions/once.d.ts.map +1 -1
- package/dist/functions/once.js +10 -14
- package/dist/functions/once.js.map +1 -1
- package/dist/functions/retry.d.ts +2 -1
- package/dist/functions/retry.d.ts.map +1 -1
- package/dist/functions/retry.js +21 -23
- package/dist/functions/retry.js.map +1 -1
- package/dist/functions/throttle.d.ts +2 -1
- package/dist/functions/throttle.d.ts.map +1 -1
- package/dist/functions/throttle.js +12 -14
- package/dist/functions/throttle.js.map +1 -1
- package/dist/functions/until.d.ts +2 -1
- package/dist/functions/until.d.ts.map +1 -1
- package/dist/functions/until.js +13 -14
- package/dist/functions/until.js.map +1 -1
- package/dist/functions/watch.d.ts +1 -1
- package/dist/functions/watch.d.ts.map +1 -1
- package/dist/functions/watch.js +36 -34
- package/dist/functions/watch.js.map +1 -1
- package/dist/functions/when.d.ts +1 -1
- package/dist/functions/when.d.ts.map +1 -1
- package/dist/functions/when.js +19 -21
- package/dist/functions/when.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lifecycle.d.ts +24 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +55 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/properties/compose.d.ts +3 -2
- package/dist/properties/compose.d.ts.map +1 -1
- package/dist/properties/compose.js +33 -19
- package/dist/properties/compose.js.map +1 -1
- package/dist/properties/computed.d.ts +12 -10
- package/dist/properties/computed.d.ts.map +1 -1
- package/dist/properties/computed.js +26 -21
- package/dist/properties/computed.js.map +1 -1
- package/dist/properties/deep-state.d.ts +2 -1
- package/dist/properties/deep-state.d.ts.map +1 -1
- package/dist/properties/deep-state.js +66 -49
- package/dist/properties/deep-state.js.map +1 -1
- package/dist/properties/function-prop.d.ts +2 -1
- package/dist/properties/function-prop.d.ts.map +1 -1
- package/dist/properties/function-prop.js +20 -22
- package/dist/properties/function-prop.js.map +1 -1
- package/dist/properties/history.d.ts +2 -2
- package/dist/properties/history.d.ts.map +1 -1
- package/dist/properties/history.js +34 -31
- package/dist/properties/history.js.map +1 -1
- package/dist/properties/index.d.ts +1 -0
- package/dist/properties/index.d.ts.map +1 -1
- package/dist/properties/index.js +1 -0
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/persisted.d.ts +2 -1
- package/dist/properties/persisted.d.ts.map +1 -1
- package/dist/properties/persisted.js +30 -19
- package/dist/properties/persisted.js.map +1 -1
- package/dist/properties/prop.d.ts +2 -1
- package/dist/properties/prop.d.ts.map +1 -1
- package/dist/properties/prop.js +26 -22
- package/dist/properties/prop.js.map +1 -1
- package/dist/properties/ref.d.ts +2 -1
- package/dist/properties/ref.d.ts.map +1 -1
- package/dist/properties/ref.js +11 -8
- package/dist/properties/ref.js.map +1 -1
- package/dist/properties/resource.d.ts.map +1 -1
- package/dist/properties/resource.js +21 -16
- package/dist/properties/resource.js.map +1 -1
- package/dist/properties/selector.d.ts +12 -0
- package/dist/properties/selector.d.ts.map +1 -0
- package/dist/properties/selector.js +25 -0
- package/dist/properties/selector.js.map +1 -0
- package/dist/properties/slot.d.ts +2 -1
- package/dist/properties/slot.d.ts.map +1 -1
- package/dist/properties/slot.js +22 -20
- package/dist/properties/slot.js.map +1 -1
- package/dist/properties/state.d.ts.map +1 -1
- package/dist/properties/state.js +27 -16
- package/dist/properties/state.js.map +1 -1
- package/dist/properties/synced.d.ts +2 -1
- package/dist/properties/synced.d.ts.map +1 -1
- package/dist/properties/synced.js +27 -19
- package/dist/properties/synced.js.map +1 -1
- package/dist/shared-method.d.ts +14 -0
- package/dist/shared-method.d.ts.map +1 -0
- package/dist/shared-method.js +87 -0
- package/dist/shared-method.js.map +1 -0
- package/package.json +14 -5
- package/src/component/component.ts +8 -27
- package/src/component/lazy.ts +51 -41
- package/src/create-class-decorator.ts +90 -31
- package/src/create-field-decorator.ts +120 -43
- package/src/create-getter-decorator.ts +263 -66
- package/src/create-lifecycle-method-decorator.ts +50 -28
- package/src/create-method-decorator.ts +119 -13
- package/src/events/command.ts +11 -9
- package/src/events/emit.ts +16 -22
- package/src/events/on-command.ts +17 -18
- package/src/field.ts +116 -0
- package/src/functions/bind.ts +4 -4
- package/src/functions/debounce.ts +25 -23
- package/src/functions/index.ts +1 -1
- package/src/functions/log.ts +44 -46
- package/src/functions/memo.ts +54 -28
- package/src/functions/once.ts +10 -13
- package/src/functions/retry.ts +19 -21
- package/src/functions/throttle.ts +12 -13
- package/src/functions/until.ts +14 -14
- package/src/functions/watch.ts +37 -36
- package/src/functions/when.ts +18 -20
- package/src/index.ts +13 -5
- package/src/lifecycle.ts +74 -0
- package/src/properties/compose.ts +33 -20
- package/src/properties/computed.ts +35 -45
- package/src/properties/deep-state.ts +68 -53
- package/src/properties/function-prop.ts +25 -27
- package/src/properties/history.ts +34 -33
- package/src/properties/index.ts +1 -0
- package/src/properties/persisted.ts +41 -27
- package/src/properties/prop.ts +30 -22
- package/src/properties/ref.ts +12 -10
- package/src/properties/resource.ts +22 -17
- package/src/properties/selector.ts +45 -0
- package/src/properties/slot.ts +28 -22
- package/src/properties/state.ts +32 -16
- package/src/properties/synced.ts +31 -19
- package/src/shared-method.ts +101 -0
- package/dist/__tests__/component.test.d.ts +0 -2
- package/dist/__tests__/component.test.d.ts.map +0 -1
- package/dist/__tests__/component.test.js +0 -147
- package/dist/__tests__/component.test.js.map +0 -1
- package/dist/__tests__/compose.test.d.ts +0 -2
- package/dist/__tests__/compose.test.d.ts.map +0 -1
- package/dist/__tests__/compose.test.js +0 -164
- package/dist/__tests__/compose.test.js.map +0 -1
- package/dist/__tests__/deep-state.test.d.ts +0 -2
- package/dist/__tests__/deep-state.test.d.ts.map +0 -1
- package/dist/__tests__/deep-state.test.js +0 -150
- package/dist/__tests__/deep-state.test.js.map +0 -1
- package/dist/__tests__/events.test.d.ts +0 -2
- package/dist/__tests__/events.test.d.ts.map +0 -1
- package/dist/__tests__/events.test.js +0 -295
- package/dist/__tests__/events.test.js.map +0 -1
- package/dist/__tests__/functions.test.d.ts +0 -2
- package/dist/__tests__/functions.test.d.ts.map +0 -1
- package/dist/__tests__/functions.test.js +0 -618
- package/dist/__tests__/functions.test.js.map +0 -1
- package/dist/__tests__/lazy.test.d.ts +0 -2
- package/dist/__tests__/lazy.test.d.ts.map +0 -1
- package/dist/__tests__/lazy.test.js +0 -227
- package/dist/__tests__/lazy.test.js.map +0 -1
- package/dist/__tests__/memo.test.d.ts +0 -2
- package/dist/__tests__/memo.test.d.ts.map +0 -1
- package/dist/__tests__/memo.test.js +0 -168
- package/dist/__tests__/memo.test.js.map +0 -1
- package/dist/__tests__/properties-browser.test.d.ts +0 -2
- package/dist/__tests__/properties-browser.test.d.ts.map +0 -1
- package/dist/__tests__/properties-browser.test.js +0 -178
- package/dist/__tests__/properties-browser.test.js.map +0 -1
- package/dist/__tests__/properties.test.d.ts +0 -2
- package/dist/__tests__/properties.test.d.ts.map +0 -1
- package/dist/__tests__/properties.test.js +0 -1226
- package/dist/__tests__/properties.test.js.map +0 -1
- package/dist/__tests__/ref.test.d.ts +0 -2
- package/dist/__tests__/ref.test.d.ts.map +0 -1
- package/dist/__tests__/ref.test.js +0 -106
- package/dist/__tests__/ref.test.js.map +0 -1
- package/dist/__tests__/resource.test.d.ts +0 -2
- package/dist/__tests__/resource.test.d.ts.map +0 -1
- package/dist/__tests__/resource.test.js +0 -217
- package/dist/__tests__/resource.test.js.map +0 -1
- package/dist/__tests__/slot.test.d.ts +0 -2
- package/dist/__tests__/slot.test.d.ts.map +0 -1
- package/dist/__tests__/slot.test.js +0 -147
- package/dist/__tests__/slot.test.js.map +0 -1
- package/dist/__tests__/synced.test.d.ts +0 -2
- package/dist/__tests__/synced.test.d.ts.map +0 -1
- package/dist/__tests__/synced.test.js +0 -161
- package/dist/__tests__/synced.test.js.map +0 -1
- package/dist/__tests__/until.test.d.ts +0 -2
- package/dist/__tests__/until.test.d.ts.map +0 -1
- package/dist/__tests__/until.test.js +0 -88
- package/dist/__tests__/until.test.js.map +0 -1
- package/dist/create-accessor-decorator.d.ts +0 -14
- package/dist/create-accessor-decorator.d.ts.map +0 -1
- package/dist/create-accessor-decorator.js +0 -27
- package/dist/create-accessor-decorator.js.map +0 -1
- package/src/__tests__/component.test.ts +0 -167
- package/src/__tests__/compose.test.ts +0 -202
- package/src/__tests__/deep-state.test.ts +0 -185
- package/src/__tests__/events.test.ts +0 -366
- package/src/__tests__/functions.test.ts +0 -803
- package/src/__tests__/lazy.test.ts +0 -296
- package/src/__tests__/memo.test.ts +0 -208
- package/src/__tests__/properties-browser.test.ts +0 -234
- package/src/__tests__/properties.test.ts +0 -1526
- package/src/__tests__/ref.test.ts +0 -131
- package/src/__tests__/resource.test.ts +0 -246
- package/src/__tests__/slot.test.ts +0 -179
- package/src/__tests__/synced.test.ts +0 -193
- package/src/__tests__/until.test.ts +0 -113
- package/src/create-accessor-decorator.ts +0 -45
- package/tsconfig.json +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @praxisjs/decorators
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 75115a9: Remove the `accessor`-based APIs: `createAccessorDecorator` (with `AccessorBehavior` and `AccessorBinding`) and the `@Computed({ get, set })` form declared on an `accessor` field. Use `createFieldDecorator` with `setup` on a plain field, and a `@Computed()` getter with a `set` accessor next to it. See the migration notes in "Creating Decorators".
|
|
8
|
+
|
|
9
|
+
Add a shared `setup` form to `createFieldDecorator`, `createMethodDecorator`, `createGetterDecorator` and `createWritableGetterDecorator`: created once per decorated member, shared by every instance, with per-instance state in symbol slots and optional `init`/`onMount`/`onUnmount`. `ClassBehavior` can define `onMount(instance)`, `onUnmount(instance)` and `render(instance, originalRender)` itself, and `create` is optional. `createGetterObserverDecorator` takes `register` (per mount) and runs a cleanup returned by `observe` on unmount. Every builder takes a `label`, checks the member kind with a clear `TypeError`, and has typed `Host`/`Value` parameters.
|
|
10
|
+
|
|
11
|
+
The per-instance forms are faster: `createMethodDecorator({ wrap })` and `createWritableGetterDecorator({ bind })` call through one replacement on the class instead of defining a property on every instance (detached `wrap` methods are now bound and stack under built-in method decorators), and `@Computed()` installs its getter on the class. Fixes `@Computed()` with a `set` accessor declared next to the getter, which threw on assignment.
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 75115a9: Decorated fields are defined by their innermost decorator. With `@praxisjs/vite-plugin`, `@State()`, `@Prop()`, every built-in field decorator and `createFieldDecorator` bindings install their property directly with the field's initial value instead of replacing a plain value, which kept every instance in V8's slow dictionary mode. New `addClaimableInitializer(context, init)` export for field decorators written against the TC39 API.
|
|
16
|
+
- 75115a9: Field decorators throw a `TypeError` when the class is defined if they decorate an `accessor`, naming the member to fix. Covers `@State()`, `@Prop()`, every built-in field decorator and `createFieldDecorator` bindings. New `assertFieldContext(context, label?)` export for field decorators written against the TC39 API directly.
|
|
17
|
+
- 75115a9: Cheaper decorators per instance and per call. Method decorators (`@Bind`, `@Once`, `@Throttle`, `@Debounce`, `@Retry`, `@Log`, `@Memo`, `@Emit`, `@Until`) replace the method once on the class and bind it lazily on first read, field decorators share one accessor pair per field with per-instance state in symbol slots, lifecycle hooks chain without bound functions, and slots, `@Persisted` and `@Synced` no longer read `WeakMap`s. Fixes `@Until` on `@State` fields, a leaked registration when `onMount()` runs twice, stacked method decorators dropping all but one, and method decorators on private methods doing nothing.
|
|
18
|
+
- 75115a9: Rendering and reactivity performance overhaul. `@praxisjs/core` has a new push-pull reactive graph (linked dependencies reused across runs, version-checked computeds, glitch-free effects) and keeps component internals on the instance. `@praxisjs/decorators` shares one accessor pair per `@State`/`@Prop` field, creates `@Computed` lazily, and `@Component` no longer wraps the class. `@praxisjs/runtime` adds the compiled-template helpers, a shared event dispatcher, leaner scopes and reactive children, skipped no-op prop writes, cheaper component mounting and a detached fill for large `For` renders, and fixes a static `<select>` value being lost. `@praxisjs/vite-plugin` compiles JSX trees of host elements into templates cloned per render (`templates` option, on by default).
|
|
19
|
+
- 75115a9: Add a keyed selection primitive. `selector(source, equals?)` in `@praxisjs/core/internal` and the `@Selector(field, { equals })` field decorator expose `isSelected(key)`, whose subscribers are grouped by key: a change to the source re-runs only the effects that read the previous or the next key, instead of every row comparing against it. Key buckets and the source subscription are released when their effects are disposed.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 75115a9: Edge-case fixes in the new fast paths. `@praxisjs/vite-plugin` keeps a claimed field's initializer in the field's own scope instead of moving it into the constructor, where a constructor parameter or local of the same name shadowed what it read (and `new.target` fields are claimed too). `selector()` from `@praxisjs/core` compares against the current source value when read outside an effect, also inside a batch or an event handler before its subscribers are notified. `@praxisjs/runtime` keeps updating a hydrated element through a reactive child that fills it alone, rebuilds compiled templates when `render()` runs with another global document (a new SSG window), and always writes `open`, `selectedIndex`, media and scroll props from reactive bindings so a re-run restores what the user changed. Compiled templates keep the leading whitespace of JSX text (`{v} / {m}` lost its first space) and keep tabs inside a line, as the JSX transform does. Methods of `@Bind`, `@Emit` and the other built-in method decorators can be spied on with `vi.spyOn(instance, name)` before their first read again. `@praxisjs/router`'s `Link` removes its `class` attribute when it stops being active instead of leaving `class=""`.
|
|
24
|
+
- 75115a9: Published packages no longer contain their tests: package builds compile `src` without `src/**/__tests__` (through a `tsconfig.build.json`), and each package's `files` leaves test sources and stale compiled tests out of the tarball. `pnpm typecheck` still type-checks the tests.
|
|
25
|
+
- 75115a9: Smaller production bundles. The framework and feature packages are marked `"sideEffects": false`, so bundlers leave out the modules an app does not use (`For`/`Index` and `selector()` were kept in every bundle by their shape keepers). `@praxisjs/core`'s graph gates its observer instrumentation on a boolean that minifiers fold away when no observer is ever installed. `@praxisjs/runtime` passes `Index`'s positional update to the list view, so `For`-only apps leave it out, and builds its event prop table from camel-case names. `@praxisjs/devtools` is built one file per module and its decorators check `process.env.NODE_ENV` inline, so `@Trace`/`@Debug` in production code no longer bundle the registry and the panel. `@praxisjs/vite-plugin` serves TypeScript's decorator helpers and the claimed fields' helper from one virtual module (`virtual:praxisjs/decorators`) instead of writing them into every decorated file, and replaces the identical copies `tsc` wrote into ES module libraries.
|
|
26
|
+
- Updated dependencies [75115a9]
|
|
27
|
+
- Updated dependencies [75115a9]
|
|
28
|
+
- Updated dependencies [75115a9]
|
|
29
|
+
- Updated dependencies [75115a9]
|
|
30
|
+
- Updated dependencies [75115a9]
|
|
31
|
+
- Updated dependencies [75115a9]
|
|
32
|
+
- Updated dependencies [75115a9]
|
|
33
|
+
- @praxisjs/core@2.3.0
|
|
34
|
+
- @praxisjs/shared@0.3.2
|
|
35
|
+
|
|
36
|
+
## 1.7.0
|
|
37
|
+
|
|
38
|
+
### Minor Changes
|
|
39
|
+
|
|
40
|
+
- c7a5950: `@Persisted` now removes its `window` `storage` listener when the component unmounts (each instance used to leave one behind). `@DeepState` returns one stable proxy per nested object instead of a new `Proxy` per read, and no longer notifies for no-op assignments, deletes of missing keys, or the redundant `length` write of an array `push`.
|
|
41
|
+
|
|
42
|
+
`@Memo` keeps the 100 most recently used argument combinations by default (least-recently-used eviction); `@Memo({ max })` changes the limit and `Infinity` restores the unbounded cache. `@History` stops tracking on unmount.
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [a97a37c]
|
|
47
|
+
- @praxisjs/core@2.2.0
|
|
48
|
+
|
|
3
49
|
## 1.6.1
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ComponentConstructor, ComponentInstance } from "@praxisjs/shared/internal";
|
|
2
|
-
export declare function Component(): <T extends new (...args: any[]) => ComponentInstance>(constructor: T,
|
|
2
|
+
export declare function Component(): <T extends new (...args: any[]) => ComponentInstance>(constructor: T, _context: ClassDecoratorContext) => T & ComponentConstructor;
|
|
3
3
|
//# sourceMappingURL=component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/component/component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/component/component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAKnC,wBAAgB,SAAS,KAEN,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,iBAAiB,EAClE,aAAa,CAAC,EACd,UAAU,qBAAqB,KAC9B,CAAC,GAAG,oBAAoB,CAM5B"}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import { StatelessComponent } from "@praxisjs/core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return {};
|
|
6
|
-
}
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
initialize(Enhanced, original) {
|
|
9
|
-
const isStateless = original.prototype instanceof StatelessComponent;
|
|
10
|
-
Object.defineProperty(Enhanced, "__isComponent", { value: true, configurable: true });
|
|
11
|
-
Object.defineProperty(Enhanced, "__isStateless", { value: isStateless, configurable: true });
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
const behavior = new ComponentBehavior();
|
|
2
|
+
// @Component only marks the class for the runtime. It adds no behavior, so it marks the class itself
|
|
3
|
+
// instead of wrapping it in an enhanced subclass: every instance would otherwise pay for the
|
|
4
|
+
// wrapper's per-instance object and per-render closure.
|
|
15
5
|
export function Component() {
|
|
16
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
return function (constructor,
|
|
18
|
-
|
|
7
|
+
return function (constructor, _context) {
|
|
8
|
+
const isStateless = constructor.prototype instanceof StatelessComponent;
|
|
9
|
+
Object.defineProperty(constructor, "__isComponent", { value: true, configurable: true });
|
|
10
|
+
Object.defineProperty(constructor, "__isStateless", { value: isStateless, configurable: true });
|
|
11
|
+
return constructor;
|
|
19
12
|
};
|
|
20
13
|
}
|
|
21
14
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../src/component/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../src/component/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAMpD,qGAAqG;AACrG,6FAA6F;AAC7F,wDAAwD;AACxD,MAAM,UAAU,SAAS;IACvB,8DAA8D;IAC9D,OAAO,UACL,WAAc,EACd,QAA+B;QAE/B,MAAM,WAAW,GAAI,WAAW,CAAC,SAAoB,YAAY,kBAAkB,CAAC;QACpF,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QACzF,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QAChG,OAAO,WAAuC,CAAC;IACjD,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/component/lazy.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ export interface LazyOptions {
|
|
|
13
13
|
/** Extra margin around the root before triggering (e.g. `"200px"`). Defaults to `"100px"`. */
|
|
14
14
|
rootMargin?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare function Lazy(placeholderOrOptions?: number | LazyOptions): <T extends new (...args: any[]) => RootComponent<Record<string, any>>>(constructor: T,
|
|
16
|
+
export declare function Lazy(placeholderOrOptions?: number | LazyOptions): <T extends new (...args: any[]) => RootComponent<Record<string, any>>>(constructor: T, context: ClassDecoratorContext) => T;
|
|
17
17
|
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/component/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/component/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAGnB,MAAM,yBAAyB,CAAC;AAIjC,MAAM,WAAW,WAAW;IAC1B,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,8FAA8F;IAC9F,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA+DD,wBAAgB,IAAI,CAAC,oBAAoB,GAAE,MAAM,GAAG,WAAiB,+HAMpE"}
|
package/dist/component/lazy.js
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
|
-
import { getComponentAnchor,
|
|
1
|
+
import { getComponentAnchor, readSignal, SignalNode, writeSignal, } from "@praxisjs/core/internal";
|
|
2
2
|
import { ClassBehavior, createClassDecorator } from "../create-class-decorator";
|
|
3
|
+
// One object per instance whose methods live on the prototype, instead of three closures.
|
|
4
|
+
class LazyEnhancement {
|
|
5
|
+
instance;
|
|
6
|
+
options;
|
|
7
|
+
visible = new SignalNode(false);
|
|
8
|
+
observer = undefined;
|
|
9
|
+
constructor(instance, options) {
|
|
10
|
+
this.instance = instance;
|
|
11
|
+
this.options = options;
|
|
12
|
+
}
|
|
13
|
+
onMount() {
|
|
14
|
+
const el = getComponentAnchor(this.instance)?.parentElement ?? null;
|
|
15
|
+
if (!el)
|
|
16
|
+
return;
|
|
17
|
+
if (!("IntersectionObserver" in window)) {
|
|
18
|
+
writeSignal(this.visible, true);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const { placeholder = 200, root, rootMargin = "100px" } = this.options;
|
|
22
|
+
if (!this.visible.value)
|
|
23
|
+
el.style.minHeight = `${String(placeholder)}px`;
|
|
24
|
+
const rootEl = root === undefined || root === null ? null : root.current ?? null;
|
|
25
|
+
this.observer = new IntersectionObserver((entries) => {
|
|
26
|
+
if (entries[0]?.isIntersecting) {
|
|
27
|
+
writeSignal(this.visible, true);
|
|
28
|
+
el.style.minHeight = "";
|
|
29
|
+
this.observer?.disconnect();
|
|
30
|
+
}
|
|
31
|
+
}, { root: rootEl, rootMargin });
|
|
32
|
+
this.observer.observe(el);
|
|
33
|
+
}
|
|
34
|
+
onUnmount() {
|
|
35
|
+
this.observer?.disconnect();
|
|
36
|
+
}
|
|
37
|
+
render(originalRender) {
|
|
38
|
+
return (() => {
|
|
39
|
+
if (!readSignal(this.visible))
|
|
40
|
+
return null;
|
|
41
|
+
return originalRender();
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
3
45
|
class LazyBehavior extends ClassBehavior {
|
|
4
46
|
options;
|
|
5
47
|
constructor(options) {
|
|
@@ -7,41 +49,7 @@ class LazyBehavior extends ClassBehavior {
|
|
|
7
49
|
this.options = options;
|
|
8
50
|
}
|
|
9
51
|
create(instance) {
|
|
10
|
-
|
|
11
|
-
const visible = signal(false);
|
|
12
|
-
let observer;
|
|
13
|
-
return {
|
|
14
|
-
onMount() {
|
|
15
|
-
const el = getComponentAnchor(instance)?.parentElement ?? null;
|
|
16
|
-
if (!el)
|
|
17
|
-
return;
|
|
18
|
-
if (!("IntersectionObserver" in window)) {
|
|
19
|
-
visible.set(true);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (!visible())
|
|
23
|
-
el.style.minHeight = `${String(placeholder)}px`;
|
|
24
|
-
const rootEl = root === undefined || root === null ? null : root.current ?? null;
|
|
25
|
-
observer = new IntersectionObserver((entries) => {
|
|
26
|
-
if (entries[0]?.isIntersecting) {
|
|
27
|
-
visible.set(true);
|
|
28
|
-
el.style.minHeight = "";
|
|
29
|
-
observer?.disconnect();
|
|
30
|
-
}
|
|
31
|
-
}, { root: rootEl, rootMargin });
|
|
32
|
-
observer.observe(el);
|
|
33
|
-
},
|
|
34
|
-
onUnmount() {
|
|
35
|
-
observer?.disconnect();
|
|
36
|
-
},
|
|
37
|
-
render(originalRender) {
|
|
38
|
-
return (() => {
|
|
39
|
-
if (!visible())
|
|
40
|
-
return null;
|
|
41
|
-
return originalRender();
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
};
|
|
52
|
+
return new LazyEnhancement(instance, this.options);
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
export function Lazy(placeholderOrOptions = 200) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.js","sourceRoot":"","sources":["../../src/component/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,
|
|
1
|
+
{"version":3,"file":"lazy.js","sourceRoot":"","sources":["../../src/component/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,UAAU,EAEV,UAAU,EACV,WAAW,G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,SAAS,GAAG,EAAE,CAAC;gBACxB,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC;YAC9B,CAAC;QACH,CAAC,EACD,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAC7B,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,SAAS;QACP,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,cAA0C;QAC/C,OAAO,CAAC,GAAG,EAAE;YACX,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;gBAAE,OAAO,IAAI,CAAC;YAC3C,OAAO,cAAc,EAAE,CAAC;QAC1B,CAAC,CAAoB,CAAC;IACxB,CAAC;CACF;AAED,MAAM,YAAa,SAAQ,aAAa;IACT;IAA7B,YAA6B,OAAoB;QAC/C,KAAK,EAAE,CAAC;QADmB,YAAO,GAAP,OAAO,CAAa;IAEjD,CAAC;IAED,MAAM,CAAC,QAAuB;QAC5B,OAAO,IAAI,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;CACF;AAED,MAAM,UAAU,IAAI,CAAC,uBAA6C,GAAG;IACnE,MAAM,OAAO,GACX,OAAO,oBAAoB,KAAK,QAAQ;QACtC,CAAC,CAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE;QACvC,CAAC,CAAC,oBAAoB,CAAC;IAC3B,OAAO,oBAAoB,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
import type { RootComponent } from "@praxisjs/core/internal";
|
|
2
|
+
type RenderResult = Node | Node[] | null;
|
|
2
3
|
export interface ClassEnhancement {
|
|
3
4
|
onMount?(): void;
|
|
4
5
|
onUnmount?(): void;
|
|
5
|
-
render?(originalRender: () =>
|
|
6
|
+
render?(originalRender: () => RenderResult): RenderResult;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
type AnyConstructor = new (...args: any[]) => unknown;
|
|
9
|
+
type AnyComponent = RootComponent<Record<string, any>>;
|
|
10
|
+
/**
|
|
11
|
+
* The behavior a class decorator adds. Every method is optional: hooks that take the instance
|
|
12
|
+
* (`onMount`, `onUnmount`, `render`) live on the behavior itself and allocate nothing per
|
|
13
|
+
* instance; `create` returns a per-instance `ClassEnhancement` when hooks need their own closures.
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class ClassBehavior<Instance extends object = AnyComponent> {
|
|
16
|
+
/** Names the decorator in error messages, e.g. `"@Analytics()"`. */
|
|
17
|
+
label?: string;
|
|
18
|
+
/** Runs once per instance, after its own constructor. */
|
|
19
|
+
create?(instance: Instance): ClassEnhancement;
|
|
20
|
+
/** Runs on every mount of each instance, after the class's own `onMount`. */
|
|
21
|
+
onMount?(instance: Instance): void;
|
|
22
|
+
/** Runs on every unmount of each instance, after the class's own `onUnmount`. */
|
|
23
|
+
onUnmount?(instance: Instance): void;
|
|
24
|
+
/** Wraps every render of each instance; `originalRender` renders the class's own output. */
|
|
25
|
+
render?(instance: Instance, originalRender: () => RenderResult): RenderResult;
|
|
9
26
|
/**
|
|
10
27
|
* Called once after the enhanced class is created.
|
|
11
28
|
* Use this to set static properties on the class constructor itself.
|
|
12
29
|
*/
|
|
13
|
-
initialize?(_Enhanced:
|
|
30
|
+
initialize?(_Enhanced: AnyConstructor, _original: AnyConstructor): void;
|
|
14
31
|
}
|
|
15
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Builds a class decorator from a `ClassBehavior`. The class is extended by a subclass that runs
|
|
34
|
+
* the behavior's hooks; a behavior with only `initialize` leaves the class as it is.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createClassDecorator<Instance extends object = AnyComponent>(behavior: ClassBehavior<Instance>): <T extends new (...args: any[]) => Instance>(constructor: T, context: ClassDecoratorContext) => T;
|
|
37
|
+
export {};
|
|
16
38
|
//# sourceMappingURL=create-class-decorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-class-decorator.d.ts","sourceRoot":"","sources":["../src/create-class-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-class-decorator.d.ts","sourceRoot":"","sources":["../src/create-class-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI7D,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,SAAS,CAAC,IAAI,IAAI,CAAC;IACnB,MAAM,CAAC,CAAC,cAAc,EAAE,MAAM,YAAY,GAAG,YAAY,CAAC;CAC3D;AAGD,KAAK,cAAc,GAAG,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAEtD,KAAK,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;AAEvD;;;;GAIG;AACH,8BAAsB,aAAa,CAAC,QAAQ,SAAS,MAAM,GAAG,YAAY;IACxE,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,yDAAyD;IACzD,MAAM,CAAC,CAAC,QAAQ,EAAE,QAAQ,GAAG,gBAAgB;IAE7C,6EAA6E;IAC7E,OAAO,CAAC,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAElC,iFAAiF;IACjF,SAAS,CAAC,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAEpC,4FAA4F;IAC5F,MAAM,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,GAAG,YAAY;IAE7E;;;OAGG;IACH,UAAU,CAAC,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,GAAG,IAAI;CACxE;AAkBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,SAAS,MAAM,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC,IAI1G,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,QAAQ,EAC1C,aAAa,CAAC,EAAE,SAAS,qBAAqB,KAAG,CAAC,CA6DrD"}
|
|
@@ -1,40 +1,75 @@
|
|
|
1
|
+
import { assertMemberKind } from "./field";
|
|
2
|
+
/**
|
|
3
|
+
* The behavior a class decorator adds. Every method is optional: hooks that take the instance
|
|
4
|
+
* (`onMount`, `onUnmount`, `render`) live on the behavior itself and allocate nothing per
|
|
5
|
+
* instance; `create` returns a per-instance `ClassEnhancement` when hooks need their own closures.
|
|
6
|
+
*/
|
|
1
7
|
export class ClassBehavior {
|
|
8
|
+
/** Names the decorator in error messages, e.g. `"@Analytics()"`. */
|
|
9
|
+
label;
|
|
2
10
|
}
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
|
|
11
|
+
// Keyed by symbols so they can't collide with the component's own fields.
|
|
12
|
+
const ENHANCEMENT = Symbol("praxis.classEnhancement");
|
|
13
|
+
// Set on an instance while its render is being called as `originalRender` from within an
|
|
14
|
+
// enhancement. While set, the Enhanced render skips the enhancement's render so stacked decorators
|
|
15
|
+
// (e.g. @Lazy + another render-overriding decorator) don't re-enter the outermost one recursively.
|
|
16
|
+
const IN_ORIGINAL_RENDER = Symbol("praxis.inOriginalRender");
|
|
17
|
+
const NO_ENHANCEMENT = Object.freeze({});
|
|
18
|
+
/**
|
|
19
|
+
* Builds a class decorator from a `ClassBehavior`. The class is extended by a subclass that runs
|
|
20
|
+
* the behavior's hooks; a behavior with only `initialize` leaves the class as it is.
|
|
21
|
+
*/
|
|
8
22
|
export function createClassDecorator(behavior) {
|
|
9
|
-
|
|
23
|
+
const label = behavior.label ?? "This class decorator";
|
|
24
|
+
return function (constructor, context) {
|
|
25
|
+
assertMemberKind(context, "class", label);
|
|
26
|
+
const hasCreate = behavior.create !== undefined;
|
|
27
|
+
const sharedRender = behavior.render !== undefined;
|
|
28
|
+
if (!hasCreate && !sharedRender && behavior.onMount === undefined && behavior.onUnmount === undefined) {
|
|
29
|
+
behavior.initialize?.(constructor, constructor);
|
|
30
|
+
return constructor;
|
|
31
|
+
}
|
|
32
|
+
const original = constructor.prototype.render;
|
|
10
33
|
const Enhanced = class extends constructor {
|
|
11
|
-
|
|
34
|
+
[ENHANCEMENT] = hasCreate
|
|
35
|
+
? behavior.create(this)
|
|
36
|
+
: NO_ENHANCEMENT;
|
|
12
37
|
onMount() {
|
|
13
38
|
super.onMount?.();
|
|
14
|
-
|
|
39
|
+
behavior.onMount?.(this);
|
|
40
|
+
this[ENHANCEMENT].onMount?.();
|
|
15
41
|
}
|
|
16
42
|
onUnmount() {
|
|
17
43
|
super.onUnmount?.();
|
|
18
|
-
|
|
44
|
+
behavior.onUnmount?.(this);
|
|
45
|
+
this[ENHANCEMENT].onUnmount?.();
|
|
19
46
|
}
|
|
20
47
|
render(...args) {
|
|
21
|
-
const
|
|
22
|
-
|
|
48
|
+
const render = original;
|
|
49
|
+
const host = this;
|
|
50
|
+
const enhancement = host[ENHANCEMENT];
|
|
51
|
+
if ((!sharedRender && enhancement.render === undefined) || host[IN_ORIGINAL_RENDER] === true) {
|
|
52
|
+
return render.apply(this, args);
|
|
53
|
+
}
|
|
54
|
+
const renderOriginal = () => {
|
|
55
|
+
host[IN_ORIGINAL_RENDER] = true;
|
|
23
56
|
try {
|
|
24
|
-
return
|
|
57
|
+
return render.apply(this, args);
|
|
25
58
|
}
|
|
26
59
|
finally {
|
|
27
|
-
|
|
60
|
+
host[IN_ORIGINAL_RENDER] = false;
|
|
28
61
|
}
|
|
29
62
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
63
|
+
const inner = enhancement.render === undefined
|
|
64
|
+
? renderOriginal
|
|
65
|
+
: () => enhancement.render(renderOriginal);
|
|
66
|
+
if (!sharedRender)
|
|
67
|
+
return inner();
|
|
68
|
+
return behavior.render(this, inner);
|
|
34
69
|
}
|
|
35
70
|
};
|
|
36
71
|
// If the original class has no render, remove the wrapper so instances see `undefined`.
|
|
37
|
-
if (typeof
|
|
72
|
+
if (typeof original !== "function") {
|
|
38
73
|
delete Enhanced.prototype.render;
|
|
39
74
|
}
|
|
40
75
|
Object.defineProperty(Enhanced, "name", { value: constructor.name });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-class-decorator.js","sourceRoot":"","sources":["../src/create-class-decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-class-decorator.js","sourceRoot":"","sources":["../src/create-class-decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAe3C;;;;GAIG;AACH,MAAM,OAAgB,aAAa;IACjC,oEAAoE;IACpE,KAAK,CAAU;CAmBhB;AAED,0EAA0E;AAC1E,MAAM,WAAW,GAAkB,MAAM,CAAC,yBAAyB,CAAC,CAAC;AACrE,yFAAyF;AACzF,mGAAmG;AACnG,mGAAmG;AACnG,MAAM,kBAAkB,GAAkB,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAE5E,MAAM,cAAc,GAAqB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAS3D;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAyC,QAAiC;IAC5G,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,sBAAsB,CAAC;IACvD,OAAO,UAGL,WAAc,EAAE,OAA8B;QAC9C,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC1C,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,KAAK,SA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CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAClC,CAAC;gBACD,MAAM,cAAc,GAAG,GAAiB,EAAE;oBACxC,IAAI,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;oBAChC,IAAI,CAAC;wBACH,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;oBAClC,CAAC;4BAAS,CAAC;wBACT,IAAI,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC;oBACnC,CAAC;gBACH,CAAC,CAAC;gBACF,MAAM,KAAK,GACT,WAAW,CAAC,MAAM,KAAK,SAAS;oBAC9B,CAAC,CAAC,cAAc;oBAChB,CAAC,CAAC,GAAG,EAAE,CAAE,WAA0C,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;gBAC/E,IAAI,CAAC,YAAY;oBAAE,OAAO,KAAK,EAAE,CAAC;gBAClC,OAAQ,QAA8D,CAAC,MAAM,CAAC,IAA2B,EAAE,KAAK,CAAC,CAAC;YACpH,CAAC;SACF,CAAC;QAEF,wFAAwF;QACxF,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACnC,OAAQ,QAAQ,CAAC,SAAkC,CAAC,MAAM,CAAC;QAC7D,CAAC;QAED,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QACrE,QAAQ,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC7C,OAAO,QAAwB,CAAC;IAClC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StatefulComponent } from "@praxisjs/core";
|
|
2
|
+
import { type FieldDecorator } from "./field";
|
|
2
3
|
export interface FieldBinding {
|
|
3
4
|
/** Replaces the decorated property. If absent, the original property is left untouched. */
|
|
4
5
|
descriptor?: PropertyDescriptor;
|
|
@@ -7,8 +8,46 @@ export interface FieldBinding {
|
|
|
7
8
|
onMount?: () => void;
|
|
8
9
|
onUnmount?: () => void;
|
|
9
10
|
}
|
|
10
|
-
export interface FieldBehavior<T = object> {
|
|
11
|
-
|
|
11
|
+
export interface FieldBehavior<T = object, Value = unknown> {
|
|
12
|
+
/** Names the decorator in error messages, e.g. `"@SessionValue()"`. */
|
|
13
|
+
label?: string;
|
|
14
|
+
/** Runs once per instance, while it is built. */
|
|
15
|
+
bind(instance: T, name: string, initialValue: Value): FieldBinding;
|
|
12
16
|
}
|
|
13
|
-
|
|
17
|
+
/**
|
|
18
|
+
* What a shared field decorator installs. `get` and `set` become one accessor pair shared by every
|
|
19
|
+
* instance (`this` is the instance), so per-instance state belongs in symbol slots on the instance,
|
|
20
|
+
* created in `init`.
|
|
21
|
+
*/
|
|
22
|
+
export interface FieldSetup<This = object, Value = unknown> {
|
|
23
|
+
get?(this: This): Value;
|
|
24
|
+
set?(this: This, value: Value): void;
|
|
25
|
+
/**
|
|
26
|
+
* Runs once per instance, before `get`/`set` are installed, with the field's initial value. A
|
|
27
|
+
* decorator stacked under this one has already installed its own property.
|
|
28
|
+
*/
|
|
29
|
+
init?: (instance: This, initialValue: Value) => void;
|
|
30
|
+
onMount?: (instance: This) => void;
|
|
31
|
+
onUnmount?: (instance: This) => void;
|
|
32
|
+
/** Defaults to `true`, like a plain field. */
|
|
33
|
+
enumerable?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface SharedFieldBehavior<Host = object, Value = unknown> {
|
|
36
|
+
/** Names the decorator in error messages, e.g. `"@Clamp()"`. */
|
|
37
|
+
label?: string;
|
|
38
|
+
/** Runs once per decorated field, when the class is defined. */
|
|
39
|
+
setup(name: string, context: ClassFieldDecoratorContext<Host, Value>): FieldSetup<Host, Value>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Builds a field decorator.
|
|
43
|
+
*
|
|
44
|
+
* With `setup`, the recommended form, the decorator's accessors are created once per decorated
|
|
45
|
+
* field and shared by every instance, which keeps its state in symbol slots: building an instance
|
|
46
|
+
* allocates no closures and every instance keeps the same hidden class.
|
|
47
|
+
*
|
|
48
|
+
* With `bind`, a binding (descriptor, hooks, extra properties) is created for each instance, which
|
|
49
|
+
* suits decorators that wrap whatever property a decorator stacked under them installed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createFieldDecorator<Host = object, Value = unknown>(behavior: SharedFieldBehavior<Host, Value>): FieldDecorator<Host, Value>;
|
|
52
|
+
export declare function createFieldDecorator<T = StatefulComponent, Value = unknown>(behavior: FieldBehavior<T, Value>): FieldDecorator<T, Value>;
|
|
14
53
|
//# sourceMappingURL=create-field-decorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-field-decorator.d.ts","sourceRoot":"","sources":["../src/create-field-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,WAAW,YAAY;IAC3B,2FAA2F;IAC3F,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,iGAAiG;IACjG,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"create-field-decorator.d.ts","sourceRoot":"","sources":["../src/create-field-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAA8D,KAAK,cAAc,EAAkB,MAAM,SAAS,CAAC;AAG1H,MAAM,WAAW,YAAY;IAC3B,2FAA2F;IAC3F,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,iGAAiG;IACjG,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAA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E,KAAK,GAAG,OAAO,EACjE,QAAQ,EAAE,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,GACzC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC/B,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,iBAAiB,EAAE,KAAK,GAAG,OAAO,EACzE,QAAQ,EAAE,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,GAChC,cAAc,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -1,37 +1,73 @@
|
|
|
1
|
-
|
|
1
|
+
import { addClaimableInitializer, assertFieldContext, describeValue } from "./field";
|
|
2
|
+
import { addLifecycleHooks } from "./lifecycle";
|
|
3
|
+
const DEFAULT_LABEL = "This field decorator";
|
|
4
|
+
function defineValue(instance, name, value) {
|
|
5
|
+
Object.defineProperty(instance, name, { value, writable: true, enumerable: true, configurable: true });
|
|
6
|
+
}
|
|
7
|
+
function bindField(behavior) {
|
|
8
|
+
const label = behavior.label ?? DEFAULT_LABEL;
|
|
2
9
|
return function (_value, context) {
|
|
3
|
-
context
|
|
10
|
+
assertFieldContext(context, label);
|
|
11
|
+
const name = context.name;
|
|
12
|
+
addClaimableInitializer(context, function (initialValue) {
|
|
4
13
|
const instance = this;
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
14
|
+
const binding = behavior.bind(instance, name, initialValue);
|
|
15
|
+
if (typeof binding !== "object" || binding === null) {
|
|
16
|
+
throw new TypeError(`${label}: bind() must return an object (a FieldBinding), got ${describeValue(binding)}.`);
|
|
17
|
+
}
|
|
18
|
+
const { descriptor, additional, onMount, onUnmount } = binding;
|
|
8
19
|
if (descriptor) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
...descriptor,
|
|
14
|
-
});
|
|
20
|
+
// The descriptor is fresh from bind(), so defaults are filled in place rather than copied.
|
|
21
|
+
descriptor.enumerable ??= true;
|
|
22
|
+
descriptor.configurable ??= true;
|
|
23
|
+
Object.defineProperty(instance, name, descriptor);
|
|
15
24
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
...desc,
|
|
20
|
-
});
|
|
25
|
+
else if (!Object.hasOwn(instance, name)) {
|
|
26
|
+
// A binding without a descriptor keeps the plain field, which a claimed field has not got yet.
|
|
27
|
+
defineValue(instance, name, initialValue);
|
|
21
28
|
}
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
instance.onUnmount = () => {
|
|
30
|
-
prevUnmount?.();
|
|
31
|
-
onUnmount?.();
|
|
32
|
-
};
|
|
29
|
+
if (additional) {
|
|
30
|
+
for (const key in additional) {
|
|
31
|
+
const desc = additional[key];
|
|
32
|
+
desc.configurable ??= true;
|
|
33
|
+
Object.defineProperty(instance, key, desc);
|
|
34
|
+
}
|
|
33
35
|
}
|
|
36
|
+
if (onMount ?? onUnmount)
|
|
37
|
+
addLifecycleHooks(instance, onMount, onUnmount);
|
|
34
38
|
});
|
|
35
39
|
};
|
|
36
40
|
}
|
|
41
|
+
function sharedFieldDecorator(behavior) {
|
|
42
|
+
const label = behavior.label ?? DEFAULT_LABEL;
|
|
43
|
+
return function (_value, context) {
|
|
44
|
+
assertFieldContext(context, label);
|
|
45
|
+
const name = context.name;
|
|
46
|
+
const result = behavior.setup(name, context);
|
|
47
|
+
if (typeof result !== "object" || result === null) {
|
|
48
|
+
throw new TypeError(`${label}: setup() must return an object (a FieldSetup), got ${describeValue(result)}.`);
|
|
49
|
+
}
|
|
50
|
+
const field = result;
|
|
51
|
+
const { init, onMount, onUnmount } = field;
|
|
52
|
+
const descriptor = field.get === undefined && field.set === undefined
|
|
53
|
+
? undefined
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method -- installed as accessors, which call them with the instance as `this`
|
|
55
|
+
: { get: field.get, set: field.set, enumerable: field.enumerable ?? true, configurable: true };
|
|
56
|
+
const hooks = onMount !== undefined || onUnmount !== undefined;
|
|
57
|
+
addClaimableInitializer(context, function (value) {
|
|
58
|
+
const instance = this;
|
|
59
|
+
init?.(instance, value);
|
|
60
|
+
if (descriptor !== undefined)
|
|
61
|
+
Object.defineProperty(instance, name, descriptor);
|
|
62
|
+
else if (!Object.hasOwn(instance, name))
|
|
63
|
+
defineValue(instance, name, value);
|
|
64
|
+
if (hooks) {
|
|
65
|
+
addLifecycleHooks(instance, onMount, onUnmount);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function createFieldDecorator(behavior) {
|
|
71
|
+
return "setup" in behavior ? sharedFieldDecorator(behavior) : bindField(behavior);
|
|
72
|
+
}
|
|
37
73
|
//# sourceMappingURL=create-field-decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-field-decorator.js","sourceRoot":"","sources":["../src/create-field-decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-field-decorator.js","sourceRoot":"","sources":["../src/create-field-decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,aAAa,EAAuC,MAAM,SAAS,CAAC;AAC1H,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AA4ChD,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAE7C,SAAS,WAAW,CAAC,QAAgB,EAAE,IAAY,EAAE,KAAc;IACjE,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;AACzG,CAAC;AAED,SAAS,SAAS,CAAW,QAAiC;IAC5D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,aAAa,CAAC;IAC9C,OAAO,UAAU,MAAM,EAAE,OAAO;QAC9B,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