@fluffjs/fluff 0.4.5 → 0.5.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.
Files changed (77) hide show
  1. package/bundle.min.js +1 -1
  2. package/decorators/Directive.d.ts +16 -0
  3. package/decorators/Directive.js +23 -0
  4. package/decorators/HostElement.d.ts +1 -0
  5. package/decorators/HostElement.js +4 -0
  6. package/index.d.ts +4 -0
  7. package/index.js +3 -0
  8. package/interfaces/ElementWithDirectives.d.ts +4 -0
  9. package/interfaces/FluffHostElement.d.ts +3 -10
  10. package/package.json +1 -1
  11. package/runtime/BreakController.d.ts +2 -3
  12. package/runtime/BreakController.js +0 -3
  13. package/runtime/FluffBase.d.ts +50 -42
  14. package/runtime/FluffBase.js +185 -242
  15. package/runtime/FluffDirective.d.ts +9 -0
  16. package/runtime/FluffDirective.js +36 -0
  17. package/runtime/FluffElement.d.ts +0 -1
  18. package/runtime/FluffElementImpl.d.ts +5 -10
  19. package/runtime/FluffElementImpl.js +59 -77
  20. package/runtime/FluffMarkers.d.ts +0 -1
  21. package/runtime/FluffMarkers.js +0 -1
  22. package/runtime/ForController.d.ts +2 -5
  23. package/runtime/ForController.js +7 -9
  24. package/runtime/IfController.d.ts +2 -5
  25. package/runtime/IfController.js +12 -13
  26. package/runtime/MarkerController.d.ts +9 -11
  27. package/runtime/MarkerController.js +6 -3
  28. package/runtime/MarkerManager.d.ts +2 -5
  29. package/runtime/MarkerManager.js +11 -50
  30. package/runtime/MarkerManagerInterface.d.ts +5 -2
  31. package/runtime/SwitchController.d.ts +2 -5
  32. package/runtime/SwitchController.js +10 -13
  33. package/runtime/TextController.d.ts +2 -4
  34. package/runtime/TextController.js +8 -16
  35. package/runtime/tests/DirectOutputParent.js +4 -1
  36. package/runtime/tests/TestChildTasksListComponent.js +4 -1
  37. package/runtime/tests/TestForComponent.js +4 -1
  38. package/runtime/tests/TestForReinsertBindsInputParentComponent.js +7 -2
  39. package/runtime/tests/TestForTextMarkerCollisionNoTrackParentComponent.js +5 -2
  40. package/runtime/tests/TestForTextMarkerCollisionParentComponent.js +5 -10
  41. package/runtime/tests/TestForUnsubscribeNestedParentComponent.js +7 -2
  42. package/runtime/tests/TestGetterReactivityComponent.js +4 -1
  43. package/runtime/tests/TestHarness.d.ts +1 -1
  44. package/runtime/tests/TestHarness.js +3 -3
  45. package/runtime/tests/TestIfReinsertBindsInputChildComponent.js +4 -1
  46. package/runtime/tests/TestIfReinsertBindsInputParentComponent.js +7 -2
  47. package/runtime/tests/TestIfUnsubscribeNestedParentComponent.js +7 -2
  48. package/runtime/tests/TestInterpolationNestedPropertyComponentBase.js +4 -1
  49. package/runtime/tests/TestLateDefineForComponent.js +4 -1
  50. package/runtime/tests/TestNullInputTextComponent.js +5 -2
  51. package/runtime/tests/TestOutputBindingChildComponent.js +4 -1
  52. package/runtime/tests/TestOutputBindingParentComponent.js +7 -2
  53. package/runtime/tests/TestParentBindsTasksComponent.js +4 -1
  54. package/runtime/tests/TestSwitchReinsertBindsInputChildComponent.js +4 -1
  55. package/runtime/tests/TestSwitchReinsertBindsInputParentComponent.js +8 -10
  56. package/runtime/tests/TestSwitchUnsubscribeNestedParentComponent.js +7 -9
  57. package/runtime/tests/TestTemplateNestedMarkersComponent.js +5 -2
  58. package/runtime/tests/TestUnsubscribeNestedChildComponent.js +4 -1
  59. package/runtime/tests/TestUnsubscribeNestedGrandchildComponent.js +4 -1
  60. package/runtime/tests/createPipeUnwrapTestComponent.js +4 -1
  61. package/runtime/tests/createPropBindParentComponent.js +4 -1
  62. package/runtime/tests/createTestInterpolationPipeComponent.js +4 -1
  63. package/runtime/tests/createTestInterpolationPipeWithArgsComponent.js +4 -1
  64. package/interfaces/BreakMarkerConfig.d.ts +0 -3
  65. package/interfaces/ForMarkerConfig.d.ts +0 -8
  66. package/interfaces/ForMarkerConfig.js +0 -1
  67. package/interfaces/IfMarkerConfig.d.ts +0 -7
  68. package/interfaces/IfMarkerConfig.js +0 -1
  69. package/interfaces/MarkerConfig.d.ts +0 -6
  70. package/interfaces/MarkerConfig.js +0 -1
  71. package/interfaces/SwitchMarkerConfig.d.ts +0 -10
  72. package/interfaces/SwitchMarkerConfig.js +0 -1
  73. package/interfaces/TextMarkerConfig.d.ts +0 -9
  74. package/interfaces/TextMarkerConfig.js +0 -1
  75. package/runtime/MarkerConfigGuards.d.ts +0 -13
  76. package/runtime/MarkerConfigGuards.js +0 -17
  77. /package/interfaces/{BreakMarkerConfig.js → ElementWithDirectives.js} +0 -0
