@valbuild/tanstack 0.150.23 → 0.151.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 (32) hide show
  1. package/CHANGELOG.md +187 -0
  2. package/README.md +11 -11
  3. package/client/dist/valbuild-tanstack-client.cjs.dev.js +100 -293
  4. package/client/dist/valbuild-tanstack-client.cjs.prod.js +100 -293
  5. package/client/dist/valbuild-tanstack-client.esm.js +99 -292
  6. package/dist/ValOverlayContext-1e50a557.cjs.prod.js +47 -0
  7. package/dist/ValOverlayContext-6826b4d9.esm.js +40 -0
  8. package/dist/ValOverlayContext-b18c2f18.cjs.dev.js +47 -0
  9. package/dist/declarations/src/ValDraft.d.ts +6 -50
  10. package/dist/declarations/src/ValModulesClient.d.ts +1 -3
  11. package/dist/declarations/src/ValProvider.d.ts +1 -1
  12. package/dist/declarations/src/client/initValClient.d.ts +25 -3
  13. package/dist/declarations/src/server/initValContent.d.ts +55 -169
  14. package/dist/{routeFromVal-06590f50.esm.js → routeFromVal-124235a5.esm.js} +3 -153
  15. package/dist/{routeFromVal-3c3915e2.cjs.dev.js → routeFromVal-2e834397.cjs.prod.js} +1 -156
  16. package/dist/{routeFromVal-b31a9e00.cjs.prod.js → routeFromVal-3d4d7c30.cjs.dev.js} +1 -156
  17. package/dist/{typeof-66e2d869.esm.js → typeof-3e1a1d11.esm.js} +1 -1
  18. package/dist/{typeof-8998e126.cjs.prod.js → typeof-56656438.cjs.prod.js} +0 -2
  19. package/dist/{typeof-dd0246a1.cjs.dev.js → typeof-bd6ec82c.cjs.dev.js} +0 -2
  20. package/dist/valbuild-tanstack.cjs.dev.js +162 -282
  21. package/dist/valbuild-tanstack.cjs.prod.js +162 -282
  22. package/dist/valbuild-tanstack.esm.js +162 -281
  23. package/dist/{version-3d755ee7.esm.js → version-2b3824bf.esm.js} +2 -19
  24. package/dist/{version-278a8d18.cjs.dev.js → version-8e19c405.cjs.dev.js} +1 -19
  25. package/dist/{version-30535975.cjs.prod.js → version-d46bc4bb.cjs.prod.js} +1 -19
  26. package/package.json +8 -8
  27. package/server/dist/valbuild-tanstack-server.cjs.dev.js +278 -1140
  28. package/server/dist/valbuild-tanstack-server.cjs.prod.js +278 -1140
  29. package/server/dist/valbuild-tanstack-server.esm.js +279 -1141
  30. package/dist/ValOverlayContext-198b4bd1.cjs.dev.js +0 -301
  31. package/dist/ValOverlayContext-6411bbe3.esm.js +0 -293
  32. package/dist/ValOverlayContext-d9b22d1a.cjs.prod.js +0 -301
@@ -1,159 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var _typeof = require('./typeof-8998e126.cjs.prod.js');
3
+ var _typeof = require('./typeof-bd6ec82c.cjs.dev.js');
4
4
  var core = require('@valbuild/core');
5
5
  var client = require('@valbuild/shared/client');
6
6
 
