@pithyjs/core 0.1.0-beta.0 → 0.1.0-beta.1

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 (94) hide show
  1. package/README.md +27 -2
  2. package/dist/compile/bindSwitchCases.js +5 -2
  3. package/dist/compile/bindSwitchCases.js.map +1 -1
  4. package/dist/compile/binds/bindClassDirectives.d.ts +2 -0
  5. package/dist/compile/binds/bindClassDirectives.d.ts.map +1 -1
  6. package/dist/compile/binds/bindClassDirectives.js +18 -15
  7. package/dist/compile/binds/bindClassDirectives.js.map +1 -1
  8. package/dist/compile/binds/bindComponentsTags.d.ts.map +1 -1
  9. package/dist/compile/binds/bindComponentsTags.js +90 -33
  10. package/dist/compile/binds/bindComponentsTags.js.map +1 -1
  11. package/dist/compile/binds/bindDeferDirectives.d.ts.map +1 -1
  12. package/dist/compile/binds/bindDeferDirectives.js +41 -11
  13. package/dist/compile/binds/bindDeferDirectives.js.map +1 -1
  14. package/dist/compile/binds/bindErrorBoundary.d.ts +13 -2
  15. package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -1
  16. package/dist/compile/binds/bindErrorBoundary.js +17 -7
  17. package/dist/compile/binds/bindErrorBoundary.js.map +1 -1
  18. package/dist/compile/binds/forwardedAttrs.d.ts +22 -0
  19. package/dist/compile/binds/forwardedAttrs.d.ts.map +1 -0
  20. package/dist/compile/binds/forwardedAttrs.js +66 -0
  21. package/dist/compile/binds/forwardedAttrs.js.map +1 -0
  22. package/dist/compile/componentResult.d.ts +100 -0
  23. package/dist/compile/componentResult.d.ts.map +1 -0
  24. package/dist/compile/componentResult.js +138 -0
  25. package/dist/compile/componentResult.js.map +1 -0
  26. package/dist/compile/forLoops/createLoopManager.d.ts +4 -1
  27. package/dist/compile/forLoops/createLoopManager.d.ts.map +1 -1
  28. package/dist/compile/forLoops/createLoopManager.js +120 -92
  29. package/dist/compile/forLoops/createLoopManager.js.map +1 -1
  30. package/dist/compile/handleConditionalChain.d.ts.map +1 -1
  31. package/dist/compile/handleConditionalChain.js +21 -18
  32. package/dist/compile/handleConditionalChain.js.map +1 -1
  33. package/dist/compile/index.d.ts +6 -3
  34. package/dist/compile/index.d.ts.map +1 -1
  35. package/dist/compile/index.js +19 -3
  36. package/dist/compile/index.js.map +1 -1
  37. package/dist/compile/renderChildren.d.ts +17 -0
  38. package/dist/compile/renderChildren.d.ts.map +1 -1
  39. package/dist/compile/renderChildren.js +20 -1
  40. package/dist/compile/renderChildren.js.map +1 -1
  41. package/dist/compile/ssrCrashes.d.ts +116 -0
  42. package/dist/compile/ssrCrashes.d.ts.map +1 -0
  43. package/dist/compile/ssrCrashes.js +173 -0
  44. package/dist/compile/ssrCrashes.js.map +1 -0
  45. package/dist/runtime/applyBindings.d.ts +3 -3
  46. package/dist/runtime/applyBindings.d.ts.map +1 -1
  47. package/dist/runtime/applyBindings.js +28 -4
  48. package/dist/runtime/applyBindings.js.map +1 -1
  49. package/dist/runtime/bindings/applyComponent.d.ts.map +1 -1
  50. package/dist/runtime/bindings/applyComponent.js +102 -13
  51. package/dist/runtime/bindings/applyComponent.js.map +1 -1
  52. package/dist/runtime/bindings/applyDefer.d.ts.map +1 -1
  53. package/dist/runtime/bindings/applyDefer.js +40 -12
  54. package/dist/runtime/bindings/applyDefer.js.map +1 -1
  55. package/dist/runtime/bindings/applySimple.d.ts +2 -1
  56. package/dist/runtime/bindings/applySimple.d.ts.map +1 -1
  57. package/dist/runtime/bindings/applySimple.js +27 -3
  58. package/dist/runtime/bindings/applySimple.js.map +1 -1
  59. package/dist/runtime/bindings/index.d.ts +2 -2
  60. package/dist/runtime/bindings/index.d.ts.map +1 -1
  61. package/dist/runtime/bindings/index.js +1 -1
  62. package/dist/runtime/bindings/index.js.map +1 -1
  63. package/dist/runtime/bindings/types.d.ts +12 -1
  64. package/dist/runtime/bindings/types.d.ts.map +1 -1
  65. package/dist/runtime/index.d.ts +1 -0
  66. package/dist/runtime/index.d.ts.map +1 -1
  67. package/dist/runtime/index.js +2 -0
  68. package/dist/runtime/index.js.map +1 -1
  69. package/dist/runtime/resource/createAction.d.ts +44 -0
  70. package/dist/runtime/resource/createAction.d.ts.map +1 -0
  71. package/dist/runtime/resource/createAction.js +102 -0
  72. package/dist/runtime/resource/createAction.js.map +1 -0
  73. package/dist/runtime/resource/createResource.d.ts +56 -0
  74. package/dist/runtime/resource/createResource.d.ts.map +1 -0
  75. package/dist/runtime/resource/createResource.js +103 -0
  76. package/dist/runtime/resource/createResource.js.map +1 -0
  77. package/dist/runtime/resource/engine.d.ts +136 -0
  78. package/dist/runtime/resource/engine.d.ts.map +1 -0
  79. package/dist/runtime/resource/engine.js +363 -0
  80. package/dist/runtime/resource/engine.js.map +1 -0
  81. package/dist/runtime/resource/index.d.ts +19 -0
  82. package/dist/runtime/resource/index.d.ts.map +1 -0
  83. package/dist/runtime/resource/index.js +18 -0
  84. package/dist/runtime/resource/index.js.map +1 -0
  85. package/dist/runtime/resource/types.d.ts +240 -0
  86. package/dist/runtime/resource/types.d.ts.map +1 -0
  87. package/dist/runtime/resource/types.js +9 -0
  88. package/dist/runtime/resource/types.js.map +1 -0
  89. package/dist/types/globals.d.ts +9 -0
  90. package/dist/types/globals.d.ts.map +1 -1
  91. package/dist/types/globals.js.map +1 -1
  92. package/dist/types/index.d.ts +15 -1
  93. package/dist/types/index.d.ts.map +1 -1
  94. package/package.json +5 -5
