@nordcraft/ssr 1.0.92 → 1.0.94

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.
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/utils/routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AAChF,OAAO,EACL,YAAY,EACZ,eAAe,GAEhB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAsB,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,0CAA0C,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,gCAAgC,GACjC,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AActD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,UAAU,EACV,KAAK,EACL,OAAO,GAKR,EAMC,EAAE,CAAC;IACH,MAAM,QAAQ,GAAU,EAAE,CAAA;IAC1B,MAAM,SAAS,GAA2B,EAAE,CAAA;IAC5C,MAAM,OAAO,GAA2B,EAAE,CAAA;IAE1C,MAAM,MAAM,GAAW;QACrB,MAAM,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE;QACnC,KAAK,EAAE,EAAE;KACV,CAAA;IACD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,OAAO,CA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SAAS,EAAE,CAAC;YAC5B,OAAO;gBACL,GAAG,GAAG;gBACN,CAAC,GAAG,CAAC,EAAE,IAAI;aACZ,CAAA;QACH,CAAC;QAED,OAAO;YACL,GAAG,GAAG;YACN,CAAC,GAAG,CAAC,EAAE;gBACL,GAAG,IAAI;gBACP,GAAG,EAAE,IAAI,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG;aAC7C;SACF,CAAA;IAAA,CACF,EAAE,EAAE,CAAC;CACP,CAAC,CAAA"}
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/utils/tags.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAC5B,CAAC,MAAc,EAAE,MAAc,EAAE,EAAE,CAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,CAAC;IAC7D,GAAG,SAAS;IACZ,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;QACvE,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO;gBACL,GAAG,GAAG;gBACN,CAAC,GAAG,CAAC,EAAE,IAAI;aACZ,CAAA;QACH,CAAC;QAED,OAAO;YACL,GAAG,GAAG;YACN,CAAC,GAAG,CAAC,EAAE;gBACL,GAAG,IAAI;gBACP,GAAG,EAAE,IAAI,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG;aAC7C;SACF,CAAA;IACH,CAAC,EAAE,EAAE,CAAC;CACP,CAAC,CAAA"}
package/package.json CHANGED
@@ -21,11 +21,11 @@
21
21
  "main": "dist/index.js",
22
22
  "types": "dist/index.d.ts",
23
23
  "dependencies": {
24
- "@nordcraft/core": "1.0.92",
25
- "@nordcraft/std-lib": "1.0.92",
24
+ "@nordcraft/core": "1.0.94",
25
+ "@nordcraft/std-lib": "1.0.94",
26
26
  "fast-deep-equal": "3.1.3",
27
27
  "cookie": "1.0.2",
28
28
  "xss": "1.0.15"
29
29
  },
30
- "version": "1.0.92"
30
+ "version": "1.0.94"
31
31
  }
@@ -364,148 +364,143 @@ describe('renderPageBody', () => {
364
364
  )
365
365
  })
366
366
 
367
- // Disabled test
368
-
369
367
  // Bug: https://discord.com/channels/972416966683926538/1458387768504746068/1458387768504746068
370
368
  // TODO: Fix rendering so that context is properly passed through slots. Rendering should go through inner components before slotted content.