7
- /**
8
- * True when the module's schema is a `.jsonValues()` record/router — i.e. each
9
- * entry value is a lazily-loaded `c.json(() => import(...))` marker. Used by the
10
- * route helpers to load ONLY the matched entry instead of the whole record.
11
- */
12
- function isJsonValuesRecordSchema(schema) {
13
- return schema instanceof core.RecordSchema && schema["executeSerialize"]().jsonValues === true;
14
- }
15
-
16
- /**
17
- * A whole `.jsonValues()` record, as `useVal` and `fetchVal` read it: with
18
- * every entry's content. In the record's own source each entry is a lazy
19
- * `c.json(() => import(...))` marker, so a reader that encodes that source
20
- * renders every entry empty. (`useValKey` and `fetchValKey` read one entry,
21
- * and load only that one.)
22
- *
23
- * `sourcesOf(modulePath)` are what the reader has before the bundle, the first
24
- * that has the record winning: a draft view, then a snapshot (a proposal's saves, or the
25
- * content version the site serves). An entry that is still a marker there is
26
- * taken from a later source that has its content; the rest are named in
27
- * `load`, for the reader to load from the bundle by key and hand to
28
- * {@link fillJsonValuesRecord}.
29
- *
30
- * `null` when the selector is not a `.jsonValues()` module, or its record is
31
- * not an object (a nullable record that is null): there is nothing to fill.
32
- */
33
- function jsonValuesRecordToFill(
34
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
- selector, sourcesOf) {
36
- // Untyped, as `getJsonEntryStegaRoot`'s selector is: a module or a view of
37
- // one, whichever source type it was defined with.
38
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
- var module = core.Internal.resolveViewedModule(selector);
40
- if (!module || !isJsonValuesRecordSchema(core.Internal.getSchema(module))) {
41
- return null;
42
- }
43
- var modulePath = core.Internal.getValPath(module);
44
- if (!modulePath) {
45
- return null;
46
- }
47
- var sources = sourcesOf(modulePath);
48
- var isRecord = function isRecord(value) {
49
- return _typeof._typeof(value) === "object" && value !== null && !Array.isArray(value);
50
- };
51
- var chosen = sources.find(function (source) {
52
- return source !== undefined;
53
- });
54
- var base = chosen !== undefined ? chosen : core.Internal.getSource(module);
55
- if (!isRecord(base)) {
56
- return null;
57
- }
58
- var record = {};
59
- var load = [];
60
- var _loop = function _loop() {
61
- var _Object$entries$_i = _typeof._slicedToArray(_Object$entries[_i], 2),
62
- key = _Object$entries$_i[0],
63
- entry = _Object$entries$_i[1];
64
- if (!core.Internal.isJson(entry)) {
65
- record[key] = entry;
66
- return 1; // continue
67
- }
68
- var later = sources.slice(sources.indexOf(chosen) + 1).map(function (source) {
69
- return isRecord(source) && Object.prototype.hasOwnProperty.call(source, key) ? source[key] : undefined;
70
- }).find(function (content) {
71
- return content !== undefined && !core.Internal.isJson(content);
72
- });
73
- if (later !== undefined) {
74
- record[key] = later;
75
- } else {
76
- // Left as the marker until it is loaded: see `fillJsonValuesRecord`.
77
- record[key] = entry;
78
- load.push(key);
79
- }
80
- };
81
- for (var _i = 0, _Object$entries = Object.entries(base); _i < _Object$entries.length; _i++) {
82
- if (_loop()) continue;
83
- }
84
- return {
85
- modulePath: modulePath,
86
- module: module,
87
- record: record,
88
- load: load
89
- };
90
- }
91
-
92
- /**
93
- * The record from {@link jsonValuesRecordToFill}, with the entries it named in
94
- * `load` put in: `loaded[key]`, as the bundle's import of that entry gave it.
95
- * An entry the bundle has no import for keeps its marker.
96
- */
97
- function fillJsonValuesRecord(record, loaded) {
98
- var filled = _typeof._objectSpread2({}, record);
99
- for (var _i2 = 0, _Object$entries2 = Object.entries(loaded); _i2 < _Object$entries2.length; _i2++) {
100
- var _Object$entries2$_i = _typeof._slicedToArray(_Object$entries2[_i2], 2),
101
- key = _Object$entries2$_i[0],
102
- content = _Object$entries2$_i[1];
103
- if (content !== undefined) {
104
- filled[key] = content;
105
- }
106
- }
107
- return filled;
108
- }
109
-
110
- /**
111
- * The bundle's import of one `.jsonValues()` entry, started: `undefined` when
112
- * the module's own source has no marker for `key` to import from.
113
- */
114
- function bundledJsonEntryImport(
115
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
116
- module, key) {
117
- var _Internal$getJsonImpo;
118
- var source = module && core.Internal.getSource(module);
119
- var marker = _typeof._typeof(source) === "object" && source !== null && !Array.isArray(source) ? source[key] : undefined;
120
- if (!core.Internal.isJson(marker)) {
121
- return undefined;
122
- }
123
- return (_Internal$getJsonImpo = core.Internal.getJsonImport(marker)) !== null && _Internal$getJsonImpo !== void 0 ? _Internal$getJsonImpo : undefined;
124
- }
125
-
126
- /**
127
- * Builds the `stegaEncode` `root` seed for a single `.jsonValues()` entry, so its
128
- * strings get edit tags. Without a seed, `stegaEncode` on raw entry content is an
129
- * identity transform (the content carries no selector path/schema).
130
- *
131
- * Yields e.g. `/src/routes/support.$slug.val.ts?p="/support/faq"`, so a `title`
132
- * field is tagged `…?p="/support/faq"."title"` — the shape the Studio's
133
- * `findUnloadedJsonEntryKey` walks, so click-to-edit + lazy load line up.
134
- */
135
- function getJsonEntryStegaRoot(
136
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
137
- selector, key
138
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
139
- ) {
140
- var modulePath = selector && core.Internal.getValPath(selector);
141
- if (!modulePath) {
142
- return undefined;
143
- }
144
- var schema = selector && core.Internal.getSchema(selector);
145
- if (!(schema instanceof core.RecordSchema)) {
146
- return undefined;
147
- }
148
- var path = core.Internal.createValPathOfItem(modulePath, key);
149
- if (!path) {
150
- return undefined;
151
- }
152
- return {
153
- path: path,
154
- schema: schema["executeSerialize"]().item
155
- };
156
- }
157
7
  function getValRouteUrlFromVal(resolvedParams, methodName,
158
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
159
9
  path,
@@ -323,10 +173,5 @@ val) {
323
173
  return actualRoute;
324
174
  }