@@ -1,4 +1,5 @@
1
1
  import { Property } from '../../utils/Property.js';
2
+ import { FluffBase } from '../FluffBase.js';
2
3
  import { FluffElement } from '../FluffElementImpl.js';
3
4
  import { MarkerManager } from '../MarkerManager.js';
4
5
  export function createTestInterpolationPipeComponent() {
@@ -22,8 +23,10 @@ export function createTestInterpolationPipeComponent() {
22
23
  };
23
24
  __render() {
24
25
  this.__getShadowRoot().innerHTML = '<span><!--fluff:text:0--><!--/fluff:text:0--></span>';
26
+ const si = FluffBase.__s.length;
27
+ FluffBase.__s.push('message', 'uppercase');
25
28
  this.__setMarkerConfigs([
26
- [0, { type: 'text', exprId: 0, deps: ['message'], pipes: [{ name: 'uppercase', argExprIds: [] }] }]
29
+ [0, [2, 0, [si], [[si + 1, []]]]]
27
30
  ]);
28
31
  }
29
32
  __setupBindings() {
@@ -1,4 +1,5 @@
1
1
  import { Property } from '../../utils/Property.js';
2
+ import { FluffBase } from '../FluffBase.js';
2
3
  import { FluffElement } from '../FluffElementImpl.js';
3
4
  import { MarkerManager } from '../MarkerManager.js';
4
5
  export function createTestInterpolationPipeWithArgsComponent() {
@@ -22,8 +23,10 @@ export function createTestInterpolationPipeWithArgsComponent() {
22
23
  };
23
24
  __render() {
24
25
  this.__getShadowRoot().innerHTML = '<span><!--fluff:text:0--><!--/fluff:text:0--></span>';
26
+ const si = FluffBase.__s.length;
27
+ FluffBase.__s.push('message', 'truncate');
25
28
  this.__setMarkerConfigs([
26
- [0, { type: 'text', exprId: 0, deps: ['message'], pipes: [{ name: 'truncate', argExprIds: [1] }] }]
29
+ [0, [2, 0, [si], [[si + 1, [1]]]]]
27
30
  ]);
28
31
  }
29
32
  __setupBindings() {
@@ -1,3 +0,0 @@
1
- export interface BreakMarkerConfig {
2
- type: 'break';
3
- }
@@ -1,8 +0,0 @@
1
- export interface ForMarkerConfig {
2
- type: 'for';
3
- iterator: string;
4
- iterableExprId: number;
5
- deps?: (string | string[])[];
6
- trackBy?: string;
7
- hasEmpty: boolean;
8
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- export interface IfMarkerConfig {
2
- type: 'if';
3
- branches: {
4
- exprId?: number;
5
- deps?: (string | string[])[];
6
- }[];
7
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import type { BreakMarkerConfig } from './BreakMarkerConfig.js';
2
- import type { ForMarkerConfig } from './ForMarkerConfig.js';
3
- import type { IfMarkerConfig } from './IfMarkerConfig.js';
4
- import type { SwitchMarkerConfig } from './SwitchMarkerConfig.js';
5
- import type { TextMarkerConfig } from './TextMarkerConfig.js';
6
- export type MarkerConfig = IfMarkerConfig | ForMarkerConfig | SwitchMarkerConfig | TextMarkerConfig | BreakMarkerConfig;
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- export interface SwitchMarkerConfig {
2
- type: 'switch';
3
- expressionExprId: number;
4
- deps?: (string | string[])[];
5
- cases: {
6
- valueExprId?: number;
7
- isDefault: boolean;
8
- fallthrough: boolean;
9
- }[];
10
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- export interface TextMarkerConfig {
2
- type: 'text';
3
- exprId: number;
4
- deps?: (string | string[])[];
5
- pipes?: {
6
- name: string;
7
- argExprIds: number[];
8
- }[];
9
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- import type { BreakMarkerConfig } from '../interfaces/BreakMarkerConfig.js';
2
- import type { ForMarkerConfig } from '../interfaces/ForMarkerConfig.js';
3
- import type { IfMarkerConfig } from '../interfaces/IfMarkerConfig.js';
4
- import type { MarkerConfig } from '../interfaces/MarkerConfig.js';
5
- import type { SwitchMarkerConfig } from '../interfaces/SwitchMarkerConfig.js';
6
- import type { TextMarkerConfig } from '../interfaces/TextMarkerConfig.js';
7
- export declare class MarkerConfigGuards {
8
- static isIfConfig(config: MarkerConfig): config is IfMarkerConfig;
9
- static isForConfig(config: MarkerConfig): config is ForMarkerConfig;
10
- static isSwitchConfig(config: MarkerConfig): config is SwitchMarkerConfig;
11
- static isTextConfig(config: MarkerConfig): config is TextMarkerConfig;
12
- static isBreakConfig(config: MarkerConfig): config is BreakMarkerConfig;
13
- }
@@ -1,17 +0,0 @@
1
- export class MarkerConfigGuards {
2
- static isIfConfig(config) {
3
- return config.type === 'if';
4
- }
5
- static isForConfig(config) {
6
- return config.type === 'for';
7
- }
8
- static isSwitchConfig(config) {
9
- return config.type === 'switch';
10
- }
11
- static isTextConfig(config) {
12
- return config.type === 'text';
13
- }
14
- static isBreakConfig(config) {
15
- return config.type === 'break';
16
- }
17
- }