@@ -0,0 +1,9 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.core.resource.types",
4
+ "title": "Async State Primitive Types",
5
+ "category": "types"
6
+ }
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/resource/types.ts"],"names":[],"mappings":"AAAA;;;;;;EAME"}
@@ -1,15 +1,24 @@
1
1
  import type { SlotMap } from '../compile/contentProjection';
2
2
  import type { PithyNode } from '@pithyjs/compiler';
3
+ import type { ChildFactory } from '../runtime/bindings/types';
3
4
  export interface PithyComponentContext extends Record<string, unknown> {
4
5
  __parentComponentContext?: PithyComponentContext;
5
6
  __slotMap?: SlotMap;
6
7
  __childAstNodes?: PithyNode[];
8
+ __childFactory?: ChildFactory;
7
9
  }
8
10
  export interface PithyGlobals {
11
+ /**
12
+ * SSR component-crash registry. Lives on `globalThis` rather than in a module
13
+ * so that an app and `@pithyjs/ssr` resolving two physical copies of
14
+ * `@pithyjs/core` still share one — see `compile/ssrCrashes.ts`.
15
+ */
16
+ __pithySSRCrashes?: Map<Element, unknown>;
9
17
  PITHY_DEBUG_PROJECTION?: boolean;
10
18
  __PITHY_SSR__?: boolean;
11
19
  __getComponentContext?: () => Record<string, unknown> | undefined;
12
20
  __pithyComponentContext?: PithyComponentContext;
21
+ __pithyProjectedChildren?: DocumentFragment;
13
22
  __pithyRenderingComponent?: boolean;
14
23
  __pithyGetDestroyCallbacks?: () => (() => void)[] | undefined;
15
24
  __pithySetDestroyCallbacks?: (cbs: (() => void)[]) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../src/types/globals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,qBAAsB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACpE,wBAAwB,CAAC,EAAE,qBAAqB,CAAC;IACjD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qBAAqB,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAClE,uBAAuB,CAAC,EAAE,q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S,CAAC;IAC9D,0BAA0B,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC;CAC5D;AAED,wBAAgB,YAAY,IAAI,OAAO,UAAU,GAAG,YAAY,CAE/D"}
@@ -1 +1 @@
1
- {"version":3,"file":"globals.js","sourceRoot":"","sources":["../../src/types/globals.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,YAAY;IAC1B,OAAO,UAA8C,CAAC;AACxD,CAAC"}
1
+ {"version":3,"file":"globals.js","sourceRoot":"","sources":["../../src/types/globals.ts"],"names":[],"mappings":"AA4BA,MAAM,UAAU,YAAY;IAC1B,OAAO,UAA8C,CAAC;AACxD,CAAC"}
@@ -1,5 +1,19 @@
1
+ /**
2
+ * What a component returns.
3
+ *
4
+ * `el` is any DOM `Node`, not only an element or fragment. It was declared as
5
+ * `HTMLElement | DocumentFragment` while the runtime happily inserted anything
6
+ * `replaceWith` accepts — a component returning `document.createTextNode('hi')`
7
+ * rendered correctly and always had. Narrowing the runtime to match the old
8
+ * declaration would have silently dropped those subtrees, so the declaration is
9
+ * widened to match the behaviour instead.
10
+ *
11
+ * Anything that is a real node but cannot be inserted at a given position — a
12
+ * `Document`, say — still fails at insertion and is reported, rather than being
13
+ * excluded by type.
14
+ */
1
15
  export type Component = () => {
2
- el: HTMLElement | DocumentFragment;
16
+ el: Node;
3
17
  destroy?: () => void;
4
18
  };
5
19
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM;IAC5B,EAAE,EAAE,WAAW,GAAG,gBAAgB,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC1C;CACF;AAED,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM;IAC5B,EAAE,EAAE,IAAI,CAAC;IACT,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC1C;CACF;AAED,OAAO,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pithyjs/core",
3
- "version": "0.1.0-beta.0",
3
+ "version": "0.1.0-beta.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "@pithyjs/shared": "0.1.0-beta.0",
23
23
  "@pithyjs/signals": "0.1.0-beta.0",
24
24
  "@pithyjs/compiler": "0.1.0-beta.0",
25
- "@pithyjs/design-system": "0.1.0-beta.0"
25
+ "@pithyjs/design-system": "0.1.0-beta.1"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "parse5": ">=7.0.0"
@@ -33,12 +33,12 @@
33
33
  }
34
34
  },
35
35
  "devDependencies": {
36
- "@vitest/ui": "^3.2.4",
36
+ "@vitest/ui": "3.2.4",
37
37
  "happy-dom": "^20.0.3",
38
38
  "parse5": "^7.3.0",
39
39
  "typescript": "^5.0.0",
40
- "@vitest/coverage-v8": "^3.2.4",
41
- "vitest": "^3.2.4"
40
+ "@vitest/coverage-v8": "3.2.4",
41
+ "vitest": "3.2.4"
42
42
  },
43
43
  "license": "MIT",
44
44
  "publishConfig": {