@bamboocss/preset-base 1.45.5 → 1.46.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/dist/index.cjs CHANGED
@@ -3261,12 +3261,51 @@ const utilities = Object.assign({}, layout, display, flexGrid, spacing, outline,
3261
3261
  //#endregion
3262
3262
  //#region src/index.ts
3263
3263
  const definePreset = (preset) => preset;
3264
+ const BUILTIN_PRESET_PROVENANCE = Symbol.for("@bamboocss/builtin-preset-provenance/v1");
3265
+ /**
3266
+ * Capture the functions while this module still owns the freshly assembled preset. The
3267
+ * public preset remains mutable for compatibility, but later mutation cannot turn a custom
3268
+ * closure into a built-in function merely by placing it in that object.
3269
+ */
3270
+ const markBuiltInPreset = (owner, prefix) => {
3271
+ const functions = [];
3272
+ const active = /* @__PURE__ */ new WeakSet();
3273
+ const visit = (value, identity) => {
3274
+ if (typeof value === "function") {
3275
+ functions.push(Object.freeze({
3276
+ identity,
3277
+ value
3278
+ }));
3279
+ return;
3280
+ }
3281
+ if (value === null || typeof value !== "object" || active.has(value)) return;
3282
+ active.add(value);
3283
+ for (const key of Reflect.ownKeys(value)) {
3284
+ if (typeof key === "symbol" || Array.isArray(value) && key === "length") continue;
3285
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
3286
+ if (descriptor && "value" in descriptor) visit(descriptor.value, `${identity}[${JSON.stringify(key)}]`);
3287
+ }
3288
+ active.delete(value);
3289
+ };
3290
+ visit(owner, prefix);
3291
+ const marker = Object.freeze({
3292
+ functions: Object.freeze(functions),
3293
+ owner
3294
+ });
3295
+ Object.defineProperty(owner, BUILTIN_PRESET_PROVENANCE, {
3296
+ configurable: false,
3297
+ enumerable: false,
3298
+ value: marker,
3299
+ writable: false
3300
+ });
3301
+ };
3264
3302
  const preset = definePreset({
3265
3303
  name: "@bamboocss/preset-base",
3266
3304
  conditions,
3267
3305
  utilities,
3268
3306
  patterns
3269
3307
  });
3308
+ markBuiltInPreset(preset, "@bamboocss/preset-base");
3270
3309
  //#endregion
3271
3310
  exports.default = preset;
3272
3311
  exports.preset = preset;
package/dist/index.mjs CHANGED
@@ -3257,11 +3257,50 @@ const utilities = Object.assign({}, layout, display, flexGrid, spacing, outline,
3257
3257
  //#endregion
3258
3258
  //#region src/index.ts
3259
3259
  const definePreset = (preset) => preset;
3260
+ const BUILTIN_PRESET_PROVENANCE = Symbol.for("@bamboocss/builtin-preset-provenance/v1");
3261
+ /**
3262
+ * Capture the functions while this module still owns the freshly assembled preset. The
3263
+ * public preset remains mutable for compatibility, but later mutation cannot turn a custom
3264
+ * closure into a built-in function merely by placing it in that object.
3265
+ */
3266
+ const markBuiltInPreset = (owner, prefix) => {
3267
+ const functions = [];
3268
+ const active = /* @__PURE__ */ new WeakSet();
3269
+ const visit = (value, identity) => {
3270
+ if (typeof value === "function") {
3271
+ functions.push(Object.freeze({
3272
+ identity,
3273
+ value
3274
+ }));
3275
+ return;
3276
+ }
3277
+ if (value === null || typeof value !== "object" || active.has(value)) return;
3278
+ active.add(value);
3279
+ for (const key of Reflect.ownKeys(value)) {
3280
+ if (typeof key === "symbol" || Array.isArray(value) && key === "length") continue;
3281
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
3282
+ if (descriptor && "value" in descriptor) visit(descriptor.value, `${identity}[${JSON.stringify(key)}]`);
3283
+ }
3284
+ active.delete(value);
3285
+ };
3286
+ visit(owner, prefix);
3287
+ const marker = Object.freeze({
3288
+ functions: Object.freeze(functions),
3289
+ owner
3290
+ });
3291
+ Object.defineProperty(owner, BUILTIN_PRESET_PROVENANCE, {
3292
+ configurable: false,
3293
+ enumerable: false,
3294
+ value: marker,
3295
+ writable: false
3296
+ });
3297
+ };
3260
3298
  const preset = definePreset({
3261
3299
  name: "@bamboocss/preset-base",
3262
3300
  conditions,
3263
3301
  utilities,
3264
3302
  patterns
3265
3303
  });
3304
+ markBuiltInPreset(preset, "@bamboocss/preset-base");
3266
3305
  //#endregion
3267
3306
  export { preset as default, preset };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/preset-base",
3
- "version": "1.45.5",
3
+ "version": "1.46.0",
4
4
  "description": "The base preset for Bamboo CSS that contains the conditions and utilities",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "access": "public"
34
34
  },
35
35
  "dependencies": {
36
- "@bamboocss/types": "1.45.5"
36
+ "@bamboocss/types": "1.46.0"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "tsdown src/index.ts --format=esm,cjs --dts",