325
175
 
326
- exports.bundledJsonEntryImport = bundledJsonEntryImport;
327
- exports.fillJsonValuesRecord = fillJsonValuesRecord;
328
- exports.getJsonEntryStegaRoot = getJsonEntryStegaRoot;
329
176
  exports.getValRouteUrlFromVal = getValRouteUrlFromVal;
330
177
  exports.initValRouteFromVal = initValRouteFromVal;
331
- exports.isJsonValuesRecordSchema = isJsonValuesRecordSchema;
332
- exports.jsonValuesRecordToFill = jsonValuesRecordToFill;
@@ -158,4 +158,4 @@ function _typeof(o) {
158
158
  }, _typeof(o);
159
159
  }
160
160
 
161
- export { _objectSpread2 as _, _slicedToArray as a, _createForOfIteratorHelper as b, _typeof as c, _arrayLikeToArray as d, _unsupportedIterableToArray as e, _toPropertyKey as f, _defineProperty as g };
161
+ export { _objectSpread2 as _, _slicedToArray as a, _createForOfIteratorHelper as b, _arrayLikeToArray as c, _unsupportedIterableToArray as d, _typeof as e };
@@ -162,9 +162,7 @@ function _typeof(o) {
162
162
 
163
163
  exports._arrayLikeToArray = _arrayLikeToArray;
164
164
  exports._createForOfIteratorHelper = _createForOfIteratorHelper;
165
- exports._defineProperty = _defineProperty;
166
165
  exports._objectSpread2 = _objectSpread2;
167
166
  exports._slicedToArray = _slicedToArray;
168
- exports._toPropertyKey = _toPropertyKey;
169
167
  exports._typeof = _typeof;
170
168
  exports._unsupportedIterableToArray = _unsupportedIterableToArray;
@@ -162,9 +162,7 @@ function _typeof(o) {
162
162
 
163
163
  exports._arrayLikeToArray = _arrayLikeToArray;
164
164
  exports._createForOfIteratorHelper = _createForOfIteratorHelper;
165
- exports._defineProperty = _defineProperty;
166
165
  exports._objectSpread2 = _objectSpread2;
167
166
  exports._slicedToArray = _slicedToArray;
168
- exports._toPropertyKey = _toPropertyKey;
169
167
  exports._typeof = _typeof;
170
168
  exports._unsupportedIterableToArray = _unsupportedIterableToArray;