371
- test.failing(
372
- 'should render context value when consumer is through multiple slots of a wrapped provider',
373
- async () => {
374
- // Four components required for test setup:
375
- // PageComponent - uses WrappedProviderComponent with a slotted ConsumerComponent
376
- // WrappedProviderComponent - uses ProviderComponent and passes slot to it
377
- // ProviderComponent - provides context value to its children through a slot
378
- // ConsumerComponent - consumes context value and renders it
379
- const pageComponent: Component = {
380
- name: 'PageComponent',
381
- nodes: {
382
- root: {
383
- type: 'component',
384
- name: 'WrappedProviderComponent',
385
- attrs: {},
386
- children: ['consumerSlot'],
387
- events: {},
388
- style: {},
389
- },
390
- consumerSlot: {
391
- type: 'component',
392
- name: 'ConsumerComponent',
393
- attrs: {},
394
- children: [],
395
- events: {},
396
- style: {},
397
- },
369
+ test('should render context value when consumer is through multiple slots of a wrapped provider', async () => {
370
+ // Four components required for test setup:
371
+ // PageComponent - uses WrappedProviderComponent with a slotted ConsumerComponent
372
+ // WrappedProviderComponent - uses ProviderComponent and passes slot to it
373
+ // ProviderComponent - provides context value to its children through a slot
374
+ // ConsumerComponent - consumes context value and renders it
375
+ const pageComponent: Component = {
376
+ name: 'PageComponent',
377
+ nodes: {
378
+ root: {
379
+ type: 'component',
380
+ name: 'WrappedProviderComponent',
381
+ attrs: {},
382
+ children: ['consumerSlot'],
383
+ events: {},
384
+ style: {},
398
385
  },
399
- formulas: {},
400
- apis: {},
401
- attributes: {},
402
- variables: {},
403
- events: [],
404
- }
405
-
406
- const wrappedProviderComponent: Component = {
407
- name: 'WrappedProviderComponent',
408
- nodes: {
409
- root: {
410
- type: 'component',
411
- name: 'ProviderComponent',
412
- attrs: {},
413
- children: ['slot'],
414
- events: {},
415
- style: {},
416
- },
417
- slot: {
418
- type: 'slot',
419
- children: [],
420
- },
386
+ consumerSlot: {
387
+ type: 'component',
388
+ name: 'ConsumerComponent',
389
+ attrs: {},
390
+ children: [],
391
+ events: {},
392
+ style: {},
421
393
  },
422
- formulas: {},
423
- apis: {},
424
- attributes: {},
425
- variables: {},
426
- events: [],
427
- }
428
-
429
- const providerComponent: Component = {
430
- name: 'ProviderComponent',
431
- formulas: {
432
- contextValue: {
433
- name: 'contextValue',
434
- exposeInContext: true,
435
- formula: {
436
- type: 'value',
437
- value: 'provided-value',
438
- },
439
- },
394
+ },
395
+ formulas: {},
396
+ apis: {},
397
+ attributes: {},
398
+ variables: {},
399
+ events: [],
400
+ }
401
+
402
+ const wrappedProviderComponent: Component = {
403
+ name: 'WrappedProviderComponent',
404
+ nodes: {
405
+ root: {
406
+ type: 'component',
407
+ name: 'ProviderComponent',
408
+ attrs: {},
409
+ children: ['slot'],
410
+ events: {},
411
+ style: {},
440
412
  },
441
- nodes: {
442
- root: {
443
- type: 'slot',
444
- children: [],
445
- },
413
+ slot: {
414
+ type: 'slot',
415
+ children: [],
446
416
  },
447
- }
417
+ },
418
+ formulas: {},
419
+ apis: {},
420
+ attributes: {},
421
+ variables: {},
422
+ events: [],
423
+ }
448
424
 
449
- const consumerComponent: Component = {
450
- name: 'ConsumerComponent',
451
- contexts: {
452
- ProviderComponent: {
453
- formulas: ['contextValue'],
454
- workflows: [],
425
+ const providerComponent: Component = {
426
+ name: 'ProviderComponent',
427
+ formulas: {
428
+ contextValue: {
429
+ name: 'contextValue',
430
+ exposeInContext: true,
431
+ formula: {
432
+ type: 'value',
433
+ value: 'provided-value',
455
434
  },
456
435
  },
457
- nodes: {
458
- root: {
459
- type: 'text',
460
- value: {
461
- type: 'path',
462
- path: ['Contexts', 'ProviderComponent', 'contextValue'],
463
- },
464
- },
436
+ },
437
+ nodes: {
438
+ root: {
439
+ type: 'slot',
440
+ children: [],
441
+ },
442
+ },
443
+ }
444
+
445
+ const consumerComponent: Component = {
446
+ name: 'ConsumerComponent',
447
+ contexts: {
448
+ ProviderComponent: {
449
+ formulas: ['contextValue'],
450
+ workflows: [],
465
451
  },
466
- formulas: {},
467
- apis: {},
468
- attributes: {},
469
- variables: {},
470
- events: [],
471
- }
472
-
473
- const { html } = await renderPageBody({
474
- evaluateComponentApis: () => ({}) as any,
475
- component: pageComponent as any,
476
- formulaContext: {
477
- data: {
478
- Attributes: {},
452
+ },
453
+ nodes: {
454
+ root: {
455
+ type: 'text',
456
+ value: {
457
+ type: 'path',
458
+ path: ['Contexts', 'ProviderComponent', 'contextValue'],
479
459
  },
480
- component: pageComponent,
481
- env: {} as any,
482
- package: undefined,
483
- toddle: {} as any,
484
460
  },
461
+ },
462
+ formulas: {},
463
+ apis: {},
464
+ attributes: {},
465
+ variables: {},
466
+ events: [],
467
+ }
468
+
469
+ const { html } = await renderPageBody({
470
+ evaluateComponentApis: () => ({}) as any,
471
+ component: pageComponent as any,
472
+ formulaContext: {
473
+ data: {
474
+ Attributes: {},
475
+ },
476
+ component: pageComponent,
485
477
  env: {} as any,
486
- files: {
487
- components: {
488
- PageComponent: pageComponent,
489
- WrappedProviderComponent: wrappedProviderComponent,
490
- ProviderComponent: providerComponent,
491
- ConsumerComponent: consumerComponent,
492
- },
493
- } as any,
494
- includedComponents: [
495
- pageComponent,
496
- wrappedProviderComponent,
497
- providerComponent,
498
- consumerComponent,
499
- ],
500
- projectId: 'test-project',
501
- req: {} as any,
502
- })
478
+ package: undefined,
479
+ toddle: {} as any,
480
+ },
481
+ env: {} as any,
482
+ files: {
483
+ components: {
484
+ PageComponent: pageComponent,
485
+ WrappedProviderComponent: wrappedProviderComponent,
486
+ ProviderComponent: providerComponent,
487
+ ConsumerComponent: consumerComponent,
488
+ },
489
+ } as any,
490
+ includedComponents: [
491
+ pageComponent,
492
+ wrappedProviderComponent,
493
+ providerComponent,
494
+ consumerComponent,
495
+ ],
496
+ projectId: 'test-project',
497
+ req: {} as any,
498
+ })
503
499
 
504
- expect(html).toBe(
505
- `"<span data-node-type="text" data-node-id="root">provided-value</span>"`,
506
- )
507
- },
508
- )
500
+ expect(html).toBe(
501
+ `<span data-node-type="text" data-node-id="root">provided-value</span>`,
502
+ )
503
+ })
509
504
 
510
505
  test('should render a component where a variable initial value references Page.Theme', async () => {
511
506
  const component: Component = {
@@ -711,4 +706,262 @@ describe('renderPageBody', () => {
711
706
  '<span data-node-type="text" data-node-id="root">light</span>',
712
707
  )
713
708
  })
709
+
710
+ test('Component C should see the context value from Component A when Component B forwards its attribute using slots', async () => {
711
+ // Component A: Provider
712
+ // Accepts 'value' as attribute and provides it in context
713
+ const componentA: Component = {
714
+ name: 'ComponentA',
715
+ attributes: {
716
+ value: {
717
+ name: 'value',
718
+ testValue: 'test',
719
+ },
720
+ },
721
+ formulas: {
722
+ exposedValue: {
723
+ name: 'exposedValue',
724
+ exposeInContext: true,
725
+ formula: {
726
+ type: 'path',
727
+ path: ['Attributes', 'value'],
728
+ },
729
+ },
730
+ },
731
+ nodes: {
732
+ root: {
733
+ type: 'element',
734
+ tag: 'div',
735
+ attrs: {},
736
+ children: ['slot_node'],
737
+ events: {},
738
+ style: {},
739
+ },
740
+ slot_node: {
741
+ type: 'slot',
742
+ name: 'default',
743
+ children: [],
744
+ },
745
+ },
746
+ contexts: {},
747
+ apis: {},
748
+ variables: {},
749
+ events: [],
750
+ }
751
+
752
+ // Component B: Intermediary
753
+ // Accepts 'val' as attribute and forwards it to Component A's 'value' attribute
754
+ const componentB: Component = {
755
+ name: 'ComponentB',
756
+ attributes: {
757
+ val: {
758
+ name: 'val',
759
+ testValue: 'test',
760
+ },
761
+ },
762
+ nodes: {
763
+ root: {
764
+ type: 'element',
765
+ tag: 'div',
766
+ attrs: {},
767
+ children: ['provider_node'],
768
+ events: {},
769
+ style: {},
770
+ },
771
+ provider_node: {
772
+ type: 'component',
773
+ name: 'ComponentA',
774
+ attrs: {
775
+ value: {
776
+ type: 'path',
777
+ path: ['Attributes', 'val'],
778
+ },
779
+ },
780
+ children: ['slot_forwarder'],
781
+ events: {},
782
+ style: {},
783
+ },
784
+ slot_forwarder: {
785
+ type: 'slot',
786
+ name: 'default',
787
+ children: [],
788
+ },
789
+ },
790
+ contexts: {},
791
+ formulas: {},
792
+ apis: {},
793
+ variables: {},
794
+ events: [],
795
+ }
796
+
797
+ // Component C: Consumer
798
+ // Consumes Component A's context 'exposedValue'
799
+ const componentC: Component = {
800
+ name: 'ComponentC',
801
+ contexts: {
802
+ ComponentA: {
803
+ formulas: ['exposedValue'],
804
+ workflows: [],
805
+ },
806
+ },
807
+ nodes: {
808
+ root: {
809
+ type: 'text',
810
+ value: {
811
+ type: 'path',
812
+ path: ['Contexts', 'ComponentA', 'exposedValue'],
813
+ },
814
+ },
815
+ },
816
+ formulas: {},
817
+ apis: {},
818
+ attributes: {},
819
+ variables: {},
820
+ events: [],
821
+ }
822
+
823
+ // Root component that renders B with a specific value and C in its slot
824
+ const rootComponent: any = {
825
+ name: 'RootComponent',
826
+ route: {
827
+ path: [],
828
+ query: {},
829
+ info: {
830
+ theme: {
831
+ formula: { type: 'value', value: 'light' },
832
+ },
833
+ },
834
+ },
835
+ nodes: {
836
+ root: {
837
+ type: 'component',
838
+ name: 'ComponentB',
839
+ attrs: {
840
+ val: {
841
+ type: 'value',
842
+ value: 'expected-value',
843
+ },
844
+ },
845
+ children: ['consumer_node'],
846
+ events: {},
847
+ style: {},
848
+ },
849
+ consumer_node: {
850
+ type: 'component',
851
+ name: 'ComponentC',
852
+ attrs: {},
853
+ children: [],
854
+ events: {},
855
+ style: {},
856
+ slot: 'default',
857
+ },
858
+ },
859
+ contexts: {},
860
+ formulas: {},
861
+ apis: {},
862
+ attributes: {},
863
+ variables: {},
864
+ events: [],
865
+ }
866
+
867
+ const files = {
868
+ components: {
869
+ RootComponent: rootComponent,
870
+ ComponentB: componentB,
871
+ ComponentA: componentA,
872
+ ComponentC: componentC,
873
+ },
874
+ } as any
875
+
876
+ const { html } = await renderPageBody({
877
+ evaluateComponentApis: () => ({}) as any,
878
+ component: rootComponent as any,
879
+ formulaContext: getPageFormulaContext({
880
+ component: rootComponent as any,
881
+ branchName: 'main',
882
+ req: new Request('http://localhost'),
883
+ logErrors: true,
884
+ files,
885
+ }),
886
+ env: {} as any,
887
+ files,
888
+ includedComponents: [rootComponent, componentB, componentA, componentC],
889
+ projectId: 'test-project',
890
+ req: {} as any,
891
+ })
892
+
893
+ // Component C should render 'expected-value'
894
+ expect(html).toContain('expected-value')
895
+ })
896
+
897
+ test('should render ID formula with the expected order', async () => {
898
+ const component: Component = {
899
+ name: 'IdTestComponent',
900
+ nodes: {
901
+ root: {
902
+ type: 'element',
903
+ tag: 'div',
904
+ attrs: {
905
+ 'data-custom-id': {
906
+ type: 'function',
907
+ name: '@toddle/concatenate',
908
+ arguments: [
909
+ {
910
+ name: '0',
911
+ formula: { type: 'value', value: 'custom' },
912
+ type: { type: 'Array \\| String \\| Object' },
913
+ },
914
+ {
915
+ name: '0',
916
+ formula: {
917
+ type: 'function',
918
+ name: '@toddle/Id',
919
+ arguments: [],
920
+ display_name: 'Id',
921
+ },
922
+ type: { type: 'Array \\| String \\| Object' },
923
+ },
924
+ ],
925
+ },
926
+ },
927
+ children: [],
928
+ events: {},
929
+ style: {},
930
+ },
931
+ },
932
+ formulas: {},
933
+ apis: {},
934
+ attributes: {},
935
+ variables: {},
936
+ events: [],
937
+ route: {
938
+ path: [],
939
+ query: {},
940
+ },
941
+ }
942
+
943
+ const { html } = await renderPageBody({
944
+ evaluateComponentApis: () => ({}) as any,
945
+ component: component as any,
946
+ formulaContext: getPageFormulaContext({
947
+ component: component as any,
948
+ branchName: 'main',
949
+ req: new Request('http://localhost'),
950
+ logErrors: true,
951
+ files: {
952
+ components: { IdTestComponent: component },
953
+ },
954
+ }),
955
+ env: {} as any,
956
+ files: { components: { IdTestComponent: component } } as any,
957
+ includedComponents: [component],
958
+ projectId: 'test-project',
959
+ req: {} as any,
960
+ })
961
+
962
+ // Expect the ID formula to render with the correct order (0 in this case since it's the first formula rendered)
963
+ expect(html).toBe(
964
+ `<div data-custom-id="custom_id_0_" data-id="0" data-node-id="root" class="ftaNwg"></div>`,
965
+ )
966
+ })
714
967